/*
 * Copyright (c) 2018, 2026, Oracle and/or its affiliates.
 * Licensed under The Universal Permissive License (UPL), Version 1.0
 * as shown at https://oss.oracle.com/licenses/upl/
 */
var verList;var verData;function init(){if(!verData){try{verList=require("../meta/metaverlist.json");let o=verList.metaList,o2={},v,s;for(s in o){v=o[s];o2[v.version]={date:v.date,time:v.time}}verData={metaList:o2}}catch(e){}}return!!verData};function validate(v){var a;var i;if(v===null){return _getMVError(v,1)}if(typeof v!=="string"){return _getMVError(v,2)}a=v.split(".");for(i=0;i<a.length;i++){if(a[i]===""||parseInt(a[i])===NaN){return _getMVError(v,3)}}return null};function getBestVersion(v,a){return _findVer(v,a)}function _findVer(v,a){var keys=Object.keys(verData.metaList);var suspects=[];var s,i,ret;if(!Array.isArray(a)){a=v.split(".")}if(a.length===3&&a[2]==="0"){a.length=2}if(a.length===2){s=a[0]+"."+a[1]+".";for(i=0;i<keys.length;i++){if(keys[i].startsWith(s)){suspects.push(keys[i])}}}else if(a.length===1){s=a[0]+".";for(i=0;i<keys.length;i++){if(keys[i].startsWith(s)){suspects.push(keys[i])}}}if(suspects.length===1){return suspects[0]}if(!suspects.length){return null}ret="0.0.0";for(i=0;i<suspects.length;i++){if(suspects[i]>ret){ret=suspects[i]}}return ret};function getVersions(){return verData.metaList};function _getMVError(v,errno){var s;switch(errno){case 1:s="missing version arg after --jetver";break;case 2:s="--jetver '"+v+"' : invalid - expected major.minor.patch";break;case 3:s="--jetver '"+v+"' : invalid version specification";break;default:s="unknown error"}return s};module.exports.init=init;module.exports.validate=validate;module.exports.getVersions=getVersions;module.exports.getBestVersion=getBestVersion;