4965 lines
4.2 MiB
JavaScript
4965 lines
4.2 MiB
JavaScript
|
exports.id = 917;
|
|||
|
exports.ids = [917];
|
|||
|
exports.modules = {
|
|||
|
|
|||
|
/***/ 68214:
|
|||
|
/***/ ((__unused_webpack_module, exports) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.formatTestError = void 0;
|
|||
|
function formatTestError(error) {
|
|||
|
// Possible error cases:
|
|||
|
// - the test found some vulns. `error.message` is a
|
|||
|
// JSON-stringified
|
|||
|
// test result.
|
|||
|
// - the flow failed, `error` is a real Error object.
|
|||
|
// - the flow failed, `error` is a number or string
|
|||
|
// describing the problem.
|
|||
|
//
|
|||
|
// To standardise this, make sure we use the best _object_ to
|
|||
|
// describe the error.
|
|||
|
let errorResponse;
|
|||
|
if (error instanceof Error) {
|
|||
|
errorResponse = error;
|
|||
|
}
|
|||
|
else if (typeof error !== 'object') {
|
|||
|
errorResponse = new Error(error);
|
|||
|
}
|
|||
|
else {
|
|||
|
try {
|
|||
|
errorResponse = JSON.parse(error.message);
|
|||
|
}
|
|||
|
catch (unused) {
|
|||
|
errorResponse = error;
|
|||
|
}
|
|||
|
}
|
|||
|
return errorResponse;
|
|||
|
}
|
|||
|
exports.formatTestError = formatTestError;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 55935:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
const validate_credentials_1 = __webpack_require__(4593);
|
|||
|
const validate_test_options_1 = __webpack_require__(83476);
|
|||
|
const set_default_test_options_1 = __webpack_require__(13285);
|
|||
|
const process_command_args_1 = __webpack_require__(52369);
|
|||
|
const feature_flags_1 = __webpack_require__(63011);
|
|||
|
const rules_1 = __webpack_require__(95343);
|
|||
|
const measurable_methods_1 = __webpack_require__(5687);
|
|||
|
const config_1 = __webpack_require__(25425);
|
|||
|
const unsupported_entitlement_error_1 = __webpack_require__(78673);
|
|||
|
const scan_1 = __webpack_require__(71308);
|
|||
|
const output_1 = __webpack_require__(39313);
|
|||
|
const assert_iac_options_flag_1 = __webpack_require__(33111);
|
|||
|
async function default_1(...args) {
|
|||
|
var _a, _b, _c;
|
|||
|
const { options: originalOptions, paths } = process_command_args_1.processCommandArgs(...args);
|
|||
|
const options = set_default_test_options_1.setDefaultTestOptions(originalOptions);
|
|||
|
validate_test_options_1.validateTestOptions(options);
|
|||
|
validate_credentials_1.validateCredentials(options);
|
|||
|
const remoteRepoUrl = getFlag(options, 'remote-repo-url');
|
|||
|
const targetName = getFlag(options, 'target-name');
|
|||
|
const orgPublicId = (_a = options.org) !== null && _a !== void 0 ? _a : config_1.default.org;
|
|||
|
const iacOrgSettings = await measurable_methods_1.getIacOrgSettings(orgPublicId);
|
|||
|
if (!((_b = iacOrgSettings.entitlements) === null || _b === void 0 ? void 0 : _b.infrastructureAsCode)) {
|
|||
|
throw new unsupported_entitlement_error_1.UnsupportedEntitlementError('infrastructureAsCode');
|
|||
|
}
|
|||
|
const buildOciRegistry = () => rules_1.buildDefaultOciRegistry(iacOrgSettings);
|
|||
|
const isNewIacOutputSupported = Boolean(config_1.default.IAC_OUTPUT_V2 ||
|
|||
|
(await feature_flags_1.hasFeatureFlag('iacCliOutputRelease', options)));
|
|||
|
const isIacShareCliResultsCustomRulesSupported = Boolean(await feature_flags_1.hasFeatureFlag('iacShareCliResultsCustomRules', options));
|
|||
|
const isIacCustomRulesEntitlementEnabled = Boolean((_c = iacOrgSettings.entitlements) === null || _c === void 0 ? void 0 : _c.iacCustomRulesEntitlement);
|
|||
|
const testSpinner = output_1.buildSpinner({
|
|||
|
options,
|
|||
|
isNewIacOutputSupported,
|
|||
|
});
|
|||
|
const projectRoot = process.cwd();
|
|||
|
output_1.printHeader({
|
|||
|
options,
|
|||
|
isNewIacOutputSupported,
|
|||
|
});
|
|||
|
const { iacOutputMeta, iacScanFailures, iacIgnoredIssuesCount, results, resultOptions, } = await scan_1.scan(iacOrgSettings, options, testSpinner, paths, orgPublicId, buildOciRegistry, projectRoot, remoteRepoUrl, targetName);
|
|||
|
return output_1.buildOutput({
|
|||
|
results,
|
|||
|
options,
|
|||
|
isNewIacOutputSupported,
|
|||
|
isIacShareCliResultsCustomRulesSupported,
|
|||
|
isIacCustomRulesEntitlementEnabled,
|
|||
|
iacOutputMeta,
|
|||
|
resultOptions,
|
|||
|
iacScanFailures,
|
|||
|
iacIgnoredIssuesCount,
|
|||
|
testSpinner,
|
|||
|
});
|
|||
|
}
|
|||
|
exports.default = default_1;
|
|||
|
function getFlag(options, flag) {
|
|||
|
const flagValue = options[flag];
|
|||
|
if (!flagValue) {
|
|||
|
return;
|
|||
|
}
|
|||
|
// if the user does not provide a value, it will be of boolean type
|
|||
|
if (typeof flagValue !== 'string') {
|
|||
|
throw new assert_iac_options_flag_1.InvalidArgumentError(flag);
|
|||
|
}
|
|||
|
return flagValue;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 80509:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.getFileType = exports.shouldBeParsed = exports.getFilesForDirectoryGenerator = exports.getFilesForDirectory = exports.getAllDirectoriesForPath = void 0;
|
|||
|
const path = __webpack_require__(85622);
|
|||
|
const file_utils_1 = __webpack_require__(45281);
|
|||
|
const types_1 = __webpack_require__(94820);
|
|||
|
const detect_1 = __webpack_require__(45318);
|
|||
|
/**
|
|||
|
* Gets all nested directories for the path that we ran a scan.
|
|||
|
* @param pathToScan - the path to scan provided by the user
|
|||
|
* @param maxDepth? - An optional `maxDepth` argument can be provided to limit how deep in the file tree the search will go.
|
|||
|
* @returns {string[]} An array with all the non-empty nested directories in this path
|
|||
|
*/
|
|||
|
function getAllDirectoriesForPath(pathToScan, maxDepth) {
|
|||
|
// if it is a single file (it has an extension), we return the current path
|
|||
|
if (!detect_1.isLocalFolder(pathToScan)) {
|
|||
|
return [path.resolve(pathToScan)];
|
|||
|
}
|
|||
|
return [...getAllDirectoriesForPathGenerator(pathToScan, maxDepth)];
|
|||
|
}
|
|||
|
exports.getAllDirectoriesForPath = getAllDirectoriesForPath;
|
|||
|
/**
|
|||
|
* Gets all the directories included in this path
|
|||
|
* @param pathToScan - the path to scan provided by the user
|
|||
|
* @param maxDepth? - An optional `maxDepth` argument can be provided to limit how deep in the file tree the search will go.
|
|||
|
* @returns {Generator<string>} - a generator which yields the filepaths for the path to scan
|
|||
|
*/
|
|||
|
function* getAllDirectoriesForPathGenerator(pathToScan, maxDepth) {
|
|||
|
for (const filePath of file_utils_1.makeFileAndDirectoryGenerator(pathToScan, maxDepth)) {
|
|||
|
if (filePath.directory)
|
|||
|
yield filePath.directory;
|
|||
|
}
|
|||
|
}
|
|||
|
/**
|
|||
|
* Gets all file paths for the specific directory
|
|||
|
* @param pathToScan - the path to scan provided by the user
|
|||
|
* @param currentDirectory - the directory which we want to return files for
|
|||
|
* @returns {string[]} An array with all the Terraform filePaths for this directory
|
|||
|
*/
|
|||
|
function getFilesForDirectory(pathToScan, currentDirectory) {
|
|||
|
if (!detect_1.isLocalFolder(pathToScan)) {
|
|||
|
if (exports.shouldBeParsed(pathToScan) &&
|
|||
|
!isIgnoredFile(pathToScan, currentDirectory)) {
|
|||
|
return [pathToScan];
|
|||
|
}
|
|||
|
return [];
|
|||
|
}
|
|||
|
else {
|
|||
|
return [...getFilesForDirectoryGenerator(currentDirectory)];
|
|||
|
}
|
|||
|
}
|
|||
|
exports.getFilesForDirectory = getFilesForDirectory;
|
|||
|
/**
|
|||
|
* Iterates through the makeFileAndDirectoryGenerator function and gets all the Terraform files in the specified directory
|
|||
|
* @param pathToScan - the pathToScan to scan provided by the user
|
|||
|
* @returns {Generator<string>} - a generator which holds all the filepaths
|
|||
|
*/
|
|||
|
function* getFilesForDirectoryGenerator(pathToScan) {
|
|||
|
for (const filePath of file_utils_1.makeFileAndDirectoryGenerator(pathToScan)) {
|
|||
|
if (filePath.file && filePath.file.dir !== pathToScan) {
|
|||
|
// we want to get files that belong just to the current walking directory, not the ones in nested directories
|
|||
|
continue;
|
|||
|
}
|
|||
|
if (filePath.file &&
|
|||
|
exports.shouldBeParsed(filePath.file.fileName) &&
|
|||
|
!isIgnoredFile(filePath.file.fileName, pathToScan)) {
|
|||
|
yield filePath.file.fileName;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
exports.getFilesForDirectoryGenerator = getFilesForDirectoryGenerator;
|
|||
|
exports.shouldBeParsed = (pathToScan) => types_1.VALID_FILE_TYPES.includes(exports.getFileType(pathToScan));
|
|||
|
exports.getFileType = (pathToScan) => {
|
|||
|
const extension = path.extname(pathToScan);
|
|||
|
if (extension.startsWith('.')) {
|
|||
|
return extension.substr(1);
|
|||
|
}
|
|||
|
return extension;
|
|||
|
};
|
|||
|
/**
|
|||
|
* Checks if a file should be ignored from loading or not according to the filetype.
|
|||
|
* We ignore the same files that Terraform ignores.
|
|||
|
* https://github.com/hashicorp/terraform/blob/dc63fda44b67300d5161dabcd803426d0d2f468e/internal/configs/parser_config_dir.go#L137-L143
|
|||
|
* @param {string} pathToScan - The filepath to check
|
|||
|
* @param {currentDirectory} currentDirectory - The directory for the filepath
|
|||
|
* @returns {boolean} if the filepath should be ignored or not
|
|||
|
*/
|
|||
|
function isIgnoredFile(pathToScan, currentDirectory) {
|
|||
|
// we resolve the path in case the user tries to scan a single file with a relative path
|
|||
|
// e.g. './my-folder/terraform.tf', or '../my-folder/terraform.tf'
|
|||
|
const resolvedPath = path.resolve(currentDirectory, currentDirectory);
|
|||
|
return (resolvedPath.startsWith('.') || // Unix-like hidden files
|
|||
|
resolvedPath.startsWith('~') || // vim
|
|||
|
(resolvedPath.startsWith('#') && resolvedPath.endsWith('#')) // emacs
|
|||
|
);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 62201:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.FailedToLoadFileError = exports.NoFilesToScanError = exports.tryLoadFileData = exports.loadContentForFiles = void 0;
|
|||
|
const fs_1 = __webpack_require__(35747);
|
|||
|
const types_1 = __webpack_require__(94820);
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
const error_utils_1 = __webpack_require__(36401);
|
|||
|
const directory_loader_1 = __webpack_require__(80509);
|
|||
|
const DEFAULT_ENCODING = 'utf-8';
|
|||
|
async function loadContentForFiles(filePaths) {
|
|||
|
const loadedFiles = await Promise.all(filePaths.map(async (filePath) => {
|
|||
|
try {
|
|||
|
return await tryLoadFileData(filePath);
|
|||
|
}
|
|||
|
catch (e) {
|
|||
|
throw new FailedToLoadFileError(filePath);
|
|||
|
}
|
|||
|
}));
|
|||
|
return loadedFiles.filter((file) => file.fileContent !== '');
|
|||
|
}
|
|||
|
exports.loadContentForFiles = loadContentForFiles;
|
|||
|
async function tryLoadFileData(pathToScan) {
|
|||
|
const fileType = directory_loader_1.getFileType(pathToScan);
|
|||
|
const fileContent = removeBom(await fs_1.promises.readFile(pathToScan, DEFAULT_ENCODING));
|
|||
|
return {
|
|||
|
filePath: pathToScan,
|
|||
|
fileType: fileType,
|
|||
|
fileContent,
|
|||
|
};
|
|||
|
}
|
|||
|
exports.tryLoadFileData = tryLoadFileData;
|
|||
|
function removeBom(s) {
|
|||
|
if (s.charCodeAt(0) === 0xfeff) {
|
|||
|
return s.slice(1);
|
|||
|
}
|
|||
|
return s;
|
|||
|
}
|
|||
|
class NoFilesToScanError extends errors_1.CustomError {
|
|||
|
constructor(message) {
|
|||
|
super(message || 'Could not find any valid IaC files');
|
|||
|
this.code = types_1.IaCErrorCodes.NoFilesToScanError;
|
|||
|
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|||
|
this.userMessage =
|
|||
|
'Could not find any valid infrastructure as code files. Supported file extensions are tf, yml, yaml & json.\nMore information can be found by running `snyk iac test --help` or through our documentation:\nhttps://support.snyk.io/hc/en-us/articles/360012429477-Test-your-Kubernetes-files-with-our-CLI-tool\nhttps://support.snyk.io/hc/en-us/articles/360013723877-Test-your-Terraform-files-with-our-CLI-tool';
|
|||
|
}
|
|||
|
}
|
|||
|
exports.NoFilesToScanError = NoFilesToScanError;
|
|||
|
class FailedToLoadFileError extends errors_1.CustomError {
|
|||
|
constructor(filename) {
|
|||
|
super('Failed to load file content');
|
|||
|
this.code = types_1.IaCErrorCodes.FailedToLoadFileError;
|
|||
|
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|||
|
this.filename = filename;
|
|||
|
this.userMessage = `We were unable to read file "${filename}" for scanning. Please ensure that it is readable.`;
|
|||
|
}
|
|||
|
}
|
|||
|
exports.FailedToLoadFileError = FailedToLoadFileError;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 39331:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.UnsupportedFileTypeError = exports.tryParseIacFile = exports.parseTerraformFiles = exports.parseNonTerraformFiles = exports.parseFiles = void 0;
|
|||
|
const config_type_detection_1 = __webpack_require__(8601);
|
|||
|
const terraform_file_parser_1 = __webpack_require__(11634);
|
|||
|
const terraform_plan_parser_1 = __webpack_require__(58540);
|
|||
|
const types_1 = __webpack_require__(94820);
|
|||
|
const analytics = __webpack_require__(82744);
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
const error_utils_1 = __webpack_require__(36401);
|
|||
|
const yaml_parser_1 = __webpack_require__(80039);
|
|||
|
const hcl_to_json_v2_1 = __webpack_require__(70456);
|
|||
|
const constants_1 = __webpack_require__(68620);
|
|||
|
const Debug = __webpack_require__(15158);
|
|||
|
const debug = Debug('snyk-test');
|
|||
|
async function parseFiles(filesData, options = {}) {
|
|||
|
let tfFileData = [];
|
|||
|
let nonTfFileData = [];
|
|||
|
tfFileData = filesData.filter((fileData) => types_1.VALID_TERRAFORM_FILE_TYPES.includes(fileData.fileType));
|
|||
|
nonTfFileData = filesData.filter((fileData) => !types_1.VALID_TERRAFORM_FILE_TYPES.includes(fileData.fileType));
|
|||
|
let { parsedFiles, failedFiles } = parseNonTerraformFiles(nonTfFileData, options);
|
|||
|
if (tfFileData.length > 0) {
|
|||
|
const { parsedFiles: parsedTfFiles, failedFiles: failedTfFiles, } = parseTerraformFiles(tfFileData);
|
|||
|
parsedFiles = parsedFiles.concat(parsedTfFiles);
|
|||
|
failedFiles = failedFiles.concat(failedTfFiles);
|
|||
|
}
|
|||
|
return {
|
|||
|
parsedFiles,
|
|||
|
failedFiles,
|
|||
|
};
|
|||
|
}
|
|||
|
exports.parseFiles = parseFiles;
|
|||
|
function parseNonTerraformFiles(filesData, options) {
|
|||
|
const parsedFiles = [];
|
|||
|
const failedFiles = [];
|
|||
|
for (const fileData of filesData) {
|
|||
|
try {
|
|||
|
parsedFiles.push(...tryParseIacFile(fileData, options));
|
|||
|
}
|
|||
|
catch (err) {
|
|||
|
failedFiles.push(generateFailedParsedFile(fileData, err));
|
|||
|
}
|
|||
|
}
|
|||
|
return {
|
|||
|
parsedFiles,
|
|||
|
failedFiles,
|
|||
|
};
|
|||
|
}
|
|||
|
exports.parseNonTerraformFiles = parseNonTerraformFiles;
|
|||
|
function parseTerraformFiles(filesData) {
|
|||
|
// the parser expects a map of <filePath>:<fileContent> key-value pairs
|
|||
|
const files = filesData.reduce((map, fileData) => {
|
|||
|
map[fileData.filePath] = fileData.fileContent;
|
|||
|
return map;
|
|||
|
}, {});
|
|||
|
const { parsedFiles, failedFiles, debugLogs } = hcl_to_json_v2_1.default(files);
|
|||
|
const parsingResults = {
|
|||
|
parsedFiles: [],
|
|||
|
failedFiles: [],
|
|||
|
};
|
|||
|
for (const fileData of filesData) {
|
|||
|
if (parsedFiles[fileData.filePath]) {
|
|||
|
parsingResults.parsedFiles.push({
|
|||
|
...fileData,
|
|||
|
jsonContent: JSON.parse(parsedFiles[fileData.filePath]),
|
|||
|
projectType: constants_1.IacProjectType.TERRAFORM,
|
|||
|
engineType: types_1.EngineType.Terraform,
|
|||
|
});
|
|||
|
}
|
|||
|
else if (failedFiles[fileData.filePath]) {
|
|||
|
if (debugLogs[fileData.filePath]) {
|
|||
|
debug('File %s failed to parse with: %s', fileData.filePath, debugLogs[fileData.filePath]);
|
|||
|
}
|
|||
|
parsingResults.failedFiles.push(generateFailedParsedFile(fileData, new terraform_file_parser_1.FailedToParseTerraformFileError(fileData.filePath)));
|
|||
|
}
|
|||
|
}
|
|||
|
return parsingResults;
|
|||
|
}
|
|||
|
exports.parseTerraformFiles = parseTerraformFiles;
|
|||
|
function generateFailedParsedFile({ fileType, filePath, fileContent }, err) {
|
|||
|
return {
|
|||
|
err,
|
|||
|
failureReason: err.message,
|
|||
|
fileType,
|
|||
|
filePath,
|
|||
|
fileContent,
|
|||
|
engineType: null,
|
|||
|
jsonContent: null,
|
|||
|
};
|
|||
|
}
|
|||
|
function tryParseIacFile(fileData, options = {}) {
|
|||
|
analytics.add('iac-terraform-plan', false);
|
|||
|
switch (fileData.fileType) {
|
|||
|
case 'yaml':
|
|||
|
case 'yml': {
|
|||
|
const parsedIacFile = yaml_parser_1.parseYAMLOrJSONFileData(fileData);
|
|||
|
return config_type_detection_1.detectConfigType(fileData, parsedIacFile);
|
|||
|
}
|
|||
|
case 'json': {
|
|||
|
const parsedIacFile = yaml_parser_1.parseYAMLOrJSONFileData(fileData);
|
|||
|
// the Kubernetes file can have more than one JSON object in it
|
|||
|
// but the Terraform plan can only have one
|
|||
|
if (parsedIacFile.length === 1 && terraform_plan_parser_1.isTerraformPlan(parsedIacFile[0])) {
|
|||
|
analytics.add('iac-terraform-plan', true);
|
|||
|
return terraform_plan_parser_1.tryParsingTerraformPlan(fileData, parsedIacFile[0], {
|
|||
|
isFullScan: options.scan === types_1.TerraformPlanScanMode.FullScan,
|
|||
|
});
|
|||
|
}
|
|||
|
else {
|
|||
|
return config_type_detection_1.detectConfigType(fileData, parsedIacFile);
|
|||
|
}
|
|||
|
}
|
|||
|
default:
|
|||
|
throw new UnsupportedFileTypeError(fileData.fileType);
|
|||
|
}
|
|||
|
}
|
|||
|
exports.tryParseIacFile = tryParseIacFile;
|
|||
|
class UnsupportedFileTypeError extends errors_1.CustomError {
|
|||
|
constructor(fileType) {
|
|||
|
super('Unsupported file extension');
|
|||
|
this.code = types_1.IaCErrorCodes.UnsupportedFileTypeError;
|
|||
|
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|||
|
this.userMessage = `Unable to process the file with extension ${fileType}. Supported file extensions are tf, yml, yaml & json.\nMore information can be found by running \`snyk iac test --help\` or through our documentation:\nhttps://support.snyk.io/hc/en-us/articles/360012429477-Test-your-Kubernetes-files-with-our-CLI-tool\nhttps://support.snyk.io/hc/en-us/articles/360013723877-Test-your-Terraform-files-with-our-CLI-tool`;
|
|||
|
}
|
|||
|
}
|
|||
|
exports.UnsupportedFileTypeError = UnsupportedFileTypeError;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 88361:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.FailedToExecutePolicyEngine = exports.FailedToBuildPolicyEngine = exports.clearPolicyEngineCache = exports.validateResultFromCustomRules = exports.scanFiles = void 0;
|
|||
|
const types_1 = __webpack_require__(94820);
|
|||
|
const opa_wasm_1 = __webpack_require__(79264);
|
|||
|
const fs = __webpack_require__(35747);
|
|||
|
const local_cache_1 = __webpack_require__(50089);
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
const error_utils_1 = __webpack_require__(36401);
|
|||
|
const common_1 = __webpack_require__(53110);
|
|||
|
async function scanFiles(parsedFiles) {
|
|||
|
// TODO: gracefully handle failed scans
|
|||
|
const scannedFiles = [];
|
|||
|
let failedScans = [];
|
|||
|
for (const parsedFile of parsedFiles) {
|
|||
|
const policyEngine = await getPolicyEngine(parsedFile.engineType);
|
|||
|
const result = policyEngine.scanFile(parsedFile);
|
|||
|
if (parsedFile.engineType === types_1.EngineType.Custom) {
|
|||
|
const { validatedResult, invalidIssues } = validateResultFromCustomRules(result);
|
|||
|
scannedFiles.push(validatedResult);
|
|||
|
failedScans = [...failedScans, ...invalidIssues];
|
|||
|
}
|
|||
|
else {
|
|||
|
scannedFiles.push(result);
|
|||
|
}
|
|||
|
}
|
|||
|
return { scannedFiles, failedScans };
|
|||
|
}
|
|||
|
exports.scanFiles = scanFiles;
|
|||
|
async function getPolicyEngine(engineType) {
|
|||
|
if (policyEngineCache[engineType]) {
|
|||
|
return policyEngineCache[engineType];
|
|||
|
}
|
|||
|
policyEngineCache[engineType] = await buildPolicyEngine(engineType);
|
|||
|
return policyEngineCache[engineType];
|
|||
|
}
|
|||
|
function validateResultFromCustomRules(result) {
|
|||
|
const invalidIssues = [];
|
|||
|
const filteredViolatedPolicies = [];
|
|||
|
for (const violatedPolicy of result.violatedPolicies) {
|
|||
|
let failureReason = '';
|
|||
|
const invalidSeverity = !common_1.SEVERITIES.find((s) => s.verboseName === violatedPolicy.severity);
|
|||
|
if (invalidSeverity) {
|
|||
|
failureReason = `Invalid severity level for custom rule ${violatedPolicy.publicId}. Change to low, medium, high, or critical`;
|
|||
|
}
|
|||
|
const invalidLowercasePublicId = violatedPolicy.publicId !== violatedPolicy.publicId.toUpperCase();
|
|||
|
if (invalidLowercasePublicId) {
|
|||
|
failureReason = `Invalid non-uppercase publicId for custom rule ${violatedPolicy.publicId}. Change to ${violatedPolicy.publicId.toUpperCase()}`;
|
|||
|
}
|
|||
|
const invalidSnykPublicId = violatedPolicy.publicId.startsWith('SNYK-CC-');
|
|||
|
if (invalidSnykPublicId) {
|
|||
|
failureReason = `Invalid publicId for custom rule ${violatedPolicy.publicId}. Change to a publicId that does not start with SNYK-CC-`;
|
|||
|
}
|
|||
|
if (failureReason) {
|
|||
|
invalidIssues.push({
|
|||
|
filePath: result.filePath,
|
|||
|
fileType: result.fileType,
|
|||
|
failureReason,
|
|||
|
});
|
|||
|
}
|
|||
|
else {
|
|||
|
filteredViolatedPolicies.push(violatedPolicy);
|
|||
|
}
|
|||
|
}
|
|||
|
return {
|
|||
|
validatedResult: {
|
|||
|
...result,
|
|||
|
violatedPolicies: filteredViolatedPolicies,
|
|||
|
},
|
|||
|
invalidIssues,
|
|||
|
};
|
|||
|
}
|
|||
|
exports.validateResultFromCustomRules = validateResultFromCustomRules;
|
|||
|
// used in tests only
|
|||
|
function clearPolicyEngineCache() {
|
|||
|
policyEngineCache = {
|
|||
|
[types_1.EngineType.Kubernetes]: null,
|
|||
|
[types_1.EngineType.Terraform]: null,
|
|||
|
[types_1.EngineType.CloudFormation]: null,
|
|||
|
[types_1.EngineType.ARM]: null,
|
|||
|
[types_1.EngineType.Custom]: null,
|
|||
|
};
|
|||
|
}
|
|||
|
exports.clearPolicyEngineCache = clearPolicyEngineCache;
|
|||
|
let policyEngineCache = {
|
|||
|
[types_1.EngineType.Kubernetes]: null,
|
|||
|
[types_1.EngineType.Terraform]: null,
|
|||
|
[types_1.EngineType.CloudFormation]: null,
|
|||
|
[types_1.EngineType.ARM]: null,
|
|||
|
[types_1.EngineType.Custom]: null,
|
|||
|
};
|
|||
|
async function buildPolicyEngine(engineType) {
|
|||
|
const [policyEngineCoreDataPath, policyEngineMetaDataPath,] = local_cache_1.getLocalCachePath(engineType);
|
|||
|
try {
|
|||
|
const wasmFile = fs.readFileSync(policyEngineCoreDataPath);
|
|||
|
const policyMetaData = fs.readFileSync(policyEngineMetaDataPath);
|
|||
|
const policyMetadataAsJson = JSON.parse(policyMetaData.toString());
|
|||
|
const opaWasmInstance = await opa_wasm_1.loadPolicy(Buffer.from(wasmFile));
|
|||
|
opaWasmInstance.setData(policyMetadataAsJson);
|
|||
|
return new PolicyEngine(opaWasmInstance);
|
|||
|
}
|
|||
|
catch (err) {
|
|||
|
throw new FailedToBuildPolicyEngine();
|
|||
|
}
|
|||
|
}
|
|||
|
class PolicyEngine {
|
|||
|
constructor(opaWasmInstance) {
|
|||
|
this.opaWasmInstance = opaWasmInstance;
|
|||
|
this.opaWasmInstance = opaWasmInstance;
|
|||
|
}
|
|||
|
evaluate(data) {
|
|||
|
return this.opaWasmInstance.evaluate(data)[0].result;
|
|||
|
}
|
|||
|
scanFile(iacFile) {
|
|||
|
try {
|
|||
|
const violatedPolicies = this.evaluate(iacFile.jsonContent);
|
|||
|
return {
|
|||
|
...iacFile,
|
|||
|
violatedPolicies,
|
|||
|
};
|
|||
|
}
|
|||
|
catch (err) {
|
|||
|
// TODO: to distinguish between different failure reasons
|
|||
|
throw new FailedToExecutePolicyEngine();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
class FailedToBuildPolicyEngine extends errors_1.CustomError {
|
|||
|
constructor(message) {
|
|||
|
super(message || 'Failed to build policy engine');
|
|||
|
this.code = types_1.IaCErrorCodes.FailedToBuildPolicyEngine;
|
|||
|
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|||
|
this.userMessage =
|
|||
|
'We were unable to run the test. Please run the command again with the `-d` flag and contact support@snyk.io with the contents of the output';
|
|||
|
}
|
|||
|
}
|
|||
|
exports.FailedToBuildPolicyEngine = FailedToBuildPolicyEngine;
|
|||
|
class FailedToExecutePolicyEngine extends errors_1.CustomError {
|
|||
|
constructor(message) {
|
|||
|
super(message || 'Failed to execute policy engine');
|
|||
|
this.code = types_1.IaCErrorCodes.FailedToExecutePolicyEngine;
|
|||
|
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|||
|
this.userMessage =
|
|||
|
'We were unable to run the test. Please run the command again with the `-d` flag and contact support@snyk.io with the contents of the output';
|
|||
|
}
|
|||
|
}
|
|||
|
exports.FailedToExecutePolicyEngine = FailedToExecutePolicyEngine;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 89627:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.InvalidVarFilePath = exports.parseTags = exports.removeFileContent = exports.test = void 0;
|
|||
|
const fs_1 = __webpack_require__(35747);
|
|||
|
const detect_1 = __webpack_require__(45318);
|
|||
|
const types_1 = __webpack_require__(94820);
|
|||
|
const analytics_1 = __webpack_require__(41519);
|
|||
|
const usage_tracking_1 = __webpack_require__(70413);
|
|||
|
const measurable_methods_1 = __webpack_require__(5687);
|
|||
|
const policy_1 = __webpack_require__(32615);
|
|||
|
const monitor_1 = __webpack_require__(3708);
|
|||
|
const directory_loader_1 = __webpack_require__(80509);
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
const error_utils_1 = __webpack_require__(36401);
|
|||
|
const file_loader_1 = __webpack_require__(62201);
|
|||
|
// this method executes the local processing engine and then formats the results to adapt with the CLI output.
|
|||
|
// this flow is the default GA flow for IAC scanning.
|
|||
|
async function test(resultsProcessor, pathToScan, options, iacOrgSettings, rulesOrigin) {
|
|||
|
// Parse tags and attributes right now, so we can exit early if the user
|
|||
|
// provided invalid values.
|
|||
|
const tags = parseTags(options);
|
|||
|
const attributes = parseAttributes(options);
|
|||
|
const policy = await policy_1.findAndLoadPolicy(pathToScan, 'iac', options);
|
|||
|
let allParsedFiles = [], allFailedFiles = [];
|
|||
|
const allDirectories = directory_loader_1.getAllDirectoriesForPath(pathToScan, options.detectionDepth);
|
|||
|
// we load and parse files directory by directory
|
|||
|
// because we need all files in the same directory to share the same variable context for Terraform
|
|||
|
for (const currentDirectory of allDirectories) {
|
|||
|
const filePathsInDirectory = directory_loader_1.getFilesForDirectory(pathToScan, currentDirectory);
|
|||
|
if (currentDirectory === pathToScan &&
|
|||
|
shouldLoadVarDefinitionsFile(options)) {
|
|||
|
const varDefinitionsFilePath = options['var-file'];
|
|||
|
filePathsInDirectory.push(varDefinitionsFilePath);
|
|||
|
}
|
|||
|
const filesToParse = await measurable_methods_1.loadContentForFiles(filePathsInDirectory);
|
|||
|
const { parsedFiles, failedFiles } = await measurable_methods_1.parseFiles(filesToParse, options);
|
|||
|
allParsedFiles = allParsedFiles.concat(parsedFiles);
|
|||
|
allFailedFiles = allFailedFiles.concat(failedFiles);
|
|||
|
}
|
|||
|
if (allParsedFiles.length === 0) {
|
|||
|
if (allFailedFiles.length === 0) {
|
|||
|
throw new file_loader_1.NoFilesToScanError();
|
|||
|
}
|
|||
|
else {
|
|||
|
// we throw an array of errors in order to get the path of the files which generated an error
|
|||
|
throw allFailedFiles.map((f) => f.err);
|
|||
|
}
|
|||
|
}
|
|||
|
// Duplicate all the files and run them through the custom engine.
|
|||
|
if (rulesOrigin !== types_1.RulesOrigin.Internal) {
|
|||
|
allParsedFiles.push(...allParsedFiles.map((file) => ({
|
|||
|
...file,
|
|||
|
engineType: types_1.EngineType.Custom,
|
|||
|
})));
|
|||
|
}
|
|||
|
// NOTE: No file or parsed file data should leave this function.
|
|||
|
let failures = detect_1.isLocalFolder(pathToScan)
|
|||
|
? allFailedFiles.map(removeFileContent)
|
|||
|
: [];
|
|||
|
const { scannedFiles, failedScans } = await measurable_methods_1.scanFiles(allParsedFiles);
|
|||
|
failures = [...failures, ...failedScans];
|
|||
|
const resultsWithCustomSeverities = await measurable_methods_1.applyCustomSeverities(scannedFiles, iacOrgSettings.customPolicies);
|
|||
|
const { filteredIssues, ignoreCount } = await resultsProcessor.processResults(resultsWithCustomSeverities, policy, tags, attributes);
|
|||
|
try {
|
|||
|
await measurable_methods_1.trackUsage(filteredIssues);
|
|||
|
}
|
|||
|
catch (e) {
|
|||
|
if (e instanceof usage_tracking_1.TestLimitReachedError) {
|
|||
|
throw e;
|
|||
|
}
|
|||
|
// If something has gone wrong, err on the side of allowing the user to
|
|||
|
// run their tests by squashing the error.
|
|||
|
}
|
|||
|
analytics_1.addIacAnalytics(filteredIssues, {
|
|||
|
ignoredIssuesCount: ignoreCount,
|
|||
|
rulesOrigin,
|
|||
|
});
|
|||
|
// TODO: add support for proper typing of old TestResult interface.
|
|||
|
return {
|
|||
|
results: filteredIssues,
|
|||
|
failures,
|
|||
|
ignoreCount,
|
|||
|
};
|
|||
|
}
|
|||
|
exports.test = test;
|
|||
|
function removeFileContent({ filePath, fileType, failureReason, projectType, }) {
|
|||
|
return {
|
|||
|
filePath,
|
|||
|
fileType,
|
|||
|
failureReason,
|
|||
|
projectType,
|
|||
|
};
|
|||
|
}
|
|||
|
exports.removeFileContent = removeFileContent;
|
|||
|
function parseTags(options) {
|
|||
|
if (options.report) {
|
|||
|
return monitor_1.generateTags(options);
|
|||
|
}
|
|||
|
}
|
|||
|
exports.parseTags = parseTags;
|
|||
|
function parseAttributes(options) {
|
|||
|
if (options.report) {
|
|||
|
return monitor_1.generateProjectAttributes(options);
|
|||
|
}
|
|||
|
}
|
|||
|
function shouldLoadVarDefinitionsFile(options) {
|
|||
|
if (options['var-file']) {
|
|||
|
if (!fs_1.existsSync(options['var-file'])) {
|
|||
|
throw new InvalidVarFilePath(options['var-file']);
|
|||
|
}
|
|||
|
return true;
|
|||
|
}
|
|||
|
return false;
|
|||
|
}
|
|||
|
class InvalidVarFilePath extends errors_1.CustomError {
|
|||
|
constructor(path, message) {
|
|||
|
super(message || 'Invalid path to variable definitions file');
|
|||
|
this.code = types_1.IaCErrorCodes.InvalidVarFilePath;
|
|||
|
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|||
|
this.userMessage = `We were unable to locate a variable definitions file at: "${path}". The file at the provided path does not exist`;
|
|||
|
}
|
|||
|
}
|
|||
|
exports.InvalidVarFilePath = InvalidVarFilePath;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 5687:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.pull = exports.localTest = exports.cleanLocalCache = exports.trackUsage = exports.formatScanResults = exports.applyCustomSeverities = exports.getIacOrgSettings = exports.scanFiles = exports.parseFiles = exports.loadContentForFiles = exports.initLocalCache = exports.performanceAnalyticsDecorator = exports.asyncPerformanceAnalyticsDecorator = void 0;
|
|||
|
const file_parser_1 = __webpack_require__(39331);
|
|||
|
const file_scanner_1 = __webpack_require__(88361);
|
|||
|
const results_formatter_1 = __webpack_require__(11059);
|
|||
|
const usage_tracking_1 = __webpack_require__(70413);
|
|||
|
const local_cache_1 = __webpack_require__(50089);
|
|||
|
const apply_custom_severities_1 = __webpack_require__(71632);
|
|||
|
const get_iac_org_settings_1 = __webpack_require__(11693);
|
|||
|
const index_1 = __webpack_require__(89627);
|
|||
|
const oci_pull_1 = __webpack_require__(166);
|
|||
|
const analytics_1 = __webpack_require__(41519);
|
|||
|
const types_1 = __webpack_require__(94820);
|
|||
|
const file_loader_1 = __webpack_require__(62201);
|
|||
|
// Note: The return type of the returned async function needs to be Promise<Val> for
|
|||
|
// the compiler to be happy, so we need to unwrap it with the messy
|
|||
|
// Awaiter<ReturnType<T>> rather than just using ReturnType<T> directly.
|
|||
|
function asyncPerformanceAnalyticsDecorator(measurableMethod, analyticsKey) {
|
|||
|
return async function (...args) {
|
|||
|
const startTime = Date.now();
|
|||
|
const returnValue = await measurableMethod(...args);
|
|||
|
const durationMs = Date.now() - startTime;
|
|||
|
analytics_1.performanceAnalyticsObject[analyticsKey] = durationMs;
|
|||
|
return returnValue;
|
|||
|
};
|
|||
|
}
|
|||
|
exports.asyncPerformanceAnalyticsDecorator = asyncPerformanceAnalyticsDecorator;
|
|||
|
function performanceAnalyticsDecorator(measurableMethod, analyticsKey) {
|
|||
|
return function (...args) {
|
|||
|
const startTime = Date.now();
|
|||
|
const returnValue = measurableMethod(...args);
|
|||
|
const durationMs = Date.now() - startTime;
|
|||
|
analytics_1.performanceAnalyticsObject[analyticsKey] = durationMs;
|
|||
|
return returnValue;
|
|||
|
};
|
|||
|
}
|
|||
|
exports.performanceAnalyticsDecorator = performanceAnalyticsDecorator;
|
|||
|
const measurableInitLocalCache = asyncPerformanceAnalyticsDecorator(local_cache_1.initLocalCache, types_1.PerformanceAnalyticsKey.InitLocalCache);
|
|||
|
exports.initLocalCache = measurableInitLocalCache;
|
|||
|
const measurableParseFiles = asyncPerformanceAnalyticsDecorator(file_parser_1.parseFiles, types_1.PerformanceAnalyticsKey.FileParsing);
|
|||
|
exports.parseFiles = measurableParseFiles;
|
|||
|
const measurableloadContentForFiles = asyncPerformanceAnalyticsDecorator(file_loader_1.loadContentForFiles, types_1.PerformanceAnalyticsKey.FileLoading);
|
|||
|
exports.loadContentForFiles = measurableloadContentForFiles;
|
|||
|
const measurableScanFiles = asyncPerformanceAnalyticsDecorator(file_scanner_1.scanFiles, types_1.PerformanceAnalyticsKey.FileScanning);
|
|||
|
exports.scanFiles = measurableScanFiles;
|
|||
|
const measurableGetIacOrgSettings = asyncPerformanceAnalyticsDecorator(get_iac_org_settings_1.getIacOrgSettings, types_1.PerformanceAnalyticsKey.OrgSettings);
|
|||
|
exports.getIacOrgSettings = measurableGetIacOrgSettings;
|
|||
|
const measurableApplyCustomSeverities = asyncPerformanceAnalyticsDecorator(apply_custom_severities_1.applyCustomSeverities, types_1.PerformanceAnalyticsKey.CustomSeverities);
|
|||
|
exports.applyCustomSeverities = measurableApplyCustomSeverities;
|
|||
|
const measurableCleanLocalCache = performanceAnalyticsDecorator(local_cache_1.cleanLocalCache, types_1.PerformanceAnalyticsKey.CacheCleanup);
|
|||
|
exports.cleanLocalCache = measurableCleanLocalCache;
|
|||
|
const measurableFormatScanResults = performanceAnalyticsDecorator(results_formatter_1.formatScanResults, types_1.PerformanceAnalyticsKey.ResultFormatting);
|
|||
|
exports.formatScanResults = measurableFormatScanResults;
|
|||
|
const measurableTrackUsage = asyncPerformanceAnalyticsDecorator(usage_tracking_1.trackUsage, types_1.PerformanceAnalyticsKey.UsageTracking);
|
|||
|
exports.trackUsage = measurableTrackUsage;
|
|||
|
const measurableLocalTest = asyncPerformanceAnalyticsDecorator(index_1.test, types_1.PerformanceAnalyticsKey.Total);
|
|||
|
exports.localTest = measurableLocalTest;
|
|||
|
const measurableOciPull = asyncPerformanceAnalyticsDecorator(oci_pull_1.pull, types_1.PerformanceAnalyticsKey.Total);
|
|||
|
exports.pull = measurableOciPull;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 71632:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.applyCustomSeverities = void 0;
|
|||
|
const _ = __webpack_require__(96486);
|
|||
|
async function applyCustomSeverities(scannedFiles, customPolicies) {
|
|||
|
if (Object.keys(customPolicies).length > 0) {
|
|||
|
return scannedFiles.map((file) => {
|
|||
|
const updatedScannedFiles = _.cloneDeep(file);
|
|||
|
updatedScannedFiles.violatedPolicies.forEach((existingPolicy) => {
|
|||
|
var _a;
|
|||
|
const customPolicyForPublicID = customPolicies[existingPolicy.publicId];
|
|||
|
if (customPolicyForPublicID) {
|
|||
|
existingPolicy.severity = (_a = customPolicyForPublicID.severity) !== null && _a !== void 0 ? _a : existingPolicy.severity;
|
|||
|
}
|
|||
|
});
|
|||
|
return updatedScannedFiles;
|
|||
|
});
|
|||
|
}
|
|||
|
return scannedFiles;
|
|||
|
}
|
|||
|
exports.applyCustomSeverities = applyCustomSeverities;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 8601:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.checkRequiredFieldsMatch = exports.detectConfigType = exports.REQUIRED_ARM_FIELDS = exports.REQUIRED_CLOUDFORMATION_FIELDS = exports.REQUIRED_K8S_FIELDS = void 0;
|
|||
|
const constants_1 = __webpack_require__(68620);
|
|||
|
const types_1 = __webpack_require__(94820);
|
|||
|
exports.REQUIRED_K8S_FIELDS = ['apiVersion', 'kind', 'metadata'];
|
|||
|
exports.REQUIRED_CLOUDFORMATION_FIELDS = ['Resources'];
|
|||
|
exports.REQUIRED_ARM_FIELDS = ['$schema', 'contentVersion', 'resources'];
|
|||
|
function detectConfigType(fileData, parsedIacFiles) {
|
|||
|
return parsedIacFiles
|
|||
|
.map((parsedFile, docId) => {
|
|||
|
if (checkRequiredFieldsMatch(parsedFile, exports.REQUIRED_CLOUDFORMATION_FIELDS)) {
|
|||
|
return {
|
|||
|
...fileData,
|
|||
|
jsonContent: parsedFile,
|
|||
|
projectType: constants_1.IacProjectType.CLOUDFORMATION,
|
|||
|
engineType: types_1.EngineType.CloudFormation,
|
|||
|
docId: fileData.fileType === 'json' ? undefined : docId,
|
|||
|
};
|
|||
|
}
|
|||
|
else if (checkRequiredFieldsMatch(parsedFile, exports.REQUIRED_K8S_FIELDS)) {
|
|||
|
return {
|
|||
|
...fileData,
|
|||
|
jsonContent: parsedFile,
|
|||
|
projectType: constants_1.IacProjectType.K8S,
|
|||
|
engineType: types_1.EngineType.Kubernetes,
|
|||
|
docId: fileData.fileType === 'json' ? undefined : docId,
|
|||
|
};
|
|||
|
}
|
|||
|
else if (checkRequiredFieldsMatch(parsedFile, exports.REQUIRED_ARM_FIELDS)) {
|
|||
|
return {
|
|||
|
...fileData,
|
|||
|
jsonContent: parsedFile,
|
|||
|
projectType: constants_1.IacProjectType.ARM,
|
|||
|
engineType: types_1.EngineType.ARM,
|
|||
|
};
|
|||
|
}
|
|||
|
else {
|
|||
|
return null;
|
|||
|
}
|
|||
|
})
|
|||
|
.filter((f) => !!f);
|
|||
|
}
|
|||
|
exports.detectConfigType = detectConfigType;
|
|||
|
function checkRequiredFieldsMatch(parsedDocument, requiredFields) {
|
|||
|
if (!parsedDocument) {
|
|||
|
return false;
|
|||
|
}
|
|||
|
return requiredFields.every((requiredField) => parsedDocument.hasOwnProperty(requiredField));
|
|||
|
}
|
|||
|
exports.checkRequiredFieldsMatch = checkRequiredFieldsMatch;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 70456:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
// This artifact was generated using GopherJS and https://github.com/snyk/snyk-iac-parsers
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
const gopherJsArtifact = __webpack_require__(61520);
|
|||
|
function hclToJsonV2(files) {
|
|||
|
return gopherJsArtifact.parseModule(files);
|
|||
|
}
|
|||
|
exports.default = hclToJsonV2;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 11634:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.FailedToParseTerraformFileError = void 0;
|
|||
|
const types_1 = __webpack_require__(94820);
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
const error_utils_1 = __webpack_require__(36401);
|
|||
|
class FailedToParseTerraformFileError extends errors_1.CustomError {
|
|||
|
constructor(filename) {
|
|||
|
super('Failed to parse Terraform file');
|
|||
|
this.code = types_1.IaCErrorCodes.FailedToParseTerraformFileError;
|
|||
|
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|||
|
this.filename = filename;
|
|||
|
this.userMessage = `We were unable to parse the Terraform file "${filename}", please ensure it is valid HCL2. This can be done by running it through the 'terraform validate' command.`;
|
|||
|
}
|
|||
|
}
|
|||
|
exports.FailedToParseTerraformFileError = FailedToParseTerraformFileError;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 58540:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.FailedToExtractResourcesInTerraformPlanError = exports.tryParsingTerraformPlan = exports.isTerraformPlan = void 0;
|
|||
|
const types_1 = __webpack_require__(94820);
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
const error_utils_1 = __webpack_require__(36401);
|
|||
|
const constants_1 = __webpack_require__(68620);
|
|||
|
function terraformPlanReducer(scanInput, resource) {
|
|||
|
// TODO: investigate if this reduction logic covers all edge-cases (nested modules, similar names, etc')
|
|||
|
const { type, name, mode, index, values } = resource;
|
|||
|
const inputKey = mode === 'data' ? 'data' : 'resource';
|
|||
|
if (scanInput[inputKey][type]) {
|
|||
|
// add new resources of the same type with different names
|
|||
|
scanInput[inputKey][type][getResourceName(index, name)] = values || {};
|
|||
|
}
|
|||
|
else {
|
|||
|
// add a new resource type
|
|||
|
scanInput[inputKey][type] = { [getResourceName(index, name)]: values };
|
|||
|
}
|
|||
|
return scanInput;
|
|||
|
}
|
|||
|
function getExpressions(expressions) {
|
|||
|
const result = {};
|
|||
|
// expressions can be nested. we are only doing 1 depth to resolve top level depenencies
|
|||
|
for (const key of Object.keys(expressions)) {
|
|||
|
const referenceKey = getReference(expressions[key]);
|
|||
|
if (referenceKey) {
|
|||
|
result[key] = referenceKey;
|
|||
|
}
|
|||
|
}
|
|||
|
return result;
|
|||
|
}
|
|||
|
// this is very naive implementation
|
|||
|
// the referenences can be composed of number of keys
|
|||
|
// we only going to use the first reference for time being
|
|||
|
function getReference(value) {
|
|||
|
var _a;
|
|||
|
return (_a = value.references) === null || _a === void 0 ? void 0 : _a[0];
|
|||
|
}
|
|||
|
function getResourceName(index, name) {
|
|||
|
return index !== undefined ? `${name}["${index}"]` : name;
|
|||
|
}
|
|||
|
function resourceChangeReducer(scanInput, resource, isFullScan) {
|
|||
|
// TODO: investigate if we need to address also `after_unknown` field.
|
|||
|
const { actions, after } = resource.change || { actions: [], after: {} };
|
|||
|
if (isValidResourceActions(actions, isFullScan)) {
|
|||
|
const resourceForReduction = { ...resource, values: after || {} };
|
|||
|
return terraformPlanReducer(scanInput, resourceForReduction);
|
|||
|
}
|
|||
|
return scanInput;
|
|||
|
}
|
|||
|
function isValidResourceActions(action, isFullScan) {
|
|||
|
const VALID_ACTIONS = isFullScan
|
|||
|
? types_1.VALID_RESOURCE_ACTIONS_FOR_FULL_SCAN
|
|||
|
: types_1.VALID_RESOURCE_ACTIONS_FOR_DELTA_SCAN;
|
|||
|
return VALID_ACTIONS.some((validAction) => {
|
|||
|
if (action.length !== validAction.length) {
|
|||
|
return false;
|
|||
|
}
|
|||
|
return validAction.every((field, idx) => action[idx] === field);
|
|||
|
});
|
|||
|
}
|
|||
|
function referencedResourcesResolver(scanInput, resources) {
|
|||
|
var _a, _b;
|
|||
|
// check root module for references in first depth of attributes
|
|||
|
for (const resource of resources) {
|
|||
|
const { type, name, mode, index, expressions } = resource;
|
|||
|
// don't care about references in data sources for time being
|
|||
|
if (mode == 'data') {
|
|||
|
continue;
|
|||
|
}
|
|||
|
const inputKey = 'resource';
|
|||
|
// only update the references in resources that have some resolved attributes already
|
|||
|
const resolvedResource = (_b = (_a = scanInput[inputKey]) === null || _a === void 0 ? void 0 : _a[type]) === null || _b === void 0 ? void 0 : _b[getResourceName(index, name)];
|
|||
|
if (resolvedResource && expressions) {
|
|||
|
const resourceExpressions = getExpressions(expressions);
|
|||
|
for (const key of Object.keys(resourceExpressions)) {
|
|||
|
// only add non existing attributes. If we already have resolved value do not overwrite it with reference
|
|||
|
if (!resolvedResource[key]) {
|
|||
|
resolvedResource[key] = resourceExpressions[key];
|
|||
|
}
|
|||
|
}
|
|||
|
scanInput[inputKey][type][getResourceName(index, name)] = resolvedResource;
|
|||
|
}
|
|||
|
}
|
|||
|
return scanInput;
|
|||
|
}
|
|||
|
function extractResourceChanges(terraformPlanJson) {
|
|||
|
return terraformPlanJson.resource_changes || [];
|
|||
|
}
|
|||
|
function extractReferencedResources(terraformPlanJson) {
|
|||
|
var _a, _b;
|
|||
|
return ((_b = (_a = terraformPlanJson.configuration) === null || _a === void 0 ? void 0 : _a.root_module) === null || _b === void 0 ? void 0 : _b.resources) || [];
|
|||
|
}
|
|||
|
function extractResourcesForScan(terraformPlanJson, isFullScan = false) {
|
|||
|
const resourceChanges = extractResourceChanges(terraformPlanJson);
|
|||
|
const scanInput = resourceChanges.reduce((memo, curr) => resourceChangeReducer(memo, curr, isFullScan), {
|
|||
|
resource: {},
|
|||
|
data: {},
|
|||
|
});
|
|||
|
const referencedResources = extractReferencedResources(terraformPlanJson);
|
|||
|
return referencedResourcesResolver(scanInput, referencedResources);
|
|||
|
}
|
|||
|
function isTerraformPlan(terraformPlanJson) {
|
|||
|
const missingRequiredFields = terraformPlanJson.resource_changes === undefined;
|
|||
|
return !missingRequiredFields;
|
|||
|
}
|
|||
|
exports.isTerraformPlan = isTerraformPlan;
|
|||
|
function tryParsingTerraformPlan(terraformPlanFile, terraformPlanJson, { isFullScan } = { isFullScan: false }) {
|
|||
|
try {
|
|||
|
return [
|
|||
|
{
|
|||
|
...terraformPlanFile,
|
|||
|
jsonContent: extractResourcesForScan(terraformPlanJson, isFullScan),
|
|||
|
engineType: types_1.EngineType.Terraform,
|
|||
|
projectType: constants_1.IacProjectType.TERRAFORM,
|
|||
|
},
|
|||
|
];
|
|||
|
}
|
|||
|
catch (err) {
|
|||
|
throw new FailedToExtractResourcesInTerraformPlanError();
|
|||
|
}
|
|||
|
}
|
|||
|
exports.tryParsingTerraformPlan = tryParsingTerraformPlan;
|
|||
|
// This error is due to the complex reduction logic, so it catches scenarios we might have not covered.
|
|||
|
class FailedToExtractResourcesInTerraformPlanError extends errors_1.CustomError {
|
|||
|
constructor(message) {
|
|||
|
super(message || 'Failed to extract resources from Terraform plan JSON file');
|
|||
|
this.code = types_1.IaCErrorCodes.FailedToExtractResourcesInTerraformPlanError;
|
|||
|
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|||
|
this.userMessage =
|
|||
|
'We failed to extract resource changes from the Terraform plan file, please contact support@snyk.io, if possible with a redacted version of the file';
|
|||
|
}
|
|||
|
}
|
|||
|
exports.FailedToExtractResourcesInTerraformPlanError = FailedToExtractResourcesInTerraformPlanError;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 40008:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.shareResults = void 0;
|
|||
|
const config_1 = __webpack_require__(25425);
|
|||
|
const request_1 = __webpack_require__(52050);
|
|||
|
const api_token_1 = __webpack_require__(95181);
|
|||
|
const envelope_formatters_1 = __webpack_require__(88784);
|
|||
|
const analytics = __webpack_require__(82744);
|
|||
|
const dev_count_analysis_1 = __webpack_require__(73898);
|
|||
|
const Debug = __webpack_require__(15158);
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
const usage_tracking_1 = __webpack_require__(70413);
|
|||
|
const debug = Debug('iac-cli-share-results');
|
|||
|
async function shareResults({ results, policy, tags, attributes, options, meta, }) {
|
|||
|
var _a, _b;
|
|||
|
const scanResults = results.map((result) => envelope_formatters_1.convertIacResultToScanResult(result, policy, meta, options));
|
|||
|
let contributors = [];
|
|||
|
if (meta.gitRemoteUrl) {
|
|||
|
if (analytics.allowAnalytics()) {
|
|||
|
try {
|
|||
|
contributors = await dev_count_analysis_1.getContributors();
|
|||
|
}
|
|||
|
catch (err) {
|
|||
|
debug('error getting repo contributors', err);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
const { res, body } = await request_1.makeRequest({
|
|||
|
method: 'POST',
|
|||
|
url: `${config_1.default.API}/iac-cli-share-results`,
|
|||
|
json: true,
|
|||
|
qs: { org: (_a = options === null || options === void 0 ? void 0 : options.org) !== null && _a !== void 0 ? _a : config_1.default.org },
|
|||
|
headers: {
|
|||
|
authorization: api_token_1.getAuthHeader(),
|
|||
|
},
|
|||
|
body: {
|
|||
|
scanResults,
|
|||
|
contributors,
|
|||
|
tags,
|
|||
|
attributes,
|
|||
|
},
|
|||
|
});
|
|||
|
if (res.statusCode === 401) {
|
|||
|
throw errors_1.AuthFailedError();
|
|||
|
}
|
|||
|
else if (res.statusCode === 429) {
|
|||
|
throw new usage_tracking_1.TestLimitReachedError();
|
|||
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|||
|
}
|
|||
|
else if (res.statusCode < 200 || res.statusCode > 299) {
|
|||
|
throw new errors_1.ValidationError((_b = res.body.error) !== null && _b !== void 0 ? _b : 'An error occurred, please contact Snyk support');
|
|||
|
}
|
|||
|
return { projectPublicIds: body, gitRemoteUrl: meta.gitRemoteUrl };
|
|||
|
}
|
|||
|
exports.shareResults = shareResults;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 30537:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.extractLineNumber = exports.getFileTypeForParser = void 0;
|
|||
|
const types_1 = __webpack_require__(94820);
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
const cloud_config_parser_1 = __webpack_require__(98611);
|
|||
|
const file_parser_1 = __webpack_require__(39331);
|
|||
|
const analytics = __webpack_require__(82744);
|
|||
|
const Debug = __webpack_require__(15158);
|
|||
|
const error_utils_1 = __webpack_require__(36401);
|
|||
|
const debug = Debug('iac-extract-line-number');
|
|||
|
function getFileTypeForParser(fileType) {
|
|||
|
switch (fileType) {
|
|||
|
case 'yaml':
|
|||
|
case 'yml':
|
|||
|
return cloud_config_parser_1.CloudConfigFileTypes.YAML;
|
|||
|
case 'json':
|
|||
|
return cloud_config_parser_1.CloudConfigFileTypes.JSON;
|
|||
|
case 'tf':
|
|||
|
return cloud_config_parser_1.CloudConfigFileTypes.TF;
|
|||
|
default:
|
|||
|
throw new file_parser_1.UnsupportedFileTypeError(fileType);
|
|||
|
}
|
|||
|
}
|
|||
|
exports.getFileTypeForParser = getFileTypeForParser;
|
|||
|
function extractLineNumber(cloudConfigPath, fileType, treeByDocId) {
|
|||
|
try {
|
|||
|
return cloud_config_parser_1.getLineNumber(cloudConfigPath, fileType, treeByDocId);
|
|||
|
}
|
|||
|
catch {
|
|||
|
const err = new FailedToExtractLineNumberError();
|
|||
|
analytics.add('error-code', err.code);
|
|||
|
debug('Parser library failed. Could not assign lineNumber to issue');
|
|||
|
return -1;
|
|||
|
}
|
|||
|
}
|
|||
|
exports.extractLineNumber = extractLineNumber;
|
|||
|
class FailedToExtractLineNumberError extends errors_1.CustomError {
|
|||
|
constructor(message) {
|
|||
|
super(message || 'Parser library failed. Could not assign lineNumber to issue');
|
|||
|
this.code = types_1.IaCErrorCodes.FailedToExtractLineNumberError;
|
|||
|
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|||
|
this.userMessage = ''; // Not a user facing error.
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 1229:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.SingleGroupResultsProcessor = void 0;
|
|||
|
const process_results_1 = __webpack_require__(78744);
|
|||
|
class SingleGroupResultsProcessor {
|
|||
|
constructor(projectRoot, orgPublicId, iacOrgSettings, options, meta) {
|
|||
|
this.projectRoot = projectRoot;
|
|||
|
this.orgPublicId = orgPublicId;
|
|||
|
this.iacOrgSettings = iacOrgSettings;
|
|||
|
this.options = options;
|
|||
|
this.meta = meta;
|
|||
|
}
|
|||
|
processResults(resultsWithCustomSeverities, policy, tags, attributes) {
|
|||
|
return process_results_1.processResults(resultsWithCustomSeverities, this.orgPublicId, this.iacOrgSettings, policy, tags, attributes, this.options, this.projectRoot, this.meta);
|
|||
|
}
|
|||
|
}
|
|||
|
exports.SingleGroupResultsProcessor = SingleGroupResultsProcessor;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 91434:
|
|||
|
/***/ ((__unused_webpack_module, exports) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.filterIgnoredIssues = void 0;
|
|||
|
function filterIgnoredIssues(policy, results) {
|
|||
|
if (!policy) {
|
|||
|
return { filteredIssues: results, ignoreCount: 0 };
|
|||
|
}
|
|||
|
const vulns = results.map((res) => policy.filter(toIaCVulnAdapter(res), undefined, 'exact'));
|
|||
|
const ignoreCount = vulns.reduce((totalIgnored, vuln) => totalIgnored + vuln.filtered.ignore.length, 0);
|
|||
|
const filteredIssues = vulns.map((vuln) => toFormattedResult(vuln));
|
|||
|
return { filteredIssues, ignoreCount };
|
|||
|
}
|
|||
|
exports.filterIgnoredIssues = filterIgnoredIssues;
|
|||
|
function toIaCVulnAdapter(result) {
|
|||
|
return {
|
|||
|
vulnerabilities: result.result.cloudConfigResults.map((cloudConfigResult) => {
|
|||
|
const annotatedResult = cloudConfigResult;
|
|||
|
// Copy the cloudConfigPath array to avoid modifying the original with
|
|||
|
// splice.
|
|||
|
// Insert the targetFile into the path so that it is taken into account
|
|||
|
// when determining whether an ignore rule should be applied.
|
|||
|
const path = [...annotatedResult.cloudConfigPath];
|
|||
|
path.splice(0, 0, result.targetFile);
|
|||
|
return {
|
|||
|
id: cloudConfigResult.id,
|
|||
|
from: path,
|
|||
|
};
|
|||
|
}),
|
|||
|
originalResult: result,
|
|||
|
};
|
|||
|
}
|
|||
|
function toFormattedResult(adapter) {
|
|||
|
const original = adapter.originalResult;
|
|||
|
const filteredCloudConfigResults = original.result.cloudConfigResults.filter((res) => {
|
|||
|
return adapter.vulnerabilities.some((vuln) => {
|
|||
|
if (vuln.id !== res.id) {
|
|||
|
return false;
|
|||
|
}
|
|||
|
// Unfortunately we are forced to duplicate the logic in
|
|||
|
// toIaCVulnAdapter so that we're comparing path components properly,
|
|||
|
// including target file context. As that logic changes, so must this.
|
|||
|
const annotatedResult = res;
|
|||
|
const significantPath = [...annotatedResult.cloudConfigPath];
|
|||
|
significantPath.splice(0, 0, original.targetFile);
|
|||
|
if (vuln.from.length !== significantPath.length) {
|
|||
|
return false;
|
|||
|
}
|
|||
|
for (let i = 0; i < vuln.from.length; i++) {
|
|||
|
if (vuln.from[i] !== significantPath[i]) {
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
return true;
|
|||
|
});
|
|||
|
});
|
|||
|
original.result.cloudConfigResults = filteredCloudConfigResults;
|
|||
|
return original;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 78744:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.processResults = void 0;
|
|||
|
const policy_1 = __webpack_require__(91434);
|
|||
|
const share_results_1 = __webpack_require__(68971);
|
|||
|
const measurable_methods_1 = __webpack_require__(5687);
|
|||
|
const cloneDeep = __webpack_require__(83465);
|
|||
|
async function processResults(resultsWithCustomSeverities, orgPublicId, iacOrgSettings, policy, tags, attributes, options, projectRoot, meta) {
|
|||
|
let projectPublicIds = {};
|
|||
|
let gitRemoteUrl;
|
|||
|
if (options.report) {
|
|||
|
({ projectPublicIds, gitRemoteUrl } = await share_results_1.formatAndShareResults({
|
|||
|
// this is to fix a bug where we mutated the "results" in the formatAndShareResults
|
|||
|
// and these were used again in the formatScanResults below
|
|||
|
// resulting in double count of issues
|
|||
|
// note: this happened only in multi-YAML documents
|
|||
|
results: cloneDeep(resultsWithCustomSeverities),
|
|||
|
options,
|
|||
|
orgPublicId,
|
|||
|
policy,
|
|||
|
tags,
|
|||
|
attributes,
|
|||
|
projectRoot,
|
|||
|
meta,
|
|||
|
}));
|
|||
|
}
|
|||
|
const formattedResults = measurable_methods_1.formatScanResults(resultsWithCustomSeverities, options, iacOrgSettings.meta, projectPublicIds, projectRoot, gitRemoteUrl);
|
|||
|
return policy_1.filterIgnoredIssues(policy, formattedResults);
|
|||
|
}
|
|||
|
exports.processResults = processResults;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 11059:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.FailedToFormatResults = exports.filterPoliciesBySeverity = exports.formatScanResults = void 0;
|
|||
|
const types_1 = __webpack_require__(94820);
|
|||
|
const common_1 = __webpack_require__(53110);
|
|||
|
const constants_1 = __webpack_require__(68620);
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
const extract_line_number_1 = __webpack_require__(30537);
|
|||
|
const error_utils_1 = __webpack_require__(36401);
|
|||
|
const cloud_config_parser_1 = __webpack_require__(98611);
|
|||
|
const path = __webpack_require__(85622);
|
|||
|
const detect_1 = __webpack_require__(45318);
|
|||
|
const severitiesArray = common_1.SEVERITIES.map((s) => s.verboseName);
|
|||
|
function formatScanResults(scanResults, options, meta, projectPublicIds, projectRoot, gitRemoteUrl) {
|
|||
|
try {
|
|||
|
const groupedByFile = scanResults.reduce((memo, scanResult) => {
|
|||
|
const res = formatScanResult(scanResult, meta, options, projectRoot);
|
|||
|
if (memo[scanResult.filePath]) {
|
|||
|
memo[scanResult.filePath].result.cloudConfigResults.push(...res.result.cloudConfigResults);
|
|||
|
}
|
|||
|
else {
|
|||
|
res.meta.gitRemoteUrl = gitRemoteUrl;
|
|||
|
res.meta.projectId = projectPublicIds[res.targetFile];
|
|||
|
memo[scanResult.filePath] = res;
|
|||
|
}
|
|||
|
return memo;
|
|||
|
}, {});
|
|||
|
return Object.values(groupedByFile);
|
|||
|
}
|
|||
|
catch (e) {
|
|||
|
throw new FailedToFormatResults();
|
|||
|
}
|
|||
|
}
|
|||
|
exports.formatScanResults = formatScanResults;
|
|||
|
const engineTypeToProjectType = {
|
|||
|
[types_1.EngineType.Kubernetes]: constants_1.IacProjectType.K8S,
|
|||
|
[types_1.EngineType.Terraform]: constants_1.IacProjectType.TERRAFORM,
|
|||
|
[types_1.EngineType.CloudFormation]: constants_1.IacProjectType.CLOUDFORMATION,
|
|||
|
[types_1.EngineType.ARM]: constants_1.IacProjectType.ARM,
|
|||
|
[types_1.EngineType.Custom]: constants_1.IacProjectType.CUSTOM,
|
|||
|
};
|
|||
|
function formatScanResult(scanResult, meta, options, projectRoot) {
|
|||
|
const fileType = extract_line_number_1.getFileTypeForParser(scanResult.fileType);
|
|||
|
const isGeneratedByCustomRule = scanResult.engineType === types_1.EngineType.Custom;
|
|||
|
let treeByDocId;
|
|||
|
try {
|
|||
|
treeByDocId = cloud_config_parser_1.getTrees(fileType, scanResult.fileContent);
|
|||
|
}
|
|||
|
catch (err) {
|
|||
|
// we do nothing intentionally.
|
|||
|
// Even if the building of the tree fails in the external parser,
|
|||
|
// we still pass an undefined tree and not calculated line number for those
|
|||
|
}
|
|||
|
const formattedIssues = scanResult.violatedPolicies.map((policy) => {
|
|||
|
const cloudConfigPath = scanResult.docId !== undefined
|
|||
|
? [`[DocId: ${scanResult.docId}]`].concat(cloud_config_parser_1.parsePath(policy.msg))
|
|||
|
: policy.msg.split('.');
|
|||
|
const lineNumber = treeByDocId
|
|||
|
? extract_line_number_1.extractLineNumber(cloudConfigPath, fileType, treeByDocId)
|
|||
|
: -1;
|
|||
|
return {
|
|||
|
...policy,
|
|||
|
id: policy.publicId,
|
|||
|
name: policy.title,
|
|||
|
cloudConfigPath,
|
|||
|
isIgnored: false,
|
|||
|
iacDescription: {
|
|||
|
issue: policy.issue,
|
|||
|
impact: policy.impact,
|
|||
|
resolve: policy.resolve,
|
|||
|
},
|
|||
|
severity: policy.severity,
|
|||
|
lineNumber,
|
|||
|
documentation: !isGeneratedByCustomRule
|
|||
|
? `https://snyk.io/security-rules/${policy.publicId}`
|
|||
|
: undefined,
|
|||
|
isGeneratedByCustomRule,
|
|||
|
};
|
|||
|
});
|
|||
|
const { targetFilePath, projectName, targetFile } = computePaths(projectRoot, scanResult.filePath, options.path);
|
|||
|
return {
|
|||
|
result: {
|
|||
|
cloudConfigResults: filterPoliciesBySeverity(formattedIssues, options.severityThreshold),
|
|||
|
projectType: scanResult.projectType,
|
|||
|
},
|
|||
|
meta: {
|
|||
|
...meta,
|
|||
|
projectId: '',
|
|||
|
policy: '',
|
|||
|
},
|
|||
|
filesystemPolicy: false,
|
|||
|
vulnerabilities: [],
|
|||
|
dependencyCount: 0,
|
|||
|
licensesPolicy: null,
|
|||
|
ignoreSettings: null,
|
|||
|
targetFile,
|
|||
|
projectName,
|
|||
|
org: meta.org,
|
|||
|
policy: '',
|
|||
|
isPrivate: true,
|
|||
|
targetFilePath,
|
|||
|
packageManager: engineTypeToProjectType[scanResult.engineType],
|
|||
|
};
|
|||
|
}
|
|||
|
function filterPoliciesBySeverity(violatedPolicies, severityThreshold) {
|
|||
|
if (!severityThreshold || severityThreshold === common_1.SEVERITY.LOW) {
|
|||
|
return violatedPolicies.filter((violatedPolicy) => {
|
|||
|
return violatedPolicy.severity !== 'none';
|
|||
|
});
|
|||
|
}
|
|||
|
const severitiesToInclude = severitiesArray.slice(severitiesArray.indexOf(severityThreshold));
|
|||
|
return violatedPolicies.filter((policy) => {
|
|||
|
return (policy.severity !== 'none' &&
|
|||
|
severitiesToInclude.includes(policy.severity));
|
|||
|
});
|
|||
|
}
|
|||
|
exports.filterPoliciesBySeverity = filterPoliciesBySeverity;
|
|||
|
class FailedToFormatResults extends errors_1.CustomError {
|
|||
|
constructor(message) {
|
|||
|
super(message || 'Failed to format results');
|
|||
|
this.code = types_1.IaCErrorCodes.FailedToFormatResults;
|
|||
|
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|||
|
this.userMessage =
|
|||
|
'We failed printing the results, please contact support@snyk.io';
|
|||
|
}
|
|||
|
}
|
|||
|
exports.FailedToFormatResults = FailedToFormatResults;
|
|||
|
function computePaths(projectRoot, filePath, pathArg = '.') {
|
|||
|
const targetFilePath = path.resolve(filePath, '.');
|
|||
|
// the absolute path is needed to compute the full project path
|
|||
|
const cmdPath = path.resolve(pathArg);
|
|||
|
let projectPath;
|
|||
|
let targetFile;
|
|||
|
if (!detect_1.isLocalFolder(cmdPath)) {
|
|||
|
// if the provided path points to a file, then the project starts at the parent folder of that file
|
|||
|
// and the target file was provided as the path argument
|
|||
|
projectPath = path.dirname(cmdPath);
|
|||
|
targetFile = path.isAbsolute(pathArg)
|
|||
|
? path.relative(process.cwd(), pathArg)
|
|||
|
: pathArg;
|
|||
|
}
|
|||
|
else {
|
|||
|
// otherwise, the project starts at the provided path
|
|||
|
// and the target file must be the relative path from the project path to the path of the scanned file
|
|||
|
projectPath = cmdPath;
|
|||
|
targetFile = path.relative(projectPath, targetFilePath);
|
|||
|
}
|
|||
|
return {
|
|||
|
targetFilePath,
|
|||
|
projectName: path.basename(projectRoot),
|
|||
|
targetFile,
|
|||
|
};
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 97153:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.formatShareResults = void 0;
|
|||
|
const path = __webpack_require__(85622);
|
|||
|
function formatShareResults(projectRoot, scanResults, meta) {
|
|||
|
const resultsGroupedByFilePath = groupByFilePath(scanResults);
|
|||
|
return resultsGroupedByFilePath.map((result) => {
|
|||
|
const { projectName, targetFile } = computePaths(projectRoot, result.filePath, meta);
|
|||
|
return {
|
|||
|
projectName,
|
|||
|
targetFile,
|
|||
|
filePath: result.filePath,
|
|||
|
fileType: result.fileType,
|
|||
|
projectType: result.projectType,
|
|||
|
violatedPolicies: result.violatedPolicies,
|
|||
|
};
|
|||
|
});
|
|||
|
}
|
|||
|
exports.formatShareResults = formatShareResults;
|
|||
|
function groupByFilePath(scanResults) {
|
|||
|
const groupedByFilePath = scanResults.reduce((memo, scanResult) => {
|
|||
|
scanResult.violatedPolicies.forEach((violatedPolicy) => {
|
|||
|
violatedPolicy.docId = scanResult.docId;
|
|||
|
});
|
|||
|
if (memo[scanResult.filePath]) {
|
|||
|
memo[scanResult.filePath].violatedPolicies.push(...scanResult.violatedPolicies);
|
|||
|
}
|
|||
|
else {
|
|||
|
memo[scanResult.filePath] = scanResult;
|
|||
|
}
|
|||
|
return memo;
|
|||
|
}, {});
|
|||
|
return Object.values(groupedByFilePath);
|
|||
|
}
|
|||
|
function computePaths(projectRoot, filePath, meta) {
|
|||
|
const projectDirectory = path.resolve(projectRoot);
|
|||
|
const absoluteFilePath = path.resolve(filePath);
|
|||
|
const relativeFilePath = path.relative(projectDirectory, absoluteFilePath);
|
|||
|
const unixRelativeFilePath = relativeFilePath.split(path.sep).join('/');
|
|||
|
return {
|
|||
|
targetFilePath: absoluteFilePath,
|
|||
|
projectName: meta.projectName,
|
|||
|
targetFile: unixRelativeFilePath,
|
|||
|
};
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 68971:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.formatAndShareResults = void 0;
|
|||
|
const feature_flags_1 = __webpack_require__(63011);
|
|||
|
const cli_share_results_1 = __webpack_require__(40008);
|
|||
|
const assert_iac_options_flag_1 = __webpack_require__(33111);
|
|||
|
const share_results_formatter_1 = __webpack_require__(97153);
|
|||
|
async function formatAndShareResults({ results, options, orgPublicId, policy, tags, attributes, projectRoot, meta, }) {
|
|||
|
const isCliReportEnabled = await feature_flags_1.isFeatureFlagSupportedForOrg('iacCliShareResults', orgPublicId);
|
|||
|
if (!isCliReportEnabled.ok) {
|
|||
|
throw new assert_iac_options_flag_1.FeatureFlagError('report', 'iacCliShareResults');
|
|||
|
}
|
|||
|
const formattedResults = share_results_formatter_1.formatShareResults(projectRoot, results, meta);
|
|||
|
return await cli_share_results_1.shareResults({
|
|||
|
results: formattedResults,
|
|||
|
policy,
|
|||
|
tags,
|
|||
|
attributes,
|
|||
|
options,
|
|||
|
meta,
|
|||
|
});
|
|||
|
}
|
|||
|
exports.formatAndShareResults = formatAndShareResults;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 51309:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.RemoteOciRegistry = void 0;
|
|||
|
const registryClient = __webpack_require__(28310);
|
|||
|
class RemoteOciRegistry {
|
|||
|
constructor(registry, username, password) {
|
|||
|
this.registry = registry;
|
|||
|
this.username = username;
|
|||
|
this.password = password;
|
|||
|
}
|
|||
|
getManifest(repository, tag) {
|
|||
|
return registryClient.getManifest(this.registry, repository, tag, this.username, this.password, RemoteOciRegistry.options);
|
|||
|
}
|
|||
|
async getLayer(repository, digest) {
|
|||
|
const blob = await registryClient.getLayer(this.registry, repository, digest, this.username, this.password, RemoteOciRegistry.options);
|
|||
|
return { blob };
|
|||
|
}
|
|||
|
}
|
|||
|
exports.RemoteOciRegistry = RemoteOciRegistry;
|
|||
|
RemoteOciRegistry.options = {
|
|||
|
acceptManifest: 'application/vnd.oci.image.manifest.v1+json',
|
|||
|
acceptLayers: 'application/vnd.oci.image.layer.v1.tar+gzip',
|
|||
|
};
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 95343:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.FailedToExecuteCustomRulesError = exports.FailedToPullCustomBundleError = exports.pullIaCCustomRules = exports.buildDefaultOciRegistry = exports.initRules = void 0;
|
|||
|
const types_1 = __webpack_require__(94820);
|
|||
|
const os_1 = __webpack_require__(12087);
|
|||
|
const assert_iac_options_flag_1 = __webpack_require__(33111);
|
|||
|
const oci_pull_1 = __webpack_require__(166);
|
|||
|
const measurable_methods_1 = __webpack_require__(5687);
|
|||
|
const user_config_1 = __webpack_require__(28137);
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
const error_utils_1 = __webpack_require__(36401);
|
|||
|
const iac_output_1 = __webpack_require__(68145);
|
|||
|
const oci_registry_1 = __webpack_require__(51309);
|
|||
|
const url_utils_1 = __webpack_require__(30922);
|
|||
|
const feature_flags_1 = __webpack_require__(63011);
|
|||
|
async function initRules(buildOciRegistry, iacOrgSettings, options, orgPublicId) {
|
|||
|
var _a, _b;
|
|||
|
let customRulesPath;
|
|||
|
let rulesOrigin = types_1.RulesOrigin.Internal;
|
|||
|
if (options.rules) {
|
|||
|
if (!((_a = iacOrgSettings.entitlements) === null || _a === void 0 ? void 0 : _a.iacCustomRulesEntitlement)) {
|
|||
|
throw new assert_iac_options_flag_1.UnsupportedEntitlementFlagError('rules', 'iacCustomRulesEntitlement');
|
|||
|
}
|
|||
|
customRulesPath = options.rules;
|
|||
|
rulesOrigin = types_1.RulesOrigin.Local;
|
|||
|
}
|
|||
|
const isOCIRegistryURLProvided = checkOCIRegistryURLProvided(iacOrgSettings);
|
|||
|
if ((isOCIRegistryURLProvided || customRulesPath) &&
|
|||
|
!(options.sarif || options.json)) {
|
|||
|
let userMessage = `${iac_output_1.customRulesMessage}${os_1.EOL}`;
|
|||
|
if (options.report) {
|
|||
|
const isCliReportCustomRulesEnabled = await feature_flags_1.isFeatureFlagSupportedForOrg('iacShareCliResultsCustomRules', orgPublicId);
|
|||
|
if (!isCliReportCustomRulesEnabled.ok) {
|
|||
|
userMessage += `${iac_output_1.customRulesReportMessage}${os_1.EOL}`;
|
|||
|
}
|
|||
|
}
|
|||
|
console.log(userMessage);
|
|||
|
}
|
|||
|
if (isOCIRegistryURLProvided && customRulesPath) {
|
|||
|
throw new FailedToExecuteCustomRulesError();
|
|||
|
}
|
|||
|
if (isOCIRegistryURLProvided) {
|
|||
|
if (!((_b = iacOrgSettings.entitlements) === null || _b === void 0 ? void 0 : _b.iacCustomRulesEntitlement)) {
|
|||
|
throw new oci_pull_1.UnsupportedEntitlementPullError('iacCustomRulesEntitlement');
|
|||
|
}
|
|||
|
customRulesPath = await pullIaCCustomRules(buildOciRegistry, iacOrgSettings);
|
|||
|
rulesOrigin = types_1.RulesOrigin.Remote;
|
|||
|
}
|
|||
|
await measurable_methods_1.initLocalCache({ customRulesPath });
|
|||
|
return rulesOrigin;
|
|||
|
}
|
|||
|
exports.initRules = initRules;
|
|||
|
/**
|
|||
|
* Checks if the OCI registry URL has been provided.
|
|||
|
*/
|
|||
|
function checkOCIRegistryURLProvided(iacOrgSettings) {
|
|||
|
return (checkOCIRegistryURLExistsInSettings(iacOrgSettings) ||
|
|||
|
!!user_config_1.config.get('oci-registry-url'));
|
|||
|
}
|
|||
|
/**
|
|||
|
* Checks if the OCI registry URL was provided in the org's IaC settings.
|
|||
|
*/
|
|||
|
function checkOCIRegistryURLExistsInSettings(iacOrgSettings) {
|
|||
|
var _a, _b;
|
|||
|
return (!!((_a = iacOrgSettings.customRules) === null || _a === void 0 ? void 0 : _a.isEnabled) &&
|
|||
|
!!((_b = iacOrgSettings.customRules) === null || _b === void 0 ? void 0 : _b.ociRegistryURL));
|
|||
|
}
|
|||
|
/**
|
|||
|
* Extracts the OCI registry URL components from the org's IaC settings.
|
|||
|
*/
|
|||
|
function getOCIRegistryURLComponentsFromSettings(iacOrgSettings) {
|
|||
|
const settingsOCIRegistryURL = iacOrgSettings.customRules.ociRegistryURL;
|
|||
|
return {
|
|||
|
...oci_pull_1.extractOCIRegistryURLComponents(settingsOCIRegistryURL),
|
|||
|
tag: iacOrgSettings.customRules.ociRegistryTag || 'latest',
|
|||
|
};
|
|||
|
}
|
|||
|
/**
|
|||
|
* Extracts the OCI registry URL components from the environment variables.
|
|||
|
*/
|
|||
|
function getOCIRegistryURLComponentsFromEnv() {
|
|||
|
const envOCIRegistryURL = user_config_1.config.get('oci-registry-url');
|
|||
|
if (!url_utils_1.isValidUrl(envOCIRegistryURL)) {
|
|||
|
throw new oci_pull_1.InvalidRemoteRegistryURLError();
|
|||
|
}
|
|||
|
return oci_pull_1.extractOCIRegistryURLComponents(envOCIRegistryURL);
|
|||
|
}
|
|||
|
/**
|
|||
|
* Gets the OCI registry URL components from either the env variables or the IaC org settings.
|
|||
|
*/
|
|||
|
function getOCIRegistryURLComponents(iacOrgSettings) {
|
|||
|
if (checkOCIRegistryURLExistsInSettings(iacOrgSettings)) {
|
|||
|
return getOCIRegistryURLComponentsFromSettings(iacOrgSettings);
|
|||
|
}
|
|||
|
// Default is to get the URL from env variables.
|
|||
|
return getOCIRegistryURLComponentsFromEnv();
|
|||
|
}
|
|||
|
function buildDefaultOciRegistry(settings) {
|
|||
|
const { registryBase } = getOCIRegistryURLComponents(settings);
|
|||
|
const username = user_config_1.config.get('oci-registry-username');
|
|||
|
const password = user_config_1.config.get('oci-registry-password');
|
|||
|
return new oci_registry_1.RemoteOciRegistry(registryBase, username, password);
|
|||
|
}
|
|||
|
exports.buildDefaultOciRegistry = buildDefaultOciRegistry;
|
|||
|
/**
|
|||
|
* Pull and store the IaC custom-rules bundle from the remote OCI Registry.
|
|||
|
*/
|
|||
|
async function pullIaCCustomRules(buildOciRegistry, iacOrgSettings) {
|
|||
|
const { repo, tag } = getOCIRegistryURLComponents(iacOrgSettings);
|
|||
|
try {
|
|||
|
return await measurable_methods_1.pull(buildOciRegistry(), repo, tag);
|
|||
|
}
|
|||
|
catch (err) {
|
|||
|
if (err.statusCode === 401) {
|
|||
|
throw new FailedToPullCustomBundleError('There was an authentication error. Incorrect credentials provided.');
|
|||
|
}
|
|||
|
else if (err.statusCode === 404) {
|
|||
|
throw new FailedToPullCustomBundleError('The remote repository could not be found. Please check the provided registry URL.');
|
|||
|
}
|
|||
|
else if (err instanceof oci_pull_1.InvalidManifestSchemaVersionError) {
|
|||
|
throw new FailedToPullCustomBundleError(err.message);
|
|||
|
}
|
|||
|
else if (err instanceof oci_pull_1.FailedToBuildOCIArtifactError) {
|
|||
|
throw new oci_pull_1.FailedToBuildOCIArtifactError();
|
|||
|
}
|
|||
|
else if (err instanceof oci_pull_1.InvalidRemoteRegistryURLError) {
|
|||
|
throw new oci_pull_1.InvalidRemoteRegistryURLError();
|
|||
|
}
|
|||
|
else {
|
|||
|
throw new FailedToPullCustomBundleError();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
exports.pullIaCCustomRules = pullIaCCustomRules;
|
|||
|
class FailedToPullCustomBundleError extends errors_1.CustomError {
|
|||
|
constructor(message) {
|
|||
|
super(message || 'Could not pull custom bundle');
|
|||
|
this.code = types_1.IaCErrorCodes.FailedToPullCustomBundleError;
|
|||
|
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|||
|
this.userMessage =
|
|||
|
`${message ? message + ' ' : ''}` +
|
|||
|
'\nWe were unable to download the custom bundle to the disk. Please ensure access to the remote Registry and validate you have provided all the right parameters.' +
|
|||
|
'\nSee documentation on troubleshooting: https://docs.snyk.io/products/snyk-infrastructure-as-code/custom-rules/use-IaC-custom-rules-with-CLI/using-a-remote-custom-rules-bundle#troubleshooting';
|
|||
|
}
|
|||
|
}
|
|||
|
exports.FailedToPullCustomBundleError = FailedToPullCustomBundleError;
|
|||
|
class FailedToExecuteCustomRulesError extends errors_1.CustomError {
|
|||
|
constructor(message) {
|
|||
|
super(message || 'Could not execute custom rules mode');
|
|||
|
this.code = types_1.IaCErrorCodes.FailedToExecuteCustomRulesError;
|
|||
|
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|||
|
this.userMessage = `
|
|||
|
Remote and local custom rules bundle can not be used at the same time.
|
|||
|
Please provide a registry URL for the remote bundle, or specify local path location by using the --rules flag for the local bundle.`;
|
|||
|
}
|
|||
|
}
|
|||
|
exports.FailedToExecuteCustomRulesError = FailedToExecuteCustomRulesError;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 30922:
|
|||
|
/***/ ((__unused_webpack_module, exports) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.isValidUrl = void 0;
|
|||
|
const URL_REGEX = /^((?:https?:\/\/)?[^./]+(?:\.[^./]+)+(?:\/.*)?)$/;
|
|||
|
/**
|
|||
|
* Checks if the provided URL string is valid.
|
|||
|
*/
|
|||
|
function isValidUrl(urlStr) {
|
|||
|
return URL_REGEX.test(urlStr);
|
|||
|
}
|
|||
|
exports.isValidUrl = isValidUrl;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 70413:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.TestLimitReachedError = exports.trackUsage = void 0;
|
|||
|
const request_1 = __webpack_require__(52050);
|
|||
|
const config_1 = __webpack_require__(25425);
|
|||
|
const api_token_1 = __webpack_require__(95181);
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
async function trackUsage(formattedResults) {
|
|||
|
const trackingData = formattedResults.map((res) => {
|
|||
|
return {
|
|||
|
isPrivate: res.meta.isPrivate,
|
|||
|
issuesPrevented: res.result.cloudConfigResults.length,
|
|||
|
};
|
|||
|
});
|
|||
|
const trackingResponse = await request_1.makeRequest({
|
|||
|
method: 'POST',
|
|||
|
headers: {
|
|||
|
Authorization: api_token_1.getAuthHeader(),
|
|||
|
},
|
|||
|
url: `${config_1.default.API}/track-iac-usage/cli`,
|
|||
|
body: { results: trackingData },
|
|||
|
gzip: true,
|
|||
|
json: true,
|
|||
|
});
|
|||
|
switch (trackingResponse.res.statusCode) {
|
|||
|
case 200:
|
|||
|
break;
|
|||
|
case 429:
|
|||
|
throw new TestLimitReachedError();
|
|||
|
default:
|
|||
|
throw new errors_1.CustomError('An error occurred while attempting to track test usage: ' +
|
|||
|
JSON.stringify(trackingResponse.res.body));
|
|||
|
}
|
|||
|
}
|
|||
|
exports.trackUsage = trackUsage;
|
|||
|
class TestLimitReachedError extends errors_1.CustomError {
|
|||
|
constructor() {
|
|||
|
super('Test limit reached! You have exceeded your infrastructure as code test allocation for this billing period.');
|
|||
|
}
|
|||
|
}
|
|||
|
exports.TestLimitReachedError = TestLimitReachedError;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 80039:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.InvalidYamlFileError = exports.InvalidJsonFileError = exports.parseYAMLOrJSONFileData = void 0;
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
const error_utils_1 = __webpack_require__(36401);
|
|||
|
const types_1 = __webpack_require__(94820);
|
|||
|
const cloud_config_parser_1 = __webpack_require__(98611);
|
|||
|
function parseYAMLOrJSONFileData(fileData) {
|
|||
|
try {
|
|||
|
// this function will always be called with the file types recognised by the parser
|
|||
|
return cloud_config_parser_1.parseFileContent(fileData.fileContent);
|
|||
|
}
|
|||
|
catch (e) {
|
|||
|
if (fileData.fileType === 'json') {
|
|||
|
throw new InvalidJsonFileError(fileData.filePath);
|
|||
|
}
|
|||
|
else {
|
|||
|
throw new InvalidYamlFileError(fileData.filePath);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
exports.parseYAMLOrJSONFileData = parseYAMLOrJSONFileData;
|
|||
|
class InvalidJsonFileError extends errors_1.CustomError {
|
|||
|
constructor(filename) {
|
|||
|
super('Failed to parse JSON file');
|
|||
|
this.code = types_1.IaCErrorCodes.InvalidJsonFileError;
|
|||
|
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|||
|
this.filename = filename;
|
|||
|
this.userMessage = `We were unable to parse the JSON file "${filename}". Please ensure that it contains properly structured JSON`;
|
|||
|
}
|
|||
|
}
|
|||
|
exports.InvalidJsonFileError = InvalidJsonFileError;
|
|||
|
class InvalidYamlFileError extends errors_1.CustomError {
|
|||
|
constructor(filename) {
|
|||
|
super('Failed to parse YAML file');
|
|||
|
this.code = types_1.IaCErrorCodes.InvalidYamlFileError;
|
|||
|
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|||
|
this.filename = filename;
|
|||
|
this.userMessage = `We were unable to parse the YAML file "${filename}". Please ensure that it contains properly structured YAML, without any template directives`;
|
|||
|
}
|
|||
|
}
|
|||
|
exports.InvalidYamlFileError = InvalidYamlFileError;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 51677:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.getProjectNameFromGitUrl = exports.buildMeta = void 0;
|
|||
|
const pathLib = __webpack_require__(85622);
|
|||
|
async function buildMeta(repositoryFinder, orgSettings, projectRoot, remoteRepoUrl, targetName) {
|
|||
|
const gitRemoteUrl = await getGitRemoteUrl(repositoryFinder, projectRoot, remoteRepoUrl);
|
|||
|
const projectName = getProjectName(projectRoot, gitRemoteUrl, targetName);
|
|||
|
const orgName = getOrgName(orgSettings);
|
|||
|
return { projectName, orgName, gitRemoteUrl };
|
|||
|
}
|
|||
|
exports.buildMeta = buildMeta;
|
|||
|
function getProjectName(projectRoot, gitRemoteUrl, targetName) {
|
|||
|
if (targetName) {
|
|||
|
return targetName;
|
|||
|
}
|
|||
|
if (gitRemoteUrl) {
|
|||
|
return getProjectNameFromGitUrl(gitRemoteUrl);
|
|||
|
}
|
|||
|
return pathLib.basename(pathLib.resolve(projectRoot));
|
|||
|
}
|
|||
|
function getOrgName(orgSettings) {
|
|||
|
return orgSettings.meta.org;
|
|||
|
}
|
|||
|
async function getGitRemoteUrl(repositoryFinder, projectRoot, remoteRepoUrl) {
|
|||
|
if (remoteRepoUrl) {
|
|||
|
return remoteRepoUrl;
|
|||
|
}
|
|||
|
const repository = await repositoryFinder.findRepositoryForPath(projectRoot);
|
|||
|
if (!repository) {
|
|||
|
return;
|
|||
|
}
|
|||
|
const resolvedRepositoryRoot = pathLib.resolve(repository.path);
|
|||
|
const resolvedProjectRoot = pathLib.resolve(projectRoot);
|
|||
|
if (resolvedRepositoryRoot != resolvedProjectRoot) {
|
|||
|
return;
|
|||
|
}
|
|||
|
return await repository.readRemoteUrl();
|
|||
|
}
|
|||
|
function getProjectNameFromGitUrl(url) {
|
|||
|
const regexps = [
|
|||
|
/^ssh:\/\/([^@]+@)?[^:/]+(:[^/]+)?\/(?<name>.*).git\/?$/,
|
|||
|
/^(git|https?|ftp):\/\/[^:/]+(:[^/]+)?\/(?<name>.*).git\/?$/,
|
|||
|
/^[^@]+@[^:]+:(?<name>.*).git$/,
|
|||
|
];
|
|||
|
const trimmed = url.trim();
|
|||
|
for (const regexp of regexps) {
|
|||
|
const match = trimmed.match(regexp);
|
|||
|
if (match && match.groups) {
|
|||
|
return match.groups.name;
|
|||
|
}
|
|||
|
}
|
|||
|
return trimmed;
|
|||
|
}
|
|||
|
exports.getProjectNameFromGitUrl = getProjectNameFromGitUrl;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 39313:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.buildOutput = exports.printHeader = exports.buildSpinner = void 0;
|
|||
|
const Debug = __webpack_require__(15158);
|
|||
|
const os_1 = __webpack_require__(12087);
|
|||
|
const chalk_1 = __webpack_require__(32589);
|
|||
|
const types_1 = __webpack_require__(55246);
|
|||
|
const iac_test_result_1 = __webpack_require__(46816);
|
|||
|
const formatters_1 = __webpack_require__(81329);
|
|||
|
const iac_output_1 = __webpack_require__(68145);
|
|||
|
const format_test_results_1 = __webpack_require__(59744);
|
|||
|
const display_result_1 = __webpack_require__(89667);
|
|||
|
const assert_iac_options_flag_1 = __webpack_require__(33111);
|
|||
|
const ora = __webpack_require__(63395);
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
const v2_1 = __webpack_require__(49041);
|
|||
|
const iac_output_2 = __webpack_require__(68145);
|
|||
|
const debug = Debug('snyk-test');
|
|||
|
const SEPARATOR = '\n-------------------------------------------------------\n';
|
|||
|
function buildSpinner({ options, isNewIacOutputSupported, }) {
|
|||
|
if (iac_output_1.shouldLogUserMessages(options, isNewIacOutputSupported)) {
|
|||
|
return ora({ isSilent: options.quiet, stream: process.stdout });
|
|||
|
}
|
|||
|
}
|
|||
|
exports.buildSpinner = buildSpinner;
|
|||
|
function printHeader({ options, isNewIacOutputSupported, }) {
|
|||
|
if (iac_output_1.shouldLogUserMessages(options, isNewIacOutputSupported)) {
|
|||
|
console.log(os_1.EOL + iac_output_1.iacTestTitle + os_1.EOL);
|
|||
|
}
|
|||
|
}
|
|||
|
exports.printHeader = printHeader;
|
|||
|
function buildOutput({ results, options, isNewIacOutputSupported, isIacShareCliResultsCustomRulesSupported, isIacCustomRulesEntitlementEnabled, iacOutputMeta, resultOptions, iacScanFailures, iacIgnoredIssuesCount, testSpinner, }) {
|
|||
|
// this is any[] to follow the resArray type above
|
|||
|
const successResults = [], errorResults = [];
|
|||
|
results.forEach((result) => {
|
|||
|
if (!(result instanceof Error)) {
|
|||
|
successResults.push(result);
|
|||
|
}
|
|||
|
else {
|
|||
|
errorResults.push(result);
|
|||
|
}
|
|||
|
});
|
|||
|
const vulnerableResults = successResults.filter((res) => (res.vulnerabilities && res.vulnerabilities.length) ||
|
|||
|
(res.result &&
|
|||
|
res.result.cloudConfigResults &&
|
|||
|
res.result.cloudConfigResults.length));
|
|||
|
const hasErrors = errorResults.length;
|
|||
|
const isPartialSuccess = !hasErrors || successResults.length;
|
|||
|
const foundVulnerabilities = vulnerableResults.length;
|
|||
|
if (isPartialSuccess) {
|
|||
|
testSpinner === null || testSpinner === void 0 ? void 0 : testSpinner.succeed(iac_output_1.spinnerSuccessMessage);
|
|||
|
}
|
|||
|
else {
|
|||
|
testSpinner === null || testSpinner === void 0 ? void 0 : testSpinner.stop();
|
|||
|
}
|
|||
|
// resultOptions is now an array of 1 or more options used for
|
|||
|
// the tests results is now an array of 1 or more test results
|
|||
|
// values depend on `options.json` value - string or object
|
|||
|
const mappedResults = results.map(iac_test_result_1.mapIacTestResult);
|
|||
|
const { stdout: dataToSend, stringifiedData, stringifiedJsonData, stringifiedSarifData, } = format_test_results_1.extractDataToSendFromResults(results, mappedResults, options);
|
|||
|
if (options.json || options.sarif) {
|
|||
|
// if all results are ok (.ok == true)
|
|||
|
if (mappedResults.every((res) => res.ok)) {
|
|||
|
return types_1.TestCommandResult.createJsonTestCommandResult(stringifiedData, stringifiedJsonData, stringifiedSarifData);
|
|||
|
}
|
|||
|
const err = new Error(stringifiedData);
|
|||
|
if (foundVulnerabilities) {
|
|||
|
err.code = 'VULNS';
|
|||
|
const dataToSendNoVulns = dataToSend;
|
|||
|
delete dataToSendNoVulns.vulnerabilities;
|
|||
|
err.jsonNoVulns = dataToSendNoVulns;
|
|||
|
}
|
|||
|
if (hasErrors && !options.sarif) {
|
|||
|
// Take the code of the first problem to go through error
|
|||
|
// translation.
|
|||
|
// Note: this is done based on the logic done below
|
|||
|
// for non-json/sarif outputs, where we take the code of
|
|||
|
// the first error.
|
|||
|
err.code = errorResults[0].code;
|
|||
|
}
|
|||
|
err.json = stringifiedData;
|
|||
|
err.jsonStringifiedResults = stringifiedJsonData;
|
|||
|
err.sarifStringifiedResults = stringifiedSarifData;
|
|||
|
throw err;
|
|||
|
}
|
|||
|
let response = '';
|
|||
|
const newOutputTestData = iac_output_2.formatTestData({
|
|||
|
oldFormattedResults: successResults,
|
|||
|
ignoresCount: iacIgnoredIssuesCount,
|
|||
|
iacOutputMeta: iacOutputMeta,
|
|||
|
});
|
|||
|
if (isNewIacOutputSupported) {
|
|||
|
if (isPartialSuccess) {
|
|||
|
response +=
|
|||
|
os_1.EOL + iac_output_1.getIacDisplayedIssues(newOutputTestData.resultsBySeverity);
|
|||
|
}
|
|||
|
}
|
|||
|
else {
|
|||
|
response += results
|
|||
|
.map((result, i) => {
|
|||
|
return display_result_1.displayResult(results[i], {
|
|||
|
...resultOptions[i],
|
|||
|
}, result.foundProjectCount);
|
|||
|
})
|
|||
|
.join(`\n${SEPARATOR}`);
|
|||
|
}
|
|||
|
if (!isNewIacOutputSupported && hasErrors) {
|
|||
|
debug(`Failed to test ${errorResults.length} projects, errors:`);
|
|||
|
errorResults.forEach((err) => {
|
|||
|
const errString = err.stack ? err.stack.toString() : err.toString();
|
|||
|
debug('error: %s', errString);
|
|||
|
});
|
|||
|
}
|
|||
|
let summaryMessage = '';
|
|||
|
let errorResultsLength = errorResults.length;
|
|||
|
if (iacScanFailures.length || hasErrors) {
|
|||
|
errorResultsLength = iacScanFailures.length || errorResults.length;
|
|||
|
const thrownErrors = errorResults.map((err) => ({
|
|||
|
filePath: err.path,
|
|||
|
failureReason: err.message,
|
|||
|
}));
|
|||
|
const allTestFailures = iacScanFailures
|
|||
|
.map((f) => ({
|
|||
|
filePath: f.filePath,
|
|||
|
failureReason: f.failureReason,
|
|||
|
}))
|
|||
|
.concat(thrownErrors);
|
|||
|
if (hasErrors && !isPartialSuccess) {
|
|||
|
response += chalk_1.default.bold.red(summaryMessage);
|
|||
|
// take the code of the first problem to go through error
|
|||
|
// translation
|
|||
|
// HACK as there can be different errors, and we pass only the
|
|||
|
// first one
|
|||
|
const error = isNewIacOutputSupported && allTestFailures
|
|||
|
? new errors_1.FormattedCustomError(errorResults[0].message, iac_output_1.formatFailuresList(allTestFailures))
|
|||
|
: new errors_1.CustomError(response);
|
|||
|
error.code = errorResults[0].code;
|
|||
|
error.userMessage = errorResults[0].userMessage;
|
|||
|
error.strCode = errorResults[0].strCode;
|
|||
|
throw error;
|
|||
|
}
|
|||
|
response += isNewIacOutputSupported
|
|||
|
? os_1.EOL.repeat(2) + iac_output_1.formatIacTestFailures(allTestFailures)
|
|||
|
: iacScanFailures
|
|||
|
.map((reason) => chalk_1.default.bold.red(iac_output_1.getIacDisplayErrorFileOutput(reason)))
|
|||
|
.join('');
|
|||
|
}
|
|||
|
if (isPartialSuccess && iacOutputMeta && isNewIacOutputSupported) {
|
|||
|
response += `${os_1.EOL}${SEPARATOR}${os_1.EOL}`;
|
|||
|
const iacTestSummary = `${iac_output_1.formatIacTestSummary(newOutputTestData)}`;
|
|||
|
response += iacTestSummary;
|
|||
|
}
|
|||
|
if (results.length > 1) {
|
|||
|
if (isNewIacOutputSupported) {
|
|||
|
response += errorResultsLength ? os_1.EOL.repeat(2) + iac_output_1.failuresTipOutput : '';
|
|||
|
}
|
|||
|
else {
|
|||
|
const projects = results.length === 1 ? 'project' : 'projects';
|
|||
|
summaryMessage +=
|
|||
|
`\n\n\nTested ${results.length} ${projects}` +
|
|||
|
formatters_1.summariseVulnerableResults(vulnerableResults, options) +
|
|||
|
formatters_1.summariseErrorResults(errorResultsLength) +
|
|||
|
'\n';
|
|||
|
}
|
|||
|
}
|
|||
|
if (foundVulnerabilities) {
|
|||
|
response += chalk_1.default.bold.red(summaryMessage);
|
|||
|
}
|
|||
|
else {
|
|||
|
response += chalk_1.default.bold.green(summaryMessage);
|
|||
|
}
|
|||
|
response += os_1.EOL;
|
|||
|
if (assert_iac_options_flag_1.isIacShareResultsOptions(options)) {
|
|||
|
if (isNewIacOutputSupported) {
|
|||
|
response += buildShareResultsSummary({
|
|||
|
options,
|
|||
|
iacOutputMeta,
|
|||
|
isIacCustomRulesEntitlementEnabled,
|
|||
|
isIacShareCliResultsCustomRulesSupported,
|
|||
|
isNewIacOutputSupported,
|
|||
|
});
|
|||
|
}
|
|||
|
else {
|
|||
|
response += os_1.EOL + iac_output_1.shareResultsOutput(iacOutputMeta);
|
|||
|
}
|
|||
|
response += os_1.EOL;
|
|||
|
}
|
|||
|
if (shouldPrintShareResultsTip(options, isNewIacOutputSupported)) {
|
|||
|
response += SEPARATOR + os_1.EOL + v2_1.shareResultsTip + os_1.EOL;
|
|||
|
}
|
|||
|
if (foundVulnerabilities) {
|
|||
|
const error = new Error(response);
|
|||
|
// take the code of the first problem to go through error
|
|||
|
// translation
|
|||
|
// HACK as there can be different errors, and we pass only the
|
|||
|
// first one
|
|||
|
error.code = vulnerableResults[0].code || 'VULNS';
|
|||
|
error.userMessage = vulnerableResults[0].userMessage;
|
|||
|
error.jsonStringifiedResults = stringifiedJsonData;
|
|||
|
error.sarifStringifiedResults = stringifiedSarifData;
|
|||
|
throw error;
|
|||
|
}
|
|||
|
return types_1.TestCommandResult.createHumanReadableTestCommandResult(response, stringifiedJsonData, stringifiedSarifData);
|
|||
|
}
|
|||
|
exports.buildOutput = buildOutput;
|
|||
|
function buildShareResultsSummary({ iacOutputMeta, options, isIacCustomRulesEntitlementEnabled, isNewIacOutputSupported, isIacShareCliResultsCustomRulesSupported, }) {
|
|||
|
let response = '';
|
|||
|
response += SEPARATOR + os_1.EOL + iac_output_1.formatShareResultsOutput(iacOutputMeta);
|
|||
|
if (shouldPrintShareCustomRulesDisclaimer(options, isIacCustomRulesEntitlementEnabled, isNewIacOutputSupported, isIacShareCliResultsCustomRulesSupported)) {
|
|||
|
response += os_1.EOL + os_1.EOL + v2_1.shareCustomRulesDisclaimer;
|
|||
|
}
|
|||
|
return response;
|
|||
|
}
|
|||
|
function shouldPrintShareResultsTip(options, isNewOutput) {
|
|||
|
return iac_output_1.shouldLogUserMessages(options, isNewOutput) && !options.report;
|
|||
|
}
|
|||
|
function shouldPrintShareCustomRulesDisclaimer(options, isIacCustomRulesEntitlementEnabled, isNewOutput, isIacShareCliResultsCustomRulesSupported) {
|
|||
|
return (iac_output_1.shouldLogUserMessages(options, isNewOutput) &&
|
|||
|
Boolean(options.rules) &&
|
|||
|
isIacCustomRulesEntitlementEnabled &&
|
|||
|
!isIacShareCliResultsCustomRulesSupported);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 71308:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.scan = void 0;
|
|||
|
const cloneDeep = __webpack_require__(83465);
|
|||
|
const assign = __webpack_require__(31730);
|
|||
|
const utils = __webpack_require__(77978);
|
|||
|
const iac_output_1 = __webpack_require__(68145);
|
|||
|
const local_execution_1 = __webpack_require__(89627);
|
|||
|
const assert_iac_options_flag_1 = __webpack_require__(33111);
|
|||
|
const rules_1 = __webpack_require__(95343);
|
|||
|
const measurable_methods_1 = __webpack_require__(5687);
|
|||
|
const types_1 = __webpack_require__(94820);
|
|||
|
const pathLib = __webpack_require__(85622);
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
const process_results_1 = __webpack_require__(1229);
|
|||
|
const error_utils_1 = __webpack_require__(36401);
|
|||
|
const git_1 = __webpack_require__(82421);
|
|||
|
const git_2 = __webpack_require__(24850);
|
|||
|
const meta_1 = __webpack_require__(51677);
|
|||
|
async function scan(iacOrgSettings, options, testSpinner, paths, orgPublicId, buildOciRules, projectRoot, remoteRepoUrl, targetName) {
|
|||
|
const results = [];
|
|||
|
const resultOptions = [];
|
|||
|
const repositoryFinder = new DefaultGitRepositoryFinder();
|
|||
|
const iacOutputMeta = await meta_1.buildMeta(repositoryFinder, iacOrgSettings, projectRoot, remoteRepoUrl, targetName);
|
|||
|
let iacScanFailures = [];
|
|||
|
let iacIgnoredIssuesCount = 0;
|
|||
|
try {
|
|||
|
const rulesOrigin = await rules_1.initRules(buildOciRules, iacOrgSettings, options, orgPublicId);
|
|||
|
testSpinner === null || testSpinner === void 0 ? void 0 : testSpinner.start(iac_output_1.spinnerMessage);
|
|||
|
for (const path of paths) {
|
|||
|
// Create a copy of the options so a specific test can
|
|||
|
// modify them i.e. add `options.file` etc. We'll need
|
|||
|
// these options later.
|
|||
|
const testOpts = cloneDeep(options);
|
|||
|
testOpts.path = path;
|
|||
|
testOpts.projectName = testOpts['project-name'];
|
|||
|
let res;
|
|||
|
try {
|
|||
|
assert_iac_options_flag_1.assertIaCOptionsFlags(process.argv);
|
|||
|
if (pathLib.relative(projectRoot, path).includes('..')) {
|
|||
|
throw new CurrentWorkingDirectoryTraversalError(path, projectRoot);
|
|||
|
}
|
|||
|
const resultsProcessor = new process_results_1.SingleGroupResultsProcessor(projectRoot, orgPublicId, iacOrgSettings, testOpts, iacOutputMeta);
|
|||
|
const { results, failures, ignoreCount } = await local_execution_1.test(resultsProcessor, path, testOpts, iacOrgSettings, rulesOrigin);
|
|||
|
res = results;
|
|||
|
iacScanFailures = [...iacScanFailures, ...(failures || [])];
|
|||
|
iacIgnoredIssuesCount += ignoreCount;
|
|||
|
}
|
|||
|
catch (error) {
|
|||
|
res = formatTestError(error);
|
|||
|
}
|
|||
|
// Not all test results are arrays in order to be backwards compatible
|
|||
|
// with scripts that use a callback with test. Coerce results/errors to be arrays
|
|||
|
// and add the result options to each to be displayed
|
|||
|
const resArray = Array.isArray(res) ? res : [res];
|
|||
|
for (let i = 0; i < resArray.length; i++) {
|
|||
|
const pathWithOptionalProjectName = resArray[i].filename ||
|
|||
|
utils.getPathWithOptionalProjectName(path, resArray[i]);
|
|||
|
results.push(assign(resArray[i], { path: pathWithOptionalProjectName }));
|
|||
|
// currently testOpts are identical for each test result returned even if it's for multiple projects.
|
|||
|
// we want to return the project names, so will need to be crafty in a way that makes sense.
|
|||
|
if (!testOpts.projectNames) {
|
|||
|
resultOptions.push(testOpts);
|
|||
|
}
|
|||
|
else {
|
|||
|
resultOptions.push(assign(cloneDeep(testOpts), {
|
|||
|
projectName: testOpts.projectNames[i],
|
|||
|
}));
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
finally {
|
|||
|
measurable_methods_1.cleanLocalCache();
|
|||
|
}
|
|||
|
return {
|
|||
|
iacOutputMeta,
|
|||
|
iacScanFailures,
|
|||
|
iacIgnoredIssuesCount,
|
|||
|
results,
|
|||
|
resultOptions,
|
|||
|
};
|
|||
|
}
|
|||
|
exports.scan = scan;
|
|||
|
// This is a duplicate of commands/test/format-test-error.ts
|
|||
|
// we wanted to adjust it and check the case we send errors in an Array
|
|||
|
function formatTestError(error) {
|
|||
|
let errorResponse;
|
|||
|
if (error instanceof Error) {
|
|||
|
errorResponse = error;
|
|||
|
}
|
|||
|
else if (Array.isArray(error)) {
|
|||
|
return error.map(formatTestError);
|
|||
|
}
|
|||
|
else if (typeof error !== 'object') {
|
|||
|
errorResponse = new Error(error);
|
|||
|
}
|
|||
|
else {
|
|||
|
try {
|
|||
|
errorResponse = JSON.parse(error.message);
|
|||
|
}
|
|||
|
catch (unused) {
|
|||
|
errorResponse = error;
|
|||
|
}
|
|||
|
}
|
|||
|
return errorResponse;
|
|||
|
}
|
|||
|
class CurrentWorkingDirectoryTraversalError extends errors_1.CustomError {
|
|||
|
constructor(path, projectRoot) {
|
|||
|
super('Path is outside the current working directory');
|
|||
|
this.code = types_1.IaCErrorCodes.CurrentWorkingDirectoryTraversalError;
|
|||
|
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|||
|
this.userMessage = `Path is outside the current working directory`;
|
|||
|
this.filename = path;
|
|||
|
this.projectRoot = projectRoot;
|
|||
|
}
|
|||
|
}
|
|||
|
class DefaultGitRepository {
|
|||
|
constructor(path) {
|
|||
|
this.path = path;
|
|||
|
}
|
|||
|
async readRemoteUrl() {
|
|||
|
const gitInfo = await git_2.getInfo({
|
|||
|
isFromContainer: false,
|
|||
|
cwd: this.path,
|
|||
|
});
|
|||
|
return gitInfo === null || gitInfo === void 0 ? void 0 : gitInfo.remoteUrl;
|
|||
|
}
|
|||
|
}
|
|||
|
class DefaultGitRepositoryFinder {
|
|||
|
async findRepositoryForPath(path) {
|
|||
|
try {
|
|||
|
return new DefaultGitRepository(git_1.getRepositoryRootForPath(path));
|
|||
|
}
|
|||
|
catch {
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 2460:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.test = void 0;
|
|||
|
const env_paths_1 = __webpack_require__(21766);
|
|||
|
const pathLib = __webpack_require__(85622);
|
|||
|
const testLib = __webpack_require__(17152);
|
|||
|
const config_1 = __webpack_require__(25425);
|
|||
|
const output_1 = __webpack_require__(39313);
|
|||
|
const iac_output_1 = __webpack_require__(68145);
|
|||
|
const output_2 = __webpack_require__(99687);
|
|||
|
const get_iac_org_settings_1 = __webpack_require__(11693);
|
|||
|
const monitor_1 = __webpack_require__(3708);
|
|||
|
const local_execution_1 = __webpack_require__(89627);
|
|||
|
async function test(paths, options) {
|
|||
|
const testConfig = await prepareTestConfig(paths, options);
|
|||
|
const { projectName, orgSettings } = testConfig;
|
|||
|
const testSpinner = output_1.buildSpinner({
|
|||
|
options,
|
|||
|
isNewIacOutputSupported: true,
|
|||
|
});
|
|||
|
output_1.printHeader({
|
|||
|
options,
|
|||
|
isNewIacOutputSupported: true,
|
|||
|
});
|
|||
|
testSpinner === null || testSpinner === void 0 ? void 0 : testSpinner.start(iac_output_1.spinnerMessage);
|
|||
|
const scanResult = await testLib.test(testConfig);
|
|||
|
return output_2.buildOutput({
|
|||
|
scanResult,
|
|||
|
testSpinner,
|
|||
|
projectName,
|
|||
|
orgSettings,
|
|||
|
options,
|
|||
|
});
|
|||
|
}
|
|||
|
exports.test = test;
|
|||
|
async function prepareTestConfig(paths, options) {
|
|||
|
var _a;
|
|||
|
const systemCachePath = (_a = config_1.default.CACHE_PATH) !== null && _a !== void 0 ? _a : env_paths_1.default('snyk').cache;
|
|||
|
const iacCachePath = pathLib.join(systemCachePath, 'iac');
|
|||
|
const projectName = pathLib.basename(process.cwd());
|
|||
|
const org = options.org || config_1.default.org;
|
|||
|
const orgSettings = await get_iac_org_settings_1.getIacOrgSettings(org);
|
|||
|
const projectTags = local_execution_1.parseTags(options);
|
|||
|
const attributes = parseAttributes(options);
|
|||
|
return {
|
|||
|
paths,
|
|||
|
iacCachePath,
|
|||
|
projectName,
|
|||
|
orgSettings,
|
|||
|
userRulesBundlePath: config_1.default.IAC_BUNDLE_PATH,
|
|||
|
userPolicyEnginePath: config_1.default.IAC_POLICY_ENGINE_PATH,
|
|||
|
severityThreshold: options.severityThreshold,
|
|||
|
report: !!options.report,
|
|||
|
attributes,
|
|||
|
projectTags,
|
|||
|
};
|
|||
|
}
|
|||
|
function parseAttributes(options) {
|
|||
|
if (options.report) {
|
|||
|
return monitor_1.generateProjectAttributes(options);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 86917:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
const Debug = __webpack_require__(15158);
|
|||
|
const os_1 = __webpack_require__(12087);
|
|||
|
const cloneDeep = __webpack_require__(83465);
|
|||
|
const assign = __webpack_require__(31730);
|
|||
|
const chalk_1 = __webpack_require__(32589);
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
const snyk = __webpack_require__(9146);
|
|||
|
const types_1 = __webpack_require__(55246);
|
|||
|
const formatters_1 = __webpack_require__(81329);
|
|||
|
const utils = __webpack_require__(77978);
|
|||
|
const ecosystems_1 = __webpack_require__(5168);
|
|||
|
const vuln_helpers_1 = __webpack_require__(14784);
|
|||
|
const format_test_results_1 = __webpack_require__(59744);
|
|||
|
const validate_credentials_1 = __webpack_require__(4593);
|
|||
|
const validate_test_options_1 = __webpack_require__(83476);
|
|||
|
const set_default_test_options_1 = __webpack_require__(13285);
|
|||
|
const process_command_args_1 = __webpack_require__(52369);
|
|||
|
const format_test_error_1 = __webpack_require__(68214);
|
|||
|
const display_result_1 = __webpack_require__(89667);
|
|||
|
const analytics = __webpack_require__(82744);
|
|||
|
const protect_update_notification_1 = __webpack_require__(79304);
|
|||
|
const spotlight_vuln_notification_1 = __webpack_require__(24083);
|
|||
|
const iac_1 = __webpack_require__(55935);
|
|||
|
const iacTestCommandV2 = __webpack_require__(2460);
|
|||
|
const feature_flags_1 = __webpack_require__(63011);
|
|||
|
const check_paths_1 = __webpack_require__(94501);
|
|||
|
const debug = Debug('snyk-test');
|
|||
|
const SEPARATOR = '\n-------------------------------------------------------\n';
|
|||
|
// TODO: avoid using `as any` whenever it's possible
|
|||
|
async function test(...args) {
|
|||
|
const { options: originalOptions, paths } = process_command_args_1.processCommandArgs(...args);
|
|||
|
const options = set_default_test_options_1.setDefaultTestOptions(originalOptions);
|
|||
|
if (originalOptions.iac) {
|
|||
|
// temporary placeholder for the "new" flow that integrates with UPE
|
|||
|
if ((await feature_flags_1.hasFeatureFlag('iacCliUnifiedEngine', options)) &&
|
|||
|
options.experimental) {
|
|||
|
return await iacTestCommandV2.test(paths, originalOptions);
|
|||
|
}
|
|||
|
else {
|
|||
|
return await iac_1.default(...args);
|
|||
|
}
|
|||
|
}
|
|||
|
if (!options.docker) {
|
|||
|
check_paths_1.checkOSSPaths(paths, options);
|
|||
|
}
|
|||
|
validate_test_options_1.validateTestOptions(options);
|
|||
|
validate_credentials_1.validateCredentials(options);
|
|||
|
const packageJsonPathsWithSnykDepForProtect = protect_update_notification_1.getPackageJsonPathsContainingSnykDependency(options.file, paths);
|
|||
|
analytics.add('upgradable-snyk-protect-paths', packageJsonPathsWithSnykDepForProtect.length);
|
|||
|
// Handles no image arg provided to the container command until
|
|||
|
// a validation interface is implemented in the docker plugin.
|
|||
|
if (options.docker && paths.length === 0) {
|
|||
|
throw new errors_1.MissingArgError();
|
|||
|
}
|
|||
|
// TODO remove once https://github.com/snyk/cli/pull/3433 is merged
|
|||
|
if (options.docker && !options['app-vulns']) {
|
|||
|
options['exclude-app-vulns'] = true;
|
|||
|
}
|
|||
|
const ecosystem = ecosystems_1.getEcosystemForTest(options);
|
|||
|
if (ecosystem) {
|
|||
|
try {
|
|||
|
const commandResult = await ecosystems_1.testEcosystem(ecosystem, paths, options);
|
|||
|
return commandResult;
|
|||
|
}
|
|||
|
catch (error) {
|
|||
|
if (error instanceof Error) {
|
|||
|
throw error;
|
|||
|
}
|
|||
|
else {
|
|||
|
throw new Error(error);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
const resultOptions = [];
|
|||
|
const results = [];
|
|||
|
// Promise waterfall to test all other paths sequentially
|
|||
|
for (const path of paths) {
|
|||
|
// Create a copy of the options so a specific test can
|
|||
|
// modify them i.e. add `options.file` etc. We'll need
|
|||
|
// these options later.
|
|||
|
const testOpts = cloneDeep(options);
|
|||
|
testOpts.path = path;
|
|||
|
testOpts.projectName = testOpts['project-name'];
|
|||
|
let res;
|
|||
|
try {
|
|||
|
res = await snyk.test(path, testOpts);
|
|||
|
}
|
|||
|
catch (error) {
|
|||
|
// not throwing here but instead returning error response
|
|||
|
// for legacy flow reasons.
|
|||
|
res = format_test_error_1.formatTestError(error);
|
|||
|
}
|
|||
|
// Not all test results are arrays in order to be backwards compatible
|
|||
|
// with scripts that use a callback with test. Coerce results/errors to be arrays
|
|||
|
// and add the result options to each to be displayed
|
|||
|
const resArray = Array.isArray(res) ? res : [res];
|
|||
|
for (let i = 0; i < resArray.length; i++) {
|
|||
|
const pathWithOptionalProjectName = utils.getPathWithOptionalProjectName(path, resArray[i]);
|
|||
|
results.push(assign(resArray[i], { path: pathWithOptionalProjectName }));
|
|||
|
// currently testOpts are identical for each test result returned even if it's for multiple projects.
|
|||
|
// we want to return the project names, so will need to be crafty in a way that makes sense.
|
|||
|
if (!testOpts.projectNames) {
|
|||
|
resultOptions.push(testOpts);
|
|||
|
}
|
|||
|
else {
|
|||
|
resultOptions.push(assign(cloneDeep(testOpts), {
|
|||
|
projectName: testOpts.projectNames[i],
|
|||
|
}));
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
const vulnerableResults = results.filter((res) => (res.vulnerabilities && res.vulnerabilities.length) ||
|
|||
|
(res.result &&
|
|||
|
res.result.cloudConfigResults &&
|
|||
|
res.result.cloudConfigResults.length));
|
|||
|
const errorResults = results.filter((res) => res instanceof Error);
|
|||
|
const notSuccess = errorResults.length > 0;
|
|||
|
const foundVulnerabilities = vulnerableResults.length > 0;
|
|||
|
// resultOptions is now an array of 1 or more options used for
|
|||
|
// the tests results is now an array of 1 or more test results
|
|||
|
// values depend on `options.json` value - string or object
|
|||
|
const mappedResults = format_test_results_1.createErrorMappedResultsForJsonOutput(results);
|
|||
|
const { stdout: dataToSend, stringifiedData, stringifiedJsonData, stringifiedSarifData, } = format_test_results_1.extractDataToSendFromResults(results, mappedResults, options);
|
|||
|
if (options.json || options.sarif) {
|
|||
|
// if all results are ok (.ok == true)
|
|||
|
if (mappedResults.every((res) => res.ok)) {
|
|||
|
return types_1.TestCommandResult.createJsonTestCommandResult(stringifiedData, stringifiedJsonData, stringifiedSarifData);
|
|||
|
}
|
|||
|
const err = new Error(stringifiedData);
|
|||
|
if (foundVulnerabilities) {
|
|||
|
if (options.failOn) {
|
|||
|
const fail = shouldFail(vulnerableResults, options.failOn);
|
|||
|
if (!fail) {
|
|||
|
// return here to prevent failure
|
|||
|
return types_1.TestCommandResult.createJsonTestCommandResult(stringifiedData, stringifiedJsonData, stringifiedSarifData);
|
|||
|
}
|
|||
|
}
|
|||
|
err.code = 'VULNS';
|
|||
|
const dataToSendNoVulns = dataToSend;
|
|||
|
delete dataToSendNoVulns.vulnerabilities;
|
|||
|
err.jsonNoVulns = dataToSendNoVulns;
|
|||
|
}
|
|||
|
if (notSuccess) {
|
|||
|
// Take the code of the first problem to go through error
|
|||
|
// translation.
|
|||
|
// Note: this is done based on the logic done below
|
|||
|
// for non-json/sarif outputs, where we take the code of
|
|||
|
// the first error.
|
|||
|
err.code = errorResults[0].code;
|
|||
|
}
|
|||
|
err.json = stringifiedData;
|
|||
|
err.jsonStringifiedResults = stringifiedJsonData;
|
|||
|
err.sarifStringifiedResults = stringifiedSarifData;
|
|||
|
throw err;
|
|||
|
}
|
|||
|
let response = results
|
|||
|
.map((result, i) => {
|
|||
|
return display_result_1.displayResult(results[i], resultOptions[i], result.foundProjectCount);
|
|||
|
})
|
|||
|
.join(`\n${SEPARATOR}`);
|
|||
|
if (notSuccess) {
|
|||
|
debug(`Failed to test ${errorResults.length} projects, errors:`);
|
|||
|
errorResults.forEach((err) => {
|
|||
|
const errString = err.stack ? err.stack.toString() : err.toString();
|
|||
|
debug('error: %s', errString);
|
|||
|
});
|
|||
|
}
|
|||
|
let summaryMessage = '';
|
|||
|
const errorResultsLength = errorResults.length;
|
|||
|
if (results.length > 1) {
|
|||
|
const projects = results.length === 1 ? 'project' : 'projects';
|
|||
|
summaryMessage =
|
|||
|
`\n\n\nTested ${results.length} ${projects}` +
|
|||
|
formatters_1.summariseVulnerableResults(vulnerableResults, options) +
|
|||
|
formatters_1.summariseErrorResults(errorResultsLength) +
|
|||
|
'\n';
|
|||
|
}
|
|||
|
if (notSuccess) {
|
|||
|
response += chalk_1.default.bold.red(summaryMessage);
|
|||
|
const error = new Error(response);
|
|||
|
// take the code of the first problem to go through error
|
|||
|
// translation
|
|||
|
// HACK as there can be different errors, and we pass only the
|
|||
|
// first one
|
|||
|
error.code = errorResults[0].code;
|
|||
|
error.userMessage = errorResults[0].userMessage;
|
|||
|
error.strCode = errorResults[0].strCode;
|
|||
|
throw error;
|
|||
|
}
|
|||
|
if (foundVulnerabilities) {
|
|||
|
if (options.failOn) {
|
|||
|
const fail = shouldFail(vulnerableResults, options.failOn);
|
|||
|
if (!fail) {
|
|||
|
// return here to prevent throwing failure
|
|||
|
response += chalk_1.default.bold.green(summaryMessage);
|
|||
|
response += os_1.EOL + os_1.EOL;
|
|||
|
response += protect_update_notification_1.getProtectUpgradeWarningForPaths(packageJsonPathsWithSnykDepForProtect);
|
|||
|
return types_1.TestCommandResult.createHumanReadableTestCommandResult(response, stringifiedJsonData, stringifiedSarifData);
|
|||
|
}
|
|||
|
}
|
|||
|
response += chalk_1.default.bold.red(summaryMessage);
|
|||
|
response += os_1.EOL + os_1.EOL;
|
|||
|
const foundSpotlightVulnIds = spotlight_vuln_notification_1.containsSpotlightVulnIds(results);
|
|||
|
const spotlightVulnsMsg = spotlight_vuln_notification_1.notificationForSpotlightVulns(foundSpotlightVulnIds);
|
|||
|
response += spotlightVulnsMsg;
|
|||
|
const error = new Error(response);
|
|||
|
// take the code of the first problem to go through error
|
|||
|
// translation
|
|||
|
// HACK as there can be different errors, and we pass only the
|
|||
|
// first one
|
|||
|
error.code = vulnerableResults[0].code || 'VULNS';
|
|||
|
error.userMessage = vulnerableResults[0].userMessage;
|
|||
|
error.jsonStringifiedResults = stringifiedJsonData;
|
|||
|
error.sarifStringifiedResults = stringifiedSarifData;
|
|||
|
throw error;
|
|||
|
}
|
|||
|
response += chalk_1.default.bold.green(summaryMessage);
|
|||
|
response += os_1.EOL + os_1.EOL;
|
|||
|
response += protect_update_notification_1.getProtectUpgradeWarningForPaths(packageJsonPathsWithSnykDepForProtect);
|
|||
|
return types_1.TestCommandResult.createHumanReadableTestCommandResult(response, stringifiedJsonData, stringifiedSarifData);
|
|||
|
}
|
|||
|
exports.default = test;
|
|||
|
function shouldFail(vulnerableResults, failOn) {
|
|||
|
// find reasons not to fail
|
|||
|
if (failOn === 'all') {
|
|||
|
return vuln_helpers_1.hasFixes(vulnerableResults);
|
|||
|
}
|
|||
|
if (failOn === 'upgradable') {
|
|||
|
return vuln_helpers_1.hasUpgrades(vulnerableResults);
|
|||
|
}
|
|||
|
if (failOn === 'patchable') {
|
|||
|
return vuln_helpers_1.hasPatches(vulnerableResults);
|
|||
|
}
|
|||
|
// should fail by default when there are vulnerable results
|
|||
|
return vulnerableResults.length > 0;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 13285:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.setDefaultTestOptions = void 0;
|
|||
|
const config_1 = __webpack_require__(25425);
|
|||
|
function setDefaultTestOptions(options) {
|
|||
|
const svpSupplied = (options['show-vulnerable-paths'] || '')
|
|||
|
.toString()
|
|||
|
.toLowerCase();
|
|||
|
delete options['show-vulnerable-paths'];
|
|||
|
return {
|
|||
|
...options,
|
|||
|
// org fallback to config unless specified
|
|||
|
org: options.org || config_1.default.org,
|
|||
|
// making `show-vulnerable-paths` 'some' by default.
|
|||
|
showVulnPaths: showVulnPathsMapping[svpSupplied] || 'some',
|
|||
|
};
|
|||
|
}
|
|||
|
exports.setDefaultTestOptions = setDefaultTestOptions;
|
|||
|
const showVulnPathsMapping = {
|
|||
|
false: 'none',
|
|||
|
none: 'none',
|
|||
|
true: 'some',
|
|||
|
some: 'some',
|
|||
|
all: 'all',
|
|||
|
};
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 77978:
|
|||
|
/***/ ((__unused_webpack_module, exports) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.getPathWithOptionalProjectName = void 0;
|
|||
|
function getPathWithOptionalProjectName(currPath, testResult) {
|
|||
|
let projectName = testResult.projectName;
|
|||
|
if (projectName) {
|
|||
|
const index = projectName.indexOf('/');
|
|||
|
if (index > -1) {
|
|||
|
projectName = projectName.substr(index + 1);
|
|||
|
}
|
|||
|
else {
|
|||
|
projectName = undefined;
|
|||
|
}
|
|||
|
}
|
|||
|
const pathWithOptionalProjectName = projectName
|
|||
|
? `${currPath}/${projectName}`
|
|||
|
: currPath;
|
|||
|
return pathWithOptionalProjectName;
|
|||
|
}
|
|||
|
exports.getPathWithOptionalProjectName = getPathWithOptionalProjectName;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 4593:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.validateCredentials = void 0;
|
|||
|
const api_token_1 = __webpack_require__(95181);
|
|||
|
function validateCredentials(options) {
|
|||
|
try {
|
|||
|
api_token_1.apiTokenExists();
|
|||
|
}
|
|||
|
catch (err) {
|
|||
|
if (api_token_1.getOAuthToken()) {
|
|||
|
return;
|
|||
|
}
|
|||
|
else if (options.docker && api_token_1.getDockerToken()) {
|
|||
|
options.testDepGraphDockerEndpoint = '/docker-jwt/test-dependencies';
|
|||
|
options.isDockerUser = true;
|
|||
|
}
|
|||
|
else {
|
|||
|
throw err;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
exports.validateCredentials = validateCredentials;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 83476:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.validateTestOptions = void 0;
|
|||
|
const theme_1 = __webpack_require__(86988);
|
|||
|
const common_1 = __webpack_require__(53110);
|
|||
|
const fail_on_error_ts_1 = __webpack_require__(18195);
|
|||
|
function validateTestOptions(options) {
|
|||
|
if (options.severityThreshold &&
|
|||
|
!validateSeverityThreshold(options.severityThreshold)) {
|
|||
|
throw new Error('INVALID_SEVERITY_THRESHOLD');
|
|||
|
}
|
|||
|
if (options.failOn && !validateFailOn(options.failOn)) {
|
|||
|
const error = new fail_on_error_ts_1.FailOnError();
|
|||
|
throw theme_1.color.status.error(error.message);
|
|||
|
}
|
|||
|
}
|
|||
|
exports.validateTestOptions = validateTestOptions;
|
|||
|
function validateSeverityThreshold(severityThreshold) {
|
|||
|
return common_1.SEVERITIES.map((s) => s.verboseName).indexOf(severityThreshold) > -1;
|
|||
|
}
|
|||
|
function validateFailOn(arg) {
|
|||
|
return Object.keys(common_1.FAIL_ON).includes(arg);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 18195:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.FailOnError = void 0;
|
|||
|
const custom_error_1 = __webpack_require__(17188);
|
|||
|
const common_1 = __webpack_require__(53110);
|
|||
|
class FailOnError extends custom_error_1.CustomError {
|
|||
|
constructor() {
|
|||
|
super(FailOnError.ERROR_MESSAGE);
|
|||
|
}
|
|||
|
}
|
|||
|
exports.FailOnError = FailOnError;
|
|||
|
FailOnError.ERROR_MESSAGE = 'Invalid fail on argument, please use one of: ' +
|
|||
|
Object.keys(common_1.FAIL_ON).join(' | ');
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 78673:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.UnsupportedEntitlementError = void 0;
|
|||
|
const custom_error_1 = __webpack_require__(17188);
|
|||
|
class UnsupportedEntitlementError extends custom_error_1.CustomError {
|
|||
|
constructor(entitlement, userMessage = `This feature is currently not enabled for your org. To enable it, please contact snyk support.`) {
|
|||
|
super('Unsupported feature - Missing the ${entitlementName} entitlement');
|
|||
|
this.entitlement = entitlement;
|
|||
|
this.code = UnsupportedEntitlementError.ERROR_CODE;
|
|||
|
this.userMessage = userMessage;
|
|||
|
}
|
|||
|
}
|
|||
|
exports.UnsupportedEntitlementError = UnsupportedEntitlementError;
|
|||
|
UnsupportedEntitlementError.ERROR_CODE = 403;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 9401:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.getLevel = exports.getResults = exports.getRules = exports.createSarifOutputForOpenSource = void 0;
|
|||
|
const upperFirst = __webpack_require__(90039);
|
|||
|
const groupBy = __webpack_require__(20276);
|
|||
|
const map = __webpack_require__(80820);
|
|||
|
const legacy_1 = __webpack_require__(34013);
|
|||
|
const LOCK_FILES_TO_MANIFEST_MAP = {
|
|||
|
'Gemfile.lock': 'Gemfile',
|
|||
|
'package-lock.json': 'package.json',
|
|||
|
'yarn.lock': 'package.json',
|
|||
|
'Gopkg.lock': 'Gopkg.toml',
|
|||
|
'go.sum': 'go.mod',
|
|||
|
'composer.lock': 'composer.json',
|
|||
|
'Podfile.lock': 'Podfile',
|
|||
|
'poetry.lock': 'pyproject.toml',
|
|||
|
};
|
|||
|
function createSarifOutputForOpenSource(testResults) {
|
|||
|
return {
|
|||
|
$schema: 'https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json',
|
|||
|
version: '2.1.0',
|
|||
|
runs: testResults.map(replaceLockfileWithManifest).map((testResult) => ({
|
|||
|
tool: {
|
|||
|
driver: {
|
|||
|
name: 'Snyk Open Source',
|
|||
|
rules: getRules(testResult),
|
|||
|
},
|
|||
|
},
|
|||
|
results: getResults(testResult),
|
|||
|
})),
|
|||
|
};
|
|||
|
}
|
|||
|
exports.createSarifOutputForOpenSource = createSarifOutputForOpenSource;
|
|||
|
function replaceLockfileWithManifest(testResult) {
|
|||
|
let targetFile = testResult.displayTargetFile || '';
|
|||
|
for (const [key, replacer] of Object.entries(LOCK_FILES_TO_MANIFEST_MAP)) {
|
|||
|
targetFile = targetFile.replace(new RegExp(key, 'g'), replacer);
|
|||
|
}
|
|||
|
return {
|
|||
|
...testResult,
|
|||
|
vulnerabilities: testResult.vulnerabilities || [],
|
|||
|
displayTargetFile: targetFile,
|
|||
|
};
|
|||
|
}
|
|||
|
function getRules(testResult) {
|
|||
|
const groupedVulnerabilities = groupBy(testResult.vulnerabilities, 'id');
|
|||
|
return map(groupedVulnerabilities, ([vuln, ...moreVulns]) => {
|
|||
|
var _a, _b, _c;
|
|||
|
const cves = (_b = (_a = vuln.identifiers) === null || _a === void 0 ? void 0 : _a.CVE) === null || _b === void 0 ? void 0 : _b.join();
|
|||
|
return {
|
|||
|
id: vuln.id,
|
|||
|
shortDescription: {
|
|||
|
text: `${upperFirst(vuln.severity)} severity - ${vuln.title} vulnerability in ${vuln.packageName}`,
|
|||
|
},
|
|||
|
fullDescription: {
|
|||
|
text: cves
|
|||
|
? `(${cves}) ${vuln.name}@${vuln.version}`
|
|||
|
: `${vuln.name}@${vuln.version}`,
|
|||
|
},
|
|||
|
help: {
|
|||
|
text: '',
|
|||
|
markdown: `* Package Manager: ${testResult.packageManager}
|
|||
|
* ${vuln.type === 'license' ? 'Module' : 'Vulnerable module'}: ${vuln.name}
|
|||
|
* Introduced through: ${getIntroducedThrough(vuln)}
|
|||
|
#### Detailed paths
|
|||
|
${[vuln, ...moreVulns]
|
|||
|
.map((item) => `* _Introduced through_: ${item.from.join(' › ')}`)
|
|||
|
.join('\n')}
|
|||
|
${vuln.description}`.replace(/##\s/g, '# '),
|
|||
|
},
|
|||
|
properties: {
|
|||
|
tags: [
|
|||
|
'security',
|
|||
|
...(((_c = vuln.identifiers) === null || _c === void 0 ? void 0 : _c.CWE) || []),
|
|||
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|||
|
testResult.packageManager,
|
|||
|
],
|
|||
|
},
|
|||
|
};
|
|||
|
});
|
|||
|
}
|
|||
|
exports.getRules = getRules;
|
|||
|
function getResults(testResult) {
|
|||
|
const groupedVulnerabilities = groupBy(testResult.vulnerabilities, 'id');
|
|||
|
return map(groupedVulnerabilities, ([vuln]) => ({
|
|||
|
ruleId: vuln.id,
|
|||
|
level: getLevel(vuln),
|
|||
|
message: {
|
|||
|
text: `This file introduces a vulnerable ${vuln.packageName} package with a ${vuln.severity} severity vulnerability.`,
|
|||
|
},
|
|||
|
locations: [
|
|||
|
{
|
|||
|
physicalLocation: {
|
|||
|
artifactLocation: {
|
|||
|
uri: testResult.displayTargetFile,
|
|||
|
},
|
|||
|
region: {
|
|||
|
startLine: vuln.lineNumber || 1,
|
|||
|
},
|
|||
|
},
|
|||
|
},
|
|||
|
],
|
|||
|
}));
|
|||
|
}
|
|||
|
exports.getResults = getResults;
|
|||
|
function getLevel(vuln) {
|
|||
|
switch (vuln.severity) {
|
|||
|
case legacy_1.SEVERITY.CRITICAL:
|
|||
|
case legacy_1.SEVERITY.HIGH:
|
|||
|
return 'error';
|
|||
|
case legacy_1.SEVERITY.MEDIUM:
|
|||
|
return 'warning';
|
|||
|
case legacy_1.SEVERITY.LOW:
|
|||
|
default:
|
|||
|
return 'note';
|
|||
|
}
|
|||
|
}
|
|||
|
exports.getLevel = getLevel;
|
|||
|
function getIntroducedThrough(vuln) {
|
|||
|
const [firstFrom, secondFrom] = vuln.from || [];
|
|||
|
return vuln.from.length > 2
|
|||
|
? `${firstFrom}, ${secondFrom} and others`
|
|||
|
: vuln.from.length === 2
|
|||
|
? `${firstFrom} and ${secondFrom}`
|
|||
|
: firstFrom;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 30417:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.showFixTip = void 0;
|
|||
|
const chalk_1 = __webpack_require__(32589);
|
|||
|
const detect_1 = __webpack_require__(45318);
|
|||
|
function showFixTip(projectType, res, options) {
|
|||
|
const snykFixSupported = ['pip', 'poetry'];
|
|||
|
if (!snykFixSupported.includes(projectType) || !detect_1.isLocalFolder(options.path)) {
|
|||
|
return '';
|
|||
|
}
|
|||
|
if (!res.ok && res.vulnerabilities.length > 0) {
|
|||
|
return (`Tip: Try ${chalk_1.default.bold('`snyk fix`')} to address these issues.${chalk_1.default.bold('`snyk fix`')} is a new CLI command in that aims to automatically apply the recommended updates for supported ecosystems.` +
|
|||
|
'\nSee documentation on how to enable this beta feature: https://docs.snyk.io/snyk-cli/fix-vulnerabilities-from-the-cli/automatic-remediation-with-snyk-fix#enabling-snyk-fix');
|
|||
|
}
|
|||
|
return '';
|
|||
|
}
|
|||
|
exports.showFixTip = showFixTip;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 89667:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.displayResult = void 0;
|
|||
|
const chalk_1 = __webpack_require__(32589);
|
|||
|
const theme_1 = __webpack_require__(86988);
|
|||
|
const is_ci_1 = __webpack_require__(10090);
|
|||
|
const detect_1 = __webpack_require__(45318);
|
|||
|
const formatters_1 = __webpack_require__(81329);
|
|||
|
const iac_output_1 = __webpack_require__(68145);
|
|||
|
const constants_1 = __webpack_require__(68620);
|
|||
|
const format_test_results_1 = __webpack_require__(59744);
|
|||
|
const show_multi_scan_tip_1 = __webpack_require__(95100);
|
|||
|
function displayResult(res, options, foundProjectCount) {
|
|||
|
const meta = formatters_1.formatTestMeta(res, options);
|
|||
|
const dockerAdvice = formatters_1.dockerRemediationForDisplay(res);
|
|||
|
const projectType = res.packageManager || options.packageManager;
|
|||
|
const localPackageTest = detect_1.isLocalFolder(options.path);
|
|||
|
let testingPath = options.path;
|
|||
|
if (options.iac && res.targetFile) {
|
|||
|
testingPath = res.targetFile;
|
|||
|
}
|
|||
|
const prefix = chalk_1.default.bold.white('\nTesting ' + testingPath + '...\n\n');
|
|||
|
// handle errors by extracting their message
|
|||
|
if (res instanceof Error) {
|
|||
|
return prefix + res.message;
|
|||
|
}
|
|||
|
const issuesText = res.licensesPolicy ||
|
|||
|
constants_1.TEST_SUPPORTED_IAC_PROJECTS.includes(projectType)
|
|||
|
? 'issues'
|
|||
|
: 'vulnerabilities';
|
|||
|
let pathOrDepsText = '';
|
|||
|
if (res.dependencyCount) {
|
|||
|
pathOrDepsText += res.dependencyCount + ' dependencies';
|
|||
|
}
|
|||
|
else if (options.iac && res.targetFile) {
|
|||
|
pathOrDepsText += res.targetFile;
|
|||
|
}
|
|||
|
else {
|
|||
|
pathOrDepsText += options.path;
|
|||
|
}
|
|||
|
const testedInfoText = `Tested ${pathOrDepsText} for known ${issuesText}`;
|
|||
|
const multiProjectTip = show_multi_scan_tip_1.showMultiScanTip(projectType, options, foundProjectCount);
|
|||
|
const multiProjAdvice = multiProjectTip ? `\n\n${multiProjectTip}` : '';
|
|||
|
// OK => no vulns found, return
|
|||
|
if (res.ok && res.vulnerabilities.length === 0) {
|
|||
|
const vulnPathsText = options.showVulnPaths
|
|||
|
? 'no vulnerable paths found.'
|
|||
|
: 'none were found.';
|
|||
|
const summaryOKText = theme_1.color.status.success(`${theme_1.icon.VALID} ${testedInfoText}, ${vulnPathsText}`);
|
|||
|
const nextStepsText = localPackageTest
|
|||
|
? '\n\nNext steps:' +
|
|||
|
'\n- Run `snyk monitor` to be notified ' +
|
|||
|
'about new related vulnerabilities.' +
|
|||
|
'\n- Run `snyk test` as part of ' +
|
|||
|
'your CI/test.'
|
|||
|
: '';
|
|||
|
// user tested a package@version and got 0 vulns back, but there were dev deps
|
|||
|
// to consider
|
|||
|
// to consider
|
|||
|
const snykPackageTestTip = !(options.docker ||
|
|||
|
localPackageTest ||
|
|||
|
options.dev)
|
|||
|
? '\n\nTip: Snyk only tests production dependencies by default. You can try re-running with the `--dev` flag.'
|
|||
|
: '';
|
|||
|
const dockerCTA = format_test_results_1.dockerUserCTA(options);
|
|||
|
return (prefix +
|
|||
|
meta +
|
|||
|
'\n\n' +
|
|||
|
summaryOKText +
|
|||
|
multiProjAdvice +
|
|||
|
(is_ci_1.isCI()
|
|||
|
? ''
|
|||
|
: dockerAdvice + nextStepsText + snykPackageTestTip + dockerCTA));
|
|||
|
}
|
|||
|
if (constants_1.TEST_SUPPORTED_IAC_PROJECTS.includes(res.packageManager)) {
|
|||
|
return iac_output_1.getIacDisplayedOutput(res, testedInfoText, meta, prefix);
|
|||
|
}
|
|||
|
// NOT OK => We found some vulns, let's format the vulns info
|
|||
|
return format_test_results_1.getDisplayedOutput(res, options, testedInfoText, localPackageTest, projectType, meta, prefix, multiProjAdvice, dockerAdvice);
|
|||
|
}
|
|||
|
exports.displayResult = displayResult;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 59744:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.groupVulnerabilities = exports.dockerUserCTA = exports.getDisplayedOutput = exports.createErrorMappedResultsForJsonOutput = exports.extractDataToSendFromResults = void 0;
|
|||
|
const format_reachability_1 = __webpack_require__(13331);
|
|||
|
const chalk_1 = __webpack_require__(32589);
|
|||
|
const config_1 = __webpack_require__(25425);
|
|||
|
const cloneDeep = __webpack_require__(83465);
|
|||
|
const orderBy = __webpack_require__(75316);
|
|||
|
const analytics = __webpack_require__(82744);
|
|||
|
const remediation_based_format_issues_1 = __webpack_require__(57995);
|
|||
|
const legacy_format_issue_1 = __webpack_require__(63540);
|
|||
|
const docker_1 = __webpack_require__(41287);
|
|||
|
const sarif_output_1 = __webpack_require__(5034);
|
|||
|
const iac_output_1 = __webpack_require__(68145);
|
|||
|
const vuln_helpers_1 = __webpack_require__(14784);
|
|||
|
const json_1 = __webpack_require__(27019);
|
|||
|
const open_source_sarif_output_1 = __webpack_require__(9401);
|
|||
|
const get_severity_value_1 = __webpack_require__(24898);
|
|||
|
const show_fix_tip_1 = __webpack_require__(30417);
|
|||
|
const dist_1 = __webpack_require__(61165);
|
|||
|
function createJsonResultOutput(jsonResult, options) {
|
|||
|
const jsonResultClone = cloneDeep(jsonResult);
|
|||
|
delete jsonResultClone.scanResult;
|
|||
|
formatJsonVulnerabilityStructure(jsonResultClone, options);
|
|||
|
return jsonResultClone;
|
|||
|
}
|
|||
|
function formatJsonVulnerabilityStructure(jsonResult, options) {
|
|||
|
if (options['group-issues']) {
|
|||
|
// Note: we have to reverse the array to keep the existing behavior so that the json output will stay the same.
|
|||
|
// Since the entire array is reversed before grouping, we reverse it back after grouping to preserve the grouped vulns order.
|
|||
|
const reversedVulnerabilities = jsonResult.vulnerabilities
|
|||
|
? jsonResult.vulnerabilities.slice().reverse()
|
|||
|
: [];
|
|||
|
jsonResult.vulnerabilities = Object.values(reversedVulnerabilities.reduce((acc, vuln) => {
|
|||
|
if (!acc[vuln.id]) {
|
|||
|
acc[vuln.id] = {
|
|||
|
...vuln,
|
|||
|
from: [vuln.from],
|
|||
|
name: [vuln.name],
|
|||
|
};
|
|||
|
}
|
|||
|
else {
|
|||
|
acc[vuln.id].from.push(vuln.from);
|
|||
|
acc[vuln.id].name.push(vuln.name);
|
|||
|
}
|
|||
|
return acc;
|
|||
|
}, {})).reverse();
|
|||
|
}
|
|||
|
if (jsonResult.vulnerabilities) {
|
|||
|
jsonResult.vulnerabilities.forEach((vuln) => {
|
|||
|
if (vuln.reachability) {
|
|||
|
vuln.reachability = format_reachability_1.getReachabilityJson(vuln.reachability);
|
|||
|
}
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
function extractDataToSendFromResults(results, mappedResults, options) {
|
|||
|
let sarifData = {};
|
|||
|
let stringifiedSarifData = '';
|
|||
|
if (options.sarif || options['sarif-file-output']) {
|
|||
|
if (options.iac) {
|
|||
|
sarifData = iac_output_1.createSarifOutputForIac(results);
|
|||
|
}
|
|||
|
else if (options.docker) {
|
|||
|
sarifData = sarif_output_1.createSarifOutputForContainers(results);
|
|||
|
}
|
|||
|
else {
|
|||
|
sarifData = open_source_sarif_output_1.createSarifOutputForOpenSource(results);
|
|||
|
}
|
|||
|
stringifiedSarifData = json_1.jsonStringifyLargeObject(sarifData);
|
|||
|
}
|
|||
|
const jsonResults = mappedResults.map((res) => createJsonResultOutput(res, options));
|
|||
|
// backwards compat - strip array IFF only one result
|
|||
|
let jsonData = jsonResults.length === 1 ? jsonResults[0] : jsonResults;
|
|||
|
// for container projects, we want the app vulns data to be a part of the result object
|
|||
|
if (options.docker && jsonResults.length > 1 && !options.experimental) {
|
|||
|
const appVulnsData = jsonData.splice(1);
|
|||
|
jsonData = jsonData[0];
|
|||
|
if (jsonData.vulnerabilities.length === 0) {
|
|||
|
// to avoid confusion with other vulns that might be found
|
|||
|
jsonData.summary = 'No known operating system vulnerabilities';
|
|||
|
}
|
|||
|
jsonData['applications'] = appVulnsData;
|
|||
|
}
|
|||
|
let stringifiedJsonData = '';
|
|||
|
if (options.json || options['json-file-output']) {
|
|||
|
stringifiedJsonData = json_1.jsonStringifyLargeObject(jsonData);
|
|||
|
}
|
|||
|
const dataToSend = options.sarif ? sarifData : jsonData;
|
|||
|
const stringifiedData = options.sarif
|
|||
|
? stringifiedSarifData
|
|||
|
: stringifiedJsonData;
|
|||
|
return {
|
|||
|
stdout: dataToSend,
|
|||
|
stringifiedData,
|
|||
|
stringifiedJsonData,
|
|||
|
stringifiedSarifData,
|
|||
|
};
|
|||
|
}
|
|||
|
exports.extractDataToSendFromResults = extractDataToSendFromResults;
|
|||
|
function createErrorMappedResultsForJsonOutput(results) {
|
|||
|
const errorMappedResults = results.map((result) => {
|
|||
|
// add json for when thrown exception
|
|||
|
if (result instanceof Error) {
|
|||
|
return {
|
|||
|
ok: false,
|
|||
|
error: result.message,
|
|||
|
path: result.path,
|
|||
|
};
|
|||
|
}
|
|||
|
return result;
|
|||
|
});
|
|||
|
return errorMappedResults;
|
|||
|
}
|
|||
|
exports.createErrorMappedResultsForJsonOutput = createErrorMappedResultsForJsonOutput;
|
|||
|
function getDisplayedOutput(res, options, testedInfoText, localPackageTest, projectType, meta, prefix, multiProjAdvice, dockerAdvice) {
|
|||
|
var _a;
|
|||
|
const vulnCount = res.vulnerabilities && res.vulnerabilities.length;
|
|||
|
const singleVulnText = res.licensesPolicy ? 'issue' : 'vulnerability';
|
|||
|
const multipleVulnsText = res.licensesPolicy ? 'issues' : 'vulnerabilities';
|
|||
|
// Text will look like so:
|
|||
|
// 'found 232 vulnerabilities, 404 vulnerable paths.'
|
|||
|
let vulnCountText = `found ${res.uniqueCount} ` +
|
|||
|
(res.uniqueCount === 1 ? singleVulnText : multipleVulnsText);
|
|||
|
// Docker is currently not supported as num of paths is inaccurate due to trimming of paths to reduce size.
|
|||
|
if (options.showVulnPaths && !options.docker) {
|
|||
|
vulnCountText += `, ${vulnCount} vulnerable `;
|
|||
|
if (vulnCount === 1) {
|
|||
|
vulnCountText += 'path.';
|
|||
|
}
|
|||
|
else {
|
|||
|
vulnCountText += 'paths.';
|
|||
|
}
|
|||
|
}
|
|||
|
else {
|
|||
|
vulnCountText += '.';
|
|||
|
}
|
|||
|
const reachableVulnsText = options.reachableVulns && vulnCount > 0
|
|||
|
? ` ${format_reachability_1.summariseReachableVulns(res.vulnerabilities)}`
|
|||
|
: '';
|
|||
|
const summary = testedInfoText +
|
|||
|
', ' +
|
|||
|
chalk_1.default.red.bold(vulnCountText) +
|
|||
|
chalk_1.default.blue.bold(reachableVulnsText);
|
|||
|
const fixTip = show_fix_tip_1.showFixTip(projectType, res, options);
|
|||
|
const fixAdvice = fixTip ? `\n\n${fixTip}` : '';
|
|||
|
const dockerfileWarning = getDockerfileWarning(res.scanResult);
|
|||
|
const dockerSuggestion = getDockerSuggestionText(options, config_1.default, (_a = res === null || res === void 0 ? void 0 : res.docker) === null || _a === void 0 ? void 0 : _a.baseImage);
|
|||
|
const dockerDocsLink = getDockerRemediationDocsLink(dockerAdvice, config_1.default);
|
|||
|
const vulns = res.vulnerabilities || [];
|
|||
|
const groupedVulns = groupVulnerabilities(vulns);
|
|||
|
const sortedGroupedVulns = orderBy(groupedVulns, ['metadata.severityValue', 'metadata.name'], ['asc', 'desc']);
|
|||
|
const filteredSortedGroupedVulns = sortedGroupedVulns.filter((vuln) => vuln.metadata.packageManager !== 'upstream');
|
|||
|
const binariesSortedGroupedVulns = sortedGroupedVulns.filter((vuln) => vuln.metadata.packageManager === 'upstream');
|
|||
|
let groupedVulnInfoOutput;
|
|||
|
if (res.remediation) {
|
|||
|
analytics.add('actionableRemediation', true);
|
|||
|
groupedVulnInfoOutput = remediation_based_format_issues_1.formatIssuesWithRemediation(filteredSortedGroupedVulns, res.remediation, options);
|
|||
|
}
|
|||
|
else {
|
|||
|
analytics.add('actionableRemediation', false);
|
|||
|
groupedVulnInfoOutput = filteredSortedGroupedVulns.map((vuln) => legacy_format_issue_1.formatIssues(vuln, options));
|
|||
|
}
|
|||
|
const groupedDockerBinariesVulnInfoOutput = res.docker && binariesSortedGroupedVulns.length
|
|||
|
? docker_1.formatDockerBinariesIssues(binariesSortedGroupedVulns, res.docker.binariesVulns, options)
|
|||
|
: [];
|
|||
|
let body = groupedVulnInfoOutput.join('\n\n') +
|
|||
|
'\n\n' +
|
|||
|
groupedDockerBinariesVulnInfoOutput.join('\n\n') +
|
|||
|
'\n\n' +
|
|||
|
meta;
|
|||
|
if (res.remediation) {
|
|||
|
body = summary + body + fixAdvice;
|
|||
|
}
|
|||
|
else {
|
|||
|
body = body + '\n\n' + summary + fixAdvice;
|
|||
|
}
|
|||
|
const ignoredIssues = '';
|
|||
|
const dockerCTA = dockerUserCTA(options);
|
|||
|
return (prefix +
|
|||
|
body +
|
|||
|
multiProjAdvice +
|
|||
|
ignoredIssues +
|
|||
|
dockerAdvice +
|
|||
|
dockerfileWarning +
|
|||
|
dockerSuggestion +
|
|||
|
dockerDocsLink +
|
|||
|
dockerCTA);
|
|||
|
}
|
|||
|
exports.getDisplayedOutput = getDisplayedOutput;
|
|||
|
function dockerUserCTA(options) {
|
|||
|
if (options.isDockerUser) {
|
|||
|
return '\n\nFor more free scans that keep your images secure, sign up to Snyk at https://dockr.ly/3ePqVcp';
|
|||
|
}
|
|||
|
return '';
|
|||
|
}
|
|||
|
exports.dockerUserCTA = dockerUserCTA;
|
|||
|
function getDockerSuggestionText(options, config, baseImageRes) {
|
|||
|
if (!options.docker || options.isDockerUser) {
|
|||
|
return '';
|
|||
|
}
|
|||
|
let dockerSuggestion = '';
|
|||
|
if (config && config.disableSuggestions !== 'true') {
|
|||
|
const optOutSuggestions = '\n\nTo remove this message in the future, please run `snyk config set disableSuggestions=true`';
|
|||
|
if (!options.file) {
|
|||
|
if (!baseImageRes) {
|
|||
|
dockerSuggestion +=
|
|||
|
chalk_1.default.bold.white('\n\nSnyk wasn’t able to auto detect the base image, use `--file` option to get base image remediation advice.' +
|
|||
|
`\nExample: $ snyk container test ${options.path} --file=path/to/Dockerfile`) + optOutSuggestions;
|
|||
|
}
|
|||
|
}
|
|||
|
else if (!options['exclude-base-image-vulns']) {
|
|||
|
dockerSuggestion +=
|
|||
|
chalk_1.default.bold.white('\n\nPro tip: use `--exclude-base-image-vulns` to exclude from display Docker base image vulnerabilities.') + optOutSuggestions;
|
|||
|
}
|
|||
|
}
|
|||
|
return dockerSuggestion;
|
|||
|
}
|
|||
|
function getDockerfileWarning(scanResult) {
|
|||
|
if (!scanResult) {
|
|||
|
return '';
|
|||
|
}
|
|||
|
const fact = scanResult.facts.find((fact) => fact.type === 'dockerfileAnalysis');
|
|||
|
if (!fact) {
|
|||
|
return '';
|
|||
|
}
|
|||
|
const dockerfileAnalysisFact = fact;
|
|||
|
if (!dockerfileAnalysisFact.data.error) {
|
|||
|
return '';
|
|||
|
}
|
|||
|
let userMessage = chalk_1.default.yellow('\n\nWarning: Unable to analyse Dockerfile provided through `--file`.');
|
|||
|
switch (dockerfileAnalysisFact.data.error.code) {
|
|||
|
case dist_1.DockerFileAnalysisErrorCode.BASE_IMAGE_NAME_NOT_FOUND:
|
|||
|
userMessage += chalk_1.default.yellow('\n Dockerfile must begin with a FROM instruction. This may be after parser directives, comments, and globally scoped ARGs.');
|
|||
|
break;
|
|||
|
case dist_1.DockerFileAnalysisErrorCode.BASE_IMAGE_NON_RESOLVABLE:
|
|||
|
userMessage += chalk_1.default.yellow('\n Dockerfile must have default values for all ARG instructions.');
|
|||
|
break;
|
|||
|
}
|
|||
|
return userMessage;
|
|||
|
}
|
|||
|
function getDockerRemediationDocsLink(dockerAdvice, config) {
|
|||
|
if (config.disableSuggestions === 'true' || dockerAdvice.length === 0) {
|
|||
|
return '';
|
|||
|
}
|
|||
|
return (chalk_1.default.white('\n\nLearn more: ') +
|
|||
|
chalk_1.default.white.underline('https://docs.snyk.io/products/snyk-container/getting-around-the-snyk-container-ui/base-image-detection'));
|
|||
|
}
|
|||
|
function groupVulnerabilities(vulns) {
|
|||
|
return vulns.reduce((map, curr) => {
|
|||
|
if (!map[curr.id]) {
|
|||
|
map[curr.id] = {};
|
|||
|
map[curr.id].list = [];
|
|||
|
map[curr.id].metadata = metadataForVuln(curr);
|
|||
|
map[curr.id].isIgnored = false;
|
|||
|
map[curr.id].isPatched = false;
|
|||
|
// Extra added fields for ease of handling
|
|||
|
map[curr.id].title = curr.title;
|
|||
|
map[curr.id].note = curr.note;
|
|||
|
map[curr.id].severity = curr.severity;
|
|||
|
map[curr.id].originalSeverity = curr.originalSeverity;
|
|||
|
map[curr.id].isNew = vuln_helpers_1.isNewVuln(curr);
|
|||
|
map[curr.id].name = curr.name;
|
|||
|
map[curr.id].version = curr.version;
|
|||
|
map[curr.id].fixedIn = curr.fixedIn;
|
|||
|
map[curr.id].dockerfileInstruction = curr.dockerfileInstruction;
|
|||
|
map[curr.id].dockerBaseImage = curr.dockerBaseImage;
|
|||
|
map[curr.id].nearestFixedInVersion = curr.nearestFixedInVersion;
|
|||
|
map[curr.id].legalInstructionsArray = curr.legalInstructionsArray;
|
|||
|
map[curr.id].reachability = curr.reachability;
|
|||
|
}
|
|||
|
map[curr.id].list.push(curr);
|
|||
|
if (!map[curr.id].isFixable) {
|
|||
|
map[curr.id].isFixable = vuln_helpers_1.isVulnFixable(curr);
|
|||
|
}
|
|||
|
if (!map[curr.id].note) {
|
|||
|
map[curr.id].note = !!curr.note;
|
|||
|
}
|
|||
|
return map;
|
|||
|
}, {});
|
|||
|
}
|
|||
|
exports.groupVulnerabilities = groupVulnerabilities;
|
|||
|
function metadataForVuln(vuln) {
|
|||
|
return {
|
|||
|
id: vuln.id,
|
|||
|
title: vuln.title,
|
|||
|
description: vuln.description,
|
|||
|
type: vuln.type,
|
|||
|
name: vuln.name,
|
|||
|
info: vuln.info,
|
|||
|
severity: vuln.severity,
|
|||
|
severityValue: get_severity_value_1.getSeverityValue(vuln.severity),
|
|||
|
isNew: vuln_helpers_1.isNewVuln(vuln),
|
|||
|
version: vuln.version,
|
|||
|
packageManager: vuln.packageManager,
|
|||
|
};
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 88784:
|
|||
|
/***/ ((__unused_webpack_module, exports) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.convertIacResultToScanResult = void 0;
|
|||
|
function convertIacResultToScanResult(iacResult, policy, meta, options) {
|
|||
|
var _a;
|
|||
|
return {
|
|||
|
identity: {
|
|||
|
type: iacResult.projectType,
|
|||
|
targetFile: iacResult.targetFile,
|
|||
|
},
|
|||
|
facts: [],
|
|||
|
findings: iacResult.violatedPolicies.map((policy) => {
|
|||
|
return {
|
|||
|
data: { metadata: policy, docId: policy.docId },
|
|||
|
type: 'iacIssue',
|
|||
|
};
|
|||
|
}),
|
|||
|
name: iacResult.projectName,
|
|||
|
target: buildTarget(meta),
|
|||
|
policy: (_a = policy === null || policy === void 0 ? void 0 : policy.toString()) !== null && _a !== void 0 ? _a : '',
|
|||
|
targetReference: options === null || options === void 0 ? void 0 : options['target-reference'],
|
|||
|
};
|
|||
|
}
|
|||
|
exports.convertIacResultToScanResult = convertIacResultToScanResult;
|
|||
|
function buildTarget(meta) {
|
|||
|
if (meta.gitRemoteUrl) {
|
|||
|
return { remoteUrl: meta.gitRemoteUrl };
|
|||
|
}
|
|||
|
return { name: meta.projectName };
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 87198:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.SnykIacTestError = exports.getErrorUserMessage = void 0;
|
|||
|
const error_utils_1 = __webpack_require__(36401);
|
|||
|
const types_1 = __webpack_require__(94820);
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
const defaultUserMessage = 'Your test request could not be completed. Please run the command again with the `-d` flag and contact support@snyk.io with the contents of the output';
|
|||
|
const snykIacTestErrorsUserMessages = {
|
|||
|
NoPaths: 'No valid paths were provided',
|
|||
|
CwdTraversal: 'Running the scan from outside of the current working directory is not supported',
|
|||
|
NoBundle: 'A rules bundle were not provided',
|
|||
|
OpenBundle: "The Snyk CLI couldn't open the rules bundle",
|
|||
|
InvalidSeverityThreshold: 'The provided severity threshold is invalid. The following values are supported: "low", "medium", "high", "critical"',
|
|||
|
Scan: defaultUserMessage,
|
|||
|
UnableToRecognizeInputType: 'Input type was not recognized',
|
|||
|
UnsupportedInputType: 'Input type is not supported',
|
|||
|
UnableToResolveLocation: 'Could not resolve location of resource/attribute',
|
|||
|
UnrecognizedFileExtension: 'Unrecognized file extension',
|
|||
|
FailedToParseInput: 'Failed to parse input',
|
|||
|
InvalidInput: 'Invalid input',
|
|||
|
UnableToReadFile: 'Unable to read file',
|
|||
|
UnableToReadDir: 'Unable to read directory',
|
|||
|
UnableToReadStdin: 'Unable to read stdin',
|
|||
|
FailedToLoadRegoAPI: defaultUserMessage,
|
|||
|
FailedToLoadRules: defaultUserMessage,
|
|||
|
FailedToCompile: defaultUserMessage,
|
|||
|
UnableToReadPath: 'Unable to read path',
|
|||
|
NoLoadableInput: "The Snyk CLI couldn't find any valid IaC configuration files to scan",
|
|||
|
FailedToShareResults: 'Failed to upload the test results with the platform',
|
|||
|
};
|
|||
|
function getErrorUserMessage(code) {
|
|||
|
if (code < 2000 || code >= 3000) {
|
|||
|
return 'INVALID_SNYK_IAC_TEST_ERROR';
|
|||
|
}
|
|||
|
const errorName = types_1.IaCErrorCodes[code];
|
|||
|
if (!errorName) {
|
|||
|
return 'INVALID_IAC_ERROR';
|
|||
|
}
|
|||
|
return snykIacTestErrorsUserMessages[errorName];
|
|||
|
}
|
|||
|
exports.getErrorUserMessage = getErrorUserMessage;
|
|||
|
class SnykIacTestError extends errors_1.CustomError {
|
|||
|
constructor(scanError) {
|
|||
|
super(scanError.message);
|
|||
|
this.code = scanError.code;
|
|||
|
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|||
|
this.userMessage = getErrorUserMessage(this.code);
|
|||
|
this.fields = Object.assign({
|
|||
|
path: '',
|
|||
|
}, scanError.fields);
|
|||
|
}
|
|||
|
get path() {
|
|||
|
var _a;
|
|||
|
return (_a = this.fields) === null || _a === void 0 ? void 0 : _a.path;
|
|||
|
}
|
|||
|
set path(path1) {
|
|||
|
this.fields.path = path1;
|
|||
|
}
|
|||
|
}
|
|||
|
exports.SnykIacTestError = SnykIacTestError;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 17152:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.test = void 0;
|
|||
|
const setup_1 = __webpack_require__(88929);
|
|||
|
const scan_1 = __webpack_require__(50277);
|
|||
|
async function test(testConfig) {
|
|||
|
const { policyEnginePath, rulesBundlePath } = await setup_1.setup(testConfig);
|
|||
|
return scan_1.scan(testConfig, policyEnginePath, rulesBundlePath);
|
|||
|
}
|
|||
|
exports.test = test;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 71909:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
// Some of the types below specify fields constrained to a single value. Those
|
|||
|
// fields must be produced in the JSON output, and they must have those values
|
|||
|
// to keep backwards compatibility.
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.convertEngineToJsonResults = void 0;
|
|||
|
const path = __webpack_require__(85622);
|
|||
|
const format_test_results_1 = __webpack_require__(59744);
|
|||
|
function convertEngineToJsonResults({ results, projectName, orgSettings, }) {
|
|||
|
const vulnerabilityGroups = groupVulnerabilitiesByFile(results); // all vulns groups by file
|
|||
|
const resourceGroups = groupResourcesByFile(results); // all resources grouped by file
|
|||
|
const filesWithoutIssues = findFilesWithoutIssues(resourceGroups, vulnerabilityGroups); // all resources without issues grouped by file
|
|||
|
const output = [];
|
|||
|
if (results.errors) {
|
|||
|
output.push(...format_test_results_1.createErrorMappedResultsForJsonOutput(results.errors));
|
|||
|
}
|
|||
|
for (const [file, resources] of Object.entries(filesWithoutIssues)) {
|
|||
|
output.push(resourcesToResult(orgSettings, projectName, file, resources));
|
|||
|
}
|
|||
|
for (const [file, vulnerabilities] of Object.entries(vulnerabilityGroups)) {
|
|||
|
output.push(vulnerabilitiesToResult(orgSettings, projectName, file, vulnerabilities));
|
|||
|
}
|
|||
|
return output;
|
|||
|
}
|
|||
|
exports.convertEngineToJsonResults = convertEngineToJsonResults;
|
|||
|
function groupResourcesByFile(results) {
|
|||
|
var _a;
|
|||
|
const groups = {};
|
|||
|
if ((_a = results.results) === null || _a === void 0 ? void 0 : _a.resources) {
|
|||
|
for (const resource of results.results.resources) {
|
|||
|
if (resource.file) {
|
|||
|
const resources = groups[resource.file] || [];
|
|||
|
resources.push(resource);
|
|||
|
groups[resource.file] = resources;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
return groups;
|
|||
|
}
|
|||
|
function groupVulnerabilitiesByFile(results) {
|
|||
|
var _a;
|
|||
|
const groups = {};
|
|||
|
if ((_a = results.results) === null || _a === void 0 ? void 0 : _a.vulnerabilities) {
|
|||
|
for (const vulnerability of results.results.vulnerabilities) {
|
|||
|
if (vulnerability.resource.file) {
|
|||
|
const vulnerabilities = groups[vulnerability.resource.file] || [];
|
|||
|
vulnerabilities.push(vulnerability);
|
|||
|
groups[vulnerability.resource.file] = vulnerabilities;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
return groups;
|
|||
|
}
|
|||
|
function findFilesWithoutIssues(resourceGroups, vulnerabilityGroups) {
|
|||
|
const groups = {};
|
|||
|
for (const [file, resources] of Object.entries(resourceGroups)) {
|
|||
|
if (!(file in vulnerabilityGroups)) {
|
|||
|
groups[file] = resources;
|
|||
|
}
|
|||
|
}
|
|||
|
return groups;
|
|||
|
}
|
|||
|
function resourcesToResult(orgSettings, projectName, file, resources) {
|
|||
|
const kind = resourcesToKind(resources);
|
|||
|
const ignoreSettings = orgSettingsToIgnoreSettings(orgSettings);
|
|||
|
const meta = orgSettingsToMeta(orgSettings, ignoreSettings);
|
|||
|
const { meta: { org, isPrivate, policy }, } = orgSettings;
|
|||
|
return {
|
|||
|
meta,
|
|||
|
filesystemPolicy: false,
|
|||
|
vulnerabilities: [],
|
|||
|
dependencyCount: 0,
|
|||
|
licensesPolicy: null,
|
|||
|
ignoreSettings,
|
|||
|
targetFile: file,
|
|||
|
projectName,
|
|||
|
org,
|
|||
|
policy: policy || '',
|
|||
|
isPrivate,
|
|||
|
targetFilePath: path.resolve(file),
|
|||
|
packageManager: kind,
|
|||
|
path: process.cwd(),
|
|||
|
projectType: kind,
|
|||
|
ok: true,
|
|||
|
infrastructureAsCodeIssues: [],
|
|||
|
};
|
|||
|
}
|
|||
|
function vulnerabilitiesToResult(orgSettings, projectName, file, vulnerabilities) {
|
|||
|
const kind = vulnerabilitiesToKind(vulnerabilities);
|
|||
|
const ignoreSettings = orgSettingsToIgnoreSettings(orgSettings);
|
|||
|
const meta = orgSettingsToMeta(orgSettings, ignoreSettings);
|
|||
|
const infrastructureAsCodeIssues = vulnerabilitiesToIacIssues(vulnerabilities);
|
|||
|
const { meta: { org, isPrivate, policy }, } = orgSettings;
|
|||
|
return {
|
|||
|
meta,
|
|||
|
filesystemPolicy: false,
|
|||
|
vulnerabilities: [],
|
|||
|
dependencyCount: 0,
|
|||
|
licensesPolicy: null,
|
|||
|
ignoreSettings,
|
|||
|
targetFile: file,
|
|||
|
projectName,
|
|||
|
org,
|
|||
|
policy: policy || '',
|
|||
|
isPrivate,
|
|||
|
targetFilePath: path.resolve(file),
|
|||
|
packageManager: kind,
|
|||
|
path: process.cwd(),
|
|||
|
projectType: kind,
|
|||
|
ok: false,
|
|||
|
infrastructureAsCodeIssues,
|
|||
|
};
|
|||
|
}
|
|||
|
function vulnerabilitiesToIacIssues(vulnerabilities) {
|
|||
|
return vulnerabilities.map((v) => {
|
|||
|
return {
|
|||
|
severity: v.severity,
|
|||
|
resolve: v.remediation,
|
|||
|
impact: v.rule.description,
|
|||
|
msg: v.resource.formattedPath,
|
|||
|
remediation: {
|
|||
|
terraform: v.remediation,
|
|||
|
},
|
|||
|
type: v.resource.kind,
|
|||
|
subType: v.resource.type,
|
|||
|
issue: v.rule.title,
|
|||
|
publicId: v.rule.id,
|
|||
|
title: v.rule.title,
|
|||
|
references: v.rule.references ? [v.rule.references] : [],
|
|||
|
id: v.rule.id,
|
|||
|
isIgnored: v.ignored,
|
|||
|
iacDescription: {
|
|||
|
issue: v.rule.title,
|
|||
|
impact: v.rule.description,
|
|||
|
resolve: v.remediation,
|
|||
|
},
|
|||
|
lineNumber: v.resource.line || -1,
|
|||
|
documentation: `https://snyk.io/security-rules/${v.rule.id}`,
|
|||
|
isGeneratedByCustomRule: false,
|
|||
|
path: v.resource.path || [],
|
|||
|
compliance: [],
|
|||
|
description: v.rule.description,
|
|||
|
};
|
|||
|
});
|
|||
|
}
|
|||
|
// TODO: add correct mapping to our packageManger name (will probably be done in `snyk-iac-test`)
|
|||
|
function resourcesToKind(resources) {
|
|||
|
for (const r of resources) {
|
|||
|
return r.kind;
|
|||
|
}
|
|||
|
return '';
|
|||
|
}
|
|||
|
function vulnerabilitiesToKind(vulnerabilities) {
|
|||
|
for (const v of vulnerabilities) {
|
|||
|
return v.resource.kind;
|
|||
|
}
|
|||
|
return '';
|
|||
|
}
|
|||
|
function orgSettingsToMeta(orgSettings, ignoreSettings) {
|
|||
|
const { meta: { isPrivate, isLicensesEnabled, org, policy }, } = orgSettings;
|
|||
|
return {
|
|||
|
isPrivate,
|
|||
|
isLicensesEnabled,
|
|||
|
org,
|
|||
|
policy: policy || '',
|
|||
|
ignoreSettings,
|
|||
|
};
|
|||
|
}
|
|||
|
function orgSettingsToIgnoreSettings(orgSettings) {
|
|||
|
const { meta: { ignoreSettings }, } = orgSettings;
|
|||
|
return {
|
|||
|
adminOnly: (ignoreSettings === null || ignoreSettings === void 0 ? void 0 : ignoreSettings.adminOnly) || false,
|
|||
|
reasonRequired: (ignoreSettings === null || ignoreSettings === void 0 ? void 0 : ignoreSettings.reasonRequired) || false,
|
|||
|
disregardFilesystemIgnores: (ignoreSettings === null || ignoreSettings === void 0 ? void 0 : ignoreSettings.disregardFilesystemIgnores) || false,
|
|||
|
};
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 99687:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.FoundIssuesError = exports.NoSuccessfulScansError = exports.buildOutput = void 0;
|
|||
|
const os_1 = __webpack_require__(12087);
|
|||
|
const json_1 = __webpack_require__(71909);
|
|||
|
const types_1 = __webpack_require__(55246);
|
|||
|
const iac_output_1 = __webpack_require__(68145);
|
|||
|
const iac_output_2 = __webpack_require__(68145);
|
|||
|
const json_2 = __webpack_require__(27019);
|
|||
|
const sarif_1 = __webpack_require__(87999);
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
const strip_ansi_1 = __webpack_require__(76003);
|
|||
|
function buildOutput({ scanResult, testSpinner, projectName, orgSettings, options, }) {
|
|||
|
if (scanResult.results) {
|
|||
|
testSpinner === null || testSpinner === void 0 ? void 0 : testSpinner.succeed(iac_output_1.spinnerSuccessMessage);
|
|||
|
}
|
|||
|
else {
|
|||
|
testSpinner === null || testSpinner === void 0 ? void 0 : testSpinner.stop();
|
|||
|
}
|
|||
|
const { responseData, jsonData, sarifData } = buildTestCommandResultData({
|
|||
|
scanResult,
|
|||
|
projectName,
|
|||
|
orgSettings,
|
|||
|
options,
|
|||
|
});
|
|||
|
if (options.json || options.sarif) {
|
|||
|
return types_1.TestCommandResult.createJsonTestCommandResult(responseData, jsonData, sarifData);
|
|||
|
}
|
|||
|
return types_1.TestCommandResult.createHumanReadableTestCommandResult(responseData, jsonData, sarifData);
|
|||
|
}
|
|||
|
exports.buildOutput = buildOutput;
|
|||
|
function buildTestCommandResultData({ scanResult, projectName, orgSettings, options, }) {
|
|||
|
var _a, _b, _c, _d, _e;
|
|||
|
const jsonData = json_2.jsonStringifyLargeObject(json_1.convertEngineToJsonResults({
|
|||
|
results: scanResult,
|
|||
|
projectName,
|
|||
|
orgSettings,
|
|||
|
}));
|
|||
|
const sarifData = json_2.jsonStringifyLargeObject(sarif_1.convertEngineToSarifResults(scanResult));
|
|||
|
const isPartialSuccess = ((_b = (_a = scanResult.results) === null || _a === void 0 ? void 0 : _a.resources) === null || _b === void 0 ? void 0 : _b.length) || !((_c = scanResult.errors) === null || _c === void 0 ? void 0 : _c.length);
|
|||
|
if (!isPartialSuccess) {
|
|||
|
throw new NoSuccessfulScansError({ json: jsonData, sarif: sarifData }, scanResult.errors, options);
|
|||
|
}
|
|||
|
let responseData;
|
|||
|
if (options.json) {
|
|||
|
responseData = jsonData;
|
|||
|
}
|
|||
|
else if (options.sarif) {
|
|||
|
responseData = sarifData;
|
|||
|
}
|
|||
|
else {
|
|||
|
responseData = buildTextOutput({ scanResult, projectName, orgSettings });
|
|||
|
}
|
|||
|
const isFoundIssues = !!((_e = (_d = scanResult.results) === null || _d === void 0 ? void 0 : _d.vulnerabilities) === null || _e === void 0 ? void 0 : _e.length);
|
|||
|
if (isFoundIssues) {
|
|||
|
throw new FoundIssuesError({
|
|||
|
response: responseData,
|
|||
|
json: jsonData,
|
|||
|
sarif: sarifData,
|
|||
|
});
|
|||
|
}
|
|||
|
return { responseData, jsonData, sarifData };
|
|||
|
}
|
|||
|
const SEPARATOR = '\n-------------------------------------------------------\n';
|
|||
|
function buildTextOutput({ scanResult, projectName, orgSettings, }) {
|
|||
|
let response = '';
|
|||
|
const testData = iac_output_2.formatSnykIacTestTestData(scanResult.results, projectName, orgSettings.meta.org);
|
|||
|
response +=
|
|||
|
os_1.EOL +
|
|||
|
iac_output_1.getIacDisplayedIssues(testData.resultsBySeverity, {
|
|||
|
shouldShowLineNumbers: true,
|
|||
|
});
|
|||
|
if (scanResult.errors) {
|
|||
|
const testFailures = scanResult.errors.map((error) => ({
|
|||
|
filePath: error.fields.path,
|
|||
|
failureReason: error.userMessage,
|
|||
|
}));
|
|||
|
response += os_1.EOL.repeat(2) + iac_output_1.formatIacTestFailures(testFailures);
|
|||
|
}
|
|||
|
response += os_1.EOL;
|
|||
|
response += SEPARATOR;
|
|||
|
response += os_1.EOL;
|
|||
|
response += iac_output_1.formatIacTestSummary(testData);
|
|||
|
response += os_1.EOL;
|
|||
|
return response;
|
|||
|
}
|
|||
|
class NoSuccessfulScansError extends errors_1.FormattedCustomError {
|
|||
|
constructor(responseData, errors, options) {
|
|||
|
const firstErr = errors[0];
|
|||
|
const isText = !options.json && !options.sarif;
|
|||
|
const message = options.json
|
|||
|
? responseData.json
|
|||
|
: options.sarif
|
|||
|
? responseData.sarif
|
|||
|
: firstErr.message;
|
|||
|
super(message, isText
|
|||
|
? iac_output_1.formatIacTestFailures(errors.map((scanError) => ({
|
|||
|
failureReason: scanError.userMessage,
|
|||
|
filePath: scanError.fields.path,
|
|||
|
})))
|
|||
|
: strip_ansi_1.default(message));
|
|||
|
this.strCode = firstErr.strCode;
|
|||
|
this.code = firstErr.code;
|
|||
|
this.json = isText ? responseData.json : message;
|
|||
|
this.jsonStringifiedResults = responseData.json;
|
|||
|
this.sarifStringifiedResults = responseData.sarif;
|
|||
|
this.fields = firstErr.fields;
|
|||
|
}
|
|||
|
get path() {
|
|||
|
var _a;
|
|||
|
return (_a = this.fields) === null || _a === void 0 ? void 0 : _a.path;
|
|||
|
}
|
|||
|
set path(path1) {
|
|||
|
this.fields.path = path1;
|
|||
|
}
|
|||
|
}
|
|||
|
exports.NoSuccessfulScansError = NoSuccessfulScansError;
|
|||
|
class FoundIssuesError extends errors_1.CustomError {
|
|||
|
constructor(responseData) {
|
|||
|
super(responseData.response);
|
|||
|
this.code = 'VULNS';
|
|||
|
this.strCode = 'VULNS';
|
|||
|
this.userMessage = responseData.response;
|
|||
|
this.jsonStringifiedResults = responseData.json;
|
|||
|
this.sarifStringifiedResults = responseData.sarif;
|
|||
|
}
|
|||
|
}
|
|||
|
exports.FoundIssuesError = FoundIssuesError;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 87999:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.convertEngineToSarifResults = void 0;
|
|||
|
const url_1 = __webpack_require__(78835);
|
|||
|
const marked_1 = __webpack_require__(30970);
|
|||
|
const path = __webpack_require__(85622);
|
|||
|
const upperFirst = __webpack_require__(90039);
|
|||
|
const camelCase = __webpack_require__(76884);
|
|||
|
const version_1 = __webpack_require__(38217);
|
|||
|
const sarif_output_1 = __webpack_require__(5034);
|
|||
|
const git_1 = __webpack_require__(82421);
|
|||
|
// Used to reference the base path in results.
|
|||
|
const PROJECT_ROOT_KEY = 'PROJECTROOT';
|
|||
|
function convertEngineToSarifResults(scanResult) {
|
|||
|
let repoRoot;
|
|||
|
try {
|
|||
|
repoRoot = git_1.getRepositoryRoot() + '/';
|
|||
|
}
|
|||
|
catch {
|
|||
|
repoRoot = path.join(process.cwd(), '/'); // the slash at the end is required, otherwise the artifactLocation.uri starts with a slash
|
|||
|
}
|
|||
|
const tool = {
|
|||
|
driver: {
|
|||
|
name: 'Snyk IaC',
|
|||
|
fullName: 'Snyk Infrastructure as Code',
|
|||
|
version: version_1.getVersion(),
|
|||
|
informationUri: 'https://docs.snyk.io/products/snyk-infrastructure-as-code',
|
|||
|
rules: extractReportingDescriptor(scanResult.results),
|
|||
|
},
|
|||
|
};
|
|||
|
return {
|
|||
|
$schema: 'https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json',
|
|||
|
version: '2.1.0',
|
|||
|
runs: [
|
|||
|
{
|
|||
|
// https://docs.oasis-open.org/sarif/sarif/v2.1.0/os/sarif-v2.1.0-os.html#_Toc34317498
|
|||
|
originalUriBaseIds: {
|
|||
|
[PROJECT_ROOT_KEY]: {
|
|||
|
uri: url_1.pathToFileURL(repoRoot).href,
|
|||
|
description: {
|
|||
|
text: 'The root directory for all project files.',
|
|||
|
},
|
|||
|
},
|
|||
|
},
|
|||
|
tool,
|
|||
|
automationDetails: {
|
|||
|
id: 'snyk-iac',
|
|||
|
},
|
|||
|
results: mapSnykIacTestResultsToSarifResults(scanResult.results),
|
|||
|
},
|
|||
|
],
|
|||
|
};
|
|||
|
}
|
|||
|
exports.convertEngineToSarifResults = convertEngineToSarifResults;
|
|||
|
function extractReportingDescriptor(results) {
|
|||
|
const rules = {};
|
|||
|
if (!(results === null || results === void 0 ? void 0 : results.vulnerabilities)) {
|
|||
|
return Object.values(rules);
|
|||
|
}
|
|||
|
results.vulnerabilities.forEach((vulnerability) => {
|
|||
|
if (rules[vulnerability.rule.id]) {
|
|||
|
return;
|
|||
|
}
|
|||
|
const tags = ['security']; // switch to rules.labels once `snyk-iac-test` includes this info
|
|||
|
rules[vulnerability.rule.id] = {
|
|||
|
id: vulnerability.rule.id,
|
|||
|
name: upperFirst(camelCase(vulnerability.rule.title)).replace(/ /g, ''),
|
|||
|
shortDescription: {
|
|||
|
text: `${upperFirst(vulnerability.severity)} severity - ${vulnerability.rule.title}`,
|
|||
|
},
|
|||
|
fullDescription: {
|
|||
|
text: vulnerability.rule.description,
|
|||
|
},
|
|||
|
help: {
|
|||
|
text: renderMarkdown(vulnerability.remediation),
|
|||
|
markdown: vulnerability.remediation,
|
|||
|
},
|
|||
|
defaultConfiguration: {
|
|||
|
level: sarif_output_1.getIssueLevel(vulnerability.severity),
|
|||
|
},
|
|||
|
properties: {
|
|||
|
tags,
|
|||
|
problem: {
|
|||
|
severity: vulnerability.severity,
|
|||
|
},
|
|||
|
},
|
|||
|
helpUri: `https://snyk.io/security-rules/${vulnerability.rule.id}`,
|
|||
|
};
|
|||
|
});
|
|||
|
return Object.values(rules);
|
|||
|
}
|
|||
|
function renderMarkdown(markdown) {
|
|||
|
const renderer = {
|
|||
|
em(text) {
|
|||
|
return text;
|
|||
|
},
|
|||
|
strong(text) {
|
|||
|
return text;
|
|||
|
},
|
|||
|
link(text) {
|
|||
|
return text;
|
|||
|
},
|
|||
|
blockquote(quote) {
|
|||
|
return quote;
|
|||
|
},
|
|||
|
list(body) {
|
|||
|
return body;
|
|||
|
},
|
|||
|
listitem(text) {
|
|||
|
return text;
|
|||
|
},
|
|||
|
paragraph(text) {
|
|||
|
return text;
|
|||
|
},
|
|||
|
codespan(text) {
|
|||
|
return text;
|
|||
|
},
|
|||
|
code(code) {
|
|||
|
return code;
|
|||
|
},
|
|||
|
heading(text) {
|
|||
|
return `${text}\n`;
|
|||
|
},
|
|||
|
};
|
|||
|
marked_1.marked.use({ renderer });
|
|||
|
return marked_1.marked.parse(markdown);
|
|||
|
}
|
|||
|
function mapSnykIacTestResultsToSarifResults(results) {
|
|||
|
const result = [];
|
|||
|
if (!(results === null || results === void 0 ? void 0 : results.vulnerabilities)) {
|
|||
|
return result;
|
|||
|
}
|
|||
|
results.vulnerabilities.forEach((vulnerability) => {
|
|||
|
result.push({
|
|||
|
ruleId: vulnerability.rule.id,
|
|||
|
message: {
|
|||
|
text: `This line contains a potential ${vulnerability.severity} severity misconfiguration`,
|
|||
|
},
|
|||
|
locations: [
|
|||
|
{
|
|||
|
physicalLocation: {
|
|||
|
artifactLocation: {
|
|||
|
uri: vulnerability.resource.file,
|
|||
|
uriBaseId: PROJECT_ROOT_KEY,
|
|||
|
},
|
|||
|
// We exclude the `region` key when the line number is missing or -1.
|
|||
|
// https://docs.oasis-open.org/sarif/sarif/v2.0/csprd02/sarif-v2.0-csprd02.html#_Toc10127873
|
|||
|
region: {
|
|||
|
startLine: vulnerability.resource.line,
|
|||
|
},
|
|||
|
},
|
|||
|
},
|
|||
|
],
|
|||
|
});
|
|||
|
});
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 50277:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.scan = void 0;
|
|||
|
const childProcess = __webpack_require__(63129);
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
const types_1 = __webpack_require__(94820);
|
|||
|
const error_utils_1 = __webpack_require__(36401);
|
|||
|
const newDebug = __webpack_require__(15158);
|
|||
|
const results_1 = __webpack_require__(89752);
|
|||
|
const os = __webpack_require__(12087);
|
|||
|
const fs = __webpack_require__(35747);
|
|||
|
const path = __webpack_require__(85622);
|
|||
|
const rimraf = __webpack_require__(50984);
|
|||
|
const config_1 = __webpack_require__(25425);
|
|||
|
const api_token_1 = __webpack_require__(95181);
|
|||
|
const analytics_1 = __webpack_require__(82744);
|
|||
|
const debug = newDebug('snyk-iac');
|
|||
|
function scan(options, policyEnginePath, rulesBundlePath) {
|
|||
|
const configPath = createConfig(options);
|
|||
|
try {
|
|||
|
return scanWithConfig(options, policyEnginePath, rulesBundlePath, configPath);
|
|||
|
}
|
|||
|
finally {
|
|||
|
deleteConfig(configPath);
|
|||
|
}
|
|||
|
}
|
|||
|
exports.scan = scan;
|
|||
|
function scanWithConfig(options, policyEnginePath, rulesBundlePath, configPath) {
|
|||
|
const args = processFlags(options, rulesBundlePath, configPath);
|
|||
|
args.push(...options.paths);
|
|||
|
const process = childProcess.spawnSync(policyEnginePath, args, {
|
|||
|
encoding: 'utf-8',
|
|||
|
stdio: 'pipe',
|
|||
|
});
|
|||
|
debug('policy engine standard error:\n%s', '\n' + process.stderr);
|
|||
|
if (process.status && process.status !== 0) {
|
|||
|
throw new ScanError(`invalid exist status: ${process.status}`);
|
|||
|
}
|
|||
|
if (process.error) {
|
|||
|
throw new ScanError(`spawning process: ${process.error}`);
|
|||
|
}
|
|||
|
let snykIacTestOutput;
|
|||
|
try {
|
|||
|
snykIacTestOutput = JSON.parse(process.stdout);
|
|||
|
}
|
|||
|
catch (e) {
|
|||
|
throw new ScanError(`invalid output encoding: ${e}`);
|
|||
|
}
|
|||
|
const testOutput = results_1.mapSnykIacTestOutputToTestOutput(snykIacTestOutput);
|
|||
|
return testOutput;
|
|||
|
}
|
|||
|
function processFlags(options, rulesBundlePath, configPath) {
|
|||
|
var _a, _b, _c;
|
|||
|
const flags = ['-bundle', rulesBundlePath, '-config', configPath];
|
|||
|
if (options.severityThreshold) {
|
|||
|
flags.push('-severity-threshold', options.severityThreshold);
|
|||
|
}
|
|||
|
if ((_a = options.attributes) === null || _a === void 0 ? void 0 : _a.criticality) {
|
|||
|
flags.push('-project-business-criticality', options.attributes.criticality.join(','));
|
|||
|
}
|
|||
|
if ((_b = options.attributes) === null || _b === void 0 ? void 0 : _b.environment) {
|
|||
|
flags.push('-project-environment', options.attributes.environment.join(','));
|
|||
|
}
|
|||
|
if ((_c = options.attributes) === null || _c === void 0 ? void 0 : _c.lifecycle) {
|
|||
|
flags.push('-project-lifecycle', options.attributes.lifecycle.join(','));
|
|||
|
}
|
|||
|
if (options.projectTags) {
|
|||
|
const stringifiedTags = options.projectTags
|
|||
|
.map((tag) => {
|
|||
|
return `${tag.key}=${tag.value}`;
|
|||
|
})
|
|||
|
.join(',');
|
|||
|
flags.push('-project-tags', stringifiedTags);
|
|||
|
}
|
|||
|
if (options.report) {
|
|||
|
flags.push('-report');
|
|||
|
}
|
|||
|
return flags;
|
|||
|
}
|
|||
|
function createConfig(options) {
|
|||
|
try {
|
|||
|
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'snyk-'));
|
|||
|
const tempConfig = path.join(tempDir, 'config.json');
|
|||
|
const configData = JSON.stringify({
|
|||
|
org: options.orgSettings.meta.org,
|
|||
|
apiUrl: config_1.default.API,
|
|||
|
apiAuth: api_token_1.getAuthHeader(),
|
|||
|
allowAnalytics: analytics_1.allowAnalytics(),
|
|||
|
});
|
|||
|
fs.writeFileSync(tempConfig, configData);
|
|||
|
return tempConfig;
|
|||
|
}
|
|||
|
catch (e) {
|
|||
|
throw new ScanError(`unable to create config file: ${e}`);
|
|||
|
}
|
|||
|
}
|
|||
|
function deleteConfig(configPath) {
|
|||
|
try {
|
|||
|
rimraf.sync(path.dirname(configPath));
|
|||
|
}
|
|||
|
catch (e) {
|
|||
|
debug('unable to delete temporary directory', e);
|
|||
|
}
|
|||
|
}
|
|||
|
class ScanError extends errors_1.CustomError {
|
|||
|
constructor(message) {
|
|||
|
super(message);
|
|||
|
this.code = types_1.IaCErrorCodes.PolicyEngineScanError;
|
|||
|
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|||
|
this.userMessage = 'An error occurred when running the scan';
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 89752:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.mapSnykIacTestOutputToTestOutput = void 0;
|
|||
|
const errors_1 = __webpack_require__(87198);
|
|||
|
function mapSnykIacTestOutputToTestOutput(snykIacOutput) {
|
|||
|
var _a;
|
|||
|
const errors = (_a = snykIacOutput.errors) === null || _a === void 0 ? void 0 : _a.map((err) => new errors_1.SnykIacTestError(err));
|
|||
|
const errWithoutPath = errors === null || errors === void 0 ? void 0 : errors.find((err) => { var _a; return !((_a = err.fields) === null || _a === void 0 ? void 0 : _a.path); });
|
|||
|
if (errWithoutPath) {
|
|||
|
throw errWithoutPath;
|
|||
|
}
|
|||
|
return {
|
|||
|
results: snykIacOutput.results,
|
|||
|
errors,
|
|||
|
};
|
|||
|
}
|
|||
|
exports.mapSnykIacTestOutputToTestOutput = mapSnykIacTestOutputToTestOutput;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 88929:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.setup = void 0;
|
|||
|
const local_cache_1 = __webpack_require__(14379);
|
|||
|
async function setup(testConfig) {
|
|||
|
return await local_cache_1.initLocalCache(testConfig);
|
|||
|
}
|
|||
|
exports.setup = setup;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 14379:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.initLocalCache = void 0;
|
|||
|
const rules_bundle_1 = __webpack_require__(82373);
|
|||
|
const policy_engine_1 = __webpack_require__(41135);
|
|||
|
const file_utils_1 = __webpack_require__(52761);
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
const local_cache_1 = __webpack_require__(50089);
|
|||
|
async function initLocalCache(testConfig) {
|
|||
|
try {
|
|||
|
await file_utils_1.createDirIfNotExists(testConfig.iacCachePath);
|
|||
|
const policyEnginePath = await policy_engine_1.initPolicyEngine(testConfig);
|
|||
|
const rulesBundlePath = await rules_bundle_1.initRulesBundle(testConfig);
|
|||
|
return { policyEnginePath, rulesBundlePath };
|
|||
|
}
|
|||
|
catch (err) {
|
|||
|
throw err instanceof errors_1.CustomError ? err : new local_cache_1.FailedToInitLocalCacheError();
|
|||
|
}
|
|||
|
}
|
|||
|
exports.initLocalCache = initLocalCache;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 89574:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.policyEngineChecksum = exports.policyEngineFileName = exports.policyEngineReleaseVersion = void 0;
|
|||
|
const utils_1 = __webpack_require__(92040);
|
|||
|
/**
|
|||
|
* The Policy Engine release version associated with this Snyk CLI version.
|
|||
|
*/
|
|||
|
exports.policyEngineReleaseVersion = '0.15.0';
|
|||
|
/**
|
|||
|
* The Policy Engine executable's file name.
|
|||
|
*/
|
|||
|
exports.policyEngineFileName = utils_1.formatPolicyEngineFileName(exports.policyEngineReleaseVersion);
|
|||
|
exports.policyEngineChecksum = utils_1.getChecksum(exports.policyEngineFileName);
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 92040:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.getChecksum = exports.formatPolicyEngineFileName = void 0;
|
|||
|
const os = __webpack_require__(12087);
|
|||
|
function formatPolicyEngineFileName(releaseVersion) {
|
|||
|
let platform = 'Linux';
|
|||
|
switch (os.platform()) {
|
|||
|
case 'darwin':
|
|||
|
platform = 'Darwin';
|
|||
|
break;
|
|||
|
case 'win32':
|
|||
|
platform = 'Windows';
|
|||
|
break;
|
|||
|
}
|
|||
|
const arch = os.arch() === 'arm64' ? 'arm64' : 'x86_64';
|
|||
|
const execExt = os.platform() === 'win32' ? '.exe' : '';
|
|||
|
return `snyk-iac-test_${releaseVersion}_${platform}_${arch}${execExt}`;
|
|||
|
}
|
|||
|
exports.formatPolicyEngineFileName = formatPolicyEngineFileName;
|
|||
|
// this const is not placed in `index.ts` to avoid circular dependencies
|
|||
|
const policyEngineChecksums = `0a2566f393a963c4a863e774fb4fa055ecc5fd018407f4c92213085592693eb9 snyk-iac-test_0.15.0_Linux_x86_64
|
|||
|
5d46d756f849704cd811707e552dd9a9e047b01ea6ea43ce424ddd41936b295f snyk-iac-test_0.15.0_Linux_arm64
|
|||
|
7c2e881766c26711cd51f5027ff0f84ffae02d419a6489fd219092e5a2b3253d snyk-iac-test_0.15.0_Windows_x86_64.exe
|
|||
|
8e1f0c5ba1e0c4b3344218e1373b81a48c25f7d58e755e3032b7f995e4f0a6f8 snyk-iac-test_0.15.0_Windows_arm64.exe
|
|||
|
c456b9e7b0eb9c73e406cb955e5dfb6b0adc3cee92b3a17c23ec5f23f37f9eb4 snyk-iac-test_0.15.0_Darwin_x86_64
|
|||
|
d6d6e9b0f722b125e7be5e21a03104babad6949bb7ca6f7e2b19cc044fda9169 snyk-iac-test_0.15.0_Darwin_arm64
|
|||
|
`;
|
|||
|
function getChecksum(policyEngineFileName) {
|
|||
|
const lines = policyEngineChecksums.split(/\r?\n/);
|
|||
|
const checksumsMap = new Map();
|
|||
|
for (const line of lines) {
|
|||
|
const [checksum, file] = line.split(/\s+/);
|
|||
|
if (file && checksum) {
|
|||
|
checksumsMap.set(file, checksum.trim());
|
|||
|
}
|
|||
|
}
|
|||
|
const policyEngineChecksum = checksumsMap.get(policyEngineFileName);
|
|||
|
if (!policyEngineChecksum) {
|
|||
|
// This is an internal error and technically it should never be thrown
|
|||
|
throw new Error(`Could not find checksum for ${policyEngineFileName}`);
|
|||
|
}
|
|||
|
return policyEngineChecksum;
|
|||
|
}
|
|||
|
exports.getChecksum = getChecksum;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 18739:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.FailedToCachePolicyEngineError = exports.FailedToDownloadPolicyEngineError = exports.policyEngineUrl = exports.downloadPolicyEngine = void 0;
|
|||
|
const pathLib = __webpack_require__(85622);
|
|||
|
const crypto = __webpack_require__(76417);
|
|||
|
const createDebugLogger = __webpack_require__(15158);
|
|||
|
const error_utils_1 = __webpack_require__(36401);
|
|||
|
const types_1 = __webpack_require__(94820);
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
const metrics_1 = __webpack_require__(32971);
|
|||
|
const utils_1 = __webpack_require__(42256);
|
|||
|
const constants_1 = __webpack_require__(89574);
|
|||
|
const file_utils_1 = __webpack_require__(52761);
|
|||
|
const debugLog = createDebugLogger('snyk-iac');
|
|||
|
async function downloadPolicyEngine(testConfig) {
|
|||
|
let downloadDurationSeconds = 0;
|
|||
|
const timer = new metrics_1.TimerMetricInstance('iac_policy_engine_download');
|
|||
|
timer.start();
|
|||
|
const dataBuffer = await fetch();
|
|||
|
assertValidChecksum(dataBuffer);
|
|||
|
const cachedPolicyEnginePath = await cache(dataBuffer, testConfig.iacCachePath);
|
|||
|
timer.stop();
|
|||
|
downloadDurationSeconds = Math.round(timer.getValue() / 1000);
|
|||
|
debugLog(`Downloaded and cached Policy Engine successfully in ${downloadDurationSeconds} seconds`);
|
|||
|
return cachedPolicyEnginePath;
|
|||
|
}
|
|||
|
exports.downloadPolicyEngine = downloadPolicyEngine;
|
|||
|
async function fetch() {
|
|||
|
debugLog(`Fetching Policy Engine executable from ${exports.policyEngineUrl}`);
|
|||
|
let policyEngineDataBuffer;
|
|||
|
try {
|
|||
|
policyEngineDataBuffer = await utils_1.fetchCacheResource(exports.policyEngineUrl);
|
|||
|
}
|
|||
|
catch (err) {
|
|||
|
throw new FailedToDownloadPolicyEngineError();
|
|||
|
}
|
|||
|
debugLog('Policy Engine executable was fetched successfully');
|
|||
|
return policyEngineDataBuffer;
|
|||
|
}
|
|||
|
exports.policyEngineUrl = `https://static.snyk.io/cli/iac/test/v${constants_1.policyEngineReleaseVersion}/${constants_1.policyEngineFileName}`;
|
|||
|
class FailedToDownloadPolicyEngineError extends errors_1.CustomError {
|
|||
|
constructor() {
|
|||
|
super(`Failed to download cache resource from ${exports.policyEngineUrl}`);
|
|||
|
this.code = types_1.IaCErrorCodes.FailedToDownloadPolicyEngineError;
|
|||
|
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|||
|
this.userMessage =
|
|||
|
`Could not fetch cache resource from: ${exports.policyEngineUrl}` +
|
|||
|
'\nEnsure valid network connection.';
|
|||
|
}
|
|||
|
}
|
|||
|
exports.FailedToDownloadPolicyEngineError = FailedToDownloadPolicyEngineError;
|
|||
|
function assertValidChecksum(dataBuffer) {
|
|||
|
const computedChecksum = crypto
|
|||
|
.createHash('sha256')
|
|||
|
.update(dataBuffer)
|
|||
|
.digest('hex');
|
|||
|
if (computedChecksum !== constants_1.policyEngineChecksum) {
|
|||
|
throw new FailedToDownloadPolicyEngineError();
|
|||
|
}
|
|||
|
debugLog('Fetched Policy Engine executable has valid checksum');
|
|||
|
}
|
|||
|
async function cache(dataBuffer, iacCachePath) {
|
|||
|
const savePath = pathLib.join(iacCachePath, constants_1.policyEngineFileName);
|
|||
|
debugLog(`Caching Policy Engine executable to ${savePath}`);
|
|||
|
try {
|
|||
|
await file_utils_1.saveFile(dataBuffer, savePath);
|
|||
|
}
|
|||
|
catch (err) {
|
|||
|
throw new FailedToCachePolicyEngineError(savePath);
|
|||
|
}
|
|||
|
debugLog(`Policy Engine executable was successfully cached`);
|
|||
|
return savePath;
|
|||
|
}
|
|||
|
class FailedToCachePolicyEngineError extends errors_1.CustomError {
|
|||
|
constructor(savePath) {
|
|||
|
super(`Failed to cache Policy Engine executable to ${savePath}`);
|
|||
|
this.code = types_1.IaCErrorCodes.FailedToCachePolicyEngineError;
|
|||
|
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|||
|
this.userMessage =
|
|||
|
`Could not write the downloaded cache resource to: ${savePath}` +
|
|||
|
'\nEnsure the cache directory is writable.';
|
|||
|
}
|
|||
|
}
|
|||
|
exports.FailedToCachePolicyEngineError = FailedToCachePolicyEngineError;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 41135:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.initPolicyEngine = void 0;
|
|||
|
const createDebugLogger = __webpack_require__(15158);
|
|||
|
const lookup_local_1 = __webpack_require__(73164);
|
|||
|
const download_1 = __webpack_require__(18739);
|
|||
|
const debugLogger = createDebugLogger('snyk-iac');
|
|||
|
async function initPolicyEngine(testConfig) {
|
|||
|
debugLogger('Looking for Policy Engine locally');
|
|||
|
let policyEnginePath = await lookup_local_1.lookupLocalPolicyEngine(testConfig);
|
|||
|
if (!policyEnginePath) {
|
|||
|
debugLogger(`Downloading the Policy Engine and saving it at ${testConfig.iacCachePath}`);
|
|||
|
policyEnginePath = await download_1.downloadPolicyEngine(testConfig);
|
|||
|
}
|
|||
|
return policyEnginePath;
|
|||
|
}
|
|||
|
exports.initPolicyEngine = initPolicyEngine;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 73164:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.lookupLocalPolicyEngine = exports.InvalidUserPolicyEnginePathError = void 0;
|
|||
|
const file_utils_1 = __webpack_require__(52761);
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
const types_1 = __webpack_require__(94820);
|
|||
|
const error_utils_1 = __webpack_require__(36401);
|
|||
|
const constants_1 = __webpack_require__(89574);
|
|||
|
const utils_1 = __webpack_require__(42256);
|
|||
|
class InvalidUserPolicyEnginePathError extends errors_1.CustomError {
|
|||
|
constructor(path, message, userMessage) {
|
|||
|
super(message ||
|
|||
|
'Failed to find a valid Policy Engine executable in the configured path');
|
|||
|
this.code = types_1.IaCErrorCodes.InvalidUserPolicyEnginePathError;
|
|||
|
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|||
|
this.userMessage =
|
|||
|
userMessage ||
|
|||
|
`Could not find a valid Policy Engine executable in the configured path: ${path}` +
|
|||
|
'\nEnsure the configured path points to a valid Policy Engine executable.';
|
|||
|
}
|
|||
|
}
|
|||
|
exports.InvalidUserPolicyEnginePathError = InvalidUserPolicyEnginePathError;
|
|||
|
async function lookupLocalPolicyEngine(testConfig) {
|
|||
|
const validPolicyEngineCondition = async (path) => {
|
|||
|
return await file_utils_1.isExe(path);
|
|||
|
};
|
|||
|
try {
|
|||
|
return await utils_1.lookupLocal(testConfig.iacCachePath, constants_1.policyEngineFileName, testConfig.userPolicyEnginePath, validPolicyEngineCondition);
|
|||
|
}
|
|||
|
catch (err) {
|
|||
|
if (err instanceof utils_1.InvalidUserPathError) {
|
|||
|
throw new InvalidUserPolicyEnginePathError(testConfig.userPolicyEnginePath);
|
|||
|
}
|
|||
|
else {
|
|||
|
throw err;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
exports.lookupLocalPolicyEngine = lookupLocalPolicyEngine;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 22964:
|
|||
|
/***/ ((__unused_webpack_module, exports) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.rulesBundleName = void 0;
|
|||
|
exports.rulesBundleName = 'bundle-experimental.tar.gz';
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 30753:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.FailedToCacheRulesBundleError = exports.FailedToDownloadRulesBundleError = exports.rulesBundleUrl = exports.downloadRulesBundle = void 0;
|
|||
|
const createDebugLogger = __webpack_require__(15158);
|
|||
|
const path = __webpack_require__(85622);
|
|||
|
const error_utils_1 = __webpack_require__(36401);
|
|||
|
const types_1 = __webpack_require__(94820);
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
const metrics_1 = __webpack_require__(32971);
|
|||
|
const file_utils_1 = __webpack_require__(52761);
|
|||
|
const utils_1 = __webpack_require__(42256);
|
|||
|
const constants_1 = __webpack_require__(22964);
|
|||
|
const debugLog = createDebugLogger('snyk-iac');
|
|||
|
async function downloadRulesBundle(testConfig) {
|
|||
|
let downloadDurationSeconds = 0;
|
|||
|
const timer = new metrics_1.TimerMetricInstance('iac_rules_bundle_download');
|
|||
|
timer.start();
|
|||
|
const dataBuffer = await fetch();
|
|||
|
const cachedRulesBundlePath = await cache(dataBuffer, testConfig.iacCachePath);
|
|||
|
timer.stop();
|
|||
|
downloadDurationSeconds = Math.round(timer.getValue() / 1000);
|
|||
|
debugLog(`Downloaded and cached rules bundle successfully in ${downloadDurationSeconds} seconds`);
|
|||
|
return cachedRulesBundlePath;
|
|||
|
}
|
|||
|
exports.downloadRulesBundle = downloadRulesBundle;
|
|||
|
async function fetch() {
|
|||
|
debugLog(`Fetching rules bundle from ${exports.rulesBundleUrl}`);
|
|||
|
let rulesBundleDataBuffer;
|
|||
|
try {
|
|||
|
rulesBundleDataBuffer = await utils_1.fetchCacheResource(exports.rulesBundleUrl);
|
|||
|
}
|
|||
|
catch (err) {
|
|||
|
throw new FailedToDownloadRulesBundleError();
|
|||
|
}
|
|||
|
debugLog('Rules bundle was fetched successfully');
|
|||
|
return rulesBundleDataBuffer;
|
|||
|
}
|
|||
|
exports.rulesBundleUrl = 'https://static.snyk.io/cli/wasm/bundle-experimental.tar.gz';
|
|||
|
class FailedToDownloadRulesBundleError extends errors_1.CustomError {
|
|||
|
constructor() {
|
|||
|
super(`Failed to download cache resource from ${exports.rulesBundleUrl}`);
|
|||
|
this.code = types_1.IaCErrorCodes.FailedToDownloadRulesBundleError;
|
|||
|
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|||
|
this.userMessage =
|
|||
|
`Could not fetch cache resource from: ${exports.rulesBundleUrl}` +
|
|||
|
'\nEnsure valid network connection.';
|
|||
|
}
|
|||
|
}
|
|||
|
exports.FailedToDownloadRulesBundleError = FailedToDownloadRulesBundleError;
|
|||
|
async function cache(dataBuffer, iacCachePath) {
|
|||
|
const savePath = path.join(iacCachePath, constants_1.rulesBundleName);
|
|||
|
debugLog(`Caching rules bundle to ${savePath}`);
|
|||
|
try {
|
|||
|
await file_utils_1.saveFile(dataBuffer, savePath);
|
|||
|
}
|
|||
|
catch (err) {
|
|||
|
throw new FailedToCacheRulesBundleError(savePath);
|
|||
|
}
|
|||
|
debugLog(`Rules bundle was successfully cached`);
|
|||
|
return savePath;
|
|||
|
}
|
|||
|
class FailedToCacheRulesBundleError extends errors_1.CustomError {
|
|||
|
constructor(savePath) {
|
|||
|
super(`Failed to cache rules bundle to ${savePath}`);
|
|||
|
this.code = types_1.IaCErrorCodes.FailedToCacheRulesBundleError;
|
|||
|
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|||
|
this.userMessage =
|
|||
|
`Could not write the downloaded cache resource to: ${savePath}` +
|
|||
|
'\nEnsure the cache directory is writable.';
|
|||
|
}
|
|||
|
}
|
|||
|
exports.FailedToCacheRulesBundleError = FailedToCacheRulesBundleError;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 82373:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.initRulesBundle = void 0;
|
|||
|
const createDebugLogger = __webpack_require__(15158);
|
|||
|
const download_1 = __webpack_require__(30753);
|
|||
|
const lookup_local_1 = __webpack_require__(7062);
|
|||
|
const debugLogger = createDebugLogger('snyk-iac');
|
|||
|
async function initRulesBundle(testConfig) {
|
|||
|
debugLogger('Looking for rules bundle locally');
|
|||
|
let rulesBundlePath = await lookup_local_1.lookupLocalRulesBundle(testConfig);
|
|||
|
if (!rulesBundlePath) {
|
|||
|
debugLogger(`Downloading the rules bundle and saving it at ${testConfig.iacCachePath}`);
|
|||
|
rulesBundlePath = await download_1.downloadRulesBundle(testConfig);
|
|||
|
}
|
|||
|
return rulesBundlePath;
|
|||
|
}
|
|||
|
exports.initRulesBundle = initRulesBundle;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 7062:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.InvalidUserRulesBundlePathError = exports.lookupLocalRulesBundle = void 0;
|
|||
|
const error_utils_1 = __webpack_require__(36401);
|
|||
|
const types_1 = __webpack_require__(94820);
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
const file_utils_1 = __webpack_require__(52761);
|
|||
|
const utils_1 = __webpack_require__(42256);
|
|||
|
const constants_1 = __webpack_require__(22964);
|
|||
|
async function lookupLocalRulesBundle(testConfig) {
|
|||
|
const validRulesBundleCondition = async (path) => {
|
|||
|
return (await file_utils_1.isFile(path)) && (await file_utils_1.isArchive(path));
|
|||
|
};
|
|||
|
try {
|
|||
|
return await utils_1.lookupLocal(testConfig.iacCachePath, constants_1.rulesBundleName, testConfig.userRulesBundlePath, validRulesBundleCondition);
|
|||
|
}
|
|||
|
catch (err) {
|
|||
|
if (err instanceof utils_1.InvalidUserPathError) {
|
|||
|
throw new InvalidUserRulesBundlePathError(testConfig.userRulesBundlePath, 'Failed to find a valid Rules Bundle in the configured path');
|
|||
|
}
|
|||
|
else {
|
|||
|
throw err;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
exports.lookupLocalRulesBundle = lookupLocalRulesBundle;
|
|||
|
class InvalidUserRulesBundlePathError extends errors_1.CustomError {
|
|||
|
constructor(path, message) {
|
|||
|
super(message);
|
|||
|
this.code = types_1.IaCErrorCodes.InvalidUserRulesBundlePathError;
|
|||
|
this.strCode = error_utils_1.getErrorStringCode(this.code);
|
|||
|
this.userMessage = `Could not find a valid Rules Bundle in the configured path: ${path}`;
|
|||
|
}
|
|||
|
}
|
|||
|
exports.InvalidUserRulesBundlePathError = InvalidUserRulesBundlePathError;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 42256:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.fetchCacheResource = exports.InvalidUserPathError = exports.lookupLocal = void 0;
|
|||
|
const createDebugLogger = __webpack_require__(15158);
|
|||
|
const path = __webpack_require__(85622);
|
|||
|
const errors_1 = __webpack_require__(55191);
|
|||
|
const request_1 = __webpack_require__(52050);
|
|||
|
const debugLogger = createDebugLogger('snyk-iac');
|
|||
|
async function lookupLocal(iacCachePath, resourceName, userResourcePath, validResourceCondition) {
|
|||
|
// Lookup in custom path.
|
|||
|
if (userResourcePath) {
|
|||
|
debugLogger('User configured path detected: %s', userResourcePath);
|
|||
|
if (await validResourceCondition(userResourcePath)) {
|
|||
|
return userResourcePath;
|
|||
|
}
|
|||
|
else {
|
|||
|
// When using this function please catch this Error and throw a new specific Custom Error.
|
|||
|
throw new InvalidUserPathError(`Failed to find a valid resource in the configured path: ${userResourcePath}`);
|
|||
|
}
|
|||
|
}
|
|||
|
// Lookup in cache.
|
|||
|
else {
|
|||
|
const cachedResourcePath = path.join(iacCachePath, resourceName);
|
|||
|
if (await validResourceCondition(cachedResourcePath)) {
|
|||
|
return cachedResourcePath;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
exports.lookupLocal = lookupLocal;
|
|||
|
class InvalidUserPathError extends errors_1.CustomError {
|
|||
|
constructor(message) {
|
|||
|
super(message);
|
|||
|
}
|
|||
|
}
|
|||
|
exports.InvalidUserPathError = InvalidUserPathError;
|
|||
|
async function fetchCacheResource(url) {
|
|||
|
const { res, body: cacheResourceBuffer } = await request_1.makeRequest({
|
|||
|
url,
|
|||
|
});
|
|||
|
if (res.statusCode !== 200) {
|
|||
|
throw new errors_1.CustomError(`Failed to download cache resource from ${url}`);
|
|||
|
}
|
|||
|
return cacheResourceBuffer;
|
|||
|
}
|
|||
|
exports.fetchCacheResource = fetchCacheResource;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 79304:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.getPackageJsonPathsContainingSnykDependency = exports.checkPackageJsonForSnykDependency = exports.packageJsonFileExistsInDirectory = exports.getProtectUpgradeWarningForPaths = void 0;
|
|||
|
const os_1 = __webpack_require__(12087);
|
|||
|
const theme = __webpack_require__(86988);
|
|||
|
const fs = __webpack_require__(35747);
|
|||
|
const path = __webpack_require__(85622);
|
|||
|
const createDebug = __webpack_require__(15158);
|
|||
|
const debug = createDebug('snyk-protect-update-notification');
|
|||
|
function getProtectUpgradeWarningForPaths(packageJsonPaths) {
|
|||
|
try {
|
|||
|
if ((packageJsonPaths === null || packageJsonPaths === void 0 ? void 0 : packageJsonPaths.length) > 0) {
|
|||
|
let message = theme.color.status.warn(`${theme.icon.WARNING} WARNING: It looks like you have the \`snyk\` dependency in the \`package.json\` file(s) at the following path(s):` +
|
|||
|
os_1.EOL);
|
|||
|
packageJsonPaths.forEach((p) => {
|
|||
|
message += theme.color.status.warn(` - ${p}` + os_1.EOL);
|
|||
|
});
|
|||
|
const githubReadmeUrlShort = 'https://snyk.co/ud1cR'; // https://github.com/snyk/snyk/tree/master/packages/snyk-protect#migrating-from-snyk-protect-to-snykprotect
|
|||
|
message += theme.color.status.warn(`For more information and migration instructions, see ${githubReadmeUrlShort}` +
|
|||
|
os_1.EOL);
|
|||
|
return message;
|
|||
|
}
|
|||
|
else {
|
|||
|
return '';
|
|||
|
}
|
|||
|
}
|
|||
|
catch (e) {
|
|||
|
debug('Error in getProtectUpgradeWarningForPaths()', e);
|
|||
|
return '';
|
|||
|
}
|
|||
|
}
|
|||
|
exports.getProtectUpgradeWarningForPaths = getProtectUpgradeWarningForPaths;
|
|||
|
function packageJsonFileExistsInDirectory(directoryPath) {
|
|||
|
try {
|
|||
|
const packageJsonPath = path.resolve(directoryPath, 'package.json');
|
|||
|
const fileExists = fs.existsSync(packageJsonPath);
|
|||
|
return fileExists;
|
|||
|
}
|
|||
|
catch (e) {
|
|||
|
debug('Error in packageJsonFileExistsInDirectory()', e);
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
exports.packageJsonFileExistsInDirectory = packageJsonFileExistsInDirectory;
|
|||
|
function checkPackageJsonForSnykDependency(packageJsonPath) {
|
|||
|
try {
|
|||
|
const fileExists = fs.existsSync(packageJsonPath);
|
|||
|
if (fileExists) {
|
|||
|
const packageJson = fs.readFileSync(packageJsonPath, 'utf8');
|
|||
|
const packageJsonObject = JSON.parse(packageJson);
|
|||
|
const snykDependency = packageJsonObject.dependencies['snyk'];
|
|||
|
if (snykDependency) {
|
|||
|
return true;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
catch (e) {
|
|||
|
debug('Error in checkPackageJsonForSnykDependency()', e);
|
|||
|
}
|
|||
|
return false;
|
|||
|
}
|
|||
|
exports.checkPackageJsonForSnykDependency = checkPackageJsonForSnykDependency;
|
|||
|
function getPackageJsonPathsContainingSnykDependency(fileOption, paths) {
|
|||
|
const packageJsonPathsWithSnykDepForProtect = [];
|
|||
|
try {
|
|||
|
if (fileOption) {
|
|||
|
if (fileOption.endsWith('package.json') ||
|
|||
|
fileOption.endsWith('package-lock.json')) {
|
|||
|
const directoryWithPackageJson = path.dirname(fileOption);
|
|||
|
if (packageJsonFileExistsInDirectory(directoryWithPackageJson)) {
|
|||
|
const packageJsonPath = path.resolve(directoryWithPackageJson, 'package.json');
|
|||
|
const packageJsonContainsSnykDep = checkPackageJsonForSnykDependency(packageJsonPath);
|
|||
|
if (packageJsonContainsSnykDep) {
|
|||
|
packageJsonPathsWithSnykDepForProtect.push(packageJsonPath);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else {
|
|||
|
paths.forEach((testPath) => {
|
|||
|
if (packageJsonFileExistsInDirectory(testPath)) {
|
|||
|
const packageJsonPath = path.resolve(testPath, 'package.json');
|
|||
|
const packageJsonContainsSnykDep = checkPackageJsonForSnykDependency(packageJsonPath);
|
|||
|
if (packageJsonContainsSnykDep) {
|
|||
|
packageJsonPathsWithSnykDepForProtect.push(packageJsonPath);
|
|||
|
}
|
|||
|
}
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
catch (e) {
|
|||
|
debug('Error in getPackageJsonPathsContainingSnykDependency()', e);
|
|||
|
}
|
|||
|
return packageJsonPathsWithSnykDepForProtect;
|
|||
|
}
|
|||
|
exports.getPackageJsonPathsContainingSnykDependency = getPackageJsonPathsContainingSnykDependency;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 46816:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.mapIacIssue = exports.mapIacTestResult = void 0;
|
|||
|
const pick = __webpack_require__(25030);
|
|||
|
const IAC_ISSUES_KEY = 'infrastructureAsCodeIssues';
|
|||
|
function mapIacTestResult(iacTest) {
|
|||
|
var _a;
|
|||
|
if (iacTest instanceof Error) {
|
|||
|
return {
|
|||
|
ok: false,
|
|||
|
error: iacTest.message,
|
|||
|
path: iacTest.path,
|
|||
|
};
|
|||
|
}
|
|||
|
const infrastructureAsCodeIssues = ((_a = iacTest === null || iacTest === void 0 ? void 0 : iacTest.result) === null || _a === void 0 ? void 0 : _a.cloudConfigResults.map(mapIacIssue)) || [];
|
|||
|
const { result: { projectType }, ...filteredIacTest } = iacTest;
|
|||
|
return {
|
|||
|
...filteredIacTest,
|
|||
|
projectType,
|
|||
|
ok: infrastructureAsCodeIssues.length === 0,
|
|||
|
[IAC_ISSUES_KEY]: infrastructureAsCodeIssues,
|
|||
|
};
|
|||
|
}
|
|||
|
exports.mapIacTestResult = mapIacTestResult;
|
|||
|
function mapIacIssue(iacIssue) {
|
|||
|
// filters out & renames properties we're getting from registry and don't need for the JSON output.
|
|||
|
return {
|
|||
|
...pick(iacIssue, 'id', 'title', 'severity', 'isIgnored', 'type', 'subType', 'policyEngineType', 'documentation', 'isGeneratedByCustomRule', 'issue', 'impact', 'resolve', 'remediation', 'lineNumber', 'iacDescription', 'publicId', 'msg', 'description', 'references'),
|
|||
|
path: iacIssue.cloudConfigPath,
|
|||
|
compliance: [],
|
|||
|
};
|
|||
|
}
|
|||
|
exports.mapIacIssue = mapIacIssue;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 24083:
|
|||
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.notificationForSpotlightVulns = exports.containsSpotlightVulnIds = void 0;
|
|||
|
const theme = __webpack_require__(86988);
|
|||
|
const createDebug = __webpack_require__(15158);
|
|||
|
const os_1 = __webpack_require__(12087);
|
|||
|
const config_1 = __webpack_require__(25425);
|
|||
|
const debug = createDebug('snyk-spotlight-vuln-notification');
|
|||
|
const spotlightVulnIds = ['SNYK-JAVA-ORGAPACHELOGGINGLOG4J-2314720'];
|
|||
|
function containsSpotlightVulnIds(results) {
|
|||
|
try {
|
|||
|
const spotlightVulnsFound = new Set();
|
|||
|
for (const r of results) {
|
|||
|
if (r.vulnerabilities) {
|
|||
|
for (const v of r.vulnerabilities) {
|
|||
|
if (spotlightVulnIds.includes(v.id)) {
|
|||
|
spotlightVulnsFound.add(v.id);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
return [...spotlightVulnsFound];
|
|||
|
}
|
|||
|
catch (err) {
|
|||
|
debug('Error in containsSpotlightVulnIds()', err);
|
|||
|
return [];
|
|||
|
}
|
|||
|
}
|
|||
|
exports.containsSpotlightVulnIds = containsSpotlightVulnIds;
|
|||
|
function notificationForSpotlightVulns(foundSpotlightVulnsIds) {
|
|||
|
try {
|
|||
|
if (foundSpotlightVulnsIds.length > 0) {
|
|||
|
let message = '';
|
|||
|
for (const vulnId of spotlightVulnIds) {
|
|||
|
if (vulnId === 'SNYK-JAVA-ORGAPACHELOGGINGLOG4J-2314720') {
|
|||
|
message += theme.color.severity.critical(`${theme.icon.WARNING} WARNING: Critical severity vulnerabilities were found with Log4j!` +
|
|||
|
os_1.EOL);
|
|||
|
for (const vulnId of foundSpotlightVulnsIds) {
|
|||
|
message += ` - ${vulnId} (See ${config_1.default.PUBLIC_VULN_DB_URL}/vuln/${vulnId})`;
|
|||
|
}
|
|||
|
message += os_1.EOL + os_1.EOL;
|
|||
|
message +=
|
|||
|
theme.color.severity.critical(`We highly recommend fixing this vulnerability. If it cannot be fixed by upgrading, see mitigation information here:`) +
|
|||
|
os_1.EOL +
|
|||
|
` - ${config_1.default.PUBLIC_VULN_DB_URL}/vuln/SNYK-JAVA-ORGAPACHELOGGINGLOG4J-2314720` +
|
|||
|
os_1.EOL +
|
|||
|
` - https://snyk.io/blog/log4shell-remediation-cheat-sheet/` +
|
|||
|
os_1.EOL;
|
|||
|
}
|
|||
|
}
|
|||
|
return message;
|
|||
|
}
|
|||
|
return '';
|
|||
|
}
|
|||
|
catch (err) {
|
|||
|
debug('Error in notificationForSpotlightVulns()', err);
|
|||
|
return '';
|
|||
|
}
|
|||
|
}
|
|||
|
exports.notificationForSpotlightVulns = notificationForSpotlightVulns;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 14784:
|
|||
|
/***/ ((__unused_webpack_module, exports) => {
|
|||
|
|
|||
|
"use strict";
|
|||
|
|
|||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
|
exports.isVulnFixable = exports.isVulnPatchable = exports.isVulnUpgradable = exports.hasPatches = exports.isPatchable = exports.hasUpgrades = exports.isUpgradable = exports.hasFixes = exports.isFixable = exports.isNewVuln = void 0;
|
|||
|
// check if vuln was published in the last month
|
|||
|
function isNewVuln(vuln) {
|
|||
|
const MONTH = 30 * 24 * 60 * 60 * 1000;
|
|||
|
const publicationTime = new Date(vuln.publicationTime).getTime();
|
|||
|
return publicationTime > Date.now() - MONTH;
|
|||
|
}
|
|||
|
exports.isNewVuln = isNewVuln;
|
|||
|
function isFixable(testResult) {
|
|||
|
return isUpgradable(testResult) || isPatchable(testResult);
|
|||
|
}
|
|||
|
exports.isFixable = isFixable;
|
|||
|
function hasFixes(testResults) {
|
|||
|
return testResults.some(isFixable);
|
|||
|
}
|
|||
|
exports.hasFixes = hasFixes;
|
|||
|
function isUpgradable(testResult) {
|
|||
|
if (testResult.remediation) {
|
|||
|
const { remediation: { upgrade = {}, pin = {} }, } = testResult;
|
|||
|
return Object.keys(upgrade).length > 0 || Object.keys(pin).length > 0;
|
|||
|
}
|
|||
|
// if remediation is not available, fallback on vuln properties
|
|||
|
const { vulnerabilities = {} } = testResult;
|
|||
|
return vulnerabilities.some(isVulnUpgradable);
|
|||
|
}
|
|||
|
exports.isUpgradable = isUpgradable;
|
|||
|
function hasUpgrades(testResults) {
|
|||
|
return testResults.some(isUpgradable);
|
|||
|
}
|
|||
|
exports.hasUpgrades = hasUpgrades;
|
|||
|
function isPatchable(testResult) {
|
|||
|
if (testResult.remediation) {
|
|||
|
const { remediation: { patch = {} }, } = testResult;
|
|||
|
return Object.keys(patch).length > 0;
|
|||
|
}
|
|||
|
// if remediation is not available, fallback on vuln properties
|
|||
|
const { vulnerabilities = {} } = testResult;
|
|||
|
return vulnerabilities.some(isVulnPatchable);
|
|||
|
}
|
|||
|
exports.isPatchable = isPatchable;
|
|||
|
function hasPatches(testResults) {
|
|||
|
return testResults.some(isPatchable);
|
|||
|
}
|
|||
|
exports.hasPatches = hasPatches;
|
|||
|
function isVulnUpgradable(vuln) {
|
|||
|
return vuln.isUpgradable || vuln.isPinnable;
|
|||
|
}
|
|||
|
exports.isVulnUpgradable = isVulnUpgradable;
|
|||
|
function isVulnPatchable(vuln) {
|
|||
|
return vuln.isPatchable;
|
|||
|
}
|
|||
|
exports.isVulnPatchable = isVulnPatchable;
|
|||
|
function isVulnFixable(vuln) {
|
|||
|
return isVulnUpgradable(vuln) || isVulnPatchable(vuln);
|
|||
|
}
|
|||
|
exports.isVulnFixable = isVulnFixable;
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 61520:
|
|||
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|||
|
|
|||
|
"use strict";
|
|||
|
/* module decorator */ module = __webpack_require__.nmd(module);
|
|||
|
/* eslint-disable */
|
|||
|
|
|||
|
(function() {
|
|||
|
|
|||
|
var $goVersion = "go1.17.2";
|
|||
|
var $global,$module;if(Error.stackTraceLimit=1/0,"undefined"!=typeof window?$global=window:"undefined"!=typeof self?$global=self:"undefined"!=typeof global?($global=global).require=__webpack_require__(43810):$global=this,void 0===$global||void 0===$global.Array)throw new Error("no global object found"); true&&($module=module);var $throwRuntimeError,$linknames={},$packages={},$idCounter=0,$keys=function(e){return e?Object.keys(e):[]},$flushConsole=function(){},$throwNilPointerError=function(){$throwRuntimeError("invalid memory address or nil pointer dereference")},$call=function(e,n,r){return e.apply(n,r)},$makeFunc=function(e){return function(){return $externalize(e(this,new($sliceType($jsObjectPtr))($global.Array.prototype.slice.call(arguments,[]))),$emptyInterface)}},$unused=function(e){},$print=console.log;if(void 0!==$global.process&&$global.require)try{var util=$global.require("util");$print=function(){$global.process.stderr.write(util.format.apply(this,arguments))}}catch(e){}var $println=console.log,$initAllLinknames=function(){for(var e=$keys($packages),n=0;n<e.length;n++){var r=$packages[e[n]].$initLinknames;"function"==typeof r&&r()}},$mapArray=function(e,n){for(var r=new e.constructor(e.length),t=0;t<e.length;t++)r[t]=n(e[t]);return r},$methodVal=function(e,n){var r=e.$methodVals||{};e.$methodVals=r;var t=r[n];if(void 0!==t)return t;var i=e[n];return t=function(){$stackDepthOffset--;try{return i.apply(e,arguments)}finally{$stackDepthOffset++}},r[n]=t,t},$methodExpr=function(e,n){var r=e.prototype[n];return void 0===r.$expr&&(r.$expr=function(){$stackDepthOffset--;try{return e.wrapped&&(arguments[0]=new e(arguments[0])),Function.call.apply(r,arguments)}finally{$stackDepthOffset++}}),r.$expr},$ifaceMethodExprs={},$ifaceMethodExpr=function(e){var n=$ifaceMethodExprs["$"+e];return void 0===n&&(n=$ifaceMethodExprs["$"+e]=function(){$stackDepthOffset--;try{return Function.call.apply(arguments[0][e],arguments)}finally{$stackDepthOffset++}}),n},$subslice=function(e,n,r,t){if(void 0===r&&(r=e.$length),void 0===t&&(t=e.$capacity),(n<0||r<n||t<r||r>e.$capacity||t>e.$capacity)&&$throwRuntimeError("slice bounds out of range"),e===e.constructor.nil)return e;var i=new e.constructor(e.$array);return i.$offset=e.$offset+n,i.$length=r-n,i.$capacity=t-n,i},$substring=function(e,n,r){return(n<0||r<n||r>e.length)&&$throwRuntimeError("slice bounds out of range"),e.substring(n,r)},$sliceToNativeArray=function(e){return e.$array.constructor!==Array?e.$array.subarray(e.$offset,e.$offset+e.$length):e.$array.slice(e.$offset,e.$offset+e.$length)},$sliceToGoArray=function(e,n){var r=n.elem;return void 0!==r&&e.$length<r.len&&$throwRuntimeError("cannot convert slice with length "+e.$length+" to pointer to array with length "+r.len),e==e.constructor.nil?n.nil:e.$array.constructor!==Array?e.$array.subarray(e.$offset,e.$offset+e.$length):0==e.$offset&&e.$length==e.$capacity&&e.$length==r.len?e.$array:0==r.len?new r([]):void $throwRuntimeError("gopherjs: non-numeric slice to underlying array conversion is not supported for subslices")},$convertSliceType=function(e,n){return e==e.constructor.nil?n.nil:$subslice(new n(e.$array),e.$offset,e.$offset+e.$length)},$decodeRune=function(e,n){var r=e.charCodeAt(n);if(r<128)return[r,1];if(r!=r||r<192)return[65533,1];var t=e.charCodeAt(n+1);if(t!=t||t<128||192<=t)return[65533,1];if(r<224)return(a=(31&r)<<6|63&t)<=127?[65533,1]:[a,2];var i=e.charCodeAt(n+2);if(i!=i||i<128||192<=i)return[65533,1];if(r<240)return(a=(15&r)<<12|(63&t)<<6|63&i)<=2047?[65533,1]:55296<=a&&a<=57343?[65533,1]:[a,3];var a,o=e.charCodeAt(n+3);return o!=o||o<128||192<=o?[65533,1]:r<248?(a=(7&r)<<18|(63&t)<<12|(63&i)<<6|63&o)<=65535||1114111<a?[65533,1]:[a,4]:[65533,1]},$encodeRune=function(e){return(e<0||e>1114111||55296<=e&&e<=57343)&&(e=65533),e<=127?String.fromCharCode(e):e<=2047?String.fromCharCode(192|e>>6,128|63&e):e<=65535?String.fromCharCode(224|e>>12,128|e>>6&63,128|63&e):String.fromCharCode(240|e>>18,128|e>>12&63,128|e>>6&63,128|63&e)},$stringToBytes=function(e){for(var n=new Uint8Array(e.length),r=0;r<e.length;r++)n[r]=e.ch
|
|||
|
|
|||
|
$packages["github.com/gopherjs/gopherjs/js"]=(function(){var $pkg={},$init,A,B,L,N,Q,E,K;A=$pkg.Object=$newType(0,$kindStruct,"js.Object",true,"github.com/gopherjs/gopherjs/js",true,function(object_){this.$val=this;if(arguments.length===0){this.object=null;return;}this.object=object_;});B=$pkg.Error=$newType(0,$kindStruct,"js.Error",true,"github.com/gopherjs/gopherjs/js",true,function(Object_){this.$val=this;if(arguments.length===0){this.Object=null;return;}this.Object=Object_;});L=$sliceType($emptyInterface);N=$ptrType(A);Q=$ptrType(B);A.ptr.prototype.Get=function(a){var a,b;b=this;return b.object[$externalize(a,$String)];};A.prototype.Get=function(a){return this.$val.Get(a);};A.ptr.prototype.Set=function(a,b){var a,b,c;c=this;c.object[$externalize(a,$String)]=$externalize(b,$emptyInterface);};A.prototype.Set=function(a,b){return this.$val.Set(a,b);};A.ptr.prototype.Delete=function(a){var a,b;b=this;delete b.object[$externalize(a,$String)];};A.prototype.Delete=function(a){return this.$val.Delete(a);};A.ptr.prototype.Length=function(){var a;a=this;return $parseInt(a.object.length);};A.prototype.Length=function(){return this.$val.Length();};A.ptr.prototype.Index=function(a){var a,b;b=this;return b.object[a];};A.prototype.Index=function(a){return this.$val.Index(a);};A.ptr.prototype.SetIndex=function(a,b){var a,b,c;c=this;c.object[a]=$externalize(b,$emptyInterface);};A.prototype.SetIndex=function(a,b){return this.$val.SetIndex(a,b);};A.ptr.prototype.Call=function(a,b){var a,b,c,d;c=this;return(d=c.object,d[$externalize(a,$String)].apply(d,$externalize(b,L)));};A.prototype.Call=function(a,b){return this.$val.Call(a,b);};A.ptr.prototype.Invoke=function(a){var a,b;b=this;return b.object.apply(undefined,$externalize(a,L));};A.prototype.Invoke=function(a){return this.$val.Invoke(a);};A.ptr.prototype.New=function(a){var a,b;b=this;return new($global.Function.prototype.bind.apply(b.object,[undefined].concat($externalize(a,L))));};A.prototype.New=function(a){return this.$val.New(a);};A.ptr.prototype.Bool=function(){var a;a=this;return!!(a.object);};A.prototype.Bool=function(){return this.$val.Bool();};A.ptr.prototype.String=function(){var a;a=this;return $internalize(a.object,$String);};A.prototype.String=function(){return this.$val.String();};A.ptr.prototype.Int=function(){var a;a=this;return $parseInt(a.object)>>0;};A.prototype.Int=function(){return this.$val.Int();};A.ptr.prototype.Int64=function(){var a;a=this;return $internalize(a.object,$Int64);};A.prototype.Int64=function(){return this.$val.Int64();};A.ptr.prototype.Uint64=function(){var a;a=this;return $internalize(a.object,$Uint64);};A.prototype.Uint64=function(){return this.$val.Uint64();};A.ptr.prototype.Float=function(){var a;a=this;return $parseFloat(a.object);};A.prototype.Float=function(){return this.$val.Float();};A.ptr.prototype.Interface=function(){var a;a=this;return $internalize(a.object,$emptyInterface);};A.prototype.Interface=function(){return this.$val.Interface();};A.ptr.prototype.Unsafe=function(){var a;a=this;return a.object;};A.prototype.Unsafe=function(){return this.$val.Unsafe();};B.ptr.prototype.Error=function(){var a;a=this;return"JavaScript error: "+$internalize(a.Object.message,$String);};B.prototype.Error=function(){return this.$val.Error();};B.ptr.prototype.Stack=function(){var a;a=this;return $internalize(a.Object.stack,$String);};B.prototype.Stack=function(){return this.$val.Stack();};E=function(a){var a;return $makeFunc(a);};$pkg.MakeFunc=E;K=function(){var a;a=new B.ptr(null);$unused(a);};N.methods=[{prop:"Get",name:"Get",pkg:"",typ:$funcType([$String],[N],false)},{prop:"Set",name:"Set",pkg:"",typ:$funcType([$String,$emptyInterface],[],false)},{prop:"Delete",name:"Delete",pkg:"",typ:$funcType([$String],[],false)},{prop:"Length",name:"Length",pkg:"",typ:$funcType([],[$Int],false)},{prop:"Index",name:"Index",pkg:"",typ:$funcType([$Int],[N],false)},{prop:"SetIndex",name:"SetIndex",pkg:"",typ:$funcType([$Int,$emptyInterface],[],false)},{prop:"Call",name:"Call",pkg:"",typ:$funcType([$String,L],[N],true)},{prop:"Invoke",name:"Invoke",pkg:"",typ:$f
|
|||
|
$packages["runtime/internal/sys"]=(function(){var $pkg={},$init;$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$packages["runtime"]=(function(){var $pkg={},$init,B,A,D,E,M,T,U,AE,AS,AW,AX,AY,AZ,BA,BB,BC,BD,I,J,AL,F,G,K,L,N,O,P,Q,R,S,W,AD,AF,AI,AR,AT,AU,AV;B=$packages["github.com/gopherjs/gopherjs/js"];A=$packages["runtime/internal/sys"];D=$pkg._type=$newType(0,$kindStruct,"runtime._type",true,"runtime",false,function(str_){this.$val=this;if(arguments.length===0){this.str="";return;}this.str=str_;});E=$pkg.TypeAssertionError=$newType(0,$kindStruct,"runtime.TypeAssertionError",true,"runtime",true,function(_interface_,concrete_,asserted_,missingMethod_){this.$val=this;if(arguments.length===0){this._interface=AY.nil;this.concrete=AY.nil;this.asserted=AY.nil;this.missingMethod="";return;}this._interface=_interface_;this.concrete=concrete_;this.asserted=asserted_;this.missingMethod=missingMethod_;});M=$pkg.basicFrame=$newType(0,$kindStruct,"runtime.basicFrame",true,"runtime",false,function(FuncName_,File_,Line_){this.$val=this;if(arguments.length===0){this.FuncName="";this.File="";this.Line=0;return;}this.FuncName=FuncName_;this.File=File_;this.Line=Line_;});T=$pkg.Frames=$newType(0,$kindStruct,"runtime.Frames",true,"runtime",true,function(frames_,current_){this.$val=this;if(arguments.length===0){this.frames=BB.nil;this.current=0;return;}this.frames=frames_;this.current=current_;});U=$pkg.Frame=$newType(0,$kindStruct,"runtime.Frame",true,"runtime",true,function(PC_,Func_,Function_,File_,Line_,Entry_){this.$val=this;if(arguments.length===0){this.PC=0;this.Func=AW.nil;this.Function="";this.File="";this.Line=0;this.Entry=0;return;}this.PC=PC_;this.Func=Func_;this.Function=Function_;this.File=File_;this.Line=Line_;this.Entry=Entry_;});AE=$pkg.Func=$newType(0,$kindStruct,"runtime.Func",true,"runtime",true,function(name_,file_,line_,opaque_){this.$val=this;if(arguments.length===0){this.name="";this.file="";this.line=0;this.opaque=new AZ.ptr();return;}this.name=name_;this.file=file_;this.line=line_;this.opaque=opaque_;});AS=$pkg.errorString=$newType(8,$kindString,"runtime.errorString",true,"runtime",false,null);AW=$ptrType(AE);AX=$sliceType(AW);AY=$ptrType(D);AZ=$structType("",[]);BA=$sliceType(M);BB=$sliceType(U);BC=$ptrType(E);BD=$ptrType(T);D.ptr.prototype.string=function(){var a;a=this;return a.str;};D.prototype.string=function(){return this.$val.string();};D.ptr.prototype.pkgpath=function(){var a;a=this;return"";};D.prototype.pkgpath=function(){return this.$val.pkgpath();};E.ptr.prototype.RuntimeError=function(){};E.prototype.RuntimeError=function(){return this.$val.RuntimeError();};E.ptr.prototype.Error=function(){var a,b,c,d,e;a=this;b="interface";if(!(a._interface===AY.nil)){b=a._interface.string();}c=a.asserted.string();if(a.concrete===AY.nil){return"interface conversion: "+b+" is nil, not "+c;}d=a.concrete.string();if(a.missingMethod===""){e="interface conversion: "+b+" is "+d+", not "+c;if(d===c){if(!(a.concrete.pkgpath()===a.asserted.pkgpath())){e=e+(" (types from different packages)");}else{e=e+(" (types from different scopes)");}}return e;}return"interface conversion: "+d+" is not "+c+": missing method "+a.missingMethod;};E.prototype.Error=function(){return this.$val.Error();};F=function(){var a,b;a=$packages[$externalize("github.com/gopherjs/gopherjs/js",$String)];$jsObjectPtr=a.Object.ptr;$jsErrorPtr=a.Error.ptr;$throwRuntimeError=AT;AL=$internalize($goVersion,$String);b=$ifaceNil;b=new E.ptr(AY.nil,AY.nil,AY.nil,"");$unused(b);};G=function(){var a,b,c;a=$global.process;if(a===undefined){return"/";}b=a.env.GOPHERJS_GOROOT;if(!(b===undefined)&&!($internalize(b,$String)==="")){return $internalize(b,$String);}else{c=a.env.GOROOT;if(!(c===undefined)&&!($internalize(c,$String)==="")){return $internalize(c,$String);}}return"/usr/local/go";};$pkg.GOROOT=G;K=function(a,b,c){var a,b,c,d,e,f,g,h,i,j,k;d=b+":"+L(c);e=(f=I[$String.keyFor(d)],f!==undefined?[f.v,true]:[0,false]);g=e[0];h=e[1];if(h){return g;}i=new AE.ptr(a,b,c,new AZ.ptr());j=((J.$length>>>0));J=$append(J,i);k=d;(I||$throwRuntimeError("assignment to entry in nil map"))[$String.keyFor(k)]={k:k,v:j};return j;};L=function(a){var a;return $internalize(new($global.String)(a),$S
|
|||
|
$packages["internal/unsafeheader"]=(function(){var $pkg={},$init,A;A=$pkg.Slice=$newType(0,$kindStruct,"unsafeheader.Slice",true,"internal/unsafeheader",true,function(Data_,Len_,Cap_){this.$val=this;if(arguments.length===0){this.Data=0;this.Len=0;this.Cap=0;return;}this.Data=Data_;this.Len=Len_;this.Cap=Cap_;});A.init("",[{prop:"Data",name:"Data",embedded:false,exported:true,typ:$UnsafePointer,tag:""},{prop:"Len",name:"Len",embedded:false,exported:true,typ:$Int,tag:""},{prop:"Cap",name:"Cap",embedded:false,exported:true,typ:$Int,tag:""}]);$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$packages["internal/reflectlite"]=(function(){var $pkg={},$init,C,A,B,D,E,H,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,AB,AF,AG,AH,AS,AU,BK,BM,BN,BO,CT,CV,DT,DU,DV,DW,DX,DY,DZ,EB,EC,ED,EE,EF,EG,EH,EI,EJ,EK,EL,EM,EN,ER,ES,ET,EU,EV,EW,EX,EY,AC,AQ,BA,BC,BD,BE,BF,BG,BL,BP,BR,BT,DG,DM,AJ,AK,AL,AM,AO,AP,AT,AZ,BB,BH,BI,BJ,BQ,BS,BU,BV,BW,BX,BY,CA,CB,CE,CG,CI,CL,CP,CQ,CU,CW,CX,CY,DB,DC,DD,DE,DF,DH,DI,DJ,DK,DL;C=$packages["github.com/gopherjs/gopherjs/js"];A=$packages["internal/unsafeheader"];B=$packages["runtime"];D=$pkg.Value=$newType(0,$kindStruct,"reflectlite.Value",true,"internal/reflectlite",true,function(typ_,ptr_,flag_){this.$val=this;if(arguments.length===0){this.typ=DT.nil;this.ptr=0;this.flag=0;return;}this.typ=typ_;this.ptr=ptr_;this.flag=flag_;});E=$pkg.flag=$newType(4,$kindUintptr,"reflectlite.flag",true,"internal/reflectlite",false,null);H=$pkg.ValueError=$newType(0,$kindStruct,"reflectlite.ValueError",true,"internal/reflectlite",true,function(Method_,Kind_){this.$val=this;if(arguments.length===0){this.Method="";this.Kind=0;return;}this.Method=Method_;this.Kind=Kind_;});N=$pkg.Type=$newType(8,$kindInterface,"reflectlite.Type",true,"internal/reflectlite",true,null);O=$pkg.Kind=$newType(4,$kindUint,"reflectlite.Kind",true,"internal/reflectlite",true,null);P=$pkg.tflag=$newType(1,$kindUint8,"reflectlite.tflag",true,"internal/reflectlite",false,null);Q=$pkg.rtype=$newType(0,$kindStruct,"reflectlite.rtype",true,"internal/reflectlite",false,function(size_,ptrdata_,hash_,tflag_,align_,fieldAlign_,kind_,equal_,gcdata_,str_,ptrToThis_){this.$val=this;if(arguments.length===0){this.size=0;this.ptrdata=0;this.hash=0;this.tflag=0;this.align=0;this.fieldAlign=0;this.kind=0;this.equal=$throwNilPointerError;this.gcdata=EF.nil;this.str=0;this.ptrToThis=0;return;}this.size=size_;this.ptrdata=ptrdata_;this.hash=hash_;this.tflag=tflag_;this.align=align_;this.fieldAlign=fieldAlign_;this.kind=kind_;this.equal=equal_;this.gcdata=gcdata_;this.str=str_;this.ptrToThis=ptrToThis_;});R=$pkg.method=$newType(0,$kindStruct,"reflectlite.method",true,"internal/reflectlite",false,function(name_,mtyp_,ifn_,tfn_){this.$val=this;if(arguments.length===0){this.name=0;this.mtyp=0;this.ifn=0;this.tfn=0;return;}this.name=name_;this.mtyp=mtyp_;this.ifn=ifn_;this.tfn=tfn_;});S=$pkg.chanDir=$newType(4,$kindInt,"reflectlite.chanDir",true,"internal/reflectlite",false,null);T=$pkg.arrayType=$newType(0,$kindStruct,"reflectlite.arrayType",true,"internal/reflectlite",false,function(rtype_,elem_,slice_,len_){this.$val=this;if(arguments.length===0){this.rtype=new Q.ptr(0,0,0,0,0,0,0,$throwNilPointerError,EF.nil,0,0);this.elem=DT.nil;this.slice=DT.nil;this.len=0;return;}this.rtype=rtype_;this.elem=elem_;this.slice=slice_;this.len=len_;});U=$pkg.chanType=$newType(0,$kindStruct,"reflectlite.chanType",true,"internal/reflectlite",false,function(rtype_,elem_,dir_){this.$val=this;if(arguments.length===0){this.rtype=new Q.ptr(0,0,0,0,0,0,0,$throwNilPointerError,EF.nil,0,0);this.elem=DT.nil;this.dir=0;return;}this.rtype=rtype_;this.elem=elem_;this.dir=dir_;});V=$pkg.imethod=$newType(0,$kindStruct,"reflectlite.imethod",true,"internal/reflectlite",false,function(name_,typ_){this.$val=this;if(arguments.length===0){this.name=0;this.typ=0;return;}this.name=name_;this.typ=typ_;});W=$pkg.interfaceType=$newType(0,$kindStruct,"reflectlite.interfaceType",true,"internal/reflectlite",false,function(rtype_,pkgPath_,methods_){this.$val=this;if(arguments.length===0){this.rtype=new Q.ptr(0,0,0,0,0,0,0,$throwNilPointerError,EF.nil,0,0);this.pkgPath=new BN.ptr(EF.nil);this.methods=EJ.nil;return;}this.rtype=rtype_;this.pkgPath=pkgPath_;this.methods=methods_;});X=$pkg.mapType=$newType(0,$kindStruct,"reflectlite.mapType",true,"internal/reflectlite",false,function(rtype_,key_,elem_,bucket_,hasher_,keysize_,valuesize_,bucketsize_,flags_){this.$val=this;if(arguments.length===0){this.rtype=new Q.ptr(0,0,0,0,0,0,0,$throwNilPointerError,EF.nil,0,0);this.key=DT.nil;this.elem=DT.nil;this.bucket=DT.nil;this.hasher=$throwNilPointerError;this.keysize=0;this.valuesize=0;this.bucketsize=0;this.flags=0;return;}this.rtype=rt
|
|||
|
$packages["errors"]=(function(){var $pkg={},$init,A,G,H,L,E,a,F;A=$packages["internal/reflectlite"];G=$pkg.errorString=$newType(0,$kindStruct,"errors.errorString",true,"errors",false,function(s_){this.$val=this;if(arguments.length===0){this.s="";return;}this.s=s_;});H=$ptrType($error);L=$ptrType(G);F=function(b){var b;return new G.ptr(b);};$pkg.New=F;G.ptr.prototype.Error=function(){var b;b=this;return b.s;};G.prototype.Error=function(){return this.$val.Error();};L.methods=[{prop:"Error",name:"Error",pkg:"",typ:$funcType([],[$String],false)}];G.init("errors",[{prop:"s",name:"s",embedded:false,exported:false,typ:$String,tag:""}]);$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=A.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}a=A.TypeOf((H.nil)).Elem();$s=2;case 2:if($c){$c=false;a=a.$blk();}if(a&&a.$blk!==undefined){break s;}E=a;}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$packages["internal/cpu"]=(function(){var $pkg={},$init;$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$packages["internal/bytealg"]=(function(){var $pkg={},$init,A,C,D,F,G,N,R;A=$packages["internal/cpu"];C=function(b,c){var b,c,d;d=0;while(true){if(!(d<b.length)){break;}if(b.charCodeAt(d)===c){return d;}d=d+(1)>>0;}return-1;};$pkg.IndexByteString=C;D=function(b,c){var b,c;$panic(new $String("unimplemented"));};$pkg.Index=D;F=function(b){var b;$panic(new $String("unimplemented"));};$pkg.Cutover=F;G=function(b,c){var b,c,d,e,f,g;if(!((b.$length===c.$length))){return false;}d=b;e=0;while(true){if(!(e<d.$length)){break;}f=e;g=((e<0||e>=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+e]);if(!((g===((f<0||f>=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+f])))){return false;}e++;}return true;};$pkg.Equal=G;N=function(b){var b,c,d,e,f,g,h,i;c=0;d=0;while(true){if(!(d<b.$length)){break;}c=($imul(c,16777619)>>>0)+((((d<0||d>=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+d])>>>0))>>>0;d=d+(1)>>0;}e=1;f=16777619;g=e;h=f;i=b.$length;while(true){if(!(i>0)){break;}if(!(((i&1)===0))){g=$imul(g,(h))>>>0;}h=$imul(h,(h))>>>0;i=(i>>$min((1),31))>>0;}return[c,g];};$pkg.HashStrBytes=N;R=function(b,c){var b,c,d,e,f,g,h,i,j,k;d=N(c);e=d[0];f=d[1];g=c.$length;h=0;i=0;while(true){if(!(i<g)){break;}h=($imul(h,16777619)>>>0)+((((i<0||i>=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+i])>>>0))>>>0;i=i+(1)>>0;}if((h===e)&&G($subslice(b,0,g),c)){return 0;}j=g;while(true){if(!(j<b.$length)){break;}h=$imul(h,(16777619))>>>0;h=h+(((((j<0||j>=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+j])>>>0)))>>>0;h=h-(($imul(f,(((k=j-g>>0,((k<0||k>=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+k]))>>>0)))>>>0))>>>0;j=j+(1)>>0;if((h===e)&&G($subslice(b,(j-g>>0),j),c)){return j-g>>0;}}return-1;};$pkg.IndexRabinKarpBytes=R;$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=A.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$pkg.MaxLen=0;}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$packages["internal/race"]=(function(){var $pkg={},$init,A,B,C,D,E,H,I;A=function(a){var a;};$pkg.Acquire=A;B=function(a){var a;};$pkg.Release=B;C=function(a){var a;};$pkg.ReleaseMerge=C;D=function(){};$pkg.Disable=D;E=function(){};$pkg.Enable=E;H=function(a,b){var a,b;};$pkg.ReadRange=H;I=function(a,b){var a,b;};$pkg.WriteRange=I;$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$packages["sync/atomic"]=(function(){var $pkg={},$init,A,B,AJ,L,O,R,W,Y,Z,AC,AE,AI;A=$packages["github.com/gopherjs/gopherjs/js"];B=$pkg.Value=$newType(0,$kindStruct,"atomic.Value",true,"sync/atomic",true,function(v_){this.$val=this;if(arguments.length===0){this.v=$ifaceNil;return;}this.v=v_;});AJ=$ptrType(B);L=function(ad,ae,af){var ad,ae,af;if(ad.$get()===ae){ad.$set(af);return true;}return false;};$pkg.CompareAndSwapInt32=L;O=function(ad,ae,af){var ad,ae,af,ag;if((ag=ad.$get(),(ag.$high===ae.$high&&ag.$low===ae.$low))){ad.$set(af);return true;}return false;};$pkg.CompareAndSwapUint64=O;R=function(ad,ae){var ad,ae,af;af=ad.$get()+ae>>0;ad.$set(af);return af;};$pkg.AddInt32=R;W=function(ad){var ad;return ad.$get();};$pkg.LoadInt32=W;Y=function(ad){var ad;return ad.$get();};$pkg.LoadUint32=Y;Z=function(ad){var ad;return ad.$get();};$pkg.LoadUint64=Z;AC=function(ad,ae){var ad,ae;ad.$set(ae);};$pkg.StoreInt32=AC;AE=function(ad,ae){var ad,ae;ad.$set(ae);};$pkg.StoreUint32=AE;B.ptr.prototype.Load=function(){var ad,ae;ad=$ifaceNil;ae=this;ad=ae.v;return ad;};B.prototype.Load=function(){return this.$val.Load();};B.ptr.prototype.Store=function(ad){var ad,ae;ae=this;ae.checkNew("store",ad);ae.v=ad;};B.prototype.Store=function(ad){return this.$val.Store(ad);};B.ptr.prototype.Swap=function(ad){var ad,ae,af,ag,ah;ae=$ifaceNil;af=this;af.checkNew("swap",ad);ag=af.v;ah=ad;ae=ag;af.v=ah;ae=ae;return ae;};B.prototype.Swap=function(ad){return this.$val.Swap(ad);};B.ptr.prototype.CompareAndSwap=function(ad,ae){var ad,ae,af,ag;af=false;ag=this;ag.checkNew("compare and swap",ae);if(!($interfaceIsEqual(ag.v,$ifaceNil)&&$interfaceIsEqual(ad,$ifaceNil))&&!AI(ad,ae)){$panic(new $String("sync/atomic: compare and swap of inconsistently typed values into Value"));}if(!($interfaceIsEqual(ag.v,ad))){af=false;return af;}ag.v=ae;af=true;return af;};B.prototype.CompareAndSwap=function(ad,ae){return this.$val.CompareAndSwap(ad,ae);};B.ptr.prototype.checkNew=function(ad,ae){var ad,ae,af;af=this;if($interfaceIsEqual(ae,$ifaceNil)){$panic(new $String("sync/atomic: "+ad+" of nil value into Value"));}if(!($interfaceIsEqual(af.v,$ifaceNil))&&!AI(ae,af.v)){$panic(new $String("sync/atomic: "+ad+" of inconsistently typed value into Value"));}};B.prototype.checkNew=function(ad,ae){return this.$val.checkNew(ad,ae);};AI=function(ad,ae){var ad,ae;return ad.constructor===ae.constructor;};AJ.methods=[{prop:"Load",name:"Load",pkg:"",typ:$funcType([],[$emptyInterface],false)},{prop:"Store",name:"Store",pkg:"",typ:$funcType([$emptyInterface],[],false)},{prop:"Swap",name:"Swap",pkg:"",typ:$funcType([$emptyInterface],[$emptyInterface],false)},{prop:"CompareAndSwap",name:"CompareAndSwap",pkg:"",typ:$funcType([$emptyInterface,$emptyInterface],[$Bool],false)},{prop:"checkNew",name:"checkNew",pkg:"sync/atomic",typ:$funcType([$String,$emptyInterface],[],false)}];B.init("sync/atomic",[{prop:"v",name:"v",embedded:false,exported:false,typ:$emptyInterface,tag:""}]);$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=A.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$packages["sync"]=(function(){var $pkg={},$init,C,A,B,D,E,F,T,U,V,AL,AT,AV,AW,AX,BG,BH,BM,BN,BO,BU,BV,BW,Y,AC,AD,K,L,AF,AG,AH,AI,AJ,AK;C=$packages["github.com/gopherjs/gopherjs/js"];A=$packages["internal/race"];B=$packages["sync/atomic"];D=$pkg.RWMutex=$newType(0,$kindStruct,"sync.RWMutex",true,"sync",true,function(w_,writerSem_,readerSem_,readerCount_,readerWait_){this.$val=this;if(arguments.length===0){this.w=new U.ptr(0,0);this.writerSem=0;this.readerSem=0;this.readerCount=0;this.readerWait=0;return;}this.w=w_;this.writerSem=writerSem_;this.readerSem=readerSem_;this.readerCount=readerCount_;this.readerWait=readerWait_;});E=$pkg.rlocker=$newType(0,$kindStruct,"sync.rlocker",true,"sync",false,function(w_,writerSem_,readerSem_,readerCount_,readerWait_){this.$val=this;if(arguments.length===0){this.w=new U.ptr(0,0);this.writerSem=0;this.readerSem=0;this.readerCount=0;this.readerWait=0;return;}this.w=w_;this.writerSem=writerSem_;this.readerSem=readerSem_;this.readerCount=readerCount_;this.readerWait=readerWait_;});F=$pkg.notifyList=$newType(0,$kindStruct,"sync.notifyList",true,"sync",false,function(wait_,notify_,lock_,head_,tail_){this.$val=this;if(arguments.length===0){this.wait=0;this.notify=0;this.lock=0;this.head=0;this.tail=0;return;}this.wait=wait_;this.notify=notify_;this.lock=lock_;this.head=head_;this.tail=tail_;});T=$pkg.Once=$newType(0,$kindStruct,"sync.Once",true,"sync",true,function(done_,m_){this.$val=this;if(arguments.length===0){this.done=0;this.m=new U.ptr(0,0);return;}this.done=done_;this.m=m_;});U=$pkg.Mutex=$newType(0,$kindStruct,"sync.Mutex",true,"sync",true,function(state_,sema_){this.$val=this;if(arguments.length===0){this.state=0;this.sema=0;return;}this.state=state_;this.sema=sema_;});V=$pkg.Locker=$newType(8,$kindInterface,"sync.Locker",true,"sync",true,null);AL=$pkg.Pool=$newType(0,$kindStruct,"sync.Pool",true,"sync",true,function(store_,New_){this.$val=this;if(arguments.length===0){this.store=BU.nil;this.New=$throwNilPointerError;return;}this.store=store_;this.New=New_;});AT=$ptrType($Uint32);AV=$ptrType($Int32);AW=$ptrType(E);AX=$ptrType(D);BG=$chanType($Bool,false,false);BH=$sliceType(BG);BM=$funcType([],[],false);BN=$ptrType(T);BO=$ptrType(U);BU=$sliceType($emptyInterface);BV=$ptrType(AL);BW=$funcType([],[$emptyInterface],false);D.ptr.prototype.RLock=function(){var j,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;j=$f.j;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:j=this;if(false){}if(B.AddInt32((j.$ptr_readerCount||(j.$ptr_readerCount=new AV(function(){return this.$target.readerCount;},function($v){this.$target.readerCount=$v;},j))),1)<0){$s=1;continue;}$s=2;continue;case 1:$r=AF((j.$ptr_readerSem||(j.$ptr_readerSem=new AT(function(){return this.$target.readerSem;},function($v){this.$target.readerSem=$v;},j))),false,0);$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}case 2:if(false){}$s=-1;return;}return;}if($f===undefined){$f={$blk:D.ptr.prototype.RLock};}$f.j=j;$f.$s=$s;$f.$r=$r;return $f;};D.prototype.RLock=function(){return this.$val.RLock();};D.ptr.prototype.RUnlock=function(){var j,k,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;j=$f.j;k=$f.k;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:j=this;if(false){}k=B.AddInt32((j.$ptr_readerCount||(j.$ptr_readerCount=new AV(function(){return this.$target.readerCount;},function($v){this.$target.readerCount=$v;},j))),-1);if(k<0){$s=1;continue;}$s=2;continue;case 1:$r=j.rUnlockSlow(k);$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}case 2:if(false){}$s=-1;return;}return;}if($f===undefined){$f={$blk:D.ptr.prototype.RUnlock};}$f.j=j;$f.k=k;$f.$s=$s;$f.$r=$r;return $f;};D.prototype.RUnlock=function(){return this.$val.RUnlock();};D.ptr.prototype.rUnlockSlow=function(j){var j,k,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;j=$f.j;k=$f.k;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:k=this;if(((j+1>>0)===0)||((j+1>>0)===-1073741824)){A.Enable();AK("sync: RU
|
|||
|
$packages["io"]=(function(){var $pkg={},$init,A,B,N,O,T,Z,AA,AD,AE,AG,AH,AI,AR,BE,BF,BG,BL,M,AU,AV,AZ,AJ,AK,AL,AN,AP;A=$packages["errors"];B=$packages["sync"];N=$pkg.Reader=$newType(8,$kindInterface,"io.Reader",true,"io",true,null);O=$pkg.Writer=$newType(8,$kindInterface,"io.Writer",true,"io",true,null);T=$pkg.WriteCloser=$newType(8,$kindInterface,"io.WriteCloser",true,"io",true,null);Z=$pkg.ReaderFrom=$newType(8,$kindInterface,"io.ReaderFrom",true,"io",true,null);AA=$pkg.WriterTo=$newType(8,$kindInterface,"io.WriterTo",true,"io",true,null);AD=$pkg.ByteReader=$newType(8,$kindInterface,"io.ByteReader",true,"io",true,null);AE=$pkg.ByteScanner=$newType(8,$kindInterface,"io.ByteScanner",true,"io",true,null);AG=$pkg.RuneReader=$newType(8,$kindInterface,"io.RuneReader",true,"io",true,null);AH=$pkg.RuneScanner=$newType(8,$kindInterface,"io.RuneScanner",true,"io",true,null);AI=$pkg.StringWriter=$newType(8,$kindInterface,"io.StringWriter",true,"io",true,null);AR=$pkg.LimitedReader=$newType(0,$kindStruct,"io.LimitedReader",true,"io",true,function(R_,N_){this.$val=this;if(arguments.length===0){this.R=$ifaceNil;this.N=new $Int64(0,0);return;}this.R=R_;this.N=N_;});BE=$sliceType($emptyInterface);BF=$sliceType($Uint8);BG=$ptrType(BF);BL=$ptrType(AR);AJ=function(c,d){var c,d,e,f,g,h,i,j,k,l,m,n,o,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;m=$f.m;n=$f.n;o=$f.o;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:e=0;f=$ifaceNil;g=$assertType(c,AI,true);h=g[0];i=g[1];if(i){$s=1;continue;}$s=2;continue;case 1:k=h.WriteString(d);$s=3;case 3:if($c){$c=false;k=k.$blk();}if(k&&k.$blk!==undefined){break s;}j=k;e=j[0];f=j[1];l=[e,f];$s=4;case 4:return l;case 2:n=c.Write((new BF($stringToBytes(d))));$s=5;case 5:if($c){$c=false;n=n.$blk();}if(n&&n.$blk!==undefined){break s;}m=n;e=m[0];f=m[1];o=[e,f];$s=6;case 6:return o;}return;}if($f===undefined){$f={$blk:AJ};}$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.k=k;$f.l=l;$f.m=m;$f.n=n;$f.o=o;$f.$s=$s;$f.$r=$r;return $f;};$pkg.WriteString=AJ;AK=function(c,d,e){var c,d,e,f,g,h,i,j,k,l,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:f=0;g=$ifaceNil;if(d.$length<e){h=0;i=$pkg.ErrShortBuffer;f=h;g=i;$s=-1;return[f,g];}case 1:if(!(f<e&&$interfaceIsEqual(g,$ifaceNil))){$s=2;continue;}j=0;l=c.Read($subslice(d,f));$s=3;case 3:if($c){$c=false;l=l.$blk();}if(l&&l.$blk!==undefined){break s;}k=l;j=k[0];g=k[1];f=f+(j)>>0;$s=1;continue;case 2:if(f>=e){g=$ifaceNil;}else if(f>0&&$interfaceIsEqual(g,$pkg.EOF)){g=$pkg.ErrUnexpectedEOF;}$s=-1;return[f,g];}return;}if($f===undefined){$f={$blk:AK};}$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.k=k;$f.l=l;$f.$s=$s;$f.$r=$r;return $f;};$pkg.ReadAtLeast=AK;AL=function(c,d){var c,d,e,f,g,h,i,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:e=0;f=$ifaceNil;h=AK(c,d,d.$length);$s=1;case 1:if($c){$c=false;h=h.$blk();}if(h&&h.$blk!==undefined){break s;}g=h;e=g[0];f=g[1];i=[e,f];$s=2;case 2:return i;}return;}if($f===undefined){$f={$blk:AL};}$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.$s=$s;$f.$r=$r;return $f;};$pkg.ReadFull=AL;AN=function(c,d){var c,d,e,f,g,h,i,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:e=new $Int64(0,0);f=$ifaceNil;h=AP(c,d,BF.nil);$s=1;case 1:if($c){$c=false;h=h.$blk();}if(h&&h.$blk!==undefined){break s;}g=h;e=g[0];f=g[1];i=[e,f];$s=2;case 2:return i;}return;}if($f===undefined){$f={$blk:AN};}$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.$s=$s;$f.$r=$r;return $f;};$pkg.Copy=AN;AP=function(c,d,e){var aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,
|
|||
|
$packages["unicode"]=(function(){var $pkg={},$init,IF,IG,IH,II,IK,IW,JM,JN,JO,JP,JQ,JR,JS,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR,AS,AT,AU,AV,AW,AX,AY,AZ,BA,BB,BC,BD,BE,BF,BG,BH,BI,BJ,BK,BL,BM,BN,BO,BP,BQ,BR,BS,BT,BU,BV,BW,BX,BY,BZ,CA,CB,CC,CD,CE,CF,CG,CH,CI,CJ,CK,CL,CM,CN,CO,CP,CQ,CR,CS,CT,CU,CV,CW,CX,CY,CZ,DA,DB,DC,DD,DE,DF,DG,DH,DI,DJ,DK,DL,DM,DN,DO,DP,DQ,DR,DS,DT,DU,DV,DW,DX,DY,DZ,EA,EB,EC,ED,EE,EF,EG,EH,EI,EJ,EK,EL,EM,EN,EO,EP,EQ,ER,ES,ET,EU,EV,EW,EX,EY,EZ,FA,FB,FC,FD,FE,FF,FG,FH,FI,FJ,FK,FL,FM,FN,FO,FP,FQ,FR,FS,FT,FU,FV,FW,FX,FY,FZ,GA,GB,GC,GD,GE,GF,GG,GH,GI,GJ,HR,HS,HT,HU,HV,HW,HX,HY,HZ,IA,IB,IC,ID,IE,IL,IM,IN,IO,IP,IS,IT,IU,IV,IX,IZ,JB,JD,JH,JJ,JK;IF=$pkg.RangeTable=$newType(0,$kindStruct,"unicode.RangeTable",true,"unicode",true,function(R16_,R32_,LatinOffset_){this.$val=this;if(arguments.length===0){this.R16=JM.nil;this.R32=JN.nil;this.LatinOffset=0;return;}this.R16=R16_;this.R32=R32_;this.LatinOffset=LatinOffset_;});IG=$pkg.Range16=$newType(0,$kindStruct,"unicode.Range16",true,"unicode",true,function(Lo_,Hi_,Stride_){this.$val=this;if(arguments.length===0){this.Lo=0;this.Hi=0;this.Stride=0;return;}this.Lo=Lo_;this.Hi=Hi_;this.Stride=Stride_;});IH=$pkg.Range32=$newType(0,$kindStruct,"unicode.Range32",true,"unicode",true,function(Lo_,Hi_,Stride_){this.$val=this;if(arguments.length===0){this.Lo=0;this.Hi=0;this.Stride=0;return;}this.Lo=Lo_;this.Hi=Hi_;this.Stride=Stride_;});II=$pkg.CaseRange=$newType(0,$kindStruct,"unicode.CaseRange",true,"unicode",true,function(Lo_,Hi_,Delta_){this.$val=this;if(arguments.length===0){this.Lo=0;this.Hi=0;this.Delta=JQ.zero();return;}this.Lo=Lo_;this.Hi=Hi_;this.Delta=Delta_;});IK=$pkg.d=$newType(12,$kindArray,"unicode.d",true,"unicode",false,null);IW=$pkg.foldPair=$newType(0,$kindStruct,"unicode.foldPair",true,"unicode",false,function(From_,To_){this.$val=this;if(arguments.length===0){this.From=0;this.To=0;return;}this.From=From_;this.To=To_;});JM=$sliceType(IG);JN=$sliceType(IH);JO=$sliceType(IW);JP=$sliceType(II);JQ=$arrayType($Int32,3);JR=$ptrType(IF);JS=$sliceType(JR);IL=function(b,c){var b,c,d,e,f,g,h,i,j,k,l,m,n;if(b.$length<=18||c<=255){d=b;e=0;while(true){if(!(e<d.$length)){break;}f=e;g=((f<0||f>=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+f]);if(c<g.Lo){return false;}if(c<=g.Hi){return(g.Stride===1)||((h=((c-g.Lo<<16>>>16))%g.Stride,h===h?h:$throwRuntimeError("integer divide by zero"))===0);}e++;}return false;}i=0;j=b.$length;while(true){if(!(i<j)){break;}l=i+(k=((j-i>>0))/2,(k===k&&k!==1/0&&k!==-1/0)?k>>0:$throwRuntimeError("integer divide by zero"))>>0;m=((l<0||l>=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+l]);if(m.Lo<=c&&c<=m.Hi){return(m.Stride===1)||((n=((c-m.Lo<<16>>>16))%m.Stride,n===n?n:$throwRuntimeError("integer divide by zero"))===0);}if(c<m.Lo){j=l;}else{i=l+1>>0;}}return false;};IM=function(b,c){var b,c,d,e,f,g,h,i,j,k,l,m,n;if(b.$length<=18){d=b;e=0;while(true){if(!(e<d.$length)){break;}f=e;g=((f<0||f>=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+f]);if(c<g.Lo){return false;}if(c<=g.Hi){return(g.Stride===1)||((h=((c-g.Lo>>>0))%g.Stride,h===h?h:$throwRuntimeError("integer divide by zero"))===0);}e++;}return false;}i=0;j=b.$length;while(true){if(!(i<j)){break;}l=i+(k=((j-i>>0))/2,(k===k&&k!==1/0&&k!==-1/0)?k>>0:$throwRuntimeError("integer divide by zero"))>>0;m=$clone(((l<0||l>=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+l]),IH);if(m.Lo<=c&&c<=m.Hi){return(m.Stride===1)||((n=((c-m.Lo>>>0))%m.Stride,n===n?n:$throwRuntimeError("integer divide by zero"))===0);}if(c<m.Lo){j=l;}else{i=l+1>>0;}}return false;};IN=function(b,c){var b,c,d,e,f;d=b.R16;if(d.$length>0&&((c>>>0))<=(((e=d.$length-1>>0,((e<0||e>=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+e])).Hi>>>0))){return IL(d,((c<<16>>>16)));}f=b.R32;if(f.$length>0&&c>=(((0>=f.$length?($throwRuntimeError("index out of range"),undefined):f.$array[f.$offset+0]).Lo>
|
|||
|
$packages["unicode/utf8"]=(function(){var $pkg={},$init,B,A,C,D,F,G,H,I,J,K,L,M,N,P,Q;B=$pkg.acceptRange=$newType(0,$kindStruct,"utf8.acceptRange",true,"unicode/utf8",false,function(lo_,hi_){this.$val=this;if(arguments.length===0){this.lo=0;this.hi=0;return;}this.lo=lo_;this.hi=hi_;});D=function(a){var a,b,c,d,e,f;b=a.$length;if(b===0){return false;}d=(c=(0>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+0]),((c<0||c>=A.length)?($throwRuntimeError("index out of range"),undefined):A[c]));if(b>=((((d&7)>>>0)>>0))){return true;}f=$clone((e=d>>>4<<24>>>24,((e<0||e>=C.length)?($throwRuntimeError("index out of range"),undefined):C[e])),B);if(b>1&&((1>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+1])<f.lo||f.hi<(1>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+1]))){return true;}else if(b>2&&((2>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+2])<128||191<(2>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+2]))){return true;}return false;};$pkg.FullRune=D;F=function(a){var a,aa,ab,ac,ad,ae,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;b=0;c=0;d=a.$length;if(d<1){e=65533;f=0;b=e;c=f;return[b,c];}g=(0>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+0]);h=((g<0||g>=A.length)?($throwRuntimeError("index out of range"),undefined):A[g]);if(h>=240){i=(((h>>0))<<31>>0)>>31>>0;j=(((((0>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+0])>>0))&~i)>>0)|(65533&i);k=1;b=j;c=k;return[b,c];}l=((((h&7)>>>0)>>0));n=$clone((m=h>>>4<<24>>>24,((m<0||m>=C.length)?($throwRuntimeError("index out of range"),undefined):C[m])),B);if(d<l){o=65533;p=1;b=o;c=p;return[b,c];}q=(1>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+1]);if(q<n.lo||n.hi<q){r=65533;s=1;b=r;c=s;return[b,c];}if(l<=2){t=(((((g&31)>>>0)>>0))<<6>>0)|((((q&63)>>>0)>>0));u=2;b=t;c=u;return[b,c];}v=(2>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+2]);if(v<128||191<v){w=65533;x=1;b=w;c=x;return[b,c];}if(l<=3){y=((((((g&15)>>>0)>>0))<<12>>0)|(((((q&63)>>>0)>>0))<<6>>0))|((((v&63)>>>0)>>0));z=3;b=y;c=z;return[b,c];}aa=(3>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+3]);if(aa<128||191<aa){ab=65533;ac=1;b=ab;c=ac;return[b,c];}ad=(((((((g&7)>>>0)>>0))<<18>>0)|(((((q&63)>>>0)>>0))<<12>>0))|(((((v&63)>>>0)>>0))<<6>>0))|((((aa&63)>>>0)>>0));ae=4;b=ad;c=ae;return[b,c];};$pkg.DecodeRune=F;G=function(a){var a,aa,ab,ac,ad,ae,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;b=0;c=0;d=a.length;if(d<1){e=65533;f=0;b=e;c=f;return[b,c];}g=a.charCodeAt(0);h=((g<0||g>=A.length)?($throwRuntimeError("index out of range"),undefined):A[g]);if(h>=240){i=(((h>>0))<<31>>0)>>31>>0;j=((((a.charCodeAt(0)>>0))&~i)>>0)|(65533&i);k=1;b=j;c=k;return[b,c];}l=((((h&7)>>>0)>>0));n=$clone((m=h>>>4<<24>>>24,((m<0||m>=C.length)?($throwRuntimeError("index out of range"),undefined):C[m])),B);if(d<l){o=65533;p=1;b=o;c=p;return[b,c];}q=a.charCodeAt(1);if(q<n.lo||n.hi<q){r=65533;s=1;b=r;c=s;return[b,c];}if(l<=2){t=(((((g&31)>>>0)>>0))<<6>>0)|((((q&63)>>>0)>>0));u=2;b=t;c=u;return[b,c];}v=a.charCodeAt(2);if(v<128||191<v){w=65533;x=1;b=w;c=x;return[b,c];}if(l<=3){y=((((((g&15)>>>0)>>0))<<12>>0)|(((((q&63)>>>0)>>0))<<6>>0))|((((v&63)>>>0)>>0));z=3;b=y;c=z;return[b,c];}aa=a.charCodeAt(3);if(aa<128||191<aa){ab=65533;ac=1;b=ab;c=ac;return[b,c];}ad=(((((((g&7)>>>0)>>0))<<18>>0)|(((((q&63)>>>0)>>0))<<12>>0))|(((((v&63)>>>0)>>0))<<6>>0))|((((aa&63)>>>0)>>0));ae=4;b=ad;c=ae;return[b,c];};$pkg.DecodeRuneInString=G;H=function(a){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o;b=0;c=0;d=a.$length;if(d===0){e=65533;f=0;b=e;c=f;return[b,c];}g=d-1>>0;b=((((g<0||g>=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+g])>>0));if(b<128){h=b;i=1;b=h;c=i;return[b,c];}j=d-4>>0;if(j<0){j=0;}g=g-(1)>>0;while(true){if(!(g>=j)){break;}if(N(((g<0||g>=a.$length)?($throwRuntimeError("index ou
|
|||
|
$packages["bytes"]=(function(){var $pkg={},$init,A,D,B,E,C,F,BA,BM,BN,BT,BV,BW,BZ,CB,CC,AA,BO,BQ,G,H,I,J,S,AE,AR,AS,AT,AW,AY,AZ,BB,BC,BF,BG,BK,BL,BP;A=$packages["errors"];D=$packages["internal/bytealg"];B=$packages["io"];E=$packages["unicode"];C=$packages["unicode/utf8"];F=$pkg.Reader=$newType(0,$kindStruct,"bytes.Reader",true,"bytes",true,function(s_,i_,prevRune_){this.$val=this;if(arguments.length===0){this.s=BT.nil;this.i=new $Int64(0,0);this.prevRune=0;return;}this.s=s_;this.i=i_;this.prevRune=prevRune_;});BA=$pkg.asciiSet=$newType(32,$kindArray,"bytes.asciiSet",true,"bytes",false,null);BM=$pkg.Buffer=$newType(0,$kindStruct,"bytes.Buffer",true,"bytes",true,function(buf_,off_,lastRead_){this.$val=this;if(arguments.length===0){this.buf=BT.nil;this.off=0;this.lastRead=0;return;}this.buf=buf_;this.off=off_;this.lastRead=lastRead_;});BN=$pkg.readOp=$newType(1,$kindInt8,"bytes.readOp",true,"bytes",false,null);BT=$sliceType($Uint8);BV=$arrayType($Uint8,4);BW=$ptrType(BA);BZ=$arrayType($Uint32,8);CB=$ptrType(BM);CC=$ptrType(F);F.ptr.prototype.Len=function(){var d,e,f,g,h,i;d=this;if((e=d.i,f=(new $Int64(0,d.s.$length)),(e.$high>f.$high||(e.$high===f.$high&&e.$low>=f.$low)))){return 0;}return(((g=(h=(new $Int64(0,d.s.$length)),i=d.i,new $Int64(h.$high-i.$high,h.$low-i.$low)),g.$low+((g.$high>>31)*4294967296))>>0));};F.prototype.Len=function(){return this.$val.Len();};F.ptr.prototype.Size=function(){var d;d=this;return(new $Int64(0,d.s.$length));};F.prototype.Size=function(){return this.$val.Size();};F.ptr.prototype.Read=function(d){var d,e,f,g,h,i,j,k,l,m;e=0;f=$ifaceNil;g=this;if((h=g.i,i=(new $Int64(0,g.s.$length)),(h.$high>i.$high||(h.$high===i.$high&&h.$low>=i.$low)))){j=0;k=B.EOF;e=j;f=k;return[e,f];}g.prevRune=-1;e=$copySlice(d,$subslice(g.s,$flatten64(g.i)));g.i=(l=g.i,m=(new $Int64(0,e)),new $Int64(l.$high+m.$high,l.$low+m.$low));return[e,f];};F.prototype.Read=function(d){return this.$val.Read(d);};F.ptr.prototype.ReadAt=function(d,e){var d,e,f,g,h,i,j,k,l,m;f=0;g=$ifaceNil;h=this;if((e.$high<0||(e.$high===0&&e.$low<0))){i=0;j=A.New("bytes.Reader.ReadAt: negative offset");f=i;g=j;return[f,g];}if((k=(new $Int64(0,h.s.$length)),(e.$high>k.$high||(e.$high===k.$high&&e.$low>=k.$low)))){l=0;m=B.EOF;f=l;g=m;return[f,g];}f=$copySlice(d,$subslice(h.s,$flatten64(e)));if(f<d.$length){g=B.EOF;}return[f,g];};F.prototype.ReadAt=function(d,e){return this.$val.ReadAt(d,e);};F.ptr.prototype.ReadByte=function(){var d,e,f,g,h,i,j,k;d=this;d.prevRune=-1;if((e=d.i,f=(new $Int64(0,d.s.$length)),(e.$high>f.$high||(e.$high===f.$high&&e.$low>=f.$low)))){return[0,B.EOF];}i=(g=d.s,h=d.i,(($flatten64(h)<0||$flatten64(h)>=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+$flatten64(h)]));d.i=(j=d.i,k=new $Int64(0,1),new $Int64(j.$high+k.$high,j.$low+k.$low));return[i,$ifaceNil];};F.prototype.ReadByte=function(){return this.$val.ReadByte();};F.ptr.prototype.UnreadByte=function(){var d,e,f,g;d=this;if((e=d.i,(e.$high<0||(e.$high===0&&e.$low<=0)))){return A.New("bytes.Reader.UnreadByte: at beginning of slice");}d.prevRune=-1;d.i=(f=d.i,g=new $Int64(0,1),new $Int64(f.$high-g.$high,f.$low-g.$low));return $ifaceNil;};F.prototype.UnreadByte=function(){return this.$val.UnreadByte();};F.ptr.prototype.ReadRune=function(){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x;d=0;e=0;f=$ifaceNil;g=this;if((h=g.i,i=(new $Int64(0,g.s.$length)),(h.$high>i.$high||(h.$high===i.$high&&h.$low>=i.$low)))){g.prevRune=-1;j=0;k=0;l=B.EOF;d=j;e=k;f=l;return[d,e,f];}g.prevRune=(((m=g.i,m.$low+((m.$high>>31)*4294967296))>>0));p=(n=g.s,o=g.i,(($flatten64(o)<0||$flatten64(o)>=n.$length)?($throwRuntimeError("index out of range"),undefined):n.$array[n.$offset+$flatten64(o)]));if(p<128){g.i=(q=g.i,r=new $Int64(0,1),new $Int64(q.$high+r.$high,q.$low+r.$low));s=((p>>0));t=1;u=$ifaceNil;d=s;e=t;f=u;return[d,e,f];}v=C.DecodeRune($subslice(g.s,$flatten64(g.i)));d=v[0];e=v[1];g.i=(w=g.i,x=(new $Int64(0,e)),new $Int64(w.$high+x.$high,w.$low+x.$low));return[d,e,f];};F.prototype.ReadRune=function(){return this.$val.ReadRune();};F.ptr.prototype.UnreadRune=func
|
|||
|
$packages["encoding"]=(function(){var $pkg={},$init,A,B,C,D,E;A=$pkg.BinaryMarshaler=$newType(8,$kindInterface,"encoding.BinaryMarshaler",true,"encoding",true,null);B=$pkg.BinaryUnmarshaler=$newType(8,$kindInterface,"encoding.BinaryUnmarshaler",true,"encoding",true,null);C=$pkg.TextMarshaler=$newType(8,$kindInterface,"encoding.TextMarshaler",true,"encoding",true,null);D=$pkg.TextUnmarshaler=$newType(8,$kindInterface,"encoding.TextUnmarshaler",true,"encoding",true,null);E=$sliceType($Uint8);A.init([{prop:"MarshalBinary",name:"MarshalBinary",pkg:"",typ:$funcType([],[E,$error],false)}]);B.init([{prop:"UnmarshalBinary",name:"UnmarshalBinary",pkg:"",typ:$funcType([E],[$error],false)}]);C.init([{prop:"MarshalText",name:"MarshalText",pkg:"",typ:$funcType([],[E,$error],false)}]);D.init([{prop:"UnmarshalText",name:"UnmarshalText",pkg:"",typ:$funcType([E],[$error],false)}]);$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$packages["math/bits"]=(function(){var $pkg={},$init,A,B,C,M,N,D,E,F,H,K,L,O,R,S,AL,AM,AP,AQ,AR,AS,AT,AU,AV,AW,AX,AY,AZ;A=$pkg._err=$newType(8,$kindString,"bits._err",true,"math/bits",false,null);A.prototype.Error=function(){var e;e=this.$val;return(e);};$ptrType(A).prototype.Error=function(){return new A(this.$get()).Error();};A.prototype.RuntimeError=function(){var e;e=this.$val;};$ptrType(A).prototype.RuntimeError=function(){return new A(this.$get()).RuntimeError();};D=function(e,f){var e,f,g,h,i,j,k,l,m,n,o,p;g=0;h=0;i=(e&65535)>>>0;j=e>>>16>>>0;k=(f&65535)>>>0;l=f>>>16>>>0;m=$imul(i,k)>>>0;n=($imul(j,k)>>>0)+(m>>>16>>>0)>>>0;o=(n&65535)>>>0;p=n>>>16>>>0;o=o+(($imul(i,l)>>>0))>>>0;g=(($imul(j,l)>>>0)+p>>>0)+(o>>>16>>>0)>>>0;h=$imul(e,f)>>>0;return[g,h];};$pkg.Mul32=D;E=function(e,f,g){var e,f,g,h,i;h=0;i=0;h=(e+f>>>0)+g>>>0;i=((((((e&f)>>>0))|((((((e|f)>>>0))&~h)>>>0)))>>>0))>>>31>>>0;return[h,i];};$pkg.Add32=E;F=function(e,f,g){var aa,ab,ac,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;h=0;i=0;if(g===0){$panic(C);}if(g<=e){$panic(B);}j=((K(g)>>>0));g=(k=(j),k<32?(g<<k):0)>>>0;l=g>>>16>>>0;m=(g&65535)>>>0;p=(((n=j,n<32?(e<<n):0)>>>0)|((o=((32-j>>>0)),o<32?(f>>>o):0)>>>0))>>>0;r=(q=j,q<32?(f<<q):0)>>>0;s=r>>>16>>>0;t=(r&65535)>>>0;v=(u=p/l,(u===u&&u!==1/0&&u!==-1/0)?u>>>0:$throwRuntimeError("integer divide by zero"));w=p-($imul(v,l)>>>0)>>>0;while(true){if(!(v>=65536||($imul(v,m)>>>0)>(($imul(65536,w)>>>0)+s>>>0))){break;}v=v-(1)>>>0;w=w+(l)>>>0;if(w>=65536){break;}}x=(($imul(p,65536)>>>0)+s>>>0)-($imul(v,g)>>>0)>>>0;z=(y=x/l,(y===y&&y!==1/0&&y!==-1/0)?y>>>0:$throwRuntimeError("integer divide by zero"));w=x-($imul(z,l)>>>0)>>>0;while(true){if(!(z>=65536||($imul(z,m)>>>0)>(($imul(65536,w)>>>0)+t>>>0))){break;}z=z-(1)>>>0;w=w+(l)>>>0;if(w>=65536){break;}}aa=($imul(v,65536)>>>0)+z>>>0;ab=(ac=j,ac<32?((((($imul(x,65536)>>>0)+t>>>0)-($imul(z,g)>>>0)>>>0))>>>ac):0)>>>0;h=aa;i=ab;return[h,i];};$pkg.Div32=F;H=function(e){var e;return 32-AM(e)>>0;};$pkg.LeadingZeros=H;K=function(e){var e;return 32-AP(e)>>0;};$pkg.LeadingZeros32=K;L=function(e){var e;return 64-AQ(e)>>0;};$pkg.LeadingZeros64=L;O=function(e){var e;if(true){return R(((e>>>0)));}return S((new $Uint64(0,e)));};$pkg.TrailingZeros=O;R=function(e){var e,f;if(e===0){return 32;}return(((f=($imul((((e&(-e>>>0))>>>0)),125613361)>>>0)>>>27>>>0,((f<0||f>=M.length)?($throwRuntimeError("index out of range"),undefined):M[f]))>>0));};$pkg.TrailingZeros32=R;S=function(e){var e,f,g;if((e.$high===0&&e.$low===0)){return 64;}return(((f=$shiftRightUint64($mul64(((g=new $Uint64(-e.$high,-e.$low),new $Uint64(e.$high&g.$high,(e.$low&g.$low)>>>0))),new $Uint64(66559345,3033172745)),58),(($flatten64(f)<0||$flatten64(f)>=N.length)?($throwRuntimeError("index out of range"),undefined):N[$flatten64(f)]))>>0));};$pkg.TrailingZeros64=S;AL=function(e){var e,f,g,h,i,j,k,l,m;e=(f=(g=$shiftRightUint64(e,8),new $Uint64(g.$high&16711935,(g.$low&16711935)>>>0)),h=$shiftLeft64(new $Uint64(e.$high&16711935,(e.$low&16711935)>>>0),8),new $Uint64(f.$high|h.$high,(f.$low|h.$low)>>>0));e=(i=(j=$shiftRightUint64(e,16),new $Uint64(j.$high&65535,(j.$low&65535)>>>0)),k=$shiftLeft64(new $Uint64(e.$high&65535,(e.$low&65535)>>>0),16),new $Uint64(i.$high|k.$high,(i.$low|k.$low)>>>0));return(l=$shiftRightUint64(e,32),m=$shiftLeft64(e,32),new $Uint64(l.$high|m.$high,(l.$low|m.$low)>>>0));};$pkg.ReverseBytes64=AL;AM=function(e){var e;if(true){return AP(((e>>>0)));}return AQ((new $Uint64(0,e)));};$pkg.Len=AM;AP=function(e){var e,f,g,h;f=0;if(e>=65536){e=(g=(16),g<32?(e>>>g):0)>>>0;f=16;}if(e>=256){e=(h=(8),h<32?(e>>>h):0)>>>0;f=f+(8)>>0;}f=f+(("\x00\x01\x02\x02\x03\x03\x03\x03\x04\x04\x04\x04\x04\x04\x04\x04\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x06\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x07\x
|
|||
|
$packages["math"]=(function(){var $pkg={},$init,B,A,IT,IU,IV,IW,DN,DO,DP,DQ,DR,FJ,BJ,BU,EB,EG,EK,EM,EN,EO,EP,EQ,ET,EY,EZ,FB,FF,FK,FL,FM,FN,FO,FV,HC,HM;B=$packages["github.com/gopherjs/gopherjs/js"];A=$packages["math/bits"];IT=$arrayType($Uint32,2);IU=$arrayType($Float32,2);IV=$arrayType($Float64,1);IW=$structType("math",[{prop:"uint32array",name:"uint32array",embedded:false,exported:false,typ:IT,tag:""},{prop:"float32array",name:"float32array",embedded:false,exported:false,typ:IU,tag:""},{prop:"float64array",name:"float64array",embedded:false,exported:false,typ:IV,tag:""}]);BJ=function(av){var av,aw,ax,ay;aw=EK(av);ax=aw[0];ay=aw[1];if(ax===0.5){return((ay-1>>0));}return EQ(ax)*1.4426950408889634+(ay);};BU=function(av,aw){var av,aw,ax,ay,az,ba,bb,bc;if((av===0)){return av;}else if(EN(av,0)||EO(av)){return av;}ax=HC(av);av=ax[0];ay=ax[1];aw=aw+(ay)>>0;az=FN(av);aw=aw+((((($shiftRightUint64(az,52).$low>>0))&2047)-1023>>0))>>0;if(aw<-1075){return EB(0,av);}if(aw>1023){if(av<0){return EM(-1);}return EM(1);}ba=1;if(aw<-1022){aw=aw+(53)>>0;ba=1.1102230246251565e-16;}az=(bb=new $Uint64(2146435072,0),new $Uint64(az.$high&~bb.$high,(az.$low&~bb.$low)>>>0));az=(bc=$shiftLeft64((new $Uint64(0,(aw+1023>>0))),52),new $Uint64(az.$high|bc.$high,(az.$low|bc.$low)>>>0));return ba*FO(az);};EB=function(av,aw){var av,aw;if(!((av<0||(1/av===DQ))===(aw<0||(1/aw===DQ)))){return-av;}return av;};$pkg.Copysign=EB;EG=function(av){var av;return $parseFloat(DN.exp(av));};$pkg.Exp=EG;EK=function(av){var av,aw,ax,ay;aw=0;ax=0;ay=FV(av);aw=ay[0];ax=ay[1];return[aw,ax];};$pkg.Frexp=EK;EM=function(av){var av;if(av>=0){return DP;}else{return DQ;}};$pkg.Inf=EM;EN=function(av,aw){var av,aw;if(av===DP){return aw>=0;}if(av===DQ){return aw<=0;}return false;};$pkg.IsInf=EN;EO=function(av){var av,aw;aw=false;aw=!((av===av));return aw;};$pkg.IsNaN=EO;EP=function(av,aw){var av,aw;if(-1024<aw&&aw<1024){if(av===0){return av;}return av*$parseFloat(DN.pow(2,aw));}return BU(av,aw);};$pkg.Ldexp=EP;EQ=function(av){var av;if(!((av===av))){return DR;}return $parseFloat(DN.log(av));};$pkg.Log=EQ;ET=function(av){var av;return BJ(av);};$pkg.Log2=ET;EY=function(){return DR;};$pkg.NaN=EY;EZ=function(av,aw){var av,aw;if((av===1)||((av===-1)&&((aw===DP)||(aw===DQ)))){return 1;}return $parseFloat(DN.pow(av,aw));};$pkg.Pow=EZ;FB=function(av){var av;return av<0||(1/av===DQ);};$pkg.Signbit=FB;FF=function(av){var av;return $parseFloat(DN.sqrt(av));};$pkg.Sqrt=FF;FK=function(){var av;av=new($global.ArrayBuffer)(8);FJ.uint32array=new($global.Uint32Array)(av);FJ.float32array=new($global.Float32Array)(av);FJ.float64array=new($global.Float64Array)(av);};FL=function(av){var av;FJ.float32array[0]=av;return FJ.uint32array[0];};$pkg.Float32bits=FL;FM=function(av){var av;FJ.uint32array[0]=av;return FJ.float32array[0];};$pkg.Float32frombits=FM;FN=function(av){var av,aw,ax;FJ.float64array[0]=av;return(aw=$shiftLeft64((new $Uint64(0,FJ.uint32array[1])),32),ax=(new $Uint64(0,FJ.uint32array[0])),new $Uint64(aw.$high+ax.$high,aw.$low+ax.$low));};$pkg.Float64bits=FN;FO=function(av){var av;FJ.uint32array[0]=((av.$low>>>0));FJ.uint32array[1]=(($shiftRightUint64(av,32).$low>>>0));return FJ.float64array[0];};$pkg.Float64frombits=FO;FV=function(av){var av,aw,ax,ay,az,ba,bb,bc,bd,be,bf,bg;aw=0;ax=0;if((av===0)){ay=av;az=0;aw=ay;ax=az;return[aw,ax];}else if(EN(av,0)||EO(av)){ba=av;bb=0;aw=ba;ax=bb;return[aw,ax];}bc=HC(av);av=bc[0];ax=bc[1];bd=FN(av);ax=ax+((((((be=$shiftRightUint64(bd,52),new $Uint64(be.$high&0,(be.$low&2047)>>>0)).$low>>0))-1023>>0)+1>>0))>>0;bd=(bf=new $Uint64(2146435072,0),new $Uint64(bd.$high&~bf.$high,(bd.$low&~bf.$low)>>>0));bd=(bg=new $Uint64(1071644672,0),new $Uint64(bd.$high|bg.$high,(bd.$low|bg.$low)>>>0));aw=FO(bd);return[aw,ax];};HC=function(av){var av,aw,ax,ay,az,ba,bb;aw=0;ax=0;if(HM(av)<2.2250738585072014e-308){ay=av*4.503599627370496e+15;az=-52;aw=ay;ax=az;return[aw,ax];}ba=av;bb=0;aw=ba;ax=bb;return[aw,ax];};HM=function(av){var av,aw;return FO((aw=FN(av),new $Uint64(aw.$high&~2147483648,(aw.$low&~0)>>>0)));};$pkg.Abs=HM;$init=function(){$pkg.$init=function(){};var $f,$c=fal
|
|||
|
$packages["internal/abi"]=(function(){var $pkg={},$init;$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$packages["internal/goexperiment"]=(function(){var $pkg={},$init;$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$packages["internal/itoa"]=(function(){var $pkg={},$init,C,D,A,B;C=$arrayType($Uint8,20);D=$sliceType($Uint8);A=function(a){var a;if(a<0){return"-"+B(((-a>>>0)));}return B(((a>>>0)));};$pkg.Itoa=A;B=function(a){var a,b,c,d,e;if(a===0){return"0";}b=C.zero();c=19;while(true){if(!(a>=10)){break;}e=(d=a/10,(d===d&&d!==1/0&&d!==-1/0)?d>>>0:$throwRuntimeError("integer divide by zero"));((c<0||c>=b.length)?($throwRuntimeError("index out of range"),undefined):b[c]=((((48+a>>>0)-(e*10>>>0)>>>0)<<24>>>24)));c=c-(1)>>0;a=e;}((c<0||c>=b.length)?($throwRuntimeError("index out of range"),undefined):b[c]=(((48+a>>>0)<<24>>>24)));return($bytesToString($subslice(new D(b),c)));};$pkg.Uitoa=B;$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$packages["strconv"]=(function(){var $pkg={},$init,F,C,E,D,B,A,BL,BU,CE,CI,CQ,DT,DU,DV,DW,DX,DY,DZ,EA,EB,EC,ED,EE,EF,EG,EH,EI,AQ,AR,AS,AT,AU,AZ,BM,DR,BN,DS,CD,CJ,CY,DC,DD,DE,G,H,J,K,L,M,N,O,P,T,V,Y,Z,AA,AC,AD,AE,AF,AG,AI,AJ,AK,AL,AM,AN,AO,AP,AV,AX,AY,BA,BB,BC,BD,BE,BF,BG,BH,BI,BJ,BK,BO,BP,BQ,BR,BS,BT,BV,BW,BX,BY,BZ,CA,CB,CC,CF,CG,CH,CK,CL,CM,CO,CP,CR,CS,CT,CU,CV,CW,CX,CZ,DA,DB,DF,DG,DH,DI,DJ,DK,DL;F=$packages["errors"];C=$packages["github.com/gopherjs/gopherjs/js"];E=$packages["internal/bytealg"];D=$packages["math"];B=$packages["math/bits"];A=$packages["unicode/utf8"];BL=$pkg.floatInfo=$newType(0,$kindStruct,"strconv.floatInfo",true,"strconv",false,function(mantbits_,expbits_,bias_){this.$val=this;if(arguments.length===0){this.mantbits=0;this.expbits=0;this.bias=0;return;}this.mantbits=mantbits_;this.expbits=expbits_;this.bias=bias_;});BU=$pkg.decimalSlice=$newType(0,$kindStruct,"strconv.decimalSlice",true,"strconv",false,function(d_,nd_,dp_,neg_){this.$val=this;if(arguments.length===0){this.d=EA.nil;this.nd=0;this.dp=0;this.neg=false;return;}this.d=d_;this.nd=nd_;this.dp=dp_;this.neg=neg_;});CE=$pkg.decimal=$newType(0,$kindStruct,"strconv.decimal",true,"strconv",false,function(d_,nd_,dp_,neg_,trunc_){this.$val=this;if(arguments.length===0){this.d=EG.zero();this.nd=0;this.dp=0;this.neg=false;this.trunc=false;return;}this.d=d_;this.nd=nd_;this.dp=dp_;this.neg=neg_;this.trunc=trunc_;});CI=$pkg.leftCheat=$newType(0,$kindStruct,"strconv.leftCheat",true,"strconv",false,function(delta_,cutoff_){this.$val=this;if(arguments.length===0){this.delta=0;this.cutoff="";return;}this.delta=delta_;this.cutoff=cutoff_;});CQ=$pkg.NumError=$newType(0,$kindStruct,"strconv.NumError",true,"strconv",true,function(Func_,Num_,Err_){this.$val=this;if(arguments.length===0){this.Func="";this.Num="";this.Err=$ifaceNil;return;}this.Func=Func_;this.Num=Num_;this.Err=Err_;});DT=$sliceType($Uint16);DU=$sliceType($Uint32);DV=$arrayType($Uint64,2);DW=$sliceType(CI);DX=$sliceType($Int);DY=$sliceType($Float64);DZ=$sliceType($Float32);EA=$sliceType($Uint8);EB=$arrayType($Uint8,4);EC=$arrayType($Uint8,65);ED=$ptrType(BL);EE=$arrayType($Uint8,32);EF=$arrayType($Uint8,24);EG=$arrayType($Uint8,800);EH=$ptrType(CQ);EI=$ptrType(CE);G=function(c,d){var c,d;return!((CO(c,d)===-1));};H=function(c,d,e,f){var c,d,e,f,g;return($bytesToString(J($makeSlice(EA,0,(g=($imul(3,c.length))/2,(g===g&&g!==1/0&&g!==-1/0)?g>>0:$throwRuntimeError("integer divide by zero"))),c,d,e,f)));};J=function(c,d,e,f,g){var c,d,e,f,g,h,i,j,k;if((c.$capacity-c.$length>>0)<d.length){h=$makeSlice(EA,c.$length,(((c.$length+1>>0)+d.length>>0)+1>>0));$copySlice(h,c);c=h;}c=$append(c,e);i=0;while(true){if(!(d.length>0)){break;}j=((d.charCodeAt(0)>>0));i=1;if(j>=128){k=A.DecodeRuneInString(d);j=k[0];i=k[1];}if((i===1)&&(j===65533)){c=$appendSlice(c,"\\x");c=$append(c,"0123456789abcdef".charCodeAt((d.charCodeAt(0)>>>4<<24>>>24)));c=$append(c,"0123456789abcdef".charCodeAt(((d.charCodeAt(0)&15)>>>0)));d=$substring(d,i);continue;}c=L(c,j,e,f,g);d=$substring(d,i);}c=$append(c,e);return c;};K=function(c,d,e,f,g){var c,d,e,f,g;c=$append(c,e);if(!A.ValidRune(d)){d=65533;}c=L(c,d,e,f,g);c=$append(c,e);return c;};L=function(c,d,e,f,g){var c,d,e,f,g,h,i,j,k,l;h=EB.zero();if((d===((e>>0)))||(d===92)){c=$append(c,92);c=$append(c,((d<<24>>>24)));return c;}if(f){if(d<128&&AG(d)){c=$append(c,((d<<24>>>24)));return c;}}else if(AG(d)||g&&AI(d)){i=A.EncodeRune(new EA(h),d);c=$appendSlice(c,$subslice(new EA(h),0,i));return c;}j=d;if(j===(7)){c=$appendSlice(c,"\\a");}else if(j===(8)){c=$appendSlice(c,"\\b");}else if(j===(12)){c=$appendSlice(c,"\\f");}else if(j===(10)){c=$appendSlice(c,"\\n");}else if(j===(13)){c=$appendSlice(c,"\\r");}else if(j===(9)){c=$appendSlice(c,"\\t");}else if(j===(11)){c=$appendSlice(c,"\\v");}else{if(d<32){c=$appendSlice(c,"\\x");c=$append(c,"0123456789abcdef".charCodeAt((((d<<24>>>24))>>>4<<24>>>24)));c=$append(c,"0123456789abcdef".charCodeAt(((((d<<24>>>24))&15)>>>0)));}else if(d>1114111){d=65533;c=$appendSlice(c,"\\u");k=12;while(true){if(!(k>=0)){break;}c=$append(c,"0123456789abcdef".charCodeA
|
|||
|
$packages["reflect"]=(function(){var $pkg={},$init,K,J,A,L,B,C,D,E,F,G,H,I,O,P,S,AE,CI,CJ,CK,CL,CM,CN,CO,CP,CQ,CR,CS,CT,CU,CV,CW,CY,DG,DH,DI,DK,DL,DM,FQ,FS,FT,FU,HC,IO,IP,IQ,IR,IS,IT,IU,IW,IY,IZ,JA,JH,JJ,JK,JL,JM,JN,JO,JP,JQ,JV,JW,JX,JY,JZ,KC,KD,KE,KF,KG,KH,KM,KN,KO,KP,KU,KV,KW,AD,CZ,FK,FR,FV,FY,GA,HP,HQ,HU,T,U,AF,AG,AJ,AU,AV,AW,AZ,BA,BB,BC,BD,BE,BF,BG,BH,BI,BJ,BK,BL,BM,BN,BO,BP,BQ,BR,BS,BT,BU,BV,DO,DQ,DR,DS,DT,DU,EV,FA,FL,FM,FN,FO,FP,FW,FX,FZ,GB,GD,GE,GF,GG,GH,GI,GJ,GM,GO,GQ,GR,GS,GU,GX,GY,GZ,HA,HB,HD,HE,HF,HG,HH,HI,HJ,HK,HL,HM,HN,HO,HR,HS,HT,HV,HW,HY,HZ;K=$packages["errors"];J=$packages["github.com/gopherjs/gopherjs/js"];A=$packages["internal/abi"];L=$packages["internal/goexperiment"];B=$packages["internal/itoa"];C=$packages["internal/unsafeheader"];D=$packages["math"];E=$packages["runtime"];F=$packages["strconv"];G=$packages["sync"];H=$packages["unicode"];I=$packages["unicode/utf8"];O=$pkg.Value=$newType(0,$kindStruct,"reflect.Value",true,"reflect",true,function(typ_,ptr_,flag_){this.$val=this;if(arguments.length===0){this.typ=IP.nil;this.ptr=0;this.flag=0;return;}this.typ=typ_;this.ptr=ptr_;this.flag=flag_;});P=$pkg.flag=$newType(4,$kindUintptr,"reflect.flag",true,"reflect",false,null);S=$pkg.ValueError=$newType(0,$kindStruct,"reflect.ValueError",true,"reflect",true,function(Method_,Kind_){this.$val=this;if(arguments.length===0){this.Method="";this.Kind=0;return;}this.Method=Method_;this.Kind=Kind_;});AE=$pkg.MapIter=$newType(0,$kindStruct,"reflect.MapIter",true,"reflect",true,function(m_,it_){this.$val=this;if(arguments.length===0){this.m=new O.ptr(IP.nil,0,0);this.it=0;return;}this.m=m_;this.it=it_;});CI=$pkg.Type=$newType(8,$kindInterface,"reflect.Type",true,"reflect",true,null);CJ=$pkg.Kind=$newType(4,$kindUint,"reflect.Kind",true,"reflect",true,null);CK=$pkg.tflag=$newType(1,$kindUint8,"reflect.tflag",true,"reflect",false,null);CL=$pkg.rtype=$newType(0,$kindStruct,"reflect.rtype",true,"reflect",false,function(size_,ptrdata_,hash_,tflag_,align_,fieldAlign_,kind_,equal_,gcdata_,str_,ptrToThis_){this.$val=this;if(arguments.length===0){this.size=0;this.ptrdata=0;this.hash=0;this.tflag=0;this.align=0;this.fieldAlign=0;this.kind=0;this.equal=$throwNilPointerError;this.gcdata=JQ.nil;this.str=0;this.ptrToThis=0;return;}this.size=size_;this.ptrdata=ptrdata_;this.hash=hash_;this.tflag=tflag_;this.align=align_;this.fieldAlign=fieldAlign_;this.kind=kind_;this.equal=equal_;this.gcdata=gcdata_;this.str=str_;this.ptrToThis=ptrToThis_;});CM=$pkg.method=$newType(0,$kindStruct,"reflect.method",true,"reflect",false,function(name_,mtyp_,ifn_,tfn_){this.$val=this;if(arguments.length===0){this.name=0;this.mtyp=0;this.ifn=0;this.tfn=0;return;}this.name=name_;this.mtyp=mtyp_;this.ifn=ifn_;this.tfn=tfn_;});CN=$pkg.ChanDir=$newType(4,$kindInt,"reflect.ChanDir",true,"reflect",true,null);CO=$pkg.arrayType=$newType(0,$kindStruct,"reflect.arrayType",true,"reflect",false,function(rtype_,elem_,slice_,len_){this.$val=this;if(arguments.length===0){this.rtype=new CL.ptr(0,0,0,0,0,0,0,$throwNilPointerError,JQ.nil,0,0);this.elem=IP.nil;this.slice=IP.nil;this.len=0;return;}this.rtype=rtype_;this.elem=elem_;this.slice=slice_;this.len=len_;});CP=$pkg.chanType=$newType(0,$kindStruct,"reflect.chanType",true,"reflect",false,function(rtype_,elem_,dir_){this.$val=this;if(arguments.length===0){this.rtype=new CL.ptr(0,0,0,0,0,0,0,$throwNilPointerError,JQ.nil,0,0);this.elem=IP.nil;this.dir=0;return;}this.rtype=rtype_;this.elem=elem_;this.dir=dir_;});CQ=$pkg.imethod=$newType(0,$kindStruct,"reflect.imethod",true,"reflect",false,function(name_,typ_){this.$val=this;if(arguments.length===0){this.name=0;this.typ=0;return;}this.name=name_;this.typ=typ_;});CR=$pkg.interfaceType=$newType(0,$kindStruct,"reflect.interfaceType",true,"reflect",false,function(rtype_,pkgPath_,methods_){this.$val=this;if(arguments.length===0){this.rtype=new CL.ptr(0,0,0,0,0,0,0,$throwNilPointerError,JQ.nil,0,0);this.pkgPath=new FT.ptr(JQ.nil);this.methods=JV.nil;return;}this.rtype=rtype_;this.pkgPath=pkgPath_;this.methods=methods_;});CS=$pkg.mapType=$newType(0,$kindStruct,"reflect.mapType",
|
|||
|
$packages["encoding/binary"]=(function(){var $pkg={},$init,A,B,C,D,E,O,Z,J;A=$packages["errors"];B=$packages["io"];C=$packages["math"];D=$packages["reflect"];E=$packages["sync"];O=$pkg.bigEndian=$newType(0,$kindStruct,"binary.bigEndian",true,"encoding/binary",false,function(){this.$val=this;if(arguments.length===0){return;}});Z=$sliceType($Uint8);O.ptr.prototype.Uint16=function(a){var a;$unused((1>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+1]));return((((1>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+1])<<16>>>16))|((((0>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+0])<<16>>>16))<<8<<16>>>16))>>>0;};O.prototype.Uint16=function(a){return this.$val.Uint16(a);};O.ptr.prototype.PutUint16=function(a,b){var a,b;$unused((1>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+1]));(0>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+0]=(((b>>>8<<16>>>16)<<24>>>24)));(1>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+1]=((b<<24>>>24)));};O.prototype.PutUint16=function(a,b){return this.$val.PutUint16(a,b);};O.ptr.prototype.Uint32=function(a){var a;$unused((3>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+3]));return((((((((3>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+3])>>>0))|((((2>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+2])>>>0))<<8>>>0))>>>0)|((((1>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+1])>>>0))<<16>>>0))>>>0)|((((0>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+0])>>>0))<<24>>>0))>>>0;};O.prototype.Uint32=function(a){return this.$val.Uint32(a);};O.ptr.prototype.PutUint32=function(a,b){var a,b;$unused((3>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+3]));(0>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+0]=(((b>>>24>>>0)<<24>>>24)));(1>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+1]=(((b>>>16>>>0)<<24>>>24)));(2>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+2]=(((b>>>8>>>0)<<24>>>24)));(3>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+3]=((b<<24>>>24)));};O.prototype.PutUint32=function(a,b){return this.$val.PutUint32(a,b);};O.ptr.prototype.Uint64=function(a){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o;$unused((7>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+7]));return(b=(c=(d=(e=(f=(g=(h=(new $Uint64(0,(7>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+7]))),i=$shiftLeft64((new $Uint64(0,(6>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+6]))),8),new $Uint64(h.$high|i.$high,(h.$low|i.$low)>>>0)),j=$shiftLeft64((new $Uint64(0,(5>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+5]))),16),new $Uint64(g.$high|j.$high,(g.$low|j.$low)>>>0)),k=$shiftLeft64((new $Uint64(0,(4>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+4]))),24),new $Uint64(f.$high|k.$high,(f.$low|k.$low)>>>0)),l=$shiftLeft64((new $Uint64(0,(3>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+3]))),32),new $Uint64(e.$high|l.$high,(e.$low|l.$low)>>>0)),m=$shiftLeft64((new $Uint64(0,(2>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+2]))),40),new $Uint64(d.$high|m.$high,(d.$low|m.$low)>>>0)),n=$shiftLeft64((new $Uint64(0,(1>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+1]))),48),new $Uint64(c.$high|n.$high,(c.$low|n.$low)>>>0)),o=$shiftLeft64((new $Uint64(0,(0>=a.$length?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+0]))),56),new $Uint64(b.$high|o.$high,(b.$low|o.$low)>>>0));};O.prototype
|
|||
|
$packages["encoding/base64"]=(function(){var $pkg={},$init,A,B,C,D,F,H,N,O,P,Q,R,S,T,V,E,G,J,K;A=$packages["encoding/binary"];B=$packages["io"];C=$packages["strconv"];D=$pkg.Encoding=$newType(0,$kindStruct,"base64.Encoding",true,"encoding/base64",true,function(encode_,decodeMap_,padChar_,strict_){this.$val=this;if(arguments.length===0){this.encode=N.zero();this.decodeMap=O.zero();this.padChar=0;this.strict=false;return;}this.encode=encode_;this.decodeMap=decodeMap_;this.padChar=padChar_;this.strict=strict_;});F=$pkg.encoder=$newType(0,$kindStruct,"base64.encoder",true,"encoding/base64",false,function(err_,enc_,w_,buf_,nbuf_,out_){this.$val=this;if(arguments.length===0){this.err=$ifaceNil;this.enc=Q.nil;this.w=$ifaceNil;this.buf=R.zero();this.nbuf=0;this.out=S.zero();return;}this.err=err_;this.enc=enc_;this.w=w_;this.buf=buf_;this.nbuf=nbuf_;this.out=out_;});H=$pkg.CorruptInputError=$newType(8,$kindInt64,"base64.CorruptInputError",true,"encoding/base64",true,null);N=$arrayType($Uint8,64);O=$arrayType($Uint8,256);P=$sliceType($Uint8);Q=$ptrType(D);R=$arrayType($Uint8,3);S=$arrayType($Uint8,1024);T=$arrayType($Uint8,4);V=$ptrType(F);E=function(a){var a,b,c,d,e,f,g,h;if(!((a.length===64))){$panic(new $String("encoding alphabet is not 64-bytes long"));}b=0;while(true){if(!(b<a.length)){break;}if((a.charCodeAt(b)===10)||(a.charCodeAt(b)===13)){$panic(new $String("encoding alphabet contains newline character"));}b=b+(1)>>0;}c=new D.ptr(N.zero(),O.zero(),0,false);c.padChar=61;$copyString(new P(c.encode),a);d=0;while(true){if(!(d<256)){break;}(e=c.decodeMap,((d<0||d>=e.length)?($throwRuntimeError("index out of range"),undefined):e[d]=255));d=d+(1)>>0;}f=0;while(true){if(!(f<a.length)){break;}(g=c.decodeMap,h=a.charCodeAt(f),((h<0||h>=g.length)?($throwRuntimeError("index out of range"),undefined):g[h]=((f<<24>>>24))));f=f+(1)>>0;}return c;};$pkg.NewEncoding=E;D.ptr.prototype.WithPadding=function(a){var a,b,c,d;b=this;if((a===13)||(a===10)||a>255){$panic(new $String("invalid padding"));}c=0;while(true){if(!(c<64)){break;}if((((d=b.encode,((c<0||c>=d.length)?($throwRuntimeError("index out of range"),undefined):d[c]))>>0))===a){$panic(new $String("padding contained in alphabet"));}c=c+(1)>>0;}b.padChar=a;return b;};D.prototype.WithPadding=function(a){return this.$val.WithPadding(a);};D.ptr.prototype.Strict=function(){var a;a=this;a.strict=true;return a;};D.prototype.Strict=function(){return this.$val.Strict();};D.ptr.prototype.Encode=function(a,b){var a,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an,ao,ap,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;c=this;if(b.$length===0){return;}$unused(c.encode);d=0;e=0;f=d;g=e;i=$imul(((h=b.$length/3,(h===h&&h!==1/0&&h!==-1/0)?h>>0:$throwRuntimeError("integer divide by zero"))),3);while(true){if(!(g<i)){break;}m=(((((((j=g+0>>0,((j<0||j>=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+j]))>>>0))<<16>>>0)|((((k=g+1>>0,((k<0||k>=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+k]))>>>0))<<8>>>0))>>>0)|(((l=g+2>>0,((l<0||l>=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+l]))>>>0)))>>>0;(p=f+0>>0,((p<0||p>=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+p]=(n=c.encode,o=((m>>>18>>>0)&63)>>>0,((o<0||o>=n.length)?($throwRuntimeError("index out of range"),undefined):n[o]))));(s=f+1>>0,((s<0||s>=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+s]=(q=c.encode,r=((m>>>12>>>0)&63)>>>0,((r<0||r>=q.length)?($throwRuntimeError("index out of range"),undefined):q[r]))));(v=f+2>>0,((v<0||v>=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+v]=(t=c.encode,u=((m>>>6>>>0)&63)>>>0,((u<0||u>=t.length)?($throwRuntimeError("index out of range"),undefined):t[u]))));(y=f+3>>0,((y<0||y>=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+y]=(w=c.encode,x=(m&63)>>>0,((x<0||x>=w.length)?($throwRuntimeError("index out of range"),undefined):w[x]))));g=g+(3)>>0;f=f+(4)>>0;}z=b.$length-g>>0;if
|
|||
|
$packages["sort"]=(function(){var $pkg={},$init,A,V,Z,AC,AW,AY,AZ,BA,AN,AO,B,C,D,E,F,G,H,I,J,K,M,N,O,P,Q,R,S,T,U,AD,AF,AJ,AK,AL,AM,AP,AQ,AS,AT,AV;A=$packages["internal/reflectlite"];V=$pkg.lessSwap=$newType(0,$kindStruct,"sort.lessSwap",true,"sort",false,function(Less_,Swap_){this.$val=this;if(arguments.length===0){this.Less=$throwNilPointerError;this.Swap=$throwNilPointerError;return;}this.Less=Less_;this.Swap=Swap_;});Z=$pkg.IntSlice=$newType(12,$kindSlice,"sort.IntSlice",true,"sort",true,null);AC=$pkg.StringSlice=$newType(12,$kindSlice,"sort.StringSlice",true,"sort",true,null);AW=$sliceType($Int);AY=$sliceType($String);AZ=$funcType([$Int,$Int],[$Bool],false);BA=$funcType([$Int,$Int],[],false);B=function(a,b,c){var a,b,c,d,e,f,g,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:d=b+1>>0;case 1:if(!(d<c)){$s=2;continue;}e=d;case 3:if(!(e>b)){f=false;$s=5;continue s;}g=a.Less(e,e-1>>0);$s=6;case 6:if($c){$c=false;g=g.$blk();}if(g&&g.$blk!==undefined){break s;}f=g;case 5:if(!(f)){$s=4;continue;}$r=a.Swap(e,e-1>>0);$s=7;case 7:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}e=e-(1)>>0;$s=3;continue;case 4:d=d+(1)>>0;$s=1;continue;case 2:$s=-1;return;}return;}if($f===undefined){$f={$blk:B};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.$s=$s;$f.$r=$r;return $f;};C=function(a,b,c,d){var a,b,c,d,e,f,g,h,i,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:e=b;case 1:f=($imul(2,e))+1>>0;if(f>=c){$s=2;continue;}if(!((f+1>>0)<c)){g=false;$s=5;continue s;}h=a.Less(d+f>>0,(d+f>>0)+1>>0);$s=6;case 6:if($c){$c=false;h=h.$blk();}if(h&&h.$blk!==undefined){break s;}g=h;case 5:if(g){$s=3;continue;}$s=4;continue;case 3:f=f+(1)>>0;case 4:i=a.Less(d+e>>0,d+f>>0);$s=9;case 9:if($c){$c=false;i=i.$blk();}if(i&&i.$blk!==undefined){break s;}if(!i){$s=7;continue;}$s=8;continue;case 7:$s=-1;return;case 8:$r=a.Swap(d+e>>0,d+f>>0);$s=10;case 10:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}e=f;$s=1;continue;case 2:$s=-1;return;}return;}if($f===undefined){$f={$blk:C};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.$s=$s;$f.$r=$r;return $f;};D=function(a,b,c){var a,b,c,d,e,f,g,h,i,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:d=b;e=0;f=c-b>>0;h=(g=((f-1>>0))/2,(g===g&&g!==1/0&&g!==-1/0)?g>>0:$throwRuntimeError("integer divide by zero"));case 1:if(!(h>=0)){$s=2;continue;}$r=C($clone(a,V),h,f,d);$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}h=h-(1)>>0;$s=1;continue;case 2:i=f-1>>0;case 4:if(!(i>=0)){$s=5;continue;}$r=a.Swap(d,d+i>>0);$s=6;case 6:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=C($clone(a,V),e,i,d);$s=7;case 7:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}i=i-(1)>>0;$s=4;continue;case 5:$s=-1;return;}return;}if($f===undefined){$f={$blk:D};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.$s=$s;$f.$r=$r;return $f;};E=function(a,b,c,d){var a,b,c,d,e,f,g,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:e=a.Less(b,c);$s=3;case 3:if($c){$c=false;e=e.$blk();}if(e&&e.$blk!==undefined){break s;}if(e){$s=1;continue;}$s=2;continue;case 1:$r=a.Swap(b,c);$s=4;case 4:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}case 2:f=a.Less(d,b);$s=7;case 7:if($c){$c=false;f=f.$blk();}if(f&&f.$blk!==undefined){break s;}if(f){$s=5;continue;}$s=6;continue;case 5:$r=a.Swap(d,b);$s=8;case 8:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}g=a.Less(b,c);$s=11;case 11:if($c){$c=false;g=g.$blk();}if(g&&g.$b
|
|||
|
$packages["internal/fmtsort"]=(function(){var $pkg={},$init,A,B,C,I,J,D,E,F,G,H;A=$packages["reflect"];B=$packages["sort"];C=$pkg.SortedMap=$newType(0,$kindStruct,"fmtsort.SortedMap",true,"internal/fmtsort",true,function(Key_,Value_){this.$val=this;if(arguments.length===0){this.Key=J.nil;this.Value=J.nil;return;}this.Key=Key_;this.Value=Value_;});I=$ptrType(C);J=$sliceType(A.Value);C.ptr.prototype.Len=function(){var a;a=this;return a.Key.$length;};C.prototype.Len=function(){return this.$val.Len();};C.ptr.prototype.Less=function(a,b){var a,b,c,d,e,f,g,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:c=this;f=E($clone((d=c.Key,((a<0||a>=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+a])),A.Value),$clone((e=c.Key,((b<0||b>=e.$length)?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+b])),A.Value));$s=1;case 1:if($c){$c=false;f=f.$blk();}if(f&&f.$blk!==undefined){break s;}g=f<0;$s=2;case 2:return g;}return;}if($f===undefined){$f={$blk:C.ptr.prototype.Less};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.$s=$s;$f.$r=$r;return $f;};C.prototype.Less=function(a,b){return this.$val.Less(a,b);};C.ptr.prototype.Swap=function(a,b){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o;c=this;d=(e=c.Key,((b<0||b>=e.$length)?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+b]));f=(g=c.Key,((a<0||a>=g.$length)?($throwRuntimeError("index out of range"),undefined):g.$array[g.$offset+a]));(h=c.Key,((a<0||a>=h.$length)?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+a]=d));(i=c.Key,((b<0||b>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+b]=f));j=(k=c.Value,((b<0||b>=k.$length)?($throwRuntimeError("index out of range"),undefined):k.$array[k.$offset+b]));l=(m=c.Value,((a<0||a>=m.$length)?($throwRuntimeError("index out of range"),undefined):m.$array[m.$offset+a]));(n=c.Value,((a<0||a>=n.$length)?($throwRuntimeError("index out of range"),undefined):n.$array[n.$offset+a]=j));(o=c.Value,((b<0||b>=o.$length)?($throwRuntimeError("index out of range"),undefined):o.$array[o.$offset+b]=l));};C.prototype.Swap=function(a,b){return this.$val.Swap(a,b);};D=function(a){var a,b,c,d,e,f,g,h,i,j,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=$clone(a,A.Value).Type().Kind();$s=3;case 3:if($c){$c=false;b=b.$blk();}if(b&&b.$blk!==undefined){break s;}if(!((b===21))){$s=1;continue;}$s=2;continue;case 1:$s=-1;return I.nil;case 2:c=$clone(a,A.Value).Len();d=$makeSlice(J,0,c);e=$makeSlice(J,0,c);f=$clone(a,A.Value).MapRange();case 4:g=f.Next();$s=6;case 6:if($c){$c=false;g=g.$blk();}if(g&&g.$blk!==undefined){break s;}if(!(g)){$s=5;continue;}h=f.Key();$s=7;case 7:if($c){$c=false;h=h.$blk();}if(h&&h.$blk!==undefined){break s;}d=$append(d,h);i=f.Value();$s=8;case 8:if($c){$c=false;i=i.$blk();}if(i&&i.$blk!==undefined){break s;}e=$append(e,i);$s=4;continue;case 5:j=new C.ptr(d,e);$r=B.Stable(j);$s=9;case 9:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return j;}return;}if($f===undefined){$f={$blk:D};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.$s=$s;$f.$r=$r;return $f;};$pkg.Sort=D;E=function(a,b){var a,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an,ao,ap,aq,ar,as,at,au,av,aw,ax,ay,az,b,ba,bb,bc,bd,be,bf,bg,bh,bi,bj,bk,bl,bm,bn,bo,bp,bq,br,bs,bt,bu,bv,bw,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;aa=$f.aa;ab=$f.ab;ac=$f.ac;ad=$f.ad;ae=$f.ae;af=$f.af;ag=$f.ag;ah=$f.ah;ai=$f.ai;aj=$f.aj;ak=$f.ak;al=$f.al;am=$f.am;an=$f.an;ao=$f.ao;ap=$f.ap;aq=$f.aq;ar=$f.ar;as=$f.as;at=$f.at;au=$f.au;av=$f.av;aw=$f.aw;ax=$f.ax;ay=$f.ay;az=$f.az;b=$f.b;ba=$f.ba;bb=$f.bb;bc=$f.bc;bd=$f.bd;be=$f.be;bf=$f.bf;bg=$f.bg;bh=$f.bh
|
|||
|
$packages["internal/oserror"]=(function(){var $pkg={},$init,A;A=$packages["errors"];$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=A.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$pkg.ErrInvalid=A.New("invalid argument");$pkg.ErrPermission=A.New("permission denied");$pkg.ErrExist=A.New("file already exists");$pkg.ErrNotExist=A.New("file does not exist");$pkg.ErrClosed=A.New("file already closed");}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$packages["syscall"]=(function(){var $pkg={},$init,H,G,I,A,B,C,D,E,F,N,W,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,BL,HA,HB,HJ,HK,HL,HM,JU,JV,NH,QP,QR,QX,QY,QZ,RA,RB,RC,RD,RI,RQ,RR,RS,RT,RU,RW,SB,SP,SV,TB,TF,TG,TH,TI,TJ,TK,TL,TM,TP,TQ,GS,HC,HD,HE,IF,QN,MD,NV,NW,NX,OF,OG,QC,CH,CI,CN,CO,CQ,CT,CU,DN,EC,EF,EJ,ES,ET,EV,FG,FH,FJ,FP,FV,FW,FZ,GB,GC,GH,GI,GJ,GK,GL,GY,HF,HH,HI,HQ,HR,HS,HT,HU,HV,HW,HX,HZ,II,JW,JX,JY,KH,KI,KK,LC,NJ,NK,NS,NY,NZ,OA,OB,OE,OH,OI,OJ,OM,OR,OS;H=$packages["errors"];G=$packages["github.com/gopherjs/gopherjs/js"];I=$packages["internal/bytealg"];A=$packages["internal/itoa"];B=$packages["internal/oserror"];C=$packages["internal/race"];D=$packages["internal/unsafeheader"];E=$packages["runtime"];F=$packages["sync"];N=$pkg.Timespec=$newType(0,$kindStruct,"syscall.Timespec",true,"syscall",true,function(Sec_,Nsec_){this.$val=this;if(arguments.length===0){this.Sec=new $Int64(0,0);this.Nsec=new $Int64(0,0);return;}this.Sec=Sec_;this.Nsec=Nsec_;});W=$pkg.Stat_t=$newType(0,$kindStruct,"syscall.Stat_t",true,"syscall",true,function(Dev_,Ino_,Nlink_,Mode_,Uid_,Gid_,X__pad0_,Rdev_,Size_,Blksize_,Blocks_,Atim_,Mtim_,Ctim_,X__unused_){this.$val=this;if(arguments.length===0){this.Dev=new $Uint64(0,0);this.Ino=new $Uint64(0,0);this.Nlink=new $Uint64(0,0);this.Mode=0;this.Uid=0;this.Gid=0;this.X__pad0=0;this.Rdev=new $Uint64(0,0);this.Size=new $Int64(0,0);this.Blksize=new $Int64(0,0);this.Blocks=new $Int64(0,0);this.Atim=new N.ptr(new $Int64(0,0),new $Int64(0,0));this.Mtim=new N.ptr(new $Int64(0,0),new $Int64(0,0));this.Ctim=new N.ptr(new $Int64(0,0),new $Int64(0,0));this.X__unused=RI.zero();return;}this.Dev=Dev_;this.Ino=Ino_;this.Nlink=Nlink_;this.Mode=Mode_;this.Uid=Uid_;this.Gid=Gid_;this.X__pad0=X__pad0_;this.Rdev=Rdev_;this.Size=Size_;this.Blksize=Blksize_;this.Blocks=Blocks_;this.Atim=Atim_;this.Mtim=Mtim_;this.Ctim=Ctim_;this.X__unused=X__unused_;});AB=$pkg.RawSockaddrInet4=$newType(0,$kindStruct,"syscall.RawSockaddrInet4",true,"syscall",true,function(Family_,Port_,Addr_,Zero_){this.$val=this;if(arguments.length===0){this.Family=0;this.Port=0;this.Addr=RT.zero();this.Zero=RR.zero();return;}this.Family=Family_;this.Port=Port_;this.Addr=Addr_;this.Zero=Zero_;});AC=$pkg.RawSockaddrInet6=$newType(0,$kindStruct,"syscall.RawSockaddrInet6",true,"syscall",true,function(Family_,Port_,Flowinfo_,Addr_,Scope_id_){this.$val=this;if(arguments.length===0){this.Family=0;this.Port=0;this.Flowinfo=0;this.Addr=RU.zero();this.Scope_id=0;return;}this.Family=Family_;this.Port=Port_;this.Flowinfo=Flowinfo_;this.Addr=Addr_;this.Scope_id=Scope_id_;});AD=$pkg.RawSockaddrUnix=$newType(0,$kindStruct,"syscall.RawSockaddrUnix",true,"syscall",true,function(Family_,Path_){this.$val=this;if(arguments.length===0){this.Family=0;this.Path=RS.zero();return;}this.Family=Family_;this.Path=Path_;});AE=$pkg.RawSockaddrLinklayer=$newType(0,$kindStruct,"syscall.RawSockaddrLinklayer",true,"syscall",true,function(Family_,Protocol_,Ifindex_,Hatype_,Pkttype_,Halen_,Addr_){this.$val=this;if(arguments.length===0){this.Family=0;this.Protocol=0;this.Ifindex=0;this.Hatype=0;this.Pkttype=0;this.Halen=0;this.Addr=RR.zero();return;}this.Family=Family_;this.Protocol=Protocol_;this.Ifindex=Ifindex_;this.Hatype=Hatype_;this.Pkttype=Pkttype_;this.Halen=Halen_;this.Addr=Addr_;});AF=$pkg.RawSockaddrNetlink=$newType(0,$kindStruct,"syscall.RawSockaddrNetlink",true,"syscall",true,function(Family_,Pad_,Pid_,Groups_){this.$val=this;if(arguments.length===0){this.Family=0;this.Pad=0;this.Pid=0;this.Groups=0;return;}this.Family=Family_;this.Pad=Pad_;this.Pid=Pid_;this.Groups=Groups_;});AG=$pkg.RawSockaddr=$newType(0,$kindStruct,"syscall.RawSockaddr",true,"syscall",true,function(Family_,Data_){this.$val=this;if(arguments.length===0){this.Family=0;this.Data=RA.zero();return;}this.Family=Family_;this.Data=Data_;});AH=$pkg.RawSockaddrAny=$newType(0,$kindStruct,"syscall.RawSockaddrAny",true,"syscall",true,function(Addr_,Pad_){this.$val=this;if(arguments.length===0){this.Addr=new AG.ptr(0,RA.zero());this.Pad=RB.zero();return;}this.Addr=Addr_;this.Pad=Pad_;});AI=$pkg._Socklen=$newType(4,$kindU
|
|||
|
$packages["internal/syscall/unix"]=(function(){var $pkg={},$init,B,A,C,H;B=$packages["sync/atomic"];A=$packages["syscall"];C=function(b){var b,c,d,e,f;c=false;d=$ifaceNil;e=false;f=$ifaceNil;c=e;d=f;return[c,d];};$pkg.IsNonblock=C;H=function(b,c,d,e,f,g){var b,c,d,e,f,g,h,i,j,k,l,m,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;m=$f.m;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:h=0;i=$ifaceNil;k=A.Syscall6(0,((b>>>0)),((c)),((d>>>0)),((e)),((f>>>0)),((g>>>0)));$s=1;case 1:if($c){$c=false;k=k.$blk();}if(k&&k.$blk!==undefined){break s;}j=k;l=j[0];m=j[2];h=((l>>0));if(!((m===0))){i=new A.Errno(m);}$s=-1;return[h,i];}return;}if($f===undefined){$f={$blk:H};}$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.k=k;$f.l=l;$f.m=m;$f.$s=$s;$f.$r=$r;return $f;};$pkg.CopyFileRange=H;$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=B.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=A.$init();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$pkg.FcntlSyscall=72;}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$packages["github.com/gopherjs/gopherjs/nosync"]=(function(){var $pkg={},$init,A,B,C,E,F,G,H,I,J,K,L,N,O,P,Q;A=$pkg.Pool=$newType(0,$kindStruct,"nosync.Pool",true,"github.com/gopherjs/gopherjs/nosync",true,function(store_,New_){this.$val=this;if(arguments.length===0){this.store=G.nil;this.New=$throwNilPointerError;return;}this.store=store_;this.New=New_;});B=$pkg.Once=$newType(0,$kindStruct,"nosync.Once",true,"github.com/gopherjs/gopherjs/nosync",true,function(doing_,done_){this.$val=this;if(arguments.length===0){this.doing=false;this.done=false;return;}this.doing=doing_;this.done=done_;});C=$pkg.Mutex=$newType(0,$kindStruct,"nosync.Mutex",true,"github.com/gopherjs/gopherjs/nosync",true,function(locked_){this.$val=this;if(arguments.length===0){this.locked=false;return;}this.locked=locked_;});E=$pkg.WaitGroup=$newType(0,$kindStruct,"nosync.WaitGroup",true,"github.com/gopherjs/gopherjs/nosync",true,function(counter_){this.$val=this;if(arguments.length===0){this.counter=0;return;}this.counter=counter_;});F=$pkg.Map=$newType(0,$kindStruct,"nosync.Map",true,"github.com/gopherjs/gopherjs/nosync",true,function(m_){this.$val=this;if(arguments.length===0){this.m=false;return;}this.m=m_;});G=$sliceType($emptyInterface);H=$ptrType(A);I=$funcType([],[$emptyInterface],false);J=$funcType([],[],false);K=$ptrType(B);L=$ptrType(C);N=$ptrType(E);O=$funcType([$emptyInterface,$emptyInterface],[$Bool],false);P=$ptrType(F);Q=$mapType($emptyInterface,$emptyInterface);A.ptr.prototype.Get=function(){var a,b,c,d,e,f,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=this;if(a.store.$length===0){$s=1;continue;}$s=2;continue;case 1:if(!(a.New===$throwNilPointerError)){$s=3;continue;}$s=4;continue;case 3:b=a.New();$s=5;case 5:if($c){$c=false;b=b.$blk();}if(b&&b.$blk!==undefined){break s;}c=b;$s=6;case 6:return c;case 4:$s=-1;return $ifaceNil;case 2:f=(d=a.store,e=a.store.$length-1>>0,((e<0||e>=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+e]));a.store=$subslice(a.store,0,(a.store.$length-1>>0));$s=-1;return f;}return;}if($f===undefined){$f={$blk:A.ptr.prototype.Get};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.$s=$s;$f.$r=$r;return $f;};A.prototype.Get=function(){return this.$val.Get();};A.ptr.prototype.Put=function(a){var a,b;b=this;if($interfaceIsEqual(a,$ifaceNil)){return;}b.store=$append(b.store,a);};A.prototype.Put=function(a){return this.$val.Put(a);};B.ptr.prototype.Do=function(a){var a,b,$s,$deferred,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;$s=$f.$s;$deferred=$f.$deferred;$r=$f.$r;}var $err=null;try{s:while(true){switch($s){case 0:$deferred=[];$curGoroutine.deferStack.push($deferred);b=[b];b[0]=this;if(b[0].done){$s=1;continue;}$s=2;continue;case 1:$s=3;case 3:return;case 2:if(b[0].doing){$panic(new $String("nosync: Do called within f"));}b[0].doing=true;$deferred.push([(function(b){return function(){b[0].doing=false;b[0].done=true;};})(b),[]]);$r=a();$s=4;case 4:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return;}return;}}catch(err){$err=err;$s=-1;}finally{$callDeferred($deferred,$err);if($curGoroutine.asleep){if($f===undefined){$f={$blk:B.ptr.prototype.Do};}$f.a=a;$f.b=b;$f.$s=$s;$f.$deferred=$deferred;$f.$r=$r;return $f;}}};B.prototype.Do=function(a){return this.$val.Do(a);};C.ptr.prototype.Lock=function(){var a;a=this;if(a.locked){$panic(new $String("nosync: mutex is already locked"));}a.locked=true;};C.prototype.Lock=function(){return this.$val.Lock();};C.ptr.prototype.Unlock=function(){var a;a=this;if(!a.locked){$panic(new $String("nosync: unlock of unlocked mutex"));}a.locked=false;};C.prototype.Unlock=function(){return this.$val.Unlock();};E.ptr.prototype.Add=function(a){var a,b;b=this;b.counter=b.counter+(a)>>0;if(b.counter<0){$panic(new $String("sync: negative WaitGroup counter"));}};E.prototype.Add=function(a){return this.$val.Add(a);};E.ptr.prototype.Done=function(){var a;a=this
|
|||
|
$packages["time"]=(function(){var $pkg={},$init,C,E,D,A,B,V,W,X,AF,AG,AP,AQ,AR,AU,DI,EE,EF,EG,EI,EJ,EK,EN,ER,ES,ET,EV,FB,K,Y,EC,Z,ED,AA,AK,BB,BF,CP,CR,CU,CV,CW,CX,DB,DH,DX,EA,i,j,AB,AC,AD,AE,AH,AI,AJ,AS,AT,AV,AW,AX,BA,BC,BD,BE,BH,BI,BL,BM,BN,BO,CE,CF,CG,CS,CT,CY,CZ,DA,DC,DD,DE,DF,DG,DJ,DK,DL,DM,DN,DO,DP,DR,DS,DT,DU,DV,DW,DY,DZ,EB;C=$packages["errors"];E=$packages["github.com/gopherjs/gopherjs/js"];D=$packages["github.com/gopherjs/gopherjs/nosync"];A=$packages["runtime"];B=$packages["syscall"];V=$pkg.Location=$newType(0,$kindStruct,"time.Location",true,"time",true,function(name_,zone_,tx_,extend_,cacheStart_,cacheEnd_,cacheZone_){this.$val=this;if(arguments.length===0){this.name="";this.zone=EE.nil;this.tx=EF.nil;this.extend="";this.cacheStart=new $Int64(0,0);this.cacheEnd=new $Int64(0,0);this.cacheZone=EG.nil;return;}this.name=name_;this.zone=zone_;this.tx=tx_;this.extend=extend_;this.cacheStart=cacheStart_;this.cacheEnd=cacheEnd_;this.cacheZone=cacheZone_;});W=$pkg.zone=$newType(0,$kindStruct,"time.zone",true,"time",false,function(name_,offset_,isDST_){this.$val=this;if(arguments.length===0){this.name="";this.offset=0;this.isDST=false;return;}this.name=name_;this.offset=offset_;this.isDST=isDST_;});X=$pkg.zoneTrans=$newType(0,$kindStruct,"time.zoneTrans",true,"time",false,function(when_,index_,isstd_,isutc_){this.$val=this;if(arguments.length===0){this.when=new $Int64(0,0);this.index=0;this.isstd=false;this.isutc=false;return;}this.when=when_;this.index=index_;this.isstd=isstd_;this.isutc=isutc_;});AF=$pkg.ruleKind=$newType(4,$kindInt,"time.ruleKind",true,"time",false,null);AG=$pkg.rule=$newType(0,$kindStruct,"time.rule",true,"time",false,function(kind_,day_,week_,mon_,time_){this.$val=this;if(arguments.length===0){this.kind=0;this.day=0;this.week=0;this.mon=0;this.time=0;return;}this.kind=kind_;this.day=day_;this.week=week_;this.mon=mon_;this.time=time_;});AP=$pkg.Time=$newType(0,$kindStruct,"time.Time",true,"time",true,function(wall_,ext_,loc_){this.$val=this;if(arguments.length===0){this.wall=new $Uint64(0,0);this.ext=new $Int64(0,0);this.loc=EK.nil;return;}this.wall=wall_;this.ext=ext_;this.loc=loc_;});AQ=$pkg.Month=$newType(4,$kindInt,"time.Month",true,"time",true,null);AR=$pkg.Weekday=$newType(4,$kindInt,"time.Weekday",true,"time",true,null);AU=$pkg.Duration=$newType(8,$kindInt64,"time.Duration",true,"time",true,null);DI=$pkg.ParseError=$newType(0,$kindStruct,"time.ParseError",true,"time",true,function(Layout_,Value_,LayoutElem_,ValueElem_,Message_){this.$val=this;if(arguments.length===0){this.Layout="";this.Value="";this.LayoutElem="";this.ValueElem="";this.Message="";return;}this.Layout=Layout_;this.Value=Value_;this.LayoutElem=LayoutElem_;this.ValueElem=ValueElem_;this.Message=Message_;});EE=$sliceType(W);EF=$sliceType(X);EG=$ptrType(W);EI=$sliceType($String);EJ=$sliceType($Uint8);EK=$ptrType(V);EN=$arrayType($Uint8,32);ER=$arrayType($Uint8,20);ES=$arrayType($Uint8,9);ET=$arrayType($Uint8,64);EV=$ptrType(AP);FB=$ptrType(DI);V.ptr.prototype.get=function(){var k,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;k=$f.k;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:k=this;if(k===EK.nil){$s=-1;return Y;}if(k===Z){$s=1;continue;}$s=2;continue;case 1:$r=AA.Do(CE);$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}case 2:$s=-1;return k;}return;}if($f===undefined){$f={$blk:V.ptr.prototype.get};}$f.k=k;$f.$s=$s;$f.$r=$r;return $f;};V.prototype.get=function(){return this.$val.get();};V.ptr.prototype.String=function(){var k,l,m,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;k=$f.k;l=$f.l;m=$f.m;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:k=this;l=k.get();$s=1;case 1:if($c){$c=false;l=l.$blk();}if(l&&l.$blk!==undefined){break s;}m=l.name;$s=2;case 2:return m;}return;}if($f===undefined){$f={$blk:V.ptr.prototype.String};}$f.k=k;$f.l=l;$f.m=m;$f.$s=$s;$f.$r=$r;return $f;};V.prototype.String=function(){return this.$val.String();};AB=function(k,l){var k,l,m,n;m=new V.ptr(k,new EE([new W.ptr(k,l,false)]),new EF([n
|
|||
|
$packages["internal/poll"]=(function(){var $pkg={},$init,H,C,A,D,E,F,B,G,X,AD,AJ,AK,AM,BC,BD,BE,BF,BJ,BL,BM,BN,BO,BP,BQ,BR,BS,BT,BU,BV,BW,BX,BY,BZ,CA,CB,CC,CD,CE,CF,AB,AE,AY,AT,AZ,T,V,Z,AA,AC,AF,AG,AH,AI,AL,AN,AO,AU,AV,AW;H=$packages["errors"];C=$packages["internal/syscall/unix"];A=$packages["io"];D=$packages["runtime"];E=$packages["sync"];F=$packages["sync/atomic"];B=$packages["syscall"];G=$packages["time"];X=$pkg.pollDesc=$newType(0,$kindStruct,"poll.pollDesc",true,"internal/poll",false,function(closing_){this.$val=this;if(arguments.length===0){this.closing=false;return;}this.closing=closing_;});AD=$pkg.FD=$newType(0,$kindStruct,"poll.FD",true,"internal/poll",true,function(fdmu_,Sysfd_,pd_,iovecs_,csema_,isBlocking_,IsStream_,ZeroReadIsEOF_,isFile_){this.$val=this;if(arguments.length===0){this.fdmu=new AJ.ptr(new $Uint64(0,0),0,0);this.Sysfd=0;this.pd=new X.ptr(false);this.iovecs=BD.nil;this.csema=0;this.isBlocking=0;this.IsStream=false;this.ZeroReadIsEOF=false;this.isFile=false;return;}this.fdmu=fdmu_;this.Sysfd=Sysfd_;this.pd=pd_;this.iovecs=iovecs_;this.csema=csema_;this.isBlocking=isBlocking_;this.IsStream=IsStream_;this.ZeroReadIsEOF=ZeroReadIsEOF_;this.isFile=isFile_;});AJ=$pkg.fdMutex=$newType(0,$kindStruct,"poll.fdMutex",true,"internal/poll",false,function(state_,rsema_,wsema_){this.$val=this;if(arguments.length===0){this.state=new $Uint64(0,0);this.rsema=0;this.wsema=0;return;}this.state=state_;this.rsema=rsema_;this.wsema=wsema_;});AK=$pkg.errNetClosing=$newType(0,$kindStruct,"poll.errNetClosing",true,"internal/poll",false,function(){this.$val=this;if(arguments.length===0){return;}});AM=$pkg.DeadlineExceededError=$newType(0,$kindStruct,"poll.DeadlineExceededError",true,"internal/poll",true,function(){this.$val=this;if(arguments.length===0){return;}});BC=$sliceType(B.Iovec);BD=$ptrType(BC);BE=$ptrType($Uint8);BF=$ptrType($Int64);BJ=$arrayType($Int,2);BL=$arrayType($Uint8,4);BM=$ptrType($Uint32);BN=$chanType($Bool,false,false);BO=$sliceType(BN);BP=$ptrType($Int32);BQ=$ptrType($Uint64);BR=$arrayType($Int8,65);BS=$ptrType(AD);BT=$ptrType(X);BU=$sliceType($Uint8);BV=$sliceType(BU);BW=$ptrType(BV);BX=$ptrType(B.IPMreq);BY=$ptrType(B.IPv6Mreq);BZ=$ptrType(B.IPMreqn);CA=$ptrType(B.Linger);CB=$ptrType(B.Stat_t);CC=$funcType([$Uintptr],[$Bool],false);CD=$funcType([$Uintptr],[],false);CE=$ptrType(AJ);CF=$ptrType(AM);AD.ptr.prototype.Writev=function(c){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,$s,$deferred,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;m=$f.m;n=$f.n;o=$f.o;p=$f.p;q=$f.q;r=$f.r;s=$f.s;t=$f.t;u=$f.u;v=$f.v;w=$f.w;x=$f.x;y=$f.y;z=$f.z;$s=$f.$s;$deferred=$f.$deferred;$r=$f.$r;}var $err=null;try{s:while(true){switch($s){case 0:$deferred=[];$curGoroutine.deferStack.push($deferred);d=this;e=d.writeLock();$s=1;case 1:if($c){$c=false;e=e.$blk();}if(e&&e.$blk!==undefined){break s;}f=e;if(!($interfaceIsEqual(f,$ifaceNil))){$s=2;continue;}$s=3;continue;case 2:g=[new $Int64(0,0),f];$s=4;case 4:return g;case 3:$deferred.push([$methodVal(d,"writeUnlock"),[]]);h=d.pd.prepareWrite(d.isFile);if(!($interfaceIsEqual(h,$ifaceNil))){$s=5;continue;}$s=6;continue;case 5:i=[new $Int64(0,0),h];$s=7;case 7:return i;case 6:j=BC.nil;if(!(d.iovecs===BD.nil)){j=d.iovecs.$get();}k=1024;l=new $Int64(0,0);m=$ifaceNil;case 8:if(!(c.$get().$length>0)){$s=9;continue;}j=$subslice(j,0,0);n=c.$get();o=0;while(true){if(!(o<n.$length)){break;}p=((o<0||o>=n.$length)?($throwRuntimeError("index out of range"),undefined):n.$array[n.$offset+o]);if(p.$length===0){o++;continue;}j=$append(j,V($indexPtr(p.$array,p.$offset+0,BE)));if(d.IsStream&&p.$length>1073741824){(q=j.$length-1>>0,((q<0||q>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+q])).SetLen(1073741824);break;}(r=j.$length-1>>0,((r<0||r>=j.$length)?($throwRuntimeError("index out of range"),undefined):j.$array[j.$offset+r])).SetLen(p.$length);if(j.$length===k){break;}o++;}if(j.$length===0){$s=9;continue;}if(d.iovecs===BD.nil){d.iovecs=$newDataP
|
|||
|
$packages["internal/syscall/execenv"]=(function(){var $pkg={},$init,A;A=$packages["syscall"];$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=A.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$packages["internal/testlog"]=(function(){var $pkg={},$init,B,A,C,N,D,F,I;B=$packages["sync"];A=$packages["sync/atomic"];C=$pkg.Interface=$newType(8,$kindInterface,"testlog.Interface",true,"internal/testlog",true,null);N=$ptrType(C);F=function(){var a;a=D.Load();if($interfaceIsEqual(a,$ifaceNil)){return $ifaceNil;}return $assertType(a,N).$get();};$pkg.Logger=F;I=function(a){var a,b,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=F();if(!($interfaceIsEqual(b,$ifaceNil))){$s=1;continue;}$s=2;continue;case 1:$r=b.Stat(a);$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}case 2:$s=-1;return;}return;}if($f===undefined){$f={$blk:I};}$f.a=a;$f.b=b;$f.$s=$s;$f.$r=$r;return $f;};$pkg.Stat=I;C.init([{prop:"Chdir",name:"Chdir",pkg:"",typ:$funcType([$String],[],false)},{prop:"Getenv",name:"Getenv",pkg:"",typ:$funcType([$String],[],false)},{prop:"Open",name:"Open",pkg:"",typ:$funcType([$String],[],false)},{prop:"Stat",name:"Stat",pkg:"",typ:$funcType([$String],[],false)}]);$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=B.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=A.$init();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}D=new A.Value.ptr($ifaceNil);}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$packages["path"]=(function(){var $pkg={},$init,A,B,C;A=$packages["errors"];B=$packages["internal/bytealg"];C=$packages["unicode/utf8"];$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=A.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=B.$init();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=C.$init();$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$pkg.ErrBadPattern=A.New("syntax error in pattern");}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$packages["io/fs"]=(function(){var $pkg={},$init,A,E,C,B,D,F,G,AE,AL,AM,AN,AP,AR,AS,AT,AG,AH,AI,AJ,AK;A=$packages["errors"];E=$packages["internal/oserror"];C=$packages["io"];B=$packages["path"];D=$packages["sort"];F=$packages["time"];G=$packages["unicode/utf8"];AE=$pkg.DirEntry=$newType(8,$kindInterface,"fs.DirEntry",true,"io/fs",true,null);AL=$pkg.FileInfo=$newType(8,$kindInterface,"fs.FileInfo",true,"io/fs",true,null);AM=$pkg.FileMode=$newType(4,$kindUint32,"fs.FileMode",true,"io/fs",true,null);AN=$pkg.PathError=$newType(0,$kindStruct,"fs.PathError",true,"io/fs",true,function(Op_,Path_,Err_){this.$val=this;if(arguments.length===0){this.Op="";this.Path="";this.Err=$ifaceNil;return;}this.Op=Op_;this.Path=Path_;this.Err=Err_;});AP=$ptrType(AN);AR=$sliceType($Uint8);AS=$arrayType($Uint8,32);AT=$interfaceType([{prop:"Timeout",name:"Timeout",pkg:"",typ:$funcType([],[$Bool],false)}]);AG=function(){return E.ErrInvalid;};AH=function(){return E.ErrPermission;};AI=function(){return E.ErrExist;};AJ=function(){return E.ErrNotExist;};AK=function(){return E.ErrClosed;};AM.prototype.String=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o;a=this.$val;b=AS.zero();c=0;d="dalTLDpSugct?";e=0;while(true){if(!(e<d.length)){break;}f=$decodeRune(d,e);g=e;h=f[0];if(!((((a&(((i=(((31-g>>0)>>>0)),i<32?(1<<i):0)>>>0)))>>>0)===0))){((c<0||c>=b.length)?($throwRuntimeError("index out of range"),undefined):b[c]=((h<<24>>>24)));c=c+(1)>>0;}e+=f[1];}if(c===0){((c<0||c>=b.length)?($throwRuntimeError("index out of range"),undefined):b[c]=45);c=c+(1)>>0;}j="rwxrwxrwx";k=0;while(true){if(!(k<j.length)){break;}l=$decodeRune(j,k);m=k;n=l[0];if(!((((a&(((o=(((8-m>>0)>>>0)),o<32?(1<<o):0)>>>0)))>>>0)===0))){((c<0||c>=b.length)?($throwRuntimeError("index out of range"),undefined):b[c]=((n<<24>>>24)));}else{((c<0||c>=b.length)?($throwRuntimeError("index out of range"),undefined):b[c]=45);}c=c+(1)>>0;k+=l[1];}return($bytesToString($subslice(new AR(b),0,c)));};$ptrType(AM).prototype.String=function(){return new AM(this.$get()).String();};AM.prototype.IsDir=function(){var a;a=this.$val;return!((((a&2147483648)>>>0)===0));};$ptrType(AM).prototype.IsDir=function(){return new AM(this.$get()).IsDir();};AM.prototype.IsRegular=function(){var a;a=this.$val;return((a&2401763328)>>>0)===0;};$ptrType(AM).prototype.IsRegular=function(){return new AM(this.$get()).IsRegular();};AM.prototype.Perm=function(){var a;a=this.$val;return(a&511)>>>0;};$ptrType(AM).prototype.Perm=function(){return new AM(this.$get()).Perm();};AM.prototype.Type=function(){var a;a=this.$val;return(a&2401763328)>>>0;};$ptrType(AM).prototype.Type=function(){return new AM(this.$get()).Type();};AN.ptr.prototype.Error=function(){var a,b,c,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=this;b=a.Err.Error();$s=1;case 1:if($c){$c=false;b=b.$blk();}if(b&&b.$blk!==undefined){break s;}c=a.Op+" "+a.Path+": "+b;$s=2;case 2:return c;}return;}if($f===undefined){$f={$blk:AN.ptr.prototype.Error};}$f.a=a;$f.b=b;$f.c=c;$f.$s=$s;$f.$r=$r;return $f;};AN.prototype.Error=function(){return this.$val.Error();};AN.ptr.prototype.Unwrap=function(){var a;a=this;return a.Err;};AN.prototype.Unwrap=function(){return this.$val.Unwrap();};AN.ptr.prototype.Timeout=function(){var a,b,c,d,e,f,g,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=this;b=$assertType(a.Err,AT,true);c=b[0];d=b[1];if(!(d)){e=false;$s=1;continue s;}f=c.Timeout();$s=2;case 2:if($c){$c=false;f=f.$blk();}if(f&&f.$blk!==undefined){break s;}e=f;case 1:g=e;$s=3;case 3:return g;}return;}if($f===undefined){$f={$blk:AN.ptr.prototype.Timeout};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.$s=$s;$f.$r=$r;return $f;};AN.prototype.Timeout=function(){return this.$val.Timeout();};AM.methods=[{prop:"String",name:"String",pkg:"",typ:$funcType([],[$String],false)},{prop:"IsDir",name:"IsDir",pkg:"",typ:$funcType([],[$Bool],false)},{pr
|
|||
|
$packages["os"]=(function(){var $pkg={},$init,E,K,F,P,J,N,H,G,M,I,D,A,Q,L,O,B,C,R,U,AT,BU,CG,CP,CR,EE,EG,FD,FI,FM,FO,FP,FQ,FT,FU,FZ,GA,GC,GD,GG,GH,GI,GJ,GK,GW,GX,GY,GZ,HA,HB,HC,HD,AA,AS,CS,CZ,FE,FK,e,f,g,AK,AL,AM,AP,AU,AV,BE,BL,BM,BV,BX,BY,CH,CI,CJ,CO,CQ,EC,ED,EH,EJ,EM,EN,EZ,FA,FB,FC,FF,FG,FH;E=$packages["errors"];K=$packages["github.com/gopherjs/gopherjs/js"];F=$packages["internal/itoa"];P=$packages["internal/oserror"];J=$packages["internal/poll"];N=$packages["internal/syscall/execenv"];H=$packages["internal/syscall/unix"];G=$packages["internal/testlog"];M=$packages["internal/unsafeheader"];I=$packages["io"];D=$packages["io/fs"];A=$packages["runtime"];Q=$packages["sort"];L=$packages["sync"];O=$packages["sync/atomic"];B=$packages["syscall"];C=$packages["time"];R=$pkg.fileStat=$newType(0,$kindStruct,"os.fileStat",true,"os",false,function(name_,size_,mode_,modTime_,sys_){this.$val=this;if(arguments.length===0){this.name="";this.size=new $Int64(0,0);this.mode=0;this.modTime=new C.Time.ptr(new $Uint64(0,0),new $Int64(0,0),FZ.nil);this.sys=new B.Stat_t.ptr(new $Uint64(0,0),new $Uint64(0,0),new $Uint64(0,0),0,0,0,0,new $Uint64(0,0),new $Int64(0,0),new $Int64(0,0),new $Int64(0,0),new B.Timespec.ptr(new $Int64(0,0),new $Int64(0,0)),new B.Timespec.ptr(new $Int64(0,0),new $Int64(0,0)),new B.Timespec.ptr(new $Int64(0,0),new $Int64(0,0)),GA.zero());return;}this.name=name_;this.size=size_;this.mode=mode_;this.modTime=modTime_;this.sys=sys_;});U=$pkg.File=$newType(0,$kindStruct,"os.File",true,"os",true,function(file_){this.$val=this;if(arguments.length===0){this.file=GJ.nil;return;}this.file=file_;});AT=$pkg.rawConn=$newType(0,$kindStruct,"os.rawConn",true,"os",false,function(file_){this.$val=this;if(arguments.length===0){this.file=FU.nil;return;}this.file=file_;});BU=$pkg.file=$newType(0,$kindStruct,"os.file",true,"os",false,function(pfd_,name_,dirinfo_,nonblock_,stdoutOrErr_,appendMode_){this.$val=this;if(arguments.length===0){this.pfd=new J.FD.ptr(new J.fdMutex.ptr(new $Uint64(0,0),0,0),0,new J.pollDesc.ptr(false),GH.nil,0,0,false,false,false);this.name="";this.dirinfo=GI.nil;this.nonblock=false;this.stdoutOrErr=false;this.appendMode=false;return;}this.pfd=pfd_;this.name=name_;this.dirinfo=dirinfo_;this.nonblock=nonblock_;this.stdoutOrErr=stdoutOrErr_;this.appendMode=appendMode_;});CG=$pkg.unixDirent=$newType(0,$kindStruct,"os.unixDirent",true,"os",false,function(parent_,name_,typ_,info_){this.$val=this;if(arguments.length===0){this.parent="";this.name="";this.typ=0;this.info=$ifaceNil;return;}this.parent=parent_;this.name=name_;this.typ=typ_;this.info=info_;});CP=$pkg.LinkError=$newType(0,$kindStruct,"os.LinkError",true,"os",true,function(Op_,Old_,New_,Err_){this.$val=this;if(arguments.length===0){this.Op="";this.Old="";this.New="";this.Err=$ifaceNil;return;}this.Op=Op_;this.Old=Old_;this.New=New_;this.Err=Err_;});CR=$pkg.onlyWriter=$newType(0,$kindStruct,"os.onlyWriter",true,"os",false,function(Writer_){this.$val=this;if(arguments.length===0){this.Writer=$ifaceNil;return;}this.Writer=Writer_;});EE=$pkg.timeout=$newType(8,$kindInterface,"os.timeout",true,"os",false,null);EG=$pkg.SyscallError=$newType(0,$kindStruct,"os.SyscallError",true,"os",true,function(Syscall_,Err_){this.$val=this;if(arguments.length===0){this.Syscall="";this.Err=$ifaceNil;return;}this.Syscall=Syscall_;this.Err=Err_;});FD=$pkg.dirInfo=$newType(0,$kindStruct,"os.dirInfo",true,"os",false,function(buf_,nbuf_,bufp_){this.$val=this;if(arguments.length===0){this.buf=FQ.nil;this.nbuf=0;this.bufp=0;return;}this.buf=buf_;this.nbuf=nbuf_;this.bufp=bufp_;});FI=$pkg.readdirMode=$newType(4,$kindInt,"os.readdirMode",true,"os",false,null);FM=$sliceType($String);FO=$sliceType($emptyInterface);FP=$sliceType($Uint8);FQ=$ptrType(FP);FT=$ptrType(R);FU=$ptrType(U);FZ=$ptrType(C.Location);GA=$arrayType($Int64,3);GC=$ptrType(D.PathError);GD=$ptrType(I.LimitedReader);GG=$sliceType(B.Iovec);GH=$ptrType(GG);GI=$ptrType(FD);GJ=$ptrType(BU);GK=$funcType([GJ],[$error],false);GW=$ptrType(CP);GX=$ptrType(EG);GY=$sliceType(D.DirEntry);GZ=$sliceType(D.FileInfo);HA=$funcType([$Uintptr],[],fal
|
|||
|
$packages["fmt"]=(function(){var $pkg={},$init,A,I,B,C,D,E,F,G,H,J,V,W,X,AK,AL,AM,AN,AO,AP,BG,BH,BJ,BK,BL,BM,BN,BO,BP,BS,BT,CO,CP,CQ,CS,CT,Y,AC,AE,AF,AQ,Z,AA,AG,AR,AS,AU,AV,AY,AZ,BA,BB,BC,BD,BE,BF,BI;A=$packages["errors"];I=$packages["internal/fmtsort"];B=$packages["io"];C=$packages["math"];D=$packages["os"];E=$packages["reflect"];F=$packages["strconv"];G=$packages["sync"];H=$packages["unicode/utf8"];J=$pkg.ScanState=$newType(8,$kindInterface,"fmt.ScanState",true,"fmt",true,null);V=$pkg.scanError=$newType(0,$kindStruct,"fmt.scanError",true,"fmt",false,function(err_){this.$val=this;if(arguments.length===0){this.err=$ifaceNil;return;}this.err=err_;});W=$pkg.ss=$newType(0,$kindStruct,"fmt.ss",true,"fmt",false,function(rs_,buf_,count_,atEOF_,ssave_){this.$val=this;if(arguments.length===0){this.rs=$ifaceNil;this.buf=AO.nil;this.count=0;this.atEOF=false;this.ssave=new X.ptr(false,false,false,0,0,0);return;}this.rs=rs_;this.buf=buf_;this.count=count_;this.atEOF=atEOF_;this.ssave=ssave_;});X=$pkg.ssave=$newType(0,$kindStruct,"fmt.ssave",true,"fmt",false,function(validSave_,nlIsEnd_,nlIsSpace_,argLimit_,limit_,maxWid_){this.$val=this;if(arguments.length===0){this.validSave=false;this.nlIsEnd=false;this.nlIsSpace=false;this.argLimit=0;this.limit=0;this.maxWid=0;return;}this.validSave=validSave_;this.nlIsEnd=nlIsEnd_;this.nlIsSpace=nlIsSpace_;this.argLimit=argLimit_;this.limit=limit_;this.maxWid=maxWid_;});AK=$pkg.State=$newType(8,$kindInterface,"fmt.State",true,"fmt",true,null);AL=$pkg.Formatter=$newType(8,$kindInterface,"fmt.Formatter",true,"fmt",true,null);AM=$pkg.Stringer=$newType(8,$kindInterface,"fmt.Stringer",true,"fmt",true,null);AN=$pkg.GoStringer=$newType(8,$kindInterface,"fmt.GoStringer",true,"fmt",true,null);AO=$pkg.buffer=$newType(12,$kindSlice,"fmt.buffer",true,"fmt",false,null);AP=$pkg.pp=$newType(0,$kindStruct,"fmt.pp",true,"fmt",false,function(buf_,arg_,value_,fmt_,reordered_,goodArgNum_,panicking_,erroring_,wrapErrs_,wrappedErr_){this.$val=this;if(arguments.length===0){this.buf=AO.nil;this.arg=$ifaceNil;this.value=new E.Value.ptr(BN.nil,0,0);this.fmt=new BH.ptr(BO.nil,new BG.ptr(false,false,false,false,false,false,false,false,false),0,0,BP.zero());this.reordered=false;this.goodArgNum=false;this.panicking=false;this.erroring=false;this.wrapErrs=false;this.wrappedErr=$ifaceNil;return;}this.buf=buf_;this.arg=arg_;this.value=value_;this.fmt=fmt_;this.reordered=reordered_;this.goodArgNum=goodArgNum_;this.panicking=panicking_;this.erroring=erroring_;this.wrapErrs=wrapErrs_;this.wrappedErr=wrappedErr_;});BG=$pkg.fmtFlags=$newType(0,$kindStruct,"fmt.fmtFlags",true,"fmt",false,function(widPresent_,precPresent_,minus_,plus_,sharp_,space_,zero_,plusV_,sharpV_){this.$val=this;if(arguments.length===0){this.widPresent=false;this.precPresent=false;this.minus=false;this.plus=false;this.sharp=false;this.space=false;this.zero=false;this.plusV=false;this.sharpV=false;return;}this.widPresent=widPresent_;this.precPresent=precPresent_;this.minus=minus_;this.plus=plus_;this.sharp=sharp_;this.space=space_;this.zero=zero_;this.plusV=plusV_;this.sharpV=sharpV_;});BH=$pkg.fmt=$newType(0,$kindStruct,"fmt.fmt",true,"fmt",false,function(buf_,fmtFlags_,wid_,prec_,intbuf_){this.$val=this;if(arguments.length===0){this.buf=BO.nil;this.fmtFlags=new BG.ptr(false,false,false,false,false,false,false,false,false);this.wid=0;this.prec=0;this.intbuf=BP.zero();return;}this.buf=buf_;this.fmtFlags=fmtFlags_;this.wid=wid_;this.prec=prec_;this.intbuf=intbuf_;});BJ=$pkg.wrapError=$newType(0,$kindStruct,"fmt.wrapError",true,"fmt",false,function(msg_,err_){this.$val=this;if(arguments.length===0){this.msg="";this.err=$ifaceNil;return;}this.msg=msg_;this.err=err_;});BK=$arrayType($Uint16,2);BL=$sliceType(BK);BM=$sliceType($emptyInterface);BN=$ptrType(E.rtype);BO=$ptrType(AO);BP=$arrayType($Uint8,68);BS=$sliceType($Uint8);BT=$ptrType(W);CO=$ptrType(AP);CP=$arrayType($Uint8,6);CQ=$funcType([$Int32],[$Bool],false);CS=$ptrType(BH);CT=$ptrType(BJ);W.ptr.prototype.Read=function(a){var a,b,c,d,e,f;b=0;c=$ifaceNil;d=this;e=0;f=A.New("ScanState's Read should not be called
|
|||
|
$packages["strings"]=(function(){var $pkg={},$init,F,G,A,D,E,B,C,AS,BV,CC,CE,CF,CI,CJ,CK,CY,U,H,I,K,L,O,P,S,X,Y,Z,AA,AB,AC,AD,AJ,AK,AL,AM,AN,AQ,AR,AT,AU,AV,AY,AZ,BA,BB,BW,BX,BY,CA,CB;F=$packages["errors"];G=$packages["github.com/gopherjs/gopherjs/js"];A=$packages["internal/bytealg"];D=$packages["io"];E=$packages["sync"];B=$packages["unicode"];C=$packages["unicode/utf8"];AS=$pkg.asciiSet=$newType(32,$kindArray,"strings.asciiSet",true,"strings",false,null);BV=$pkg.Reader=$newType(0,$kindStruct,"strings.Reader",true,"strings",true,function(s_,i_,prevRune_){this.$val=this;if(arguments.length===0){this.s="";this.i=new $Int64(0,0);this.prevRune=0;return;}this.s=s_;this.i=i_;this.prevRune=prevRune_;});CC=$pkg.Builder=$newType(0,$kindStruct,"strings.Builder",true,"strings",true,function(addr_,buf_){this.$val=this;if(arguments.length===0){this.addr=CI.nil;this.buf=CJ.nil;return;}this.addr=addr_;this.buf=buf_;});CE=$sliceType($String);CF=$ptrType(AS);CI=$ptrType(CC);CJ=$sliceType($Uint8);CK=$arrayType($Uint32,8);CY=$ptrType(BV);H=function(e,f){var e,f,g,h,i,j,k,l,m;g=C.RuneCountInString(e);if(f<0||f>g){f=g;}h=$makeSlice(CE,f);i=0;while(true){if(!(i<(f-1>>0))){break;}j=C.DecodeRuneInString(e);k=j[0];l=j[1];((i<0||i>=h.$length)?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+i]=$substring(e,0,l));e=$substring(e,l);if(k===65533){((i<0||i>=h.$length)?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+i]="\xEF\xBF\xBD");}i=i+(1)>>0;}if(f>0){(m=f-1>>0,((m<0||m>=h.$length)?($throwRuntimeError("index out of range"),undefined):h.$array[h.$offset+m]=e));}return h;};I=function(e,f){var e,f;return BY(e,f)>=0;};$pkg.Contains=I;K=function(e,f){var e,f;return L(e,f)>=0;};$pkg.ContainsRune=K;L=function(e,f){var e,f,g,h,i,j,k;if(0<=f&&f<128){return BX(e,((f<<24>>>24)));}else if((f===65533)){g=e;h=0;while(true){if(!(h<g.length)){break;}i=$decodeRune(g,h);j=h;k=i[0];if(k===65533){return j;}h+=i[1];}return-1;}else if(!C.ValidRune(f)){return-1;}else{return BY(e,($encodeRune(f)));}};$pkg.IndexRune=L;O=function(e,f){var e,f,g;g=e.length-1>>0;while(true){if(!(g>=0)){break;}if(e.charCodeAt(g)===f){return g;}g=g-(1)>>0;}return-1;};$pkg.LastIndexByte=O;P=function(e,f,g,h){var e,f,g,h,i,j,k;if(h===0){return CE.nil;}if(f===""){return H(e,h);}if(h<0){h=CA(e,f)+1>>0;}i=$makeSlice(CE,h);h=h-(1)>>0;j=0;while(true){if(!(j<h)){break;}k=BY(e,f);if(k<0){break;}((j<0||j>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+j]=$substring(e,0,(k+g>>0)));e=$substring(e,(k+f.length>>0));j=j+(1)>>0;}((j<0||j>=i.$length)?($throwRuntimeError("index out of range"),undefined):i.$array[i.$offset+j]=e);return $subslice(i,0,(j+1>>0));};S=function(e,f){var e,f;return P(e,f,0,-1);};$pkg.Split=S;X=function(e,f){var e,f,g,h,i,j,k,l,m;g=e.$length;if(g===(0)){return"";}else if(g===(1)){return(0>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+0]);}h=$imul(f.length,((e.$length-1>>0)));i=0;while(true){if(!(i<e.$length)){break;}h=h+(((i<0||i>=e.$length)?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+i]).length)>>0;i=i+(1)>>0;}j=new CC.ptr(CI.nil,CJ.nil);j.Grow(h);j.WriteString((0>=e.$length?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+0]));k=$subslice(e,1);l=0;while(true){if(!(l<k.$length)){break;}m=((l<0||l>=k.$length)?($throwRuntimeError("index out of range"),undefined):k.$array[k.$offset+l]);j.WriteString(f);j.WriteString(m);l++;}return j.String();};$pkg.Join=X;Y=function(e,f){var e,f;return e.length>=f.length&&$substring(e,0,f.length)===f;};$pkg.HasPrefix=Y;Z=function(e,f){var e,f;return e.length>=f.length&&$substring(e,(e.length-f.length>>0))===f;};$pkg.HasSuffix=Z;AA=function(e,f){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;m=$f.m;n=$f.n;o=$f.o;p=$f.p;q=$f.q;r=$f.r;s=$f.s;t=$f.t;u=$f.u;v=$f.v;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:g=new CC.ptr(CI.nil,CJ.nil);h=f;i=0;case 1:if
|
|||
|
$packages["unicode/utf16"]=(function(){var $pkg={},$init,A,B;A=function(a){var a;return 55296<=a&&a<57344;};$pkg.IsSurrogate=A;B=function(a,b){var a,b;if(55296<=a&&a<56320&&56320<=b&&b<57344){return((((a-55296>>0))<<10>>0)|((b-56320>>0)))+65536>>0;}return 65533;};$pkg.DecodeRune=B;$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$packages["encoding/json"]=(function(){var $pkg={},$init,C,H,I,D,J,G,E,K,L,M,F,A,N,O,B,P,T,Y,Z,AA,AD,AE,CA,CB,CC,CE,CG,CJ,CL,CM,DB,DI,DJ,DL,DO,DQ,DS,DU,DY,DZ,EA,EG,EH,EJ,EK,EL,EM,EN,EV,EW,EX,EY,EZ,FA,FB,FC,FE,FF,FG,FH,FI,FJ,FK,FL,FM,FN,FO,FP,FQ,FR,FS,FU,FV,FW,FX,FZ,GA,GB,GC,GD,GF,GG,R,S,AF,CF,CH,CN,CQ,CR,DC,DD,ED,EP,EQ,ER,a,b,c,Q,U,V,AC,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR,AS,AT,AU,AV,AW,AX,AY,AZ,BA,BB,BC,BD,BE,BF,BG,BH,BI,BJ,BK,BL,BM,BN,BO,BQ,BR,BS,BT,BU,BV,BW,BX,BY,BZ,CI,CK,CO,CP,CS,CT,CU,CV,CW,CX,CY,CZ,DA,DE,DF,DG,DH,DK,DM,DN,DP,DR,DT,DV,DW,DX,EB,EC,EE,EF,EO,ES,ET,EU;C=$packages["bytes"];H=$packages["encoding"];I=$packages["encoding/base64"];D=$packages["errors"];J=$packages["fmt"];G=$packages["github.com/gopherjs/gopherjs/nosync"];E=$packages["io"];K=$packages["math"];L=$packages["reflect"];M=$packages["sort"];F=$packages["strconv"];A=$packages["strings"];N=$packages["unicode"];O=$packages["unicode/utf16"];B=$packages["unicode/utf8"];P=$pkg.tagOptions=$newType(8,$kindString,"json.tagOptions",true,"encoding/json",false,null);T=$pkg.Decoder=$newType(0,$kindStruct,"json.Decoder",true,"encoding/json",true,function(r_,buf_,d_,scanp_,scanned_,scan_,err_,tokenState_,tokenStack_){this.$val=this;if(arguments.length===0){this.r=$ifaceNil;this.buf=FA.nil;this.d=new EM.ptr(FA.nil,0,0,new AE.ptr($throwNilPointerError,false,EX.nil,$ifaceNil,new $Int64(0,0)),FC.nil,$ifaceNil,false,false);this.scanp=0;this.scanned=new $Int64(0,0);this.scan=new AE.ptr($throwNilPointerError,false,EX.nil,$ifaceNil,new $Int64(0,0));this.err=$ifaceNil;this.tokenState=0;this.tokenStack=EX.nil;return;}this.r=r_;this.buf=buf_;this.d=d_;this.scanp=scanp_;this.scanned=scanned_;this.scan=scan_;this.err=err_;this.tokenState=tokenState_;this.tokenStack=tokenStack_;});Y=$pkg.RawMessage=$newType(12,$kindSlice,"json.RawMessage",true,"encoding/json",true,null);Z=$pkg.Token=$newType(8,$kindInterface,"json.Token",true,"encoding/json",true,null);AA=$pkg.Delim=$newType(4,$kindInt32,"json.Delim",true,"encoding/json",true,null);AD=$pkg.SyntaxError=$newType(0,$kindStruct,"json.SyntaxError",true,"encoding/json",true,function(msg_,Offset_){this.$val=this;if(arguments.length===0){this.msg="";this.Offset=new $Int64(0,0);return;}this.msg=msg_;this.Offset=Offset_;});AE=$pkg.scanner=$newType(0,$kindStruct,"json.scanner",true,"encoding/json",false,function(step_,endTop_,parseState_,err_,bytes_){this.$val=this;if(arguments.length===0){this.step=$throwNilPointerError;this.endTop=false;this.parseState=EX.nil;this.err=$ifaceNil;this.bytes=new $Int64(0,0);return;}this.step=step_;this.endTop=endTop_;this.parseState=parseState_;this.err=err_;this.bytes=bytes_;});CA=$pkg.Marshaler=$newType(8,$kindInterface,"json.Marshaler",true,"encoding/json",true,null);CB=$pkg.UnsupportedTypeError=$newType(0,$kindStruct,"json.UnsupportedTypeError",true,"encoding/json",true,function(Type_){this.$val=this;if(arguments.length===0){this.Type=$ifaceNil;return;}this.Type=Type_;});CC=$pkg.UnsupportedValueError=$newType(0,$kindStruct,"json.UnsupportedValueError",true,"encoding/json",true,function(Value_,Str_){this.$val=this;if(arguments.length===0){this.Value=new L.Value.ptr(FO.nil,0,0);this.Str="";return;}this.Value=Value_;this.Str=Str_;});CE=$pkg.MarshalerError=$newType(0,$kindStruct,"json.MarshalerError",true,"encoding/json",true,function(Type_,Err_,sourceFunc_){this.$val=this;if(arguments.length===0){this.Type=$ifaceNil;this.Err=$ifaceNil;this.sourceFunc="";return;}this.Type=Type_;this.Err=Err_;this.sourceFunc=sourceFunc_;});CG=$pkg.encodeState=$newType(0,$kindStruct,"json.encodeState",true,"encoding/json",false,function(Buffer_,scratch_,ptrLevel_,ptrSeen_){this.$val=this;if(arguments.length===0){this.Buffer=new C.Buffer.ptr(FA.nil,0,0);this.scratch=FI.zero();this.ptrLevel=0;this.ptrSeen=false;return;}this.Buffer=Buffer_;this.scratch=scratch_;this.ptrLevel=ptrLevel_;this.ptrSeen=ptrSeen_;});CJ=$pkg.jsonError=$newType(0,$kindStruct,"json.jsonError",true,"encoding/json",false,function(error_){this.$val=this;if(arguments.length===0){this.error=$ifaceNil;return;}this.error=error_;});CL=$pkg.encOpts=$newType(0,$
|
|||
|
$packages["bufio"]=(function(){var $pkg={},$init,A,B,C,E,D,F,G,P,Z,AA,AB,AC,AE,S,T,H,L,M,Q,R;A=$packages["bytes"];B=$packages["errors"];C=$packages["io"];E=$packages["strings"];D=$packages["unicode/utf8"];F=$pkg.Scanner=$newType(0,$kindStruct,"bufio.Scanner",true,"bufio",true,function(r_,split_,maxTokenSize_,token_,buf_,start_,end_,err_,empties_,scanCalled_,done_){this.$val=this;if(arguments.length===0){this.r=$ifaceNil;this.split=$throwNilPointerError;this.maxTokenSize=0;this.token=Z.nil;this.buf=Z.nil;this.start=0;this.end=0;this.err=$ifaceNil;this.empties=0;this.scanCalled=false;this.done=false;return;}this.r=r_;this.split=split_;this.maxTokenSize=maxTokenSize_;this.token=token_;this.buf=buf_;this.start=start_;this.end=end_;this.err=err_;this.empties=empties_;this.scanCalled=scanCalled_;this.done=done_;});G=$pkg.SplitFunc=$newType(4,$kindFunc,"bufio.SplitFunc",true,"bufio",true,null);P=$pkg.Reader=$newType(0,$kindStruct,"bufio.Reader",true,"bufio",true,function(buf_,rd_,r_,w_,err_,lastByte_,lastRuneSize_){this.$val=this;if(arguments.length===0){this.buf=Z.nil;this.rd=$ifaceNil;this.r=0;this.w=0;this.err=$ifaceNil;this.lastByte=0;this.lastRuneSize=0;return;}this.buf=buf_;this.rd=rd_;this.r=r_;this.w=w_;this.err=err_;this.lastByte=lastByte_;this.lastRuneSize=lastRuneSize_;});Z=$sliceType($Uint8);AA=$ptrType(P);AB=$sliceType(Z);AC=$ptrType(E.Builder);AE=$ptrType(F);H=function(a){var a;return new F.ptr(a,M,65536,Z.nil,Z.nil,0,0,$ifaceNil,0,false,false);};$pkg.NewScanner=H;F.ptr.prototype.Err=function(){var a;a=this;if($interfaceIsEqual(a.err,C.EOF)){return $ifaceNil;}return a.err;};F.prototype.Err=function(){return this.$val.Err();};F.ptr.prototype.Bytes=function(){var a;a=this;return a.token;};F.prototype.Bytes=function(){return this.$val.Bytes();};F.ptr.prototype.Text=function(){var a;a=this;return($bytesToString(a.token));};F.prototype.Text=function(){return this.$val.Text();};F.ptr.prototype.Scan=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;m=$f.m;n=$f.n;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=this;if(a.done){$s=-1;return false;}a.scanCalled=true;case 1:if(a.end>a.start||!($interfaceIsEqual(a.err,$ifaceNil))){$s=3;continue;}$s=4;continue;case 3:c=a.split($subslice(a.buf,a.start,a.end),!($interfaceIsEqual(a.err,$ifaceNil)));$s=5;case 5:if($c){$c=false;c=c.$blk();}if(c&&c.$blk!==undefined){break s;}b=c;d=b[0];e=b[1];f=b[2];if(!($interfaceIsEqual(f,$ifaceNil))){if($interfaceIsEqual(f,$pkg.ErrFinalToken)){a.token=e;a.done=true;$s=-1;return true;}a.setErr(f);$s=-1;return false;}if(!a.advance(d)){$s=-1;return false;}a.token=e;if(!(e===Z.nil)){if($interfaceIsEqual(a.err,$ifaceNil)||d>0){a.empties=0;}else{a.empties=a.empties+(1)>>0;if(a.empties>100){$panic(new $String("bufio.Scan: too many empty tokens without progressing"));}}$s=-1;return true;}case 4:if(!($interfaceIsEqual(a.err,$ifaceNil))){a.start=0;a.end=0;$s=-1;return false;}if(a.start>0&&((a.end===a.buf.$length)||a.start>(g=a.buf.$length/2,(g===g&&g!==1/0&&g!==-1/0)?g>>0:$throwRuntimeError("integer divide by zero")))){$copySlice(a.buf,$subslice(a.buf,a.start,a.end));a.end=a.end-(a.start)>>0;a.start=0;}if(a.end===a.buf.$length){if(a.buf.$length>=a.maxTokenSize||a.buf.$length>1073741823){a.setErr($pkg.ErrTooLong);$s=-1;return false;}h=$imul(a.buf.$length,2);if(h===0){h=4096;}if(h>a.maxTokenSize){h=a.maxTokenSize;}i=$makeSlice(Z,h);$copySlice(i,$subslice(a.buf,a.start,a.end));a.buf=i;a.end=a.end-(a.start)>>0;a.start=0;}j=0;case 6:l=a.r.Read($subslice(a.buf,a.end,a.buf.$length));$s=8;case 8:if($c){$c=false;l=l.$blk();}if(l&&l.$blk!==undefined){break s;}k=l;m=k[0];n=k[1];if(m<0||(a.buf.$length-a.end>>0)<m){a.setErr($pkg.ErrBadReadCount);$s=7;continue;}a.end=a.end+(m)>>0;if(!($interfaceIsEqual(n,$ifaceNil))){a.setErr(n);$s=7;continue;}if(m>0){a.empties=0;$s=7;continue;}j=j+(1)>>0;if(j>100){a.setErr(C.ErrNoProgress);$s=7;continue;}$s=6;continue;case 7:$s=1;continue;case 2:$s=-1;return false;}retu
|
|||
|
$packages["github.com/agext/levenshtein"]=(function(){var $pkg={},$init,A,H,I,J,B,C,D,E;A=$pkg.Params=$newType(0,$kindStruct,"levenshtein.Params",true,"github.com/agext/levenshtein",true,function(insCost_,subCost_,delCost_,maxCost_,minScore_,bonusPrefix_,bonusScale_,bonusThreshold_){this.$val=this;if(arguments.length===0){this.insCost=0;this.subCost=0;this.delCost=0;this.maxCost=0;this.minScore=0;this.bonusPrefix=0;this.bonusScale=0;this.bonusThreshold=0;return;}this.insCost=insCost_;this.subCost=subCost_;this.delCost=delCost_;this.maxCost=maxCost_;this.minScore=minScore_;this.bonusPrefix=bonusPrefix_;this.bonusScale=bonusScale_;this.bonusThreshold=bonusThreshold_;});H=$ptrType(A);I=$sliceType($Int);J=$sliceType($Int32);C=function(){return new A.ptr(1,1,1,0,0,4,0.1,0.7);};$pkg.NewParams=C;A.ptr.prototype.Clone=function(){var a;a=this;if(a===H.nil){return C();}return new A.ptr(a.insCost,a.subCost,a.delCost,a.maxCost,a.minScore,a.bonusPrefix,a.bonusScale,a.bonusThreshold);};A.prototype.Clone=function(){return this.$val.Clone();};A.ptr.prototype.InsCost=function(a){var a,b;b=this;if(a>=0){b.insCost=a;}return b;};A.prototype.InsCost=function(a){return this.$val.InsCost(a);};A.ptr.prototype.SubCost=function(a){var a,b;b=this;if(a>=0){b.subCost=a;}return b;};A.prototype.SubCost=function(a){return this.$val.SubCost(a);};A.ptr.prototype.DelCost=function(a){var a,b;b=this;if(a>=0){b.delCost=a;}return b;};A.prototype.DelCost=function(a){return this.$val.DelCost(a);};A.ptr.prototype.MaxCost=function(a){var a,b;b=this;if(a>=0){b.maxCost=a;}return b;};A.prototype.MaxCost=function(a){return this.$val.MaxCost(a);};A.ptr.prototype.MinScore=function(a){var a,b;b=this;if(a>=0){b.minScore=a;}return b;};A.prototype.MinScore=function(a){return this.$val.MinScore(a);};A.ptr.prototype.BonusPrefix=function(a){var a,b;b=this;if(a>=0){b.bonusPrefix=a;}return b;};A.prototype.BonusPrefix=function(a){return this.$val.BonusPrefix(a);};A.ptr.prototype.BonusScale=function(a){var a,b;b=this;if(a>=0){b.bonusScale=a;}if((b.bonusPrefix)*b.bonusScale>1){b.bonusScale=1/(b.bonusPrefix);}return b;};A.prototype.BonusScale=function(a){return this.$val.BonusScale(a);};A.ptr.prototype.BonusThreshold=function(a){var a,b;b=this;if(a>=0){b.bonusThreshold=a;}return b;};A.prototype.BonusThreshold=function(a){return this.$val.BonusThreshold(a);};D=function(a,b,c,d,e,f){var a,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an,ao,ap,aq,ar,as,at,au,av,aw,ax,ay,az,b,ba,bb,bc,bd,be,bf,bg,bh,bi,bj,bk,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;g=0;h=0;i=0;j=a.$length;k=b.$length;l=j;m=k;while(true){if(!(h<l&&h<m)){break;}if(!((((h<0||h>=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+h])===((h<0||h>=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+h])))){break;}h=h+(1)>>0;}n=$subslice(a,h);o=$subslice(b,h);a=n;b=o;l=l-(h)>>0;m=m-(h)>>0;while(true){if(!(0<l&&0<m)){break;}if(!(((p=l-1>>0,((p<0||p>=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+p]))===(q=m-1>>0,((q<0||q>=b.$length)?($throwRuntimeError("index out of range"),undefined):b.$array[b.$offset+q]))))){r=$subslice(a,0,l);s=$subslice(b,0,m);a=r;b=s;break;}l=l-(1)>>0;m=m-(1)>>0;i=i+(1)>>0;}if(l===0){g=$imul(m,d);return[g,h,i];}if(m===0){g=$imul(l,f);return[g,h,i];}t=0;u=0;v=0;w=0;x=t;y=u;z=v;aa=w;if(c>0){if(e<(f+d>>0)){if(c>=(($imul(l,e))+($imul(((m-l>>0)),d))>>0)){c=0;}}else{if(c>=(($imul(l,f))+($imul(m,d))>>0)){c=0;}}}if(c>0){if(l<m){ab=b;ac=a;ad=m;ae=l;af=f;ag=d;a=ab;b=ac;l=ad;m=ae;d=af;f=ag;}g=$imul(((l-m>>0)),f);if(g>c){return[g,h,i];}ah=$makeSlice(I,(l+1>>0));ai=0;aj=1;ak=ai;al=aj;am=1;an=f;x=am;y=an;while(true){if(!(x<=l&&y<=c)){break;}((x<0||x>=ah.$length)?($throwRuntimeError("index out of range"),undefined):ah.$array[ah.$offset+x]=y);x=x+(1)>>0;y=$imul(x,f);al=al+(1)>>0;}ao=0;while(true){if(!(ao<m)){break;}ap=((ak<0||ak>=ah.$length)?($throwRuntimeError("index out of range"),undefined):ah.$array[ah.$offset+ak]);aq=((ak<0||ak>=ah.$length)?($throwRuntimeError("index out of range"),undefined):ah.$array[ah.$offset+ak])+
|
|||
|
$packages["github.com/apparentlymart/go-textseg/v13/textseg"]=(function(){var $pkg={},$init,D,E,C,B,A,BW,BX,BF,BG,BH,BI,BJ,BK,BL,BM,BN,BO,BP,BQ,BR,BT;D=$packages["bufio"];E=$packages["bytes"];C=$packages["errors"];B=$packages["unicode"];A=$packages["unicode/utf8"];BW=$sliceType($Uint8);BX=$sliceType($Int16);BR=function(a,b){var a,aa,ab,ac,ad,ae,af,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,$s;$s=0;s:while(true){switch($s){case 0:if(a.$length===0){$s=-1;return[0,BW.nil,$ifaceNil];}c=0;d=0;e=a.$length;f=0;g=0;h=0;i=e;$unused(f);$unused(g);$unused(h);$unused(i);j=0;k=0;c=1547;f=0;g=0;h=0;l=0;m=0;n=0;o=0;p=0;if(d===e){$s=1;continue;}$s=2;continue;case 1:$s=3;continue;case 2:if(c===0){$s=4;continue;}$s=5;continue;case 4:$s=6;continue;case 5:case 7:n=((((c<0||c>=BP.$length)?($throwRuntimeError("index out of range"),undefined):BP.$array[BP.$offset+c])>>0));o=((((n<0||n>=BF.$length)?($throwRuntimeError("index out of range"),undefined):BF.$array[BF.$offset+n])>>>0));n=n+(1)>>0;while(true){if(!(o>0)){break;}n=n+(1)>>0;r=(q=n-1>>0,((q<0||q>=BF.$length)?($throwRuntimeError("index out of range"),undefined):BF.$array[BF.$offset+q]));if(r===(4)){f=d;}o=o-(1)>>>0;}p=((((c<0||c>=BG.$length)?($throwRuntimeError("index out of range"),undefined):BG.$array[BG.$offset+c])>>0));m=((((c<0||c>=BK.$length)?($throwRuntimeError("index out of range"),undefined):BK.$array[BK.$offset+c])>>0));l=((((c<0||c>=BI.$length)?($throwRuntimeError("index out of range"),undefined):BI.$array[BI.$offset+c])>>0));if(l>0){$s=8;continue;}$s=9;continue;case 8:s=(p);t=0;u=(((p+l>>0)-1>>0));case 10:if(u<s){$s=11;continue;}t=s+((((u-s>>0))>>1>>0))>>0;if(((d<0||d>=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+d])<((t<0||t>=BH.$length)?($throwRuntimeError("index out of range"),undefined):BH.$array[BH.$offset+t])){$s=13;continue;}if(((d<0||d>=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+d])>((t<0||t>=BH.$length)?($throwRuntimeError("index out of range"),undefined):BH.$array[BH.$offset+t])){$s=14;continue;}$s=15;continue;case 13:u=t-1>>0;$s=16;continue;case 14:s=t+1>>0;$s=16;continue;case 15:m=m+(((t-(p)>>0)))>>0;$s=17;continue;case 16:case 12:$s=10;continue;case 11:p=p+(l)>>0;m=m+(l)>>0;case 9:l=((((c<0||c>=BJ.$length)?($throwRuntimeError("index out of range"),undefined):BJ.$array[BJ.$offset+c])>>0));if(l>0){$s=18;continue;}$s=19;continue;case 18:v=(p);w=0;x=(((p+((l<<1>>0))>>0)-2>>0));case 20:if(x<v){$s=21;continue;}w=v+((((((x-v>>0))>>1>>0))&-2))>>0;if(((d<0||d>=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+d])<((w<0||w>=BH.$length)?($throwRuntimeError("index out of range"),undefined):BH.$array[BH.$offset+w])){$s=23;continue;}if(((d<0||d>=a.$length)?($throwRuntimeError("index out of range"),undefined):a.$array[a.$offset+d])>(y=w+1>>0,((y<0||y>=BH.$length)?($throwRuntimeError("index out of range"),undefined):BH.$array[BH.$offset+y]))){$s=24;continue;}$s=25;continue;case 23:x=w-2>>0;$s=26;continue;case 24:v=w+2>>0;$s=26;continue;case 25:m=m+(((((w-(p)>>0))>>1>>0)))>>0;$s=17;continue;case 26:case 22:$s=20;continue;case 21:m=m+(l)>>0;case 19:case 17:m=((((m<0||m>=BL.$length)?($throwRuntimeError("index out of range"),undefined):BL.$array[BL.$offset+m])>>0));case 27:c=((((m<0||m>=BM.$length)?($throwRuntimeError("index out of range"),undefined):BM.$array[BM.$offset+m])>>0));if(((m<0||m>=BN.$length)?($throwRuntimeError("index out of range"),undefined):BN.$array[BN.$offset+m])===0){$s=28;continue;}$s=29;continue;case 28:$s=30;continue;case 29:n=((((m<0||m>=BN.$length)?($throwRuntimeError("index out of range"),undefined):BN.$array[BN.$offset+m])>>0));o=((((n<0||n>=BF.$length)?($throwRuntimeError("index out of range"),undefined):BF.$array[BF.$offset+n])>>>0));n=n+(1)>>0;case 31:if(!(o>0)){$s=32;continue;}n=n+(1)>>0;aa=(z=n-1>>0,((z<0||z>=BF.$length)?($throwRuntimeError("index out of range"),undefined):BF.$array[BF.$offset+z]));if(aa===(0)){$s=34;continue;}if(aa===(1)){$s=35;continue;}if(aa===(5)){$s=36;continue;}if(aa===(6)){$s=37;continue;}if(aa===(7)){$s=38;conti
|
|||
|
$packages["github.com/mitchellh/go-wordwrap"]=(function(){var $pkg={},$init,A,B;A=$packages["bytes"];B=$packages["unicode"];$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=A.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=B.$init();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$packages["encoding/gob"]=(function(){var $pkg={},$init,N,A,K,B,C,F,J,L,M,D,E,G,H,I,O,Z,AC,AH,BA,BC,BE,BG,BI,BJ,BS,BT,BZ,CA,CG,CK,CN,CO,CP,CR,CS,DD,EV,FD,FE,FF,FI,FJ,GF,GK,HW,HX,HY,HZ,IA,IB,IC,ID,IE,IF,IG,IH,II,IJ,IK,IL,IM,IN,IO,IP,IQ,IR,IS,IT,IU,IV,IW,IX,IY,IZ,JA,JB,JC,JD,JE,JF,JG,JH,JI,JJ,JK,JL,JM,JN,JO,JP,JQ,JR,JS,JT,JU,JV,JW,JX,JY,JZ,KA,KB,KC,KD,KE,KF,KG,KH,KI,KJ,KK,KL,KM,KN,KO,KP,KQ,KR,KS,KT,KU,KV,KW,KX,KY,KZ,LA,LB,LC,P,R,S,T,U,V,W,AA,AB,AD,AE,AF,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR,AS,AT,AU,AV,AW,AX,AY,BU,CB,CC,CL,CQ,DH,DN,DO,EX,FA,FB,FC,GG,GI,GJ,GL,GO,GP,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,Q,X,Y,AG,AZ,BB,BD,BF,BH,BK,BL,BM,BN,BO,BP,BQ,BR,BV,BW,BX,BY,CD,CE,CF,CH,CI,CJ,CM,CT,CU,CV,CW,CX,CY,CZ,DA,DB,DC,DE,DF,DG,DI,DJ,DK,DL,DM,DP,DQ,DR,DS,DT,DU,DV,DW,DX,DY,DZ,EA,EB,EC,ED,EE,EF,EG,EH,EI,EJ,EK,EL,EM,EN,EO,EP,EQ,ER,ES,ET,EU,EW,EY,FG,FH,FK,FL,FM,FN,FO,FP,FQ,FR,FS,FT,FU,FV,FW,FX,FY,FZ,GA,GB,GC,GD,GE,GH,GM,GN,GQ,GR,GS,GT,GU,GV,GW,GX,GY,GZ,HA,HB,HC,HD,HE,HF,HG,HH,HI,HJ,HK,HL,HM,HN,HO,HP,HQ,HR,HS,HT,HU,HV;N=$packages["bufio"];A=$packages["encoding"];K=$packages["encoding/binary"];B=$packages["errors"];C=$packages["fmt"];F=$packages["github.com/gopherjs/gopherjs/nosync"];J=$packages["io"];L=$packages["math"];M=$packages["math/bits"];D=$packages["os"];E=$packages["reflect"];G=$packages["sync/atomic"];H=$packages["unicode"];I=$packages["unicode/utf8"];O=$pkg.userTypeInfo=$newType(0,$kindStruct,"gob.userTypeInfo",true,"encoding/gob",false,function(user_,base_,indir_,externalEnc_,externalDec_,encIndir_,decIndir_){this.$val=this;if(arguments.length===0){this.user=$ifaceNil;this.base=$ifaceNil;this.indir=0;this.externalEnc=0;this.externalDec=0;this.encIndir=0;this.decIndir=0;return;}this.user=user_;this.base=base_;this.indir=indir_;this.externalEnc=externalEnc_;this.externalDec=externalDec_;this.encIndir=encIndir_;this.decIndir=decIndir_;});Z=$pkg.typeId=$newType(4,$kindInt32,"gob.typeId",true,"encoding/gob",false,null);AC=$pkg.gobType=$newType(8,$kindInterface,"gob.gobType",true,"encoding/gob",false,null);AH=$pkg.CommonType=$newType(0,$kindStruct,"gob.CommonType",true,"encoding/gob",true,function(Name_,Id_){this.$val=this;if(arguments.length===0){this.Name="";this.Id=0;return;}this.Name=Name_;this.Id=Id_;});BA=$pkg.arrayType=$newType(0,$kindStruct,"gob.arrayType",true,"encoding/gob",false,function(CommonType_,Elem_,Len_){this.$val=this;if(arguments.length===0){this.CommonType=new AH.ptr("",0);this.Elem=0;this.Len=0;return;}this.CommonType=CommonType_;this.Elem=Elem_;this.Len=Len_;});BC=$pkg.gobEncoderType=$newType(0,$kindStruct,"gob.gobEncoderType",true,"encoding/gob",false,function(CommonType_){this.$val=this;if(arguments.length===0){this.CommonType=new AH.ptr("",0);return;}this.CommonType=CommonType_;});BE=$pkg.mapType=$newType(0,$kindStruct,"gob.mapType",true,"encoding/gob",false,function(CommonType_,Key_,Elem_){this.$val=this;if(arguments.length===0){this.CommonType=new AH.ptr("",0);this.Key=0;this.Elem=0;return;}this.CommonType=CommonType_;this.Key=Key_;this.Elem=Elem_;});BG=$pkg.sliceType=$newType(0,$kindStruct,"gob.sliceType",true,"encoding/gob",false,function(CommonType_,Elem_){this.$val=this;if(arguments.length===0){this.CommonType=new AH.ptr("",0);this.Elem=0;return;}this.CommonType=CommonType_;this.Elem=Elem_;});BI=$pkg.fieldType=$newType(0,$kindStruct,"gob.fieldType",true,"encoding/gob",false,function(Name_,Id_){this.$val=this;if(arguments.length===0){this.Name="";this.Id=0;return;}this.Name=Name_;this.Id=Id_;});BJ=$pkg.structType=$newType(0,$kindStruct,"gob.structType",true,"encoding/gob",false,function(CommonType_,Field_){this.$val=this;if(arguments.length===0){this.CommonType=new AH.ptr("",0);this.Field=JJ.nil;return;}this.CommonType=CommonType_;this.Field=Field_;});BS=$pkg.wireType=$newType(0,$kindStruct,"gob.wireType",true,"encoding/gob",false,function(ArrayT_,SliceT_,StructT_,MapT_,GobEncoderT_,BinaryMarshalerT_,TextMarshalerT_){this.$val=this;if(arguments.length===0){this.ArrayT=JB.nil;this.SliceT=JC.nil;this.StructT=JD.nil;this.MapT=JE.nil;this.GobEncoderT=JF.nil;this.BinaryMarshalerT=JF.nil;this.TextMarsha
|
|||
|
$packages["github.com/zclconf/go-cty/cty/set"]=(function(){var $pkg={},$init,C,D,A,B,E,J,K,L,M,O,P,Q,R,S,T,U,F,G,H,I,N;C=$packages["bytes"];D=$packages["encoding/gob"];A=$packages["fmt"];B=$packages["sort"];E=$pkg.Set=$newType(0,$kindStruct,"set.Set",true,"github.com/zclconf/go-cty/cty/set",true,function(vals_,rules_){this.$val=this;if(arguments.length===0){this.vals=false;this.rules=$ifaceNil;return;}this.vals=vals_;this.rules=rules_;});J=$pkg.Rules=$newType(8,$kindInterface,"set.Rules",true,"github.com/zclconf/go-cty/cty/set",true,null);K=$pkg.OrderedRules=$newType(8,$kindInterface,"set.OrderedRules",true,"github.com/zclconf/go-cty/cty/set",true,null);L=$pkg.Iterator=$newType(0,$kindStruct,"set.Iterator",true,"github.com/zclconf/go-cty/cty/set",true,function(vals_,idx_){this.$val=this;if(arguments.length===0){this.vals=O.nil;this.idx=0;return;}this.vals=vals_;this.idx=idx_;});M=$pkg.gobSet=$newType(0,$kindStruct,"set.gobSet",true,"github.com/zclconf/go-cty/cty/set",false,function(Version_,Rules_,Values_){this.$val=this;if(arguments.length===0){this.Version=0;this.Rules=$ifaceNil;this.Values=O.nil;return;}this.Version=Version_;this.Rules=Rules_;this.Values=Values_;});O=$sliceType($emptyInterface);P=$sliceType($Int);Q=$sliceType($Uint8);R=$ptrType(L);S=$funcType([$emptyInterface],[],false);T=$ptrType(E);U=$mapType($Int,O);F=function(a){var a;return new E.ptr($makeMap($Int.keyFor,[]),a);};$pkg.NewSet=F;G=function(a,b){var a,b,c,d,e,f,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:c=$clone(F(a),E);d=b;e=0;case 1:if(!(e<d.$length)){$s=2;continue;}f=((e<0||e>=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+e]);$r=$clone(c,E).Add(f);$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}e++;$s=1;continue;case 2:$s=-1;return c;}return;}if($f===undefined){$f={$blk:G};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.$s=$s;$f.$r=$r;return $f;};$pkg.NewSetFromSlice=G;H=function(a,b){var a,b,c,d,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:c=a.rules.SameRules(b.rules);$s=1;case 1:if($c){$c=false;c=c.$blk();}if(c&&c.$blk!==undefined){break s;}d=c;$s=2;case 2:return d;}return;}if($f===undefined){$f={$blk:H};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.$s=$s;$f.$r=$r;return $f;};I=function(a,b){var a,b,c,d,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:c=H($clone(a,E),$clone(b,E));$s=3;case 3:if($c){$c=false;c=c.$blk();}if(c&&c.$blk!==undefined){break s;}if(!c){$s=1;continue;}$s=2;continue;case 1:d=A.Errorf("incompatible set rules: %#v, %#v",new O([a.rules,b.rules]));$s=4;case 4:if($c){$c=false;d=d.$blk();}if(d&&d.$blk!==undefined){break s;}$panic(d);case 2:$s=-1;return;}return;}if($f===undefined){$f={$blk:I};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.$s=$s;$f.$r=$r;return $f;};E.ptr.prototype.HasRules=function(a){var a,b,c,d,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=this;c=b.rules.SameRules(a);$s=1;case 1:if($c){$c=false;c=c.$blk();}if(c&&c.$blk!==undefined){break s;}d=c;$s=2;case 2:return d;}return;}if($f===undefined){$f={$blk:E.ptr.prototype.HasRules};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.$s=$s;$f.$r=$r;return $f;};E.prototype.HasRules=function(a){return this.$val.HasRules(a);};E.ptr.prototype.Rules=function(){var a;a=this;return a.rules;};E.prototype.Rules=function(){return this.$val.Rules();};E.ptr.prototype.Add=function(a){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;m=$f.m;n=$f.n;o=$f.o;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=this;c=b.rules.H
|
|||
|
$packages["golang.org/x/text/transform"]=(function(){var $pkg={},$init,A,B,C,D,E,F;A=$packages["bytes"];B=$packages["errors"];C=$packages["io"];D=$packages["unicode/utf8"];$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=A.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=B.$init();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=C.$init();$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=D.$init();$s=4;case 4:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$pkg.ErrShortDst=B.New("transform: short destination buffer");$pkg.ErrShortSrc=B.New("transform: short source buffer");$pkg.ErrEndOfSpan=B.New("transform: input and output are not identical");E=B.New("transform: inconsistent byte count returned");F=B.New("transform: short internal buffer");}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$packages["golang.org/x/text/unicode/norm"]=(function(){var $pkg={},$init,F,E,B,D,C,A,G,H,Q,W,AE,AF,AG,AQ,AR,BE,BH,BI,BJ,BL,BR,BS,BT,BV,CB,CC,CD,CE,CF,CG,CH,CI,CJ,CK,CL,CM,CN,CO,CP,CQ,CR,CS,CT,CU,CV,CW,I,J,K,L,N,O,P,S,T,U,V,Y,Z,AA,AB,AC,AD,BK,M,R,X,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AS,AT,AU,AV,AW,AX,AY,AZ,BA,BB,BC,BD,BF,BG,BM,BN,BO,BP,BQ,BU,BW,BX,BY,CA;F=$packages["encoding/binary"];E=$packages["fmt"];B=$packages["golang.org/x/text/transform"];D=$packages["io"];C=$packages["sync"];A=$packages["unicode/utf8"];G=$pkg.valueRange=$newType(0,$kindStruct,"norm.valueRange",true,"golang.org/x/text/unicode/norm",false,function(value_,lo_,hi_){this.$val=this;if(arguments.length===0){this.value=0;this.lo=0;this.hi=0;return;}this.value=value_;this.lo=lo_;this.hi=hi_;});H=$pkg.sparseBlocks=$newType(0,$kindStruct,"norm.sparseBlocks",true,"golang.org/x/text/unicode/norm",false,function(values_,offset_){this.$val=this;if(arguments.length===0){this.values=CD.nil;this.offset=CC.nil;return;}this.values=values_;this.offset=offset_;});Q=$pkg.nfcTrie=$newType(0,$kindStruct,"norm.nfcTrie",true,"golang.org/x/text/unicode/norm",false,function(){this.$val=this;if(arguments.length===0){return;}});W=$pkg.nfkcTrie=$newType(0,$kindStruct,"norm.nfkcTrie",true,"golang.org/x/text/unicode/norm",false,function(){this.$val=this;if(arguments.length===0){return;}});AE=$pkg.normWriter=$newType(0,$kindStruct,"norm.normWriter",true,"golang.org/x/text/unicode/norm",false,function(rb_,w_,buf_){this.$val=this;if(arguments.length===0){this.rb=new BT.ptr(CG.zero(),CH.zero(),0,0,0,new BJ.ptr(0,false,false,$throwNilPointerError,$throwNilPointerError),new BE.ptr("",CI.nil),0,new BE.ptr("",CI.nil),CI.nil,$throwNilPointerError);this.w=$ifaceNil;this.buf=CI.nil;return;}this.rb=rb_;this.w=w_;this.buf=buf_;});AF=$pkg.normReader=$newType(0,$kindStruct,"norm.normReader",true,"golang.org/x/text/unicode/norm",false,function(rb_,r_,inbuf_,outbuf_,bufStart_,lastBoundary_,err_){this.$val=this;if(arguments.length===0){this.rb=new BT.ptr(CG.zero(),CH.zero(),0,0,0,new BJ.ptr(0,false,false,$throwNilPointerError,$throwNilPointerError),new BE.ptr("",CI.nil),0,new BE.ptr("",CI.nil),CI.nil,$throwNilPointerError);this.r=$ifaceNil;this.inbuf=CI.nil;this.outbuf=CI.nil;this.bufStart=0;this.lastBoundary=0;this.err=$ifaceNil;return;}this.rb=rb_;this.r=r_;this.inbuf=inbuf_;this.outbuf=outbuf_;this.bufStart=bufStart_;this.lastBoundary=lastBoundary_;this.err=err_;});AG=$pkg.Form=$newType(4,$kindInt,"norm.Form",true,"golang.org/x/text/unicode/norm",true,null);AQ=$pkg.Iter=$newType(0,$kindStruct,"norm.Iter",true,"golang.org/x/text/unicode/norm",true,function(rb_,buf_,info_,next_,asciiF_,p_,multiSeg_){this.$val=this;if(arguments.length===0){this.rb=new BT.ptr(CG.zero(),CH.zero(),0,0,0,new BJ.ptr(0,false,false,$throwNilPointerError,$throwNilPointerError),new BE.ptr("",CI.nil),0,new BE.ptr("",CI.nil),CI.nil,$throwNilPointerError);this.buf=CH.zero();this.info=new BH.ptr(0,0,0,0,0,0,0);this.next=$throwNilPointerError;this.asciiF=$throwNilPointerError;this.p=0;this.multiSeg=CI.nil;return;}this.rb=rb_;this.buf=buf_;this.info=info_;this.next=next_;this.asciiF=asciiF_;this.p=p_;this.multiSeg=multiSeg_;});AR=$pkg.iterFunc=$newType(4,$kindFunc,"norm.iterFunc",true,"golang.org/x/text/unicode/norm",false,null);BE=$pkg.input=$newType(0,$kindStruct,"norm.input",true,"golang.org/x/text/unicode/norm",false,function(str_,bytes_){this.$val=this;if(arguments.length===0){this.str="";this.bytes=CI.nil;return;}this.str=str_;this.bytes=bytes_;});BH=$pkg.Properties=$newType(0,$kindStruct,"norm.Properties",true,"golang.org/x/text/unicode/norm",true,function(pos_,size_,ccc_,tccc_,nLead_,flags_,index_){this.$val=this;if(arguments.length===0){this.pos=0;this.size=0;this.ccc=0;this.tccc=0;this.nLead=0;this.flags=0;this.index=0;return;}this.pos=pos_;this.size=size_;this.ccc=ccc_;this.tccc=tccc_;this.nLead=nLead_;this.flags=flags_;this.index=index_;});BI=$pkg.lookupFunc=$newType(4,$kindFunc,"norm.lookupFunc",true,"golang.org/x/text/unicode/norm",false,null);BJ=$pkg.formInfo=$newType(0,$kindStruct,"norm.formInfo",true,"golang.org/x/text/
|
|||
|
$packages["hash"]=(function(){var $pkg={},$init,A;A=$packages["io"];$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=A.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$packages["hash/crc32"]=(function(){var $pkg={},$init,A,B,C,D,N,Q,AO,AQ,AR,Y,Z,AA,AB,E,F,G,K,L,M,O,P,AC,AL;A=$packages["errors"];B=$packages["hash"];C=$packages["sync"];D=$packages["sync/atomic"];N=$pkg.slicing8Table=$newType(8192,$kindArray,"crc32.slicing8Table",true,"hash/crc32",false,null);Q=$pkg.Table=$newType(1024,$kindArray,"crc32.Table",true,"hash/crc32",true,null);AO=$ptrType(N);AQ=$arrayType($Uint32,256);AR=$arrayType(Q,8);E=function(){return false;};F=function(){$panic(new $String("not available"));};G=function(a,b){var a,b;$panic(new $String("not available"));};K=function(a){var a,b;b=AQ.zero();L(a,b);return b;};L=function(a,b){var a,b,c,d,e,f;c=0;while(true){if(!(c<256)){break;}d=((c>>>0));e=0;while(true){if(!(e<8)){break;}if(((d&1)>>>0)===1){d=(((d>>>1>>>0))^a)>>>0;}else{d=(f=(1),f<32?(d>>>f):0)>>>0;}e=e+(1)>>0;}b.nilCheck,((c<0||c>=b.length)?($throwRuntimeError("index out of range"),undefined):b[c]=d);c=c+(1)>>0;}};M=function(a,b,c){var a,b,c,d,e,f,g,h;a=~a>>>0;d=c;e=0;while(true){if(!(e<d.$length)){break;}f=((e<0||e>=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+e]);a=((g=b,h=(((a<<24>>>24))^f)<<24>>>24,((h<0||h>=g.length)?($throwRuntimeError("index out of range"),undefined):g[h]))^((a>>>8>>>0)))>>>0;e++;}return~a>>>0;};O=function(a){var a,b,c,d,e,f,g,h,i,j;b=AR.zero();L(a,b[0]);c=0;while(true){if(!(c<256)){break;}e=(d=b[0],((c<0||c>=d.length)?($throwRuntimeError("index out of range"),undefined):d[c]));f=1;while(true){if(!(f<8)){break;}e=((g=b[0],h=(e&255)>>>0,((h<0||h>=g.length)?($throwRuntimeError("index out of range"),undefined):g[h]))^((e>>>8>>>0)))>>>0;(i=(j=b,((f<0||f>=j.length)?($throwRuntimeError("index out of range"),undefined):j[f])),((c<0||c>=i.length)?($throwRuntimeError("index out of range"),undefined):i[c]=e));f=f+(1)>>0;}c=c+(1)>>0;}return b;};P=function(a,b,c){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;if(c.$length>=16){a=~a>>>0;while(true){if(!(c.$length>8)){break;}a=(a^((((((((((0>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+0])>>>0))|((((1>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+1])>>>0))<<8>>>0))>>>0)|((((2>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+2])>>>0))<<16>>>0))>>>0)|((((3>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+3])>>>0))<<24>>>0))>>>0)))>>>0;a=((((((((((((((d=b[0],e=(7>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+7]),((e<0||e>=d.length)?($throwRuntimeError("index out of range"),undefined):d[e]))^(f=b[1],g=(6>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+6]),((g<0||g>=f.length)?($throwRuntimeError("index out of range"),undefined):f[g])))>>>0)^(h=b[2],i=(5>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+5]),((i<0||i>=h.length)?($throwRuntimeError("index out of range"),undefined):h[i])))>>>0)^(j=b[3],k=(4>=c.$length?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+4]),((k<0||k>=j.length)?($throwRuntimeError("index out of range"),undefined):j[k])))>>>0)^(l=b[4],m=a>>>24>>>0,((m<0||m>=l.length)?($throwRuntimeError("index out of range"),undefined):l[m])))>>>0)^(n=b[5],o=(((a>>>16>>>0))&255)>>>0,((o<0||o>=n.length)?($throwRuntimeError("index out of range"),undefined):n[o])))>>>0)^(p=b[6],q=(((a>>>8>>>0))&255)>>>0,((q<0||q>=p.length)?($throwRuntimeError("index out of range"),undefined):p[q])))>>>0)^(r=b[7],s=(a&255)>>>0,((s<0||s>=r.length)?($throwRuntimeError("index out of range"),undefined):r[s])))>>>0;c=$subslice(c,8);}a=~a>>>0;}if(c.$length===0){return a;}return M(a,b[0],c);};AC=function(){Z=E();if(Z){F();AA=G;}else{Y=O(3988292384);AA=(function(a,b){var a,b;return P(a,Y,b);});}};AL=function(a){var a,b,c,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=AB.Do(AC);$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}b=AA(0
|
|||
|
$packages["hash/crc64"]=(function(){var $pkg={},$init,A,B,C,D,U,V,W,X,E,F,G,H,I,J,K,L;A=$packages["errors"];B=$packages["hash"];C=$packages["sync"];D=$pkg.Table=$newType(2048,$kindArray,"crc64.Table",true,"hash/crc64",true,null);U=$arrayType(D,8);V=$ptrType(U);W=$ptrType(D);X=$arrayType($Uint64,256);H=function(){var $s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=E.Do(I);$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return;}return;}if($f===undefined){$f={$blk:H};}$f.$s=$s;$f.$r=$r;return $f;};I=function(){F=L(K(new $Uint64(3623878656,0)));G=L(K(new $Uint64(3379320725,3615952706)));};J=function(a){var a,b,c,d,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=H();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}b=a;if((c=new $Uint64(3623878656,0),(b.$high===c.$high&&b.$low===c.$low))){$s=-1;return F[0];}else if((d=new $Uint64(3379320725,3615952706),(b.$high===d.$high&&b.$low===d.$low))){$s=-1;return G[0];}else{$s=-1;return K(a);}$s=-1;return W.nil;}return;}if($f===undefined){$f={$blk:J};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.$s=$s;$f.$r=$r;return $f;};$pkg.MakeTable=J;K=function(a){var a,b,c,d,e,f,g;b=X.zero();c=0;while(true){if(!(c<256)){break;}d=(new $Uint64(0,c));e=0;while(true){if(!(e<8)){break;}if((f=new $Uint64(d.$high&0,(d.$low&1)>>>0),(f.$high===0&&f.$low===1))){d=(g=$shiftRightUint64(d,1),new $Uint64(g.$high^a.$high,(g.$low^a.$low)>>>0));}else{d=$shiftRightUint64(d,(1));}e=e+(1)>>0;}b.nilCheck,((c<0||c>=b.length)?($throwRuntimeError("index out of range"),undefined):b[c]=d);c=c+(1)>>0;}return b;};L=function(a){var a,b,c,d,e,f,g,h,i,j,k;b=U.zero();D.copy(b[0],a);c=0;while(true){if(!(c<256)){break;}e=(d=a,((c<0||c>=d.length)?($throwRuntimeError("index out of range"),undefined):d[c]));f=1;while(true){if(!(f<8)){break;}e=(g=(h=a,i=new $Uint64(e.$high&0,(e.$low&255)>>>0),(($flatten64(i)<0||$flatten64(i)>=h.length)?($throwRuntimeError("index out of range"),undefined):h[$flatten64(i)])),j=$shiftRightUint64(e,8),new $Uint64(g.$high^j.$high,(g.$low^j.$low)>>>0));(k=((f<0||f>=b.length)?($throwRuntimeError("index out of range"),undefined):b[f]),((c<0||c>=k.length)?($throwRuntimeError("index out of range"),undefined):k[c]=e));f=f+(1)>>0;}c=c+(1)>>0;}return b;};D.init($Uint64,256);$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=A.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=B.$init();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=C.$init();$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}E=new C.Once.ptr(0,new C.Mutex.ptr(0,0));F=V.nil;G=V.nil;}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$packages["math/rand"]=(function(){var $pkg={},$init,B,A,F,H,I,K,AE,AM,AN,AO,AQ,AR,AS,AT,AU,AV,E,N,AG,AH,AI,AJ,AK,AL,G,J,L,M,AF;B=$packages["github.com/gopherjs/gopherjs/nosync"];A=$packages["math"];F=$pkg.rngSource=$newType(0,$kindStruct,"rand.rngSource",true,"math/rand",false,function(tap_,feed_,vec_){this.$val=this;if(arguments.length===0){this.tap=0;this.feed=0;this.vec=AQ.zero();return;}this.tap=tap_;this.feed=feed_;this.vec=vec_;});H=$pkg.Source=$newType(8,$kindInterface,"rand.Source",true,"math/rand",true,null);I=$pkg.Source64=$newType(8,$kindInterface,"rand.Source64",true,"math/rand",true,null);K=$pkg.Rand=$newType(0,$kindStruct,"rand.Rand",true,"math/rand",true,function(src_,s64_,readVal_,readPos_){this.$val=this;if(arguments.length===0){this.src=$ifaceNil;this.s64=$ifaceNil;this.readVal=new $Int64(0,0);this.readPos=0;return;}this.src=src_;this.s64=s64_;this.readVal=readVal_;this.readPos=readPos_;});AE=$pkg.lockedSource=$newType(0,$kindStruct,"rand.lockedSource",true,"math/rand",false,function(lk_,src_){this.$val=this;if(arguments.length===0){this.lk=new B.Mutex.ptr(false);this.src=AM.nil;return;}this.lk=lk_;this.src=src_;});AM=$ptrType(F);AN=$ptrType(AE);AO=$ptrType(K);AQ=$arrayType($Int64,607);AR=$ptrType($Int8);AS=$sliceType($Int);AT=$ptrType($Int64);AU=$funcType([$Int,$Int],[],false);AV=$sliceType($Uint8);G=function(a){var a,b,c,d,e;c=(b=a/44488,(b===b&&b!==1/0&&b!==-1/0)?b>>0:$throwRuntimeError("integer divide by zero"));e=(d=a%44488,d===d?d:$throwRuntimeError("integer divide by zero"));a=($imul(48271,e))-($imul(3399,c))>>0;if(a<0){a=a+(2147483647)>>0;}return a;};F.ptr.prototype.Seed=function(a){var a,b,c,d,e,f,g,h,i,j;b=this;b.tap=0;b.feed=334;a=$div64(a,new $Int64(0,2147483647),true);if((a.$high<0||(a.$high===0&&a.$low<0))){a=(c=new $Int64(0,2147483647),new $Int64(a.$high+c.$high,a.$low+c.$low));}if((a.$high===0&&a.$low===0)){a=new $Int64(0,89482311);}d=(((a.$low+((a.$high>>31)*4294967296))>>0));e=-20;while(true){if(!(e<607)){break;}d=G(d);if(e>=0){f=new $Int64(0,0);f=$shiftLeft64((new $Int64(0,d)),40);d=G(d);f=(g=$shiftLeft64((new $Int64(0,d)),20),new $Int64(f.$high^g.$high,(f.$low^g.$low)>>>0));d=G(d);f=(h=(new $Int64(0,d)),new $Int64(f.$high^h.$high,(f.$low^h.$low)>>>0));f=(i=((e<0||e>=E.length)?($throwRuntimeError("index out of range"),undefined):E[e]),new $Int64(f.$high^i.$high,(f.$low^i.$low)>>>0));(j=b.vec,((e<0||e>=j.length)?($throwRuntimeError("index out of range"),undefined):j[e]=f));}e=e+(1)>>0;}};F.prototype.Seed=function(a){return this.$val.Seed(a);};F.ptr.prototype.Int63=function(){var a,b,c;a=this;return((b=(c=a.Uint64(),new $Uint64(c.$high&2147483647,(c.$low&4294967295)>>>0)),new $Int64(b.$high,b.$low)));};F.prototype.Int63=function(){return this.$val.Int63();};F.ptr.prototype.Uint64=function(){var a,b,c,d,e,f,g,h,i,j;a=this;a.tap=a.tap-(1)>>0;if(a.tap<0){a.tap=a.tap+(607)>>0;}a.feed=a.feed-(1)>>0;if(a.feed<0){a.feed=a.feed+(607)>>0;}h=(b=(c=a.vec,d=a.feed,((d<0||d>=c.length)?($throwRuntimeError("index out of range"),undefined):c[d])),e=(f=a.vec,g=a.tap,((g<0||g>=f.length)?($throwRuntimeError("index out of range"),undefined):f[g])),new $Int64(b.$high+e.$high,b.$low+e.$low));(i=a.vec,j=a.feed,((j<0||j>=i.length)?($throwRuntimeError("index out of range"),undefined):i[j]=h));return(new $Uint64(h.$high,h.$low));};F.prototype.Uint64=function(){return this.$val.Uint64();};J=function(a){var a,b;b=new F.ptr(0,0,AQ.zero());b.Seed(a);return b;};$pkg.NewSource=J;L=function(a){var a,b,c;b=$assertType(a,I,true);c=b[0];return new K.ptr(a,c,new $Int64(0,0),0);};$pkg.New=L;K.ptr.prototype.Seed=function(a){var a,b,c,d,e,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=this;c=$assertType(b.src,AN,true);d=c[0];e=c[1];if(e){d.seedPos(a,(b.$ptr_readPos||(b.$ptr_readPos=new AR(function(){return this.$target.readPos;},function($v){this.$target.readPos=$v;},b))));$s=-1;return;}$r=b.src.Seed(a);$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}b.readPos=0;$s=-1
|
|||
|
$packages["math/big"]=(function(){var $pkg={},$init,K,D,E,F,B,G,A,J,I,C,H,S,AE,AH,BG,BH,BQ,BY,BZ,CB,CC,CD,CK,DO,DP,DR,DS,DT,DV,DW,DX,DY,DZ,EA,EB,EC,ED,EE,EF,L,O,AB,AC,AD,AF,AI,AJ,AK,AL,AP,AX,AY,BB,BI,BW,DN,M,N,P,R,U,V,W,X,Y,Z,AA,AG,AM,AN,AO,AQ,AR,AS,AT,AU,AV,AW,AZ,BA,BC,BD,BE,BF,BJ,BK,BL,BM,BN,BO,BP,BR,BS,BT,BU,BX,CA,CE,CF,CG,CH,CI,CJ,CL,CM,CN,CO,CP,CQ,CR,CS,CT,CU,CV,CW,CX,CY,CZ,DA,DB,DC,DD,DE,DF,DG,DH,DI,DJ,DK,DL,DM;K=$packages["bytes"];D=$packages["encoding/binary"];E=$packages["errors"];F=$packages["fmt"];B=$packages["github.com/gopherjs/gopherjs/nosync"];G=$packages["io"];A=$packages["math"];J=$packages["math/bits"];I=$packages["math/rand"];C=$packages["strconv"];H=$packages["strings"];S=$pkg.Rat=$newType(0,$kindStruct,"big.Rat",true,"math/big",true,function(a_,b_){this.$val=this;if(arguments.length===0){this.a=new BH.ptr(false,AH.nil);this.b=new BH.ptr(false,AH.nil);return;}this.a=a_;this.b=b_;});AE=$pkg.divisor=$newType(0,$kindStruct,"big.divisor",true,"math/big",false,function(bbb_,nbits_,ndigits_){this.$val=this;if(arguments.length===0){this.bbb=AH.nil;this.nbits=0;this.ndigits=0;return;}this.bbb=bbb_;this.nbits=nbits_;this.ndigits=ndigits_;});AH=$pkg.nat=$newType(12,$kindSlice,"big.nat",true,"math/big",false,null);BG=$pkg.byteReader=$newType(0,$kindStruct,"big.byteReader",true,"math/big",false,function(ScanState_){this.$val=this;if(arguments.length===0){this.ScanState=$ifaceNil;return;}this.ScanState=ScanState_;});BH=$pkg.Int=$newType(0,$kindStruct,"big.Int",true,"math/big",true,function(neg_,abs_){this.$val=this;if(arguments.length===0){this.neg=false;this.abs=AH.nil;return;}this.neg=neg_;this.abs=abs_;});BQ=$pkg.Word=$newType(4,$kindUintptr,"big.Word",true,"math/big",true,null);BY=$pkg.Float=$newType(0,$kindStruct,"big.Float",true,"math/big",true,function(prec_,mode_,acc_,form_,neg_,mant_,exp_){this.$val=this;if(arguments.length===0){this.prec=0;this.mode=0;this.acc=0;this.form=0;this.neg=false;this.mant=AH.nil;this.exp=0;return;}this.prec=prec_;this.mode=mode_;this.acc=acc_;this.form=form_;this.neg=neg_;this.mant=mant_;this.exp=exp_;});BZ=$pkg.ErrNaN=$newType(0,$kindStruct,"big.ErrNaN",true,"math/big",true,function(msg_){this.$val=this;if(arguments.length===0){this.msg="";return;}this.msg=msg_;});CB=$pkg.form=$newType(1,$kindUint8,"big.form",true,"math/big",false,null);CC=$pkg.RoundingMode=$newType(1,$kindUint8,"big.RoundingMode",true,"math/big",true,null);CD=$pkg.Accuracy=$newType(1,$kindInt8,"big.Accuracy",true,"math/big",true,null);CK=$pkg.decimal=$newType(0,$kindStruct,"big.decimal",true,"math/big",false,function(mant_,exp_){this.$val=this;if(arguments.length===0){this.mant=DW.nil;this.exp=0;return;}this.mant=mant_;this.exp=exp_;});DO=$ptrType(BY);DP=$structType("math/big",[{prop:"Once",name:"Once",embedded:true,exported:true,typ:B.Once,tag:""},{prop:"v",name:"v",embedded:false,exported:false,typ:DO,tag:""}]);DR=$arrayType(AE,64);DS=$structType("math/big",[{prop:"Mutex",name:"Mutex",embedded:true,exported:true,typ:B.Mutex,tag:""},{prop:"table",name:"table",embedded:false,exported:false,typ:DR,tag:""}]);DT=$sliceType($emptyInterface);DV=$ptrType(S);DW=$sliceType($Uint8);DX=$ptrType(BH);DY=$sliceType(BQ);DZ=$ptrType(AH);EA=$sliceType(DZ);EB=$sliceType(AE);EC=$ptrType(BQ);ED=$arrayType(AH,16);EE=$ptrType(I.Rand);EF=$ptrType(CK);M=function(){var $s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=L.Once.Do((function $b(){var b,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;b=$f.b;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=CA(3);$s=1;case 1:if($c){$c=false;b=b.$blk();}if(b&&b.$blk!==undefined){break s;}L.v=b;$s=-1;return;}return;}if($f===undefined){$f={$blk:$b};}$f.b=b;$f.$s=$s;$f.$r=$r;return $f;}));$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return L.v;}return;}if($f===undefined){$f={$blk:M};}$f.$s=$s;$f.$r=$r;return $f;};BY.ptr.prototype.Sqrt=function(b){var b,c,d,e,f,g,h,i,j,k,l,m,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&
|
|||
|
$packages["github.com/zclconf/go-cty/cty"]=(function(){var $pkg={},$init,H,F,M,L,A,C,E,I,K,B,D,J,G,AQ,AS,AV,AZ,BA,BB,BC,BD,BG,BI,BL,BO,BP,BX,BY,BZ,CE,CF,CG,CL,CM,CO,CP,CQ,CR,CT,CZ,DA,DE,DG,DJ,DK,DL,DM,DN,DO,DP,DQ,DS,DV,DW,DX,DY,DZ,EA,EB,EC,ED,EE,EF,EG,EH,EI,EJ,EK,EL,EN,EO,EP,EQ,ER,ES,ET,EW,EX,EY,EZ,FA,FB,FC,FD,FE,FF,FG,FH,FI,FJ,FK,FL,FM,AT,BU,DR,b,N,O,S,T,U,V,W,Y,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AU,AW,AX,AY,BE,BF,BH,BJ,BK,BM,BN,BQ,BR,CH,CI,CJ,CK,CN,CS,CU,CW,CX,CY,DC,DF,DH,DI,DT,DU;H=$packages["bytes"];F=$packages["encoding/gob"];M=$packages["encoding/json"];L=$packages["errors"];A=$packages["fmt"];C=$packages["github.com/zclconf/go-cty/cty/set"];E=$packages["golang.org/x/text/unicode/norm"];I=$packages["hash/crc32"];K=$packages["hash/crc64"];B=$packages["math/big"];D=$packages["reflect"];J=$packages["sort"];G=$packages["strings"];AQ=$pkg.Value=$newType(0,$kindStruct,"cty.Value",true,"github.com/zclconf/go-cty/cty",true,function(ty_,v_){this.$val=this;if(arguments.length===0){this.ty=new AZ.ptr($ifaceNil);this.v=$ifaceNil;return;}this.ty=ty_;this.v=v_;});AS=$pkg.unknownType=$newType(0,$kindStruct,"cty.unknownType",true,"github.com/zclconf/go-cty/cty",false,function(){this.$val=this;if(arguments.length===0){return;}});AV=$pkg.pseudoTypeDynamic=$newType(0,$kindStruct,"cty.pseudoTypeDynamic",true,"github.com/zclconf/go-cty/cty",false,function(typeImplSigil_){this.$val=this;if(arguments.length===0){this.typeImplSigil=new BB.ptr();return;}this.typeImplSigil=typeImplSigil_;});AZ=$pkg.Type=$newType(0,$kindStruct,"cty.Type",true,"github.com/zclconf/go-cty/cty",true,function(typeImpl_){this.$val=this;if(arguments.length===0){this.typeImpl=$ifaceNil;return;}this.typeImpl=typeImpl_;});BA=$pkg.typeImpl=$newType(8,$kindInterface,"cty.typeImpl",true,"github.com/zclconf/go-cty/cty",false,null);BB=$pkg.typeImplSigil=$newType(0,$kindStruct,"cty.typeImplSigil",true,"github.com/zclconf/go-cty/cty",false,function(){this.$val=this;if(arguments.length===0){return;}});BC=$pkg.friendlyTypeNameMode=$newType(4,$kindInt32,"cty.friendlyTypeNameMode",true,"github.com/zclconf/go-cty/cty",false,null);BD=$pkg.typeTuple=$newType(0,$kindStruct,"cty.typeTuple",true,"github.com/zclconf/go-cty/cty",false,function(typeImplSigil_,ElemTypes_){this.$val=this;if(arguments.length===0){this.typeImplSigil=new BB.ptr();this.ElemTypes=EF.nil;return;}this.typeImplSigil=typeImplSigil_;this.ElemTypes=ElemTypes_;});BG=$pkg.typeSet=$newType(0,$kindStruct,"cty.typeSet",true,"github.com/zclconf/go-cty/cty",false,function(typeImplSigil_,ElementTypeT_){this.$val=this;if(arguments.length===0){this.typeImplSigil=new BB.ptr();this.ElementTypeT=new AZ.ptr($ifaceNil);return;}this.typeImplSigil=typeImplSigil_;this.ElementTypeT=ElementTypeT_;});BI=$pkg.setRules=$newType(0,$kindStruct,"cty.setRules",true,"github.com/zclconf/go-cty/cty",false,function(Type_){this.$val=this;if(arguments.length===0){this.Type=new AZ.ptr($ifaceNil);return;}this.Type=Type_;});BL=$pkg.ValueSet=$newType(0,$kindStruct,"cty.ValueSet",true,"github.com/zclconf/go-cty/cty",true,function(s_){this.$val=this;if(arguments.length===0){this.s=new C.Set.ptr(false,$ifaceNil);return;}this.s=s_;});BO=$pkg.primitiveType=$newType(0,$kindStruct,"cty.primitiveType",true,"github.com/zclconf/go-cty/cty",false,function(typeImplSigil_,Kind_){this.$val=this;if(arguments.length===0){this.typeImplSigil=new BB.ptr();this.Kind=0;return;}this.typeImplSigil=typeImplSigil_;this.Kind=Kind_;});BP=$pkg.primitiveTypeKind=$newType(1,$kindUint8,"cty.primitiveTypeKind",true,"github.com/zclconf/go-cty/cty",false,null);BX=$pkg.Path=$newType(12,$kindSlice,"cty.Path",true,"github.com/zclconf/go-cty/cty",true,null);BY=$pkg.PathStep=$newType(8,$kindInterface,"cty.PathStep",true,"github.com/zclconf/go-cty/cty",true,null);BZ=$pkg.pathStepImpl=$newType(0,$kindStruct,"cty.pathStepImpl",true,"github.com/zclconf/go-cty/cty",false,function(){this.$val=this;if(arguments.length===0){return;}});CE=$pkg.IndexStep=$newType(0,$kindStruct,"cty.IndexStep",true,"github.com/zclconf/go-cty/cty",true,function(pathStepImpl_,Key_){this.$val=this;if(argumen
|
|||
|
$packages["github.com/zclconf/go-cty/cty/convert"]=(function(){var $pkg={},$init,C,B,D,A,E,F,Q,AT,AY,AZ,BA,BB,BC,BD,BE,BF,BG,BH,BI,BJ,AB,AC,AD,AE,a,b,G,H,I,J,K,L,M,N,O,P,R,S,T,V,W,X,Y,Z,AA,AF,AG,AH,AI,AJ,AK,AL,AM,AN,AO,AP,AQ,AR,AS,AU,AV,AW,AX;C=$packages["bytes"];B=$packages["errors"];D=$packages["fmt"];A=$packages["github.com/zclconf/go-cty/cty"];E=$packages["sort"];F=$packages["strings"];Q=$pkg.Conversion=$newType(4,$kindFunc,"convert.Conversion",true,"github.com/zclconf/go-cty/cty/convert",true,null);AT=$pkg.conversion=$newType(4,$kindFunc,"convert.conversion",true,"github.com/zclconf/go-cty/cty/convert",false,null);AY=$sliceType($emptyInterface);AZ=$sliceType(Q);BA=$sliceType(A.Type);BB=$sliceType($Int);BC=$sliceType(BB);BD=$sliceType($String);BE=$sliceType($Uint8);BF=$sliceType(AT);BG=$sliceType(A.Value);BH=$ptrType(A.PathStep);BI=$structType("",[]);BJ=$sliceType(A.ValueMarks);G=function(c,d){var aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an,ao,ap,aq,ar,as,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;aa=$f.aa;ab=$f.ab;ac=$f.ac;ad=$f.ad;ae=$f.ae;af=$f.af;ag=$f.ag;ah=$f.ah;ai=$f.ai;aj=$f.aj;ak=$f.ak;al=$f.al;am=$f.am;an=$f.an;ao=$f.ao;ap=$f.ap;aq=$f.aq;ar=$f.ar;as=$f.as;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;m=$f.m;n=$f.n;o=$f.o;p=$f.p;q=$f.q;r=$f.r;s=$f.s;t=$f.t;u=$f.u;v=$f.v;w=$f.w;x=$f.x;y=$f.y;z=$f.z;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:if(c.$length===0){$s=-1;return[A.NilType,AZ.nil];}e=0;f=0;g=0;h=0;i=0;j=0;k=c;l=0;while(true){if(!(l<k.$length)){break;}m=$clone(((l<0||l>=k.$length)?($throwRuntimeError("index out of range"),undefined):k.$array[k.$offset+l]),A.Type);switch(0){default:if($clone(m,A.Type).IsMapType()){e=e+(1)>>0;}else if($clone(m,A.Type).IsListType()){f=f+(1)>>0;}else if($clone(m,A.Type).IsSetType()){g=g+(1)>>0;}else if($clone(m,A.Type).IsObjectType()){h=h+(1)>>0;}else if($clone(m,A.Type).IsTupleType()){i=i+(1)>>0;}else if($equal(m,A.DynamicPseudoType,A.Type)){j=j+(1)>>0;}else{break;}}l++;}if(e>0&&(((e+j>>0))===c.$length)){$s=2;continue;}if(e>0&&((((e+h>>0)+j>>0))===c.$length)){$s=3;continue;}if(f>0&&(((f+j>>0))===c.$length)){$s=4;continue;}if(f>0&&((((f+i>>0)+j>>0))===c.$length)){$s=5;continue;}if(g>0&&(((g+j>>0))===c.$length)){$s=6;continue;}if(h>0&&(((h+j>>0))===c.$length)){$s=7;continue;}if(i>0&&(((i+j>>0))===c.$length)){$s=8;continue;}if(h>0&&i>0){$s=9;continue;}$s=10;continue;case 2:n=J(A.Map,c,d,j>0);$s=11;case 11:if($c){$c=false;n=n.$blk();}if(n&&n.$blk!==undefined){break s;}o=n;$s=12;case 12:return o;case 3:q=I(c,d);$s=13;case 13:if($c){$c=false;q=q.$blk();}if(q&&q.$blk!==undefined){break s;}p=q;r=$clone(p[0],A.Type);s=p[1];if($clone(r,A.Type).IsMapType()){$s=-1;return[r,s];}$s=10;continue;case 4:t=J(A.List,c,d,j>0);$s=14;case 14:if($c){$c=false;t=t.$blk();}if(t&&t.$blk!==undefined){break s;}u=t;$s=15;case 15:return u;case 5:w=H(c,d);$s=16;case 16:if($c){$c=false;w=w.$blk();}if(w&&w.$blk!==undefined){break s;}v=w;x=$clone(v[0],A.Type);y=v[1];if($clone(x,A.Type).IsListType()){$s=-1;return[x,y];}$s=10;continue;case 6:z=J(A.Set,c,d,j>0);$s=17;case 17:if($c){$c=false;z=z.$blk();}if(z&&z.$blk!==undefined){break s;}aa=z;$s=18;case 18:return aa;case 7:ab=K(c,d,j>0);$s=19;case 19:if($c){$c=false;ab=ab.$blk();}if(ab&&ab.$blk!==undefined){break s;}ac=ab;$s=20;case 20:return ac;case 8:ad=M(c,d,j>0);$s=21;case 21:if($c){$c=false;ad=ad.$blk();}if(ad&&ad.$blk!==undefined){break s;}ae=ad;$s=22;case 22:return ae;case 9:$s=-1;return[A.NilType,AZ.nil];case 10:case 1:af=P(c);$s=23;case 23:if($c){$c=false;af=af.$blk();}if(af&&af.$blk!==undefined){break s;}ag=af;ah=$makeSlice(AZ,c.$length);ai=ag;aj=0;case 24:if(!(aj<ai.$length)){$s=25;continue;}ak=((aj<0||aj>=ai.$length)?($throwRuntimeError("index out of range"),undefined):ai.$array[ai.$offset+aj]);al=$clone(((ak<0||ak>=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+ak]),A.Type);am=c;an=0;case 26:if(!(an<am.$length)){$s=27;continue;}ao=an;ap=$clone(((an<0||an>=am.$length)?($throwRuntimeError("ind
|
|||
|
$packages["runtime/debug"]=(function(){var $pkg={},$init,B,C,E,D,A,AB,K;B=$packages["os"];C=$packages["runtime"];E=$packages["sort"];D=$packages["strings"];A=$packages["time"];AB=$sliceType($Uint8);K=function(){var c,d;c=$makeSlice(AB,1024);while(true){d=C.Stack(c,false);if(d<c.$length){return $subslice(c,0,d);}c=$makeSlice(AB,($imul(2,c.$length)));}};$pkg.Stack=K;$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=B.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=C.$init();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=E.$init();$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=D.$init();$s=4;case 4:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=A.$init();$s=5;case 5:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$packages["github.com/zclconf/go-cty/cty/function"]=(function(){var $pkg={},$init,B,A,C,F,G,I,J,L,M,P,R,S,T,U,V,W,X,Y,Z,AA,H,K,N,O,Q;B=$packages["fmt"];A=$packages["github.com/zclconf/go-cty/cty"];C=$packages["runtime/debug"];F=$pkg.Function=$newType(0,$kindStruct,"function.Function",true,"github.com/zclconf/go-cty/cty/function",true,function(spec_){this.$val=this;if(arguments.length===0){this.spec=S.nil;return;}this.spec=spec_;});G=$pkg.Spec=$newType(0,$kindStruct,"function.Spec",true,"github.com/zclconf/go-cty/cty/function",true,function(Params_,VarParam_,Type_,Impl_){this.$val=this;if(arguments.length===0){this.Params=Y.nil;this.VarParam=U.nil;this.Type=$throwNilPointerError;this.Impl=$throwNilPointerError;return;}this.Params=Params_;this.VarParam=VarParam_;this.Type=Type_;this.Impl=Impl_;});I=$pkg.TypeFunc=$newType(4,$kindFunc,"function.TypeFunc",true,"github.com/zclconf/go-cty/cty/function",true,null);J=$pkg.ImplFunc=$newType(4,$kindFunc,"function.ImplFunc",true,"github.com/zclconf/go-cty/cty/function",true,null);L=$pkg.ProxyFunc=$newType(4,$kindFunc,"function.ProxyFunc",true,"github.com/zclconf/go-cty/cty/function",true,null);M=$pkg.ArgError=$newType(0,$kindStruct,"function.ArgError",true,"github.com/zclconf/go-cty/cty/function",true,function(error_,Index_){this.$val=this;if(arguments.length===0){this.error=$ifaceNil;this.Index=0;return;}this.error=error_;this.Index=Index_;});P=$pkg.PanicError=$newType(0,$kindStruct,"function.PanicError",true,"github.com/zclconf/go-cty/cty/function",true,function(Value_,Stack_){this.$val=this;if(arguments.length===0){this.Value=$ifaceNil;this.Stack=Z.nil;return;}this.Value=Value_;this.Stack=Stack_;});R=$pkg.Parameter=$newType(0,$kindStruct,"function.Parameter",true,"github.com/zclconf/go-cty/cty/function",true,function(Name_,Type_,AllowNull_,AllowUnknown_,AllowDynamicType_,AllowMarked_){this.$val=this;if(arguments.length===0){this.Name="";this.Type=new A.Type.ptr($ifaceNil);this.AllowNull=false;this.AllowUnknown=false;this.AllowDynamicType=false;this.AllowMarked=false;return;}this.Name=Name_;this.Type=Type_;this.AllowNull=AllowNull_;this.AllowUnknown=AllowUnknown_;this.AllowDynamicType=AllowDynamicType_;this.AllowMarked=AllowMarked_;});S=$ptrType(G);T=$sliceType(A.Value);U=$ptrType(R);V=$sliceType($emptyInterface);W=$sliceType($error);X=$sliceType(A.ValueMarks);Y=$sliceType(R);Z=$sliceType($Uint8);AA=$sliceType(A.Type);H=function(a){var a,b;b=new F.ptr(a);return b;};$pkg.New=H;K=function(a){var a;return(function(b){var b;return[a,$ifaceNil];});};$pkg.StaticReturnType=K;F.ptr.prototype.ReturnType=function(a){var a,b,c,d,e,f,g,h,i,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=this;c=$makeSlice(T,a.$length);d=a;e=0;while(true){if(!(e<d.$length)){break;}f=e;g=$clone(((e<0||e>=d.$length)?($throwRuntimeError("index out of range"),undefined):d.$array[d.$offset+e]),A.Type);A.Value.copy(((f<0||f>=c.$length)?($throwRuntimeError("index out of range"),undefined):c.$array[c.$offset+f]),A.UnknownVal($clone(g,A.Type)));e++;}h=$clone(b,F).ReturnTypeForValues(c);$s=1;case 1:if($c){$c=false;h=h.$blk();}if(h&&h.$blk!==undefined){break s;}i=h;$s=2;case 2:return i;}return;}if($f===undefined){$f={$blk:F.ptr.prototype.ReturnType};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.$s=$s;$f.$r=$r;return $f;};F.prototype.ReturnType=function(a){return this.$val.ReturnType(a);};F.ptr.prototype.ReturnTypeForValues=function(a){var a,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an,ao,ap,aq,ar,as,at,au,av,aw,ax,ay,az,b,ba,bb,bc,bd,be,bf,bg,bh,bi,bj,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,$s,$deferred,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;aa=$f.aa;ab=$f.ab;ac=$f.ac;ad=$f.ad;ae=$f.ae;af=$f.af;ag=$f.ag;ah=$f.ah;ai=$f.ai;aj=$f.aj;ak=$f.ak;al=$f.al;am=$f.am;an=$f.an;ao=$f.ao;ap=$f.ap;aq=$f.aq;ar=$f.ar;as=$f.as;at=$f.at;au=$f.au;av=$f.av;aw=$f.aw;ax=$f.ax;ay=$f.ay;az=$f.az;b=$f.b;ba=$f.ba;bb=$f
|
|||
|
$packages["github.com/hashicorp/hcl/v2"]=(function(){var $pkg={},$init,C,D,J,A,I,E,M,B,G,H,K,F,L,Q,S,T,U,V,W,X,Z,AA,AB,AC,AD,AE,AF,AG,AJ,AK,AL,AP,AQ,BB,BF,BI,BJ,BO,BP,BQ,BT,BX,CB,CE,CF,CG,CH,BU,BV,BW,BY,BZ,CA,CC,CD,CI,CJ,CK,CL,CM,CN,CO,CS,CV,CW,CZ,DA,DB,DC,DE,DF,N,P,R,AR,AT,AU,BD,BK;C=$packages["bufio"];D=$packages["bytes"];J=$packages["errors"];A=$packages["fmt"];I=$packages["github.com/agext/levenshtein"];E=$packages["github.com/apparentlymart/go-textseg/v13/textseg"];M=$packages["github.com/mitchellh/go-wordwrap"];B=$packages["github.com/zclconf/go-cty/cty"];G=$packages["github.com/zclconf/go-cty/cty/convert"];H=$packages["github.com/zclconf/go-cty/cty/function"];K=$packages["io"];F=$packages["math/big"];L=$packages["sort"];Q=$pkg.Traversal=$newType(12,$kindSlice,"hcl.Traversal",true,"github.com/hashicorp/hcl/v2",true,null);S=$pkg.TraversalSplit=$newType(0,$kindStruct,"hcl.TraversalSplit",true,"github.com/hashicorp/hcl/v2",true,function(Abs_,Rel_){this.$val=this;if(arguments.length===0){this.Abs=Q.nil;this.Rel=Q.nil;return;}this.Abs=Abs_;this.Rel=Rel_;});T=$pkg.Traverser=$newType(8,$kindInterface,"hcl.Traverser",true,"github.com/hashicorp/hcl/v2",true,null);U=$pkg.isTraverser=$newType(0,$kindStruct,"hcl.isTraverser",true,"github.com/hashicorp/hcl/v2",false,function(){this.$val=this;if(arguments.length===0){return;}});V=$pkg.TraverseRoot=$newType(0,$kindStruct,"hcl.TraverseRoot",true,"github.com/hashicorp/hcl/v2",true,function(isTraverser_,Name_,SrcRange_){this.$val=this;if(arguments.length===0){this.isTraverser=new U.ptr();this.Name="";this.SrcRange=new AQ.ptr("",new AP.ptr(0,0,0),new AP.ptr(0,0,0));return;}this.isTraverser=isTraverser_;this.Name=Name_;this.SrcRange=SrcRange_;});W=$pkg.TraverseAttr=$newType(0,$kindStruct,"hcl.TraverseAttr",true,"github.com/hashicorp/hcl/v2",true,function(isTraverser_,Name_,SrcRange_){this.$val=this;if(arguments.length===0){this.isTraverser=new U.ptr();this.Name="";this.SrcRange=new AQ.ptr("",new AP.ptr(0,0,0),new AP.ptr(0,0,0));return;}this.isTraverser=isTraverser_;this.Name=Name_;this.SrcRange=SrcRange_;});X=$pkg.TraverseIndex=$newType(0,$kindStruct,"hcl.TraverseIndex",true,"github.com/hashicorp/hcl/v2",true,function(isTraverser_,Key_,SrcRange_){this.$val=this;if(arguments.length===0){this.isTraverser=new U.ptr();this.Key=new B.Value.ptr(new B.Type.ptr($ifaceNil),$ifaceNil);this.SrcRange=new AQ.ptr("",new AP.ptr(0,0,0),new AP.ptr(0,0,0));return;}this.isTraverser=isTraverser_;this.Key=Key_;this.SrcRange=SrcRange_;});Z=$pkg.File=$newType(0,$kindStruct,"hcl.File",true,"github.com/hashicorp/hcl/v2",true,function(Body_,Bytes_,Nav_){this.$val=this;if(arguments.length===0){this.Body=$ifaceNil;this.Bytes=CK.nil;this.Nav=$ifaceNil;return;}this.Body=Body_;this.Bytes=Bytes_;this.Nav=Nav_;});AA=$pkg.Block=$newType(0,$kindStruct,"hcl.Block",true,"github.com/hashicorp/hcl/v2",true,function(Type_,Labels_,Body_,DefRange_,TypeRange_,LabelRanges_){this.$val=this;if(arguments.length===0){this.Type="";this.Labels=BZ.nil;this.Body=$ifaceNil;this.DefRange=new AQ.ptr("",new AP.ptr(0,0,0),new AP.ptr(0,0,0));this.TypeRange=new AQ.ptr("",new AP.ptr(0,0,0),new AP.ptr(0,0,0));this.LabelRanges=DA.nil;return;}this.Type=Type_;this.Labels=Labels_;this.Body=Body_;this.DefRange=DefRange_;this.TypeRange=TypeRange_;this.LabelRanges=LabelRanges_;});AB=$pkg.Blocks=$newType(12,$kindSlice,"hcl.Blocks",true,"github.com/hashicorp/hcl/v2",true,null);AC=$pkg.Attributes=$newType(4,$kindMap,"hcl.Attributes",true,"github.com/hashicorp/hcl/v2",true,null);AD=$pkg.Body=$newType(8,$kindInterface,"hcl.Body",true,"github.com/hashicorp/hcl/v2",true,null);AE=$pkg.BodyContent=$newType(0,$kindStruct,"hcl.BodyContent",true,"github.com/hashicorp/hcl/v2",true,function(Attributes_,Blocks_,MissingItemRange_){this.$val=this;if(arguments.length===0){this.Attributes=false;this.Blocks=AB.nil;this.MissingItemRange=new AQ.ptr("",new AP.ptr(0,0,0),new AP.ptr(0,0,0));return;}this.Attributes=Attributes_;this.Blocks=Blocks_;this.MissingItemRange=MissingItemRange_;});AF=$pkg.Attribute=$newType(0,$kindStruct,"hcl.Attribute",true,"github.com/hashicorp/hcl/
|
|||
|
$packages["github.com/hashicorp/hcl/v2/ext/customdecode"]=(function(){var $pkg={},$init,A,C,D,B,G,K,L,N,O,P,Q,E,H,J,M;A=$packages["fmt"];C=$packages["github.com/hashicorp/hcl/v2"];D=$packages["github.com/zclconf/go-cty/cty"];B=$packages["reflect"];G=$pkg.ExpressionClosure=$newType(0,$kindStruct,"customdecode.ExpressionClosure",true,"github.com/hashicorp/hcl/v2/ext/customdecode",true,function(Expression_,EvalContext_){this.$val=this;if(arguments.length===0){this.Expression=$ifaceNil;this.EvalContext=Q.nil;return;}this.Expression=Expression_;this.EvalContext=EvalContext_;});K=$pkg.customDecoderImpl=$newType(4,$kindInt,"customdecode.customDecoderImpl",true,"github.com/hashicorp/hcl/v2/ext/customdecode",false,null);L=$pkg.CustomExpressionDecoderFunc=$newType(4,$kindFunc,"customdecode.CustomExpressionDecoderFunc",true,"github.com/hashicorp/hcl/v2/ext/customdecode",true,null);N=$ptrType(C.Expression);O=$ptrType(G);P=$sliceType($emptyInterface);Q=$ptrType(C.EvalContext);E=function(a){var a,b,c,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=[a];b=D.CapsuleVal($clone($pkg.ExpressionType,D.Type),(a.$ptr||(a.$ptr=new N(function(){return this.$target[0];},function($v){this.$target[0]=$v;},a))));$s=1;case 1:if($c){$c=false;b=b.$blk();}if(b&&b.$blk!==undefined){break s;}c=b;$s=2;case 2:return c;}return;}if($f===undefined){$f={$blk:E};}$f.a=a;$f.b=b;$f.c=c;$f.$s=$s;$f.$r=$r;return $f;};$pkg.ExpressionVal=E;H=function(a){var a,b,c,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=D.CapsuleVal($clone($pkg.ExpressionClosureType,D.Type),a);$s=1;case 1:if($c){$c=false;b=b.$blk();}if(b&&b.$blk!==undefined){break s;}c=b;$s=2;case 2:return c;}return;}if($f===undefined){$f={$blk:H};}$f.a=a;$f.b=b;$f.c=c;$f.$s=$s;$f.$r=$r;return $f;};$pkg.ExpressionClosureVal=H;G.ptr.prototype.Value=function(){var a,b,c,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=this;b=a.Expression.Value(a.EvalContext);$s=1;case 1:if($c){$c=false;b=b.$blk();}if(b&&b.$blk!==undefined){break s;}c=b;$s=2;case 2:return c;}return;}if($f===undefined){$f={$blk:G.ptr.prototype.Value};}$f.a=a;$f.b=b;$f.c=c;$f.$s=$s;$f.$r=$r;return $f;};G.prototype.Value=function(){return this.$val.Value();};J=function(){var a,b,c,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=B.TypeOf((N.nil)).Elem();$s=1;case 1:if($c){$c=false;a=a.$blk();}if(a&&a.$blk!==undefined){break s;}b=a;D.Type.copy($pkg.ExpressionType,D.CapsuleWithOps("expression",b,new D.CapsuleOps.ptr((function $b(c){var c,d,e,f,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;c=$f.c;d=$f.d;e=$f.e;f=$f.f;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:d=$assertType(c,N);e=A.Sprintf("customdecode.ExpressionVal(%#v)",new P([d.$get()]));$s=1;case 1:if($c){$c=false;e=e.$blk();}if(e&&e.$blk!==undefined){break s;}f=e;$s=2;case 2:return f;}return;}if($f===undefined){$f={$blk:$b};}$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.$s=$s;$f.$r=$r;return $f;}),(function(c){var c;return"customdecode.ExpressionType";}),$throwNilPointerError,(function $b(c,d){var c,d,e,f,g,h,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:e=$assertType(c,N);f=$assertType(d,N);g=B.DeepEqual(e.$get(),f.$get());$s=1;case 1:if($c){$c=false;g=g.$blk();}if(g&&g.$blk!==undefined){break s;}h=g;$s=2;case 2:return h;}return;}if($f===undefined){$f={$blk:$b};}$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.$s=$s;$f.$r=$r;return $f;}),$throwNilPointerError,$throwNilPointerError,(function(c){var c,d;d=c;if($interfaceIsEqual(d,new K((1)))){return new L(((function $b(e,f){var e,f,g,h,$s,$r;$s=
|
|||
|
$packages["encoding/csv"]=(function(){var $pkg={},$init,A,F,G,H,B,C,D,E,K,N,P,T,U,V,W,X,Y,Z,AB,AC,L,M,O,Q,R;A=$packages["bufio"];F=$packages["bytes"];G=$packages["errors"];H=$packages["fmt"];B=$packages["io"];C=$packages["strings"];D=$packages["unicode"];E=$packages["unicode/utf8"];K=$pkg.ParseError=$newType(0,$kindStruct,"csv.ParseError",true,"encoding/csv",true,function(StartLine_,Line_,Column_,Err_){this.$val=this;if(arguments.length===0){this.StartLine=0;this.Line=0;this.Column=0;this.Err=$ifaceNil;return;}this.StartLine=StartLine_;this.Line=Line_;this.Column=Column_;this.Err=Err_;});N=$pkg.Reader=$newType(0,$kindStruct,"csv.Reader",true,"encoding/csv",true,function(Comma_,Comment_,FieldsPerRecord_,LazyQuotes_,TrimLeadingSpace_,ReuseRecord_,TrailingComma_,r_,numLine_,rawBuffer_,recordBuffer_,fieldIndexes_,fieldPositions_,lastRecord_){this.$val=this;if(arguments.length===0){this.Comma=0;this.Comment=0;this.FieldsPerRecord=0;this.LazyQuotes=false;this.TrimLeadingSpace=false;this.ReuseRecord=false;this.TrailingComma=false;this.r=V.nil;this.numLine=0;this.rawBuffer=T.nil;this.recordBuffer=T.nil;this.fieldIndexes=W.nil;this.fieldPositions=X.nil;this.lastRecord=Y.nil;return;}this.Comma=Comma_;this.Comment=Comment_;this.FieldsPerRecord=FieldsPerRecord_;this.LazyQuotes=LazyQuotes_;this.TrimLeadingSpace=TrimLeadingSpace_;this.ReuseRecord=ReuseRecord_;this.TrailingComma=TrailingComma_;this.r=r_;this.numLine=numLine_;this.rawBuffer=rawBuffer_;this.recordBuffer=recordBuffer_;this.fieldIndexes=fieldIndexes_;this.fieldPositions=fieldPositions_;this.lastRecord=lastRecord_;});P=$pkg.position=$newType(0,$kindStruct,"csv.position",true,"encoding/csv",false,function(line_,col_){this.$val=this;if(arguments.length===0){this.line=0;this.col=0;return;}this.line=line_;this.col=col_;});T=$sliceType($Uint8);U=$sliceType($emptyInterface);V=$ptrType(A.Reader);W=$sliceType($Int);X=$sliceType(P);Y=$sliceType($String);Z=$sliceType(Y);AB=$ptrType(K);AC=$ptrType(N);K.ptr.prototype.Error=function(){var a,b,c,d,e,f,g,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=this;if($interfaceIsEqual(a.Err,$pkg.ErrFieldCount)){$s=1;continue;}$s=2;continue;case 1:b=H.Sprintf("record on line %d: %v",new U([new $Int(a.Line),a.Err]));$s=3;case 3:if($c){$c=false;b=b.$blk();}if(b&&b.$blk!==undefined){break s;}c=b;$s=4;case 4:return c;case 2:if(!((a.StartLine===a.Line))){$s=5;continue;}$s=6;continue;case 5:d=H.Sprintf("record on line %d; parse error on line %d, column %d: %v",new U([new $Int(a.StartLine),new $Int(a.Line),new $Int(a.Column),a.Err]));$s=7;case 7:if($c){$c=false;d=d.$blk();}if(d&&d.$blk!==undefined){break s;}e=d;$s=8;case 8:return e;case 6:f=H.Sprintf("parse error on line %d, column %d: %v",new U([new $Int(a.Line),new $Int(a.Column),a.Err]));$s=9;case 9:if($c){$c=false;f=f.$blk();}if(f&&f.$blk!==undefined){break s;}g=f;$s=10;case 10:return g;}return;}if($f===undefined){$f={$blk:K.ptr.prototype.Error};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.$s=$s;$f.$r=$r;return $f;};K.prototype.Error=function(){return this.$val.Error();};K.ptr.prototype.Unwrap=function(){var a;a=this;return a.Err;};K.prototype.Unwrap=function(){return this.$val.Unwrap();};M=function(a){var a;return!((a===0))&&!((a===34))&&!((a===13))&&!((a===10))&&E.ValidRune(a)&&!((a===65533));};O=function(a){var a;return new N.ptr(44,0,0,false,false,false,false,A.NewReader(a),0,T.nil,T.nil,W.nil,X.nil,Y.nil);};$pkg.NewReader=O;N.ptr.prototype.Read=function(){var a,b,c,d,e,f,g,h,i,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:a=Y.nil;b=$ifaceNil;c=this;if(c.ReuseRecord){$s=1;continue;}$s=2;continue;case 1:e=c.readRecord(c.lastRecord);$s=4;case 4:if($c){$c=false;e=e.$blk();}if(e&&e.$blk!==undefined){break s;}d=e;a=d[0];b=d[1];c.lastRecord=a;$s=3;continue;case 2:g=c.readRecord(Y.nil);$s=5;case 5:if($c)
|
|||
|
$packages["github.com/zclconf/go-cty/cty/gocty"]=(function(){var $pkg={},$init,B,E,F,C,D,A,AW,AX,AO,AP,AQ,AR,AS,AT,AU,a,b,c,d,e,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AV;B=$packages["github.com/zclconf/go-cty/cty"];E=$packages["github.com/zclconf/go-cty/cty/convert"];F=$packages["github.com/zclconf/go-cty/cty/set"];C=$packages["math"];D=$packages["math/big"];A=$packages["reflect"];AW=$sliceType($emptyInterface);AX=$ptrType(D.Int);J=function(f,g){var f,g,h,i,j,k,l,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:h=A.ValueOf(g);$s=1;case 1:if($c){$c=false;h=h.$blk();}if(h&&h.$blk!==undefined){break s;}i=h;if(!(($clone(i,A.Value).Kind()===22))){$panic(new $String("target value is not a pointer"));}if($clone(i,A.Value).IsNil()){$panic(new $String("target value is nil pointer"));}j=$makeSlice(B.Path,0);k=K($clone(f,B.Value),$clone(i,A.Value),j);$s=2;case 2:if($c){$c=false;k=k.$blk();}if(k&&k.$blk!==undefined){break s;}l=k;$s=3;case 3:return l;}return;}if($f===undefined){$f={$blk:J};}$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.k=k;$f.l=l;$f.$s=$s;$f.$r=$r;return $f;};$pkg.FromCtyValue=J;K=function(f,g,h){var aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an,ao,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;aa=$f.aa;ab=$f.ab;ac=$f.ac;ad=$f.ad;ae=$f.ae;af=$f.af;ag=$f.ag;ah=$f.ah;ai=$f.ai;aj=$f.aj;ak=$f.ak;al=$f.al;am=$f.am;an=$f.an;ao=$f.ao;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;m=$f.m;n=$f.n;o=$f.o;p=$f.p;q=$f.q;r=$f.r;s=$f.s;t=$f.t;u=$f.u;v=$f.v;w=$f.w;x=$f.x;y=$f.y;z=$f.z;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:i=$clone($clone(f,B.Value).Type(),B.Type);j=Y($clone(g,A.Value),false);$s=1;case 1:if($c){$c=false;j=j.$blk();}if(j&&j.$blk!==undefined){break s;}k=j;if(!($clone(k,A.Value).Kind()===25)){l=false;$s=4;continue s;}m=$clone(k,A.Value).Type().AssignableTo(AO);$s=5;case 5:if($c){$c=false;m=m.$blk();}if(m&&m.$blk!==undefined){break s;}l=m;case 4:if(l){$s=2;continue;}$s=3;continue;case 2:n=A.ValueOf(new f.constructor.elem(f));$s=6;case 6:if($c){$c=false;n=n.$blk();}if(n&&n.$blk!==undefined){break s;}$r=$clone(k,A.Value).Set($clone(n,A.Value));$s=7;case 7:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return $ifaceNil;case 3:if($clone(f,B.Value).IsNull()&&!$clone($clone(f,B.Value).Type(),B.Type).IsListType()&&!$clone($clone(f,B.Value).Type(),B.Type).IsMapType()&&!$clone($clone(f,B.Value).Type(),B.Type).IsCapsuleType()){$s=8;continue;}$s=9;continue;case 8:o=Y($clone(g,A.Value),true);$s=10;case 10:if($c){$c=false;o=o.$blk();}if(o&&o.$blk!==undefined){break s;}g=o;if(!(($clone(g,A.Value).Kind()===22))){$s=11;continue;}$s=12;continue;case 11:p=h.NewErrorf("null value is not allowed",new AW([]));$s=13;case 13:if($c){$c=false;p=p.$blk();}if(p&&p.$blk!==undefined){break s;}q=p;$s=14;case 14:return q;case 12:r=A.Zero($clone(g,A.Value).Type());$s=15;case 15:if($c){$c=false;r=r.$blk();}if(r&&r.$blk!==undefined){break s;}$r=$clone(g,A.Value).Set($clone(r,A.Value));$s=16;case 16:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$s=-1;return $ifaceNil;case 9:g=k;if(!$clone(f,B.Value).IsKnown()){$s=17;continue;}$s=18;continue;case 17:s=h.NewErrorf("value must be known",new AW([]));$s=19;case 19:if($c){$c=false;s=s.$blk();}if(s&&s.$blk!==undefined){break s;}t=s;$s=20;case 20:return t;case 18:u=$clone(i,B.Type);if($equal(u,(B.Bool),B.Type)){$s=22;continue;}if($equal(u,(B.Number),B.Type)){$s=23;continue;}if($equal(u,(B.String),B.Type)){$s=24;continue;}$s=25;continue;case 22:v=L($clone(f,B.Value),$clone(g,A.Value),h);$s=26;case 26:if($c){$c=false;v=v.$blk();}if(v&&v.$blk!==undefined){break s;}w=v;$s=27;case 27:return w;case 23:x=M($clone(f,B.Value),$clone(g,A.Value),h);$s=28;case 28:if($c){$c=false;x=x.$blk();}if(x&&x.$blk!==undefined){break s;}y=x;$s=29;case 29:return y;case 24:z=R($clone(f,B.Value),$clone(g,A.Value),h);$s=30;case 30:if($c){$c=false;z=z.$blk();}if(z&&z.$blk!==undefi
|
|||
|
$packages["github.com/zclconf/go-cty/cty/json"]=(function(){var $pkg={},$init,A,D,E,B,C,F,G,AD,AG,AH,AI,AJ,AK,AL,AM,AN,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,AA,AB,AE,AF;A=$packages["bytes"];D=$packages["encoding/json"];E=$packages["fmt"];B=$packages["github.com/zclconf/go-cty/cty"];C=$packages["github.com/zclconf/go-cty/cty/convert"];F=$packages["reflect"];G=$packages["sort"];AD=$pkg.SimpleJSONValue=$newType(0,$kindStruct,"json.SimpleJSONValue",true,"github.com/zclconf/go-cty/cty/json",true,function(Value_){this.$val=this;if(arguments.length===0){this.Value=new B.Value.ptr(new B.Type.ptr($ifaceNil),$ifaceNil);return;}this.Value=Value_;});AG=$sliceType($error);AH=$sliceType($Uint8);AI=$sliceType($emptyInterface);AJ=$sliceType(B.Value);AK=$ptrType(D.RawMessage);AL=$sliceType(B.Type);AM=$sliceType($String);AN=$ptrType(AD);H=function(a,b){var a,b,c,d,e,f,g,h,i,j,k,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:c=$clone($clone(a,B.Value).Type(),B.Type).TestConformance($clone(b,B.Type));$s=1;case 1:if($c){$c=false;c=c.$blk();}if(c&&c.$blk!==undefined){break s;}d=c;if(!(d===AG.nil)){$s=2;continue;}$s=3;continue;case 2:e=$ifaceNil;g=C.Convert($clone(a,B.Value),$clone(b,B.Type));$s=4;case 4:if($c){$c=false;g=g.$blk();}if(g&&g.$blk!==undefined){break s;}f=g;B.Value.copy(a,f[0]);e=f[1];if(!($interfaceIsEqual(e,$ifaceNil))){$s=-1;return[AH.nil,e];}case 3:h=new A.Buffer.ptr(AH.nil,0,0);i=B.Path.nil;j=AE($clone(a,B.Value),$clone(b,B.Type),i,h);$s=5;case 5:if($c){$c=false;j=j.$blk();}if(j&&j.$blk!==undefined){break s;}k=j;if(!($interfaceIsEqual(k,$ifaceNil))){$s=-1;return[AH.nil,k];}$s=-1;return[h.Bytes(),$ifaceNil];}return;}if($f===undefined){$f={$blk:H};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.f=f;$f.g=g;$f.h=h;$f.i=i;$f.j=j;$f.k=k;$f.$s=$s;$f.$r=$r;return $f;};$pkg.Marshal=H;I=function(a,b){var a,b,c,d,e,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:c=B.Path.nil;d=J(a,$clone(b,B.Type),c);$s=1;case 1:if($c){$c=false;d=d.$blk();}if(d&&d.$blk!==undefined){break s;}e=d;$s=2;case 2:return e;}return;}if($f===undefined){$f={$blk:I};}$f.a=a;$f.b=b;$f.c=c;$f.d=d;$f.e=e;$f.$s=$s;$f.$r=$r;return $f;};$pkg.Unmarshal=I;J=function(a,b,c){var a,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an,ao,ap,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;aa=$f.aa;ab=$f.ab;ac=$f.ac;ad=$f.ad;ae=$f.ae;af=$f.af;ag=$f.ag;ah=$f.ah;ai=$f.ai;aj=$f.aj;ak=$f.ak;al=$f.al;am=$f.am;an=$f.an;ao=$f.ao;ap=$f.ap;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;m=$f.m;n=$f.n;o=$f.o;p=$f.p;q=$f.q;r=$f.r;s=$f.s;t=$f.t;u=$f.u;v=$f.v;w=$f.w;x=$f.x;y=$f.y;z=$f.z;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:d=V(a);f=d.Token();$s=1;case 1:if($c){$c=false;f=f.$blk();}if(f&&f.$blk!==undefined){break s;}e=f;g=e[0];h=e[1];if(!($interfaceIsEqual(h,$ifaceNil))){$s=-1;return[B.NilVal,c.NewError(h)];}if($interfaceIsEqual(g,$ifaceNil)){$s=-1;return[B.NullVal($clone(b,B.Type)),$ifaceNil];}if($equal(b,B.DynamicPseudoType,B.Type)){$s=2;continue;}$s=3;continue;case 2:i=R(a,c);$s=4;case 4:if($c){$c=false;i=i.$blk();}if(i&&i.$blk!==undefined){break s;}j=i;$s=5;case 5:return j;case 3:if($clone(b,B.Type).IsPrimitiveType()){$s=7;continue;}if($clone(b,B.Type).IsListType()){$s=8;continue;}if($clone(b,B.Type).IsSetType()){$s=9;continue;}if($clone(b,B.Type).IsMapType()){$s=10;continue;}if($clone(b,B.Type).IsTupleType()){$s=11;continue;}if($clone(b,B.Type).IsObjectType()){$s=12;continue;}if($clone(b,B.Type).IsCapsuleType()){$s=13;continue;}$s=14;continue;case 7:l=K(g,$clone(b,B.Type),c);$s=16;case 16:if($c){$c=false;l=l.$blk();}if(l&&l.$blk!==undefined){break s;}k=l;m=$clone(k[0],B.Value);n=k[1];if(!($interfaceIsEqual(n,$ifaceNil))){$s=-1;return[B.NilVal,n];}$s=-1;return[m,$ifaceNil];case 8:o=a
|
|||
|
$packages["regexp/syntax"]=(function(){var $pkg={},$init,D,A,B,C,E,G,H,K,L,N,Q,AO,AP,AQ,AR,BB,BO,BU,BW,BX,CB,CC,CD,CE,CF,CG,CH,CI,CJ,CK,CL,CM,CN,CO,CP,CQ,CR,CS,M,V,W,X,Y,Z,AA,AB,AC,AD,AE,AF,AG,AH,AI,AJ,AK,AL,AM,AN,BC,BT,BZ,CA,F,I,J,P,R,S,T,U,AS,AT,AU,AV,AW,AX,AY,AZ,BA,BD,BE,BF,BG,BH,BI,BJ,BK,BL,BM,BN,BP,BQ,BR,BS,BV,BY;D=$packages["sort"];A=$packages["strconv"];B=$packages["strings"];C=$packages["unicode"];E=$packages["unicode/utf8"];G=$pkg.Regexp=$newType(0,$kindStruct,"syntax.Regexp",true,"regexp/syntax",true,function(Op_,Flags_,Sub_,Sub0_,Rune_,Rune0_,Min_,Max_,Cap_,Name_){this.$val=this;if(arguments.length===0){this.Op=0;this.Flags=0;this.Sub=CG.nil;this.Sub0=CH.zero();this.Rune=CC.nil;this.Rune0=CI.zero();this.Min=0;this.Max=0;this.Cap=0;this.Name="";return;}this.Op=Op_;this.Flags=Flags_;this.Sub=Sub_;this.Sub0=Sub0_;this.Rune=Rune_;this.Rune0=Rune0_;this.Min=Min_;this.Max=Max_;this.Cap=Cap_;this.Name=Name_;});H=$pkg.Op=$newType(1,$kindUint8,"syntax.Op",true,"regexp/syntax",true,null);K=$pkg.Prog=$newType(0,$kindStruct,"syntax.Prog",true,"regexp/syntax",true,function(Inst_,Start_,NumCap_){this.$val=this;if(arguments.length===0){this.Inst=CO.nil;this.Start=0;this.NumCap=0;return;}this.Inst=Inst_;this.Start=Start_;this.NumCap=NumCap_;});L=$pkg.InstOp=$newType(1,$kindUint8,"syntax.InstOp",true,"regexp/syntax",true,null);N=$pkg.EmptyOp=$newType(1,$kindUint8,"syntax.EmptyOp",true,"regexp/syntax",true,null);Q=$pkg.Inst=$newType(0,$kindStruct,"syntax.Inst",true,"regexp/syntax",true,function(Op_,Out_,Arg_,Rune_){this.$val=this;if(arguments.length===0){this.Op=0;this.Out=0;this.Arg=0;this.Rune=CC.nil;return;}this.Op=Op_;this.Out=Out_;this.Arg=Arg_;this.Rune=Rune_;});AO=$pkg.Error=$newType(0,$kindStruct,"syntax.Error",true,"regexp/syntax",true,function(Code_,Expr_){this.$val=this;if(arguments.length===0){this.Code="";this.Expr="";return;}this.Code=Code_;this.Expr=Expr_;});AP=$pkg.ErrorCode=$newType(8,$kindString,"syntax.ErrorCode",true,"regexp/syntax",true,null);AQ=$pkg.Flags=$newType(2,$kindUint16,"syntax.Flags",true,"regexp/syntax",true,null);AR=$pkg.parser=$newType(0,$kindStruct,"syntax.parser",true,"regexp/syntax",false,function(flags_,stack_,free_,numCap_,wholeRegexp_,tmpClass_){this.$val=this;if(arguments.length===0){this.flags=0;this.stack=CG.nil;this.free=CF.nil;this.numCap=0;this.wholeRegexp="";this.tmpClass=CC.nil;return;}this.flags=flags_;this.stack=stack_;this.free=free_;this.numCap=numCap_;this.wholeRegexp=wholeRegexp_;this.tmpClass=tmpClass_;});BB=$pkg.charGroup=$newType(0,$kindStruct,"syntax.charGroup",true,"regexp/syntax",false,function(sign_,class$1_){this.$val=this;if(arguments.length===0){this.sign=0;this.class$1=CC.nil;return;}this.sign=sign_;this.class$1=class$1_;});BO=$pkg.ranges=$newType(0,$kindStruct,"syntax.ranges",true,"regexp/syntax",false,function(p_){this.$val=this;if(arguments.length===0){this.p=CL.nil;return;}this.p=p_;});BU=$pkg.patchList=$newType(0,$kindStruct,"syntax.patchList",true,"regexp/syntax",false,function(head_,tail_){this.$val=this;if(arguments.length===0){this.head=0;this.tail=0;return;}this.head=head_;this.tail=tail_;});BW=$pkg.frag=$newType(0,$kindStruct,"syntax.frag",true,"regexp/syntax",false,function(i_,out_,nullable_){this.$val=this;if(arguments.length===0){this.i=0;this.out=new BU.ptr(0,0);this.nullable=false;return;}this.i=i_;this.out=out_;this.nullable=nullable_;});BX=$pkg.compiler=$newType(0,$kindStruct,"syntax.compiler",true,"regexp/syntax",false,function(p_){this.$val=this;if(arguments.length===0){this.p=CN.nil;return;}this.p=p_;});CB=$sliceType($String);CC=$sliceType($Int32);CD=$sliceType(C.Range16);CE=$sliceType(C.Range32);CF=$ptrType(G);CG=$sliceType(CF);CH=$arrayType(CF,1);CI=$arrayType($Int32,2);CJ=$ptrType(B.Builder);CK=$sliceType($Uint8);CL=$ptrType(CC);CM=$ptrType(C.RangeTable);CN=$ptrType(K);CO=$sliceType(Q);CP=$ptrType(Q);CQ=$ptrType(AO);CR=$ptrType(AR);CS=$ptrType(BX);G.ptr.prototype.Simplify=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;a=this;if(a===CF.nil){return CF.nil;}b=a.Op;if((b===(13))||(b===(18))||(b===(19))){c=a;d=a.Sub;e=0;while(true){if(!(e
|
|||
|
$packages["regexp"]=(function(){var $pkg={},$init,A,F,B,C,I,D,E,G,H,J,T,U,V,W,AF,AG,AK,AR,AW,AX,AY,AZ,BA,BB,BD,BI,BJ,BP,BQ,BR,BS,BT,BU,BV,BW,BX,BY,BZ,CA,CB,CC,CD,CE,CF,CG,CH,CI,CJ,CK,CL,CM,CN,CO,CP,CQ,CR,CS,CT,CU,CV,CW,CX,CY,CZ,DA,DB,DC,DD,DE,DF,DG,N,O,AA,AM,AN,AS,AT,BE,BH,BK,K,M,P,Q,S,AC,AE,AH,AI,AJ,AL,AO,AP,AQ,AU,AV,BC,BF,BG,BL,BM,BN,BO;A=$packages["bytes"];F=$packages["github.com/gopherjs/gopherjs/nosync"];B=$packages["io"];C=$packages["regexp/syntax"];I=$packages["sort"];D=$packages["strconv"];E=$packages["strings"];G=$packages["unicode"];H=$packages["unicode/utf8"];J=$pkg.Regexp=$newType(0,$kindStruct,"regexp.Regexp",true,"regexp",true,function(expr_,prog_,onepass_,numSubexp_,maxBitStateLen_,subexpNames_,prefix_,prefixBytes_,prefixRune_,prefixEnd_,mpool_,matchcap_,prefixComplete_,cond_,minInputLen_,longest_){this.$val=this;if(arguments.length===0){this.expr="";this.prog=BW.nil;this.onepass=BX.nil;this.numSubexp=0;this.maxBitStateLen=0;this.subexpNames=BY.nil;this.prefix="";this.prefixBytes=BZ.nil;this.prefixRune=0;this.prefixEnd=0;this.mpool=0;this.matchcap=0;this.prefixComplete=false;this.cond=0;this.minInputLen=0;this.longest=false;return;}this.expr=expr_;this.prog=prog_;this.onepass=onepass_;this.numSubexp=numSubexp_;this.maxBitStateLen=maxBitStateLen_;this.subexpNames=subexpNames_;this.prefix=prefix_;this.prefixBytes=prefixBytes_;this.prefixRune=prefixRune_;this.prefixEnd=prefixEnd_;this.mpool=mpool_;this.matchcap=matchcap_;this.prefixComplete=prefixComplete_;this.cond=cond_;this.minInputLen=minInputLen_;this.longest=longest_;});T=$pkg.input=$newType(8,$kindInterface,"regexp.input",true,"regexp",false,null);U=$pkg.inputString=$newType(0,$kindStruct,"regexp.inputString",true,"regexp",false,function(str_){this.$val=this;if(arguments.length===0){this.str="";return;}this.str=str_;});V=$pkg.inputBytes=$newType(0,$kindStruct,"regexp.inputBytes",true,"regexp",false,function(str_){this.$val=this;if(arguments.length===0){this.str=BZ.nil;return;}this.str=str_;});W=$pkg.inputReader=$newType(0,$kindStruct,"regexp.inputReader",true,"regexp",false,function(r_,atEOT_,pos_){this.$val=this;if(arguments.length===0){this.r=$ifaceNil;this.atEOT=false;this.pos=0;return;}this.r=r_;this.atEOT=atEOT_;this.pos=pos_;});AF=$pkg.onePassProg=$newType(0,$kindStruct,"regexp.onePassProg",true,"regexp",false,function(Inst_,Start_,NumCap_){this.$val=this;if(arguments.length===0){this.Inst=CO.nil;this.Start=0;this.NumCap=0;return;}this.Inst=Inst_;this.Start=Start_;this.NumCap=NumCap_;});AG=$pkg.onePassInst=$newType(0,$kindStruct,"regexp.onePassInst",true,"regexp",false,function(Inst_,Next_){this.$val=this;if(arguments.length===0){this.Inst=new C.Inst.ptr(0,0,0,BT.nil);this.Next=BU.nil;return;}this.Inst=Inst_;this.Next=Next_;});AK=$pkg.queueOnePass=$newType(0,$kindStruct,"regexp.queueOnePass",true,"regexp",false,function(sparse_,dense_,size_,nextIndex_){this.$val=this;if(arguments.length===0){this.sparse=BU.nil;this.dense=BU.nil;this.size=0;this.nextIndex=0;return;}this.sparse=sparse_;this.dense=dense_;this.size=size_;this.nextIndex=nextIndex_;});AR=$pkg.runeSlice=$newType(12,$kindSlice,"regexp.runeSlice",true,"regexp",false,null);AW=$pkg.queue=$newType(0,$kindStruct,"regexp.queue",true,"regexp",false,function(sparse_,dense_){this.$val=this;if(arguments.length===0){this.sparse=BU.nil;this.dense=CB.nil;return;}this.sparse=sparse_;this.dense=dense_;});AX=$pkg.entry=$newType(0,$kindStruct,"regexp.entry",true,"regexp",false,function(pc_,t_){this.$val=this;if(arguments.length===0){this.pc=0;this.t=CC.nil;return;}this.pc=pc_;this.t=t_;});AY=$pkg.thread=$newType(0,$kindStruct,"regexp.thread",true,"regexp",false,function(inst_,cap_){this.$val=this;if(arguments.length===0){this.inst=CT.nil;this.cap=CE.nil;return;}this.inst=inst_;this.cap=cap_;});AZ=$pkg.machine=$newType(0,$kindStruct,"regexp.machine",true,"regexp",false,function(re_,p_,q0_,q1_,pool_,matched_,matchcap_,inputs_){this.$val=this;if(arguments.length===0){this.re=BV.nil;this.p=BW.nil;this.q0=new AW.ptr(BU.nil,CB.nil);this.q1=new AW.ptr(BU.nil,CB.nil);this.pool=CD.nil;this.matched=false;this.mat
|
|||
|
$packages["github.com/zclconf/go-cty/cty/function/stdlib"]=(function(){var $pkg={},$init,P,N,R,U,E,G,C,I,D,H,M,S,K,L,V,A,J,F,T,B,Q,O,CM,EE,EF,EG,EH,EI,EJ,EK,EL,EM,EN,EO,EP,EQ,ER,ES,ET,EU,EV,EW,EX,EY,BZ,CA,CB,CC,CD,CE,CF,CG,CH,CI,AB,AS,AT,AY,AZ,BW,CJ,CK,CN,CO,CP,CQ,CR,CS,CT,CU,CW,CX,CY,DB,DD,DE,DF,DG,DY;P=$packages["bufio"];N=$packages["bytes"];R=$packages["encoding/csv"];U=$packages["errors"];E=$packages["fmt"];G=$packages["github.com/apparentlymart/go-textseg/v13/textseg"];C=$packages["github.com/zclconf/go-cty/cty"];I=$packages["github.com/zclconf/go-cty/cty/convert"];D=$packages["github.com/zclconf/go-cty/cty/function"];H=$packages["github.com/zclconf/go-cty/cty/gocty"];M=$packages["github.com/zclconf/go-cty/cty/json"];S=$packages["io"];K=$packages["math"];L=$packages["math/big"];V=$packages["reflect"];A=$packages["regexp"];J=$packages["regexp/syntax"];F=$packages["sort"];T=$packages["strconv"];B=$packages["strings"];Q=$packages["time"];O=$packages["unicode/utf8"];CM=$pkg.formatVerb=$newType(0,$kindStruct,"stdlib.formatVerb",true,"github.com/zclconf/go-cty/cty/function/stdlib",false,function(Raw_,Offset_,ArgNum_,Mode_,Zero_,Sharp_,Plus_,Minus_,Space_,HasPrec_,Prec_,HasWidth_,Width_){this.$val=this;if(arguments.length===0){this.Raw="";this.Offset=0;this.ArgNum=0;this.Mode=0;this.Zero=false;this.Sharp=false;this.Plus=false;this.Minus=false;this.Space=false;this.HasPrec=false;this.Prec=0;this.HasWidth=false;this.Width=0;return;}this.Raw=Raw_;this.Offset=Offset_;this.ArgNum=ArgNum_;this.Mode=Mode_;this.Zero=Zero_;this.Sharp=Sharp_;this.Plus=Plus_;this.Minus=Minus_;this.Space=Space_;this.HasPrec=HasPrec_;this.Prec=Prec_;this.HasWidth=HasWidth_;this.Width=Width_;});EE=$sliceType(D.Parameter);EF=$ptrType(D.Parameter);EG=$sliceType($Uint8);EH=$ptrType($Int);EI=$sliceType($emptyInterface);EJ=$sliceType($String);EK=$sliceType(C.Value);EL=$sliceType(C.Type);EM=$sliceType(C.ValueMarks);EN=$sliceType($Int);EO=$ptrType(L.Int);EP=$ptrType($Float64);EQ=$ptrType($String);ER=$sliceType(C.ElementIterator);ES=$sliceType($Bool);ET=$sliceType(EK);EU=$ptrType(EG);EV=$ptrType(J.Error);EW=$ptrType(Q.ParseError);EX=$ptrType(Q.Location);EY=$ptrType(R.ParseError);AB=function(a){var a,b,c,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=$clone($pkg.StrlenFunc,D.Function).Call(new EK([$clone(a,C.Value)]));$s=1;case 1:if($c){$c=false;b=b.$blk();}if(b&&b.$blk!==undefined){break s;}c=b;$s=2;case 2:return c;}return;}if($f===undefined){$f={$blk:AB};}$f.a=a;$f.b=b;$f.c=c;$f.$s=$s;$f.$r=$r;return $f;};$pkg.Strlen=AB;AS=function(a){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;d=$f.d;e=$f.e;f=$f.f;g=$f.g;h=$f.h;i=$f.i;j=$f.j;k=$f.k;l=$f.l;m=$f.m;n=$f.n;o=$f.o;p=$f.p;q=$f.q;r=$f.r;s=$f.s;t=$f.t;u=$f.u;v=$f.v;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=new C.Type.ptr($ifaceNil);c=$ifaceNil;d=EL.nil;e=a;f=0;case 1:if(!(f<e.$length)){$s=2;continue;}g=$clone(((f<0||f>=e.$length)?($throwRuntimeError("index out of range"),undefined):e.$array[e.$offset+f]),C.Value);h=$clone($clone(g,C.Value).Type(),C.Type).ElementType();$s=3;case 3:if($c){$c=false;h=h.$blk();}if(h&&h.$blk!==undefined){break s;}i=$clone(h,C.Type);if(!($clone(g,C.Value).IsKnown()&&($clone(g,C.Value).LengthInt()===0))){j=false;$s=6;continue s;}k=$clone(i,C.Type).Equals($clone(C.DynamicPseudoType,C.Type));$s=7;case 7:if($c){$c=false;k=k.$blk();}if(k&&k.$blk!==undefined){break s;}j=k;case 6:if(j){$s=4;continue;}$s=5;continue;case 4:f++;$s=1;continue;case 5:d=$append(d,i);f++;$s=1;continue;case 2:if(d.$length===0){l=$clone(C.Set($clone(C.DynamicPseudoType,C.Type)),C.Type);m=$ifaceNil;C.Type.copy(b,l);c=m;$s=-1;return[b,c];}o=I.UnifyUnsafe(d);$s=8;case 8:if($c){$c=false;o=o.$blk();}if(o&&o.$blk!==undefined){break s;}n=o;p=$clone(n[0],C.Type);if($equal(p,C.NilType,C.Type)){$s=9;continue;}$s=10;continue;case 9:q=$clone(C.NilType,C.Type);s=E.Errorf("given sets must all have comp
|
|||
|
$packages["path/filepath"]=(function(){var $pkg={},$init,A,B,C,D,G,F,E,H;A=$packages["errors"];B=$packages["io/fs"];C=$packages["os"];D=$packages["runtime"];G=$packages["sort"];F=$packages["strings"];E=$packages["syscall"];H=$packages["unicode/utf8"];$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=A.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=B.$init();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=C.$init();$s=3;case 3:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=D.$init();$s=4;case 4:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=G.$init();$s=5;case 5:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=F.$init();$s=6;case 6:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=E.$init();$s=7;case 7:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=H.$init();$s=8;case 8:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$pkg.ErrBadPattern=A.New("syntax error in pattern");}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$packages["github.com/hashicorp/hcl/v2/hclsyntax"]=(function(){var $pkg={},$init,C,D,Q,E,A,P,I,L,M,N,G,H,B,F,O,J,K,W,X,Z,AA,AB,AD,AE,AJ,AL,AM,AN,AO,BW,BX,CA,CC,CD,CE,CF,CG,CH,CI,CJ,CK,CL,CM,CQ,CR,CS,CT,DB,DC,DD,DE,DH,DI,DJ,DL,DM,DN,DO,DP,DQ,DR,DS,DT,DU,DV,DW,DX,DY,EB,EC,ED,EE,EF,EG,EH,EI,EJ,EK,EL,EM,EN,EO,EP,EQ,ER,ES,ET,EU,EV,EW,EX,EY,EZ,FA,FB,FC,FD,FE,FF,FG,FH,FI,FJ,FK,FL,FM,FN,FO,FP,FQ,FR,FS,FT,FU,FV,FW,FX,FY,FZ,GA,GB,GC,GD,GE,GF,GG,GH,GI,GJ,GK,GL,GM,GN,GO,GP,GS,GT,GU,GV,GW,GX,GY,GZ,HA,HB,HC,HD,HE,HF,Y,AH,AP,AQ,AR,AS,AT,AU,AV,AW,AX,AY,AZ,BA,BC,BD,BE,BF,BG,BH,BI,BJ,BK,BL,BV,CU,CV,CW,CX,CY,CZ,DF,U,V,AF,AG,AI,BB,BM,BN,BR,BY,BZ,CB,CN,CO,CP,DG,DZ,EA;C=$packages["bytes"];D=$packages["fmt"];Q=$packages["github.com/agext/levenshtein"];E=$packages["github.com/apparentlymart/go-textseg/v13/textseg"];A=$packages["github.com/hashicorp/hcl/v2"];P=$packages["github.com/hashicorp/hcl/v2/ext/customdecode"];I=$packages["github.com/zclconf/go-cty/cty"];L=$packages["github.com/zclconf/go-cty/cty/convert"];M=$packages["github.com/zclconf/go-cty/cty/function"];N=$packages["github.com/zclconf/go-cty/cty/function/stdlib"];G=$packages["path/filepath"];H=$packages["runtime"];B=$packages["strconv"];F=$packages["strings"];O=$packages["sync"];J=$packages["unicode"];K=$packages["unicode/utf8"];W=$pkg.variablesWalker=$newType(0,$kindStruct,"hclsyntax.variablesWalker",true,"github.com/hashicorp/hcl/v2/hclsyntax",false,function(Callback_,localScopes_){this.$val=this;if(arguments.length===0){this.Callback=$throwNilPointerError;this.localScopes=EN.nil;return;}this.Callback=Callback_;this.localScopes=localScopes_;});X=$pkg.ChildScope=$newType(0,$kindStruct,"hclsyntax.ChildScope",true,"github.com/hashicorp/hcl/v2/hclsyntax",true,function(LocalNames_,Expr_){this.$val=this;if(arguments.length===0){this.LocalNames=false;this.Expr=$ifaceNil;return;}this.LocalNames=LocalNames_;this.Expr=Expr_;});Z=$pkg.Token=$newType(0,$kindStruct,"hclsyntax.Token",true,"github.com/hashicorp/hcl/v2/hclsyntax",true,function(Type_,Bytes_,Range_){this.$val=this;if(arguments.length===0){this.Type=0;this.Bytes=EE.nil;this.Range=new A.Range.ptr("",new A.Pos.ptr(0,0,0),new A.Pos.ptr(0,0,0));return;}this.Type=Type_;this.Bytes=Bytes_;this.Range=Range_;});AA=$pkg.Tokens=$newType(12,$kindSlice,"hclsyntax.Tokens",true,"github.com/hashicorp/hcl/v2/hclsyntax",true,null);AB=$pkg.TokenType=$newType(4,$kindInt32,"hclsyntax.TokenType",true,"github.com/hashicorp/hcl/v2/hclsyntax",true,null);AD=$pkg.tokenAccum=$newType(0,$kindStruct,"hclsyntax.tokenAccum",true,"github.com/hashicorp/hcl/v2/hclsyntax",false,function(Filename_,Bytes_,Pos_,Tokens_,StartByte_){this.$val=this;if(arguments.length===0){this.Filename="";this.Bytes=EE.nil;this.Pos=new A.Pos.ptr(0,0,0);this.Tokens=FA.nil;this.StartByte=0;return;}this.Filename=Filename_;this.Bytes=Bytes_;this.Pos=Pos_;this.Tokens=Tokens_;this.StartByte=StartByte_;});AE=$pkg.heredocInProgress=$newType(0,$kindStruct,"hclsyntax.heredocInProgress",true,"github.com/hashicorp/hcl/v2/hclsyntax",false,function(Marker_,StartOfLine_){this.$val=this;if(arguments.length===0){this.Marker=EE.nil;this.StartOfLine=false;return;}this.Marker=Marker_;this.StartOfLine=StartOfLine_;});AJ=$pkg.Body=$newType(0,$kindStruct,"hclsyntax.Body",true,"github.com/hashicorp/hcl/v2/hclsyntax",true,function(Attributes_,Blocks_,hiddenAttrs_,hiddenBlocks_,SrcRange_,EndRange_){this.$val=this;if(arguments.length===0){this.Attributes=false;this.Blocks=AN.nil;this.hiddenAttrs=false;this.hiddenBlocks=false;this.SrcRange=new A.Range.ptr("",new A.Pos.ptr(0,0,0),new A.Pos.ptr(0,0,0));this.EndRange=new A.Range.ptr("",new A.Pos.ptr(0,0,0),new A.Pos.ptr(0,0,0));return;}this.Attributes=Attributes_;this.Blocks=Blocks_;this.hiddenAttrs=hiddenAttrs_;this.hiddenBlocks=hiddenBlocks_;this.SrcRange=SrcRange_;this.EndRange=EndRange_;});AL=$pkg.Attributes=$newType(4,$kindMap,"hclsyntax.Attributes",true,"github.com/hashicorp/hcl/v2/hclsyntax",true,null);AM=$pkg.Attribute=$newType(0,$kindStruct,"hclsyntax.Attribute",true,"github.com/hashicorp/hcl/v2/hclsyntax",true,function(Name_,Expr_,SrcRange_,NameRange_,EqualsR
|
|||
|
$packages["github.com/snyk/snyk-iac-parsers/terraform"]=(function(){var $pkg={},$init,G,E,C,J,D,H,K,L,I,A,F,B,M,O,AC,AH,AI,AJ,AO,AP,AX,BD,BE,BF,BG,BH,BI,BJ,BK,BL,BM,BN,BO,BP,BQ,BR,BS,BT,BU,BV,BW,BX,BY,BZ,CA,CB,CC,CD,CE,CF,W,AF,AG,AU,AV,AW,Q,R,S,T,U,V,X,Y,Z,AA,AB,AD,AE,AL,AM,AN,AQ,AR,AS,AT,AY,AZ,BA,BB,BC;G=$packages["encoding/json"];E=$packages["fmt"];C=$packages["github.com/hashicorp/hcl/v2"];J=$packages["github.com/hashicorp/hcl/v2/hclsyntax"];D=$packages["github.com/zclconf/go-cty/cty"];H=$packages["github.com/zclconf/go-cty/cty/convert"];K=$packages["github.com/zclconf/go-cty/cty/function"];L=$packages["github.com/zclconf/go-cty/cty/function/stdlib"];I=$packages["github.com/zclconf/go-cty/cty/json"];A=$packages["reflect"];F=$packages["sort"];B=$packages["strings"];M=$pkg.ValueMap=$newType(4,$kindMap,"terraform.ValueMap",true,"github.com/snyk/snyk-iac-parsers/terraform",true,null);O=$pkg.ModuleVariables=$newType(0,$kindStruct,"terraform.ModuleVariables",true,"github.com/snyk/snyk-iac-parsers/terraform",true,function(inputs_,locals_){this.$val=this;if(arguments.length===0){this.inputs=false;this.locals=false;return;}this.inputs=inputs_;this.locals=locals_;});AC=$pkg.PrioritisableFile=$newType(0,$kindStruct,"terraform.PrioritisableFile",true,"github.com/snyk/snyk-iac-parsers/terraform",true,function(fileName_,priority_){this.$val=this;if(arguments.length===0){this.fileName="";this.priority=0;return;}this.fileName=fileName_;this.priority=priority_;});AH=$pkg.Options=$newType(0,$kindStruct,"terraform.Options",true,"github.com/snyk/snyk-iac-parsers/terraform",true,function(Simplify_){this.$val=this;if(arguments.length===0){this.Simplify=false;return;}this.Simplify=Simplify_;});AI=$pkg.Parser=$newType(0,$kindStruct,"terraform.Parser",true,"github.com/snyk/snyk-iac-parsers/terraform",true,function(bytes_,variables_,options_){this.$val=this;if(arguments.length===0){this.bytes=BM.nil;this.variables=false;this.options=new AH.ptr(false);return;}this.bytes=bytes_;this.variables=variables_;this.options=options_;});AJ=$pkg.NewParserParams=$newType(0,$kindStruct,"terraform.NewParserParams",true,"github.com/snyk/snyk-iac-parsers/terraform",true,function(bytes_,variables_,options_){this.$val=this;if(arguments.length===0){this.bytes=BM.nil;this.variables=new O.ptr(false,false);this.options=new AH.ptr(false);return;}this.bytes=bytes_;this.variables=variables_;this.options=options_;});AO=$pkg.File=$newType(0,$kindStruct,"terraform.File",true,"github.com/snyk/snyk-iac-parsers/terraform",true,function(fileName_,fileContent_,hclFile_){this.$val=this;if(arguments.length===0){this.fileName="";this.fileContent="";this.hclFile=CC.nil;return;}this.fileName=fileName_;this.fileContent=fileContent_;this.hclFile=hclFile_;});AP=$pkg.ParseModuleResult=$newType(0,$kindStruct,"terraform.ParseModuleResult",true,"github.com/snyk/snyk-iac-parsers/terraform",true,function(parsedFiles_,failedFiles_,debugLogs_){this.$val=this;if(arguments.length===0){this.parsedFiles=false;this.failedFiles=false;this.debugLogs=false;return;}this.parsedFiles=parsedFiles_;this.failedFiles=failedFiles_;this.debugLogs=debugLogs_;});AX=$pkg.CustomError=$newType(0,$kindStruct,"terraform.CustomError",true,"github.com/snyk/snyk-iac-parsers/terraform",true,function(message_,errors_,userError_){this.$val=this;if(arguments.length===0){this.message="";this.errors=BN.nil;this.userError=false;return;}this.message=message_;this.errors=errors_;this.userError=userError_;});BD=$sliceType(C.AttributeSchema);BE=$sliceType(C.BlockHeaderSchema);BF=$sliceType($String);BG=$ptrType(C.Diagnostic);BH=$sliceType(BG);BI=$ptrType(C.Attribute);BJ=$ptrType(C.EvalContext);BK=$sliceType($emptyInterface);BL=$sliceType(AC);BM=$sliceType($Uint8);BN=$sliceType($error);BO=$mapType($String,$emptyInterface);BP=$ptrType(J.Body);BQ=$ptrType(J.LiteralValueExpr);BR=$ptrType(J.UnaryOpExpr);BS=$ptrType(J.TemplateExpr);BT=$ptrType(J.TemplateWrapExpr);BU=$ptrType(J.TupleConsExpr);BV=$ptrType(J.ObjectConsExpr);BW=$ptrType(B.Builder);BX=$ptrType(J.ConditionalExpr);BY=$ptrType(J.TemplateJoinExpr);BZ=$ptrType(J.ForExpr);CA=$ptr
|
|||
|
$packages["main"]=(function(){var $pkg={},$init,A,B,E,F,C,D;A=$packages["github.com/gopherjs/gopherjs/js"];B=$packages["github.com/snyk/snyk-iac-parsers/terraform"];E=$mapType($String,$emptyInterface);F=$funcType([E],[E],false);C=function(){$module.exports.parseModule=$externalize(D,F);};D=function(a){var a,b,c,$s,$r;$s=0;var $f,$c=false;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;a=$f.a;b=$f.b;c=$f.c;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:b=B.ParseModule(a);$s=1;case 1:if($c){$c=false;b=b.$blk();}if(b&&b.$blk!==undefined){break s;}c=b;$s=2;case 2:return c;}return;}if($f===undefined){$f={$blk:D};}$f.a=a;$f.b=b;$f.c=c;$f.$s=$s;$f.$r=$r;return $f;};$init=function(){$pkg.$init=function(){};var $f,$c=false,$s=0,$r;if(this!==undefined&&this.$blk!==undefined){$f=this;$c=true;$s=$f.$s;$r=$f.$r;}s:while(true){switch($s){case 0:$r=A.$init();$s=1;case 1:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}$r=B.$init();$s=2;case 2:if($c){$c=false;$r=$r.$blk();}if($r&&$r.$blk!==undefined){break s;}if($pkg===$mainPkg){C();$mainFinished=true;}}return;}if($f===undefined){$f={$blk:$init};}$f.$s=$s;$f.$r=$r;return $f;};$pkg.$init=$init;return $pkg;})();
|
|||
|
$synthesizeMethods();
|
|||
|
$initAllLinknames();
|
|||
|
var $mainPkg = $packages["main"];
|
|||
|
$packages["runtime"].$init();
|
|||
|
$go($mainPkg.$init, []);
|
|||
|
$flushConsole();
|
|||
|
|
|||
|
}).call(this);
|
|||
|
//# sourceMappingURL=hcltojson-v2.js.map
|
|||
|
|
|||
|
|
|||
|
/***/ }),
|
|||
|
|
|||
|
/***/ 43810:
|
|||
|
/***/ ((module) => {
|
|||
|
|
|||
|
function webpackEmptyContext(req) {
|
|||
|
var e = new Error("Cannot find module '" + req + "'");
|
|||
|
e.code = 'MODULE_NOT_FOUND';
|
|||
|
throw e;
|
|||
|
}
|
|||
|
webpackEmptyContext.keys = () => ([]);
|
|||
|
webpackEmptyContext.resolve = webpackEmptyContext;
|
|||
|
webpackEmptyContext.id = 43810;
|
|||
|
module.exports = webpackEmptyContext;
|
|||
|
|
|||
|
/***/ })
|
|||
|
|
|||
|
};
|
|||
|
;
|
|||
|
//# sourceMappingURL=917.index.js.map
|