@adobe/aio-commerce-lib-auth 0.6.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/chunk-YD6SZpHm.cjs +1 -0
- package/dist/cjs/commands/index.cjs +95 -0
- package/dist/cjs/commands/index.d.cts +1 -0
- package/dist/cjs/index.cjs +1 -14
- package/dist/cjs/index.d.cts +145 -51
- package/dist/es/commands/index.d.mts +1 -0
- package/dist/es/commands/index.mjs +95 -0
- package/dist/es/{index.d.ts → index.d.mts} +146 -51
- package/dist/es/index.mjs +1 -0
- package/package.json +17 -6
- package/dist/es/index.js +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @adobe/aio-commerce-lib-auth
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#217](https://github.com/adobe/aio-commerce-sdk/pull/217) [`6063a97`](https://github.com/adobe/aio-commerce-sdk/commit/6063a97299c9b44f663314420b59cee7998b2f89) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - Introduced CLI utility `sync-ims-credentials` to sync the workspace credentials of `.aio` into the `.env` file environment variables expected by the library
|
|
8
|
+
|
|
9
|
+
## 0.7.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#224](https://github.com/adobe/aio-commerce-sdk/pull/224) [`ac46985`](https://github.com/adobe/aio-commerce-sdk/commit/ac46985186961c65eddc6be3200dbe1e00369055) Thanks [@iivvaannxx](https://github.com/iivvaannxx)! - Implement token forwarding utilities
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`f2b6f34`](https://github.com/adobe/aio-commerce-sdk/commit/f2b6f34709a5adcca93b852b5855cb6b1c852312), [`f2b6f34`](https://github.com/adobe/aio-commerce-sdk/commit/f2b6f34709a5adcca93b852b5855cb6b1c852312)]:
|
|
18
|
+
- @adobe/aio-commerce-lib-core@0.6.0
|
|
19
|
+
|
|
3
20
|
## 0.6.2
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__commonJSMin=(cb,mod)=>()=>(mod||cb((mod={exports:{}}).exports,mod),mod.exports),__copyProps=(to,from,except,desc)=>{if(from&&typeof from==`object`||typeof from==`function`)for(var keys=__getOwnPropNames(from),i=0,n=keys.length,key;i<n;i++)key=keys[i],!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:(k=>from[k]).bind(null,key),enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toESM=(mod,isNodeMode,target)=>(target=mod==null?{}:__create(__getProtoOf(mod)),__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,`default`,{value:mod,enumerable:!0}):target,mod));Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return __toESM}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return __commonJSMin}});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const require_chunk=require(`../chunk-YD6SZpHm.cjs`);let _adobe_aio_commerce_lib_core_error=require(`@adobe/aio-commerce-lib-core/error`),_adobe_aio_lib_ims=require(`@adobe/aio-lib-ims`);_adobe_aio_lib_ims=require_chunk.n(_adobe_aio_lib_ims);let consola=require(`consola`);consola=require_chunk.n(consola);let fs=require(`fs`),path=require(`path`);path=require_chunk.n(path);function stringifyError(error){return error instanceof _adobe_aio_commerce_lib_core_error.CommerceSdkValidationError?error.display():error instanceof Error?error.message:String(error)}var require_ms=require_chunk.t(((exports,module)=>{var s=1e3,m=s*60,h=m*60,d=h*24,w=d*7,y=d*365.25;module.exports=function(val,options){options||={};var type=typeof val;if(type===`string`&&val.length>0)return parse(val);if(type===`number`&&isFinite(val))return options.long?fmtLong(val):fmtShort(val);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(val))};function parse(str){if(str=String(str),!(str.length>100)){var match=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);if(match){var n=parseFloat(match[1]);switch((match[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return n*y;case`weeks`:case`week`:case`w`:return n*w;case`days`:case`day`:case`d`:return n*d;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return n*h;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return n*m;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return n*s;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return n;default:return}}}}function fmtShort(ms){var msAbs=Math.abs(ms);return msAbs>=d?Math.round(ms/d)+`d`:msAbs>=h?Math.round(ms/h)+`h`:msAbs>=m?Math.round(ms/m)+`m`:msAbs>=s?Math.round(ms/s)+`s`:ms+`ms`}function fmtLong(ms){var msAbs=Math.abs(ms);return msAbs>=d?plural(ms,msAbs,d,`day`):msAbs>=h?plural(ms,msAbs,h,`hour`):msAbs>=m?plural(ms,msAbs,m,`minute`):msAbs>=s?plural(ms,msAbs,s,`second`):ms+` ms`}function plural(ms,msAbs,n,name){var isPlural=msAbs>=n*1.5;return Math.round(ms/n)+` `+name+(isPlural?`s`:``)}})),require_common$1=require_chunk.t(((exports,module)=>{function setup(env){createDebug.debug=createDebug,createDebug.default=createDebug,createDebug.coerce=coerce,createDebug.disable=disable,createDebug.enable=enable,createDebug.enabled=enabled,createDebug.humanize=require_ms(),createDebug.destroy=destroy,Object.keys(env).forEach(key=>{createDebug[key]=env[key]}),createDebug.names=[],createDebug.skips=[],createDebug.formatters={};function selectColor(namespace){let hash=0;for(let i=0;i<namespace.length;i++)hash=(hash<<5)-hash+namespace.charCodeAt(i),hash|=0;return createDebug.colors[Math.abs(hash)%createDebug.colors.length]}createDebug.selectColor=selectColor;function createDebug(namespace){let prevTime,enableOverride=null,namespacesCache,enabledCache;function debug(...args){if(!debug.enabled)return;let self=debug,curr=Number(new Date);self.diff=curr-(prevTime||curr),self.prev=prevTime,self.curr=curr,prevTime=curr,args[0]=createDebug.coerce(args[0]),typeof args[0]!=`string`&&args.unshift(`%O`);let index=0;args[0]=args[0].replace(/%([a-zA-Z%])/g,(match,format)=>{if(match===`%%`)return`%`;index++;let formatter=createDebug.formatters[format];if(typeof formatter==`function`){let val=args[index];match=formatter.call(self,val),args.splice(index,1),index--}return match}),createDebug.formatArgs.call(self,args),(self.log||createDebug.log).apply(self,args)}return debug.namespace=namespace,debug.useColors=createDebug.useColors(),debug.color=createDebug.selectColor(namespace),debug.extend=extend,debug.destroy=createDebug.destroy,Object.defineProperty(debug,`enabled`,{enumerable:!0,configurable:!1,get:()=>enableOverride===null?(namespacesCache!==createDebug.namespaces&&(namespacesCache=createDebug.namespaces,enabledCache=createDebug.enabled(namespace)),enabledCache):enableOverride,set:v=>{enableOverride=v}}),typeof createDebug.init==`function`&&createDebug.init(debug),debug}function extend(namespace,delimiter){let newDebug=createDebug(this.namespace+(delimiter===void 0?`:`:delimiter)+namespace);return newDebug.log=this.log,newDebug}function enable(namespaces){createDebug.save(namespaces),createDebug.namespaces=namespaces,createDebug.names=[],createDebug.skips=[];let split=(typeof namespaces==`string`?namespaces:``).trim().replace(/\s+/g,`,`).split(`,`).filter(Boolean);for(let ns of split)ns[0]===`-`?createDebug.skips.push(ns.slice(1)):createDebug.names.push(ns)}function matchesTemplate(search,template){let searchIndex=0,templateIndex=0,starIndex=-1,matchIndex=0;for(;searchIndex<search.length;)if(templateIndex<template.length&&(template[templateIndex]===search[searchIndex]||template[templateIndex]===`*`))template[templateIndex]===`*`?(starIndex=templateIndex,matchIndex=searchIndex,templateIndex++):(searchIndex++,templateIndex++);else if(starIndex!==-1)templateIndex=starIndex+1,matchIndex++,searchIndex=matchIndex;else return!1;for(;templateIndex<template.length&&template[templateIndex]===`*`;)templateIndex++;return templateIndex===template.length}function disable(){let namespaces=[...createDebug.names,...createDebug.skips.map(namespace=>`-`+namespace)].join(`,`);return createDebug.enable(``),namespaces}function enabled(name){for(let skip of createDebug.skips)if(matchesTemplate(name,skip))return!1;for(let ns of createDebug.names)if(matchesTemplate(name,ns))return!0;return!1}function coerce(val){return val instanceof Error?val.stack||val.message:val}function destroy(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return createDebug.enable(createDebug.load()),createDebug}module.exports=setup})),require_browser=require_chunk.t(((exports,module)=>{exports.formatArgs=formatArgs,exports.save=save,exports.load=load,exports.useColors=useColors,exports.storage=localstorage(),exports.destroy=(()=>{let warned=!1;return()=>{warned||(warned=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),exports.colors=`#0000CC.#0000FF.#0033CC.#0033FF.#0066CC.#0066FF.#0099CC.#0099FF.#00CC00.#00CC33.#00CC66.#00CC99.#00CCCC.#00CCFF.#3300CC.#3300FF.#3333CC.#3333FF.#3366CC.#3366FF.#3399CC.#3399FF.#33CC00.#33CC33.#33CC66.#33CC99.#33CCCC.#33CCFF.#6600CC.#6600FF.#6633CC.#6633FF.#66CC00.#66CC33.#9900CC.#9900FF.#9933CC.#9933FF.#99CC00.#99CC33.#CC0000.#CC0033.#CC0066.#CC0099.#CC00CC.#CC00FF.#CC3300.#CC3333.#CC3366.#CC3399.#CC33CC.#CC33FF.#CC6600.#CC6633.#CC9900.#CC9933.#CCCC00.#CCCC33.#FF0000.#FF0033.#FF0066.#FF0099.#FF00CC.#FF00FF.#FF3300.#FF3333.#FF3366.#FF3399.#FF33CC.#FF33FF.#FF6600.#FF6633.#FF9900.#FF9933.#FFCC00.#FFCC33`.split(`.`);function useColors(){if(typeof window<`u`&&window.process&&(window.process.type===`renderer`||window.process.__nwjs))return!0;if(typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let m;return typeof document<`u`&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<`u`&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<`u`&&navigator.userAgent&&(m=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(m[1],10)>=31||typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function formatArgs(args){if(args[0]=(this.useColors?`%c`:``)+this.namespace+(this.useColors?` %c`:` `)+args[0]+(this.useColors?`%c `:` `)+`+`+module.exports.humanize(this.diff),!this.useColors)return;let c=`color: `+this.color;args.splice(1,0,c,`color: inherit`);let index=0,lastC=0;args[0].replace(/%[a-zA-Z%]/g,match=>{match!==`%%`&&(index++,match===`%c`&&(lastC=index))}),args.splice(lastC,0,c)}exports.log=console.debug||console.log||(()=>{});function save(namespaces){try{namespaces?exports.storage.setItem(`debug`,namespaces):exports.storage.removeItem(`debug`)}catch{}}function load(){let r;try{r=exports.storage.getItem(`debug`)||exports.storage.getItem(`DEBUG`)}catch{}return!r&&typeof process<`u`&&`env`in process&&(r=process.env.DEBUG),r}function localstorage(){try{return localStorage}catch{}}module.exports=require_common$1()(exports);let{formatters}=module.exports;formatters.j=function(v){try{return JSON.stringify(v)}catch(error){return`[UnexpectedJSONParseError]: `+error.message}}})),require_has_flag=require_chunk.t(((exports,module)=>{module.exports=(flag,argv=process.argv)=>{let prefix=flag.startsWith(`-`)?``:flag.length===1?`-`:`--`,position=argv.indexOf(prefix+flag),terminatorPosition=argv.indexOf(`--`);return position!==-1&&(terminatorPosition===-1||position<terminatorPosition)}})),require_supports_color=require_chunk.t(((exports,module)=>{let os$4=require(`os`),tty$1=require(`tty`),hasFlag=require_has_flag(),{env}=process,forceColor;hasFlag(`no-color`)||hasFlag(`no-colors`)||hasFlag(`color=false`)||hasFlag(`color=never`)?forceColor=0:(hasFlag(`color`)||hasFlag(`colors`)||hasFlag(`color=true`)||hasFlag(`color=always`))&&(forceColor=1),`FORCE_COLOR`in env&&(forceColor=env.FORCE_COLOR===`true`?1:env.FORCE_COLOR===`false`?0:env.FORCE_COLOR.length===0?1:Math.min(parseInt(env.FORCE_COLOR,10),3));function translateLevel(level){return level===0?!1:{level,hasBasic:!0,has256:level>=2,has16m:level>=3}}function supportsColor(haveStream,streamIsTTY){if(forceColor===0)return 0;if(hasFlag(`color=16m`)||hasFlag(`color=full`)||hasFlag(`color=truecolor`))return 3;if(hasFlag(`color=256`))return 2;if(haveStream&&!streamIsTTY&&forceColor===void 0)return 0;let min=forceColor||0;if(env.TERM===`dumb`)return min;if(process.platform===`win32`){let osRelease=os$4.release().split(`.`);return Number(osRelease[0])>=10&&Number(osRelease[2])>=10586?Number(osRelease[2])>=14931?3:2:1}if(`CI`in env)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`].some(sign=>sign in env)||env.CI_NAME===`codeship`?1:min;if(`TEAMCITY_VERSION`in env)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION)?1:0;if(env.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in env){let version=parseInt((env.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(env.TERM_PROGRAM){case`iTerm.app`:return version>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(env.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)||`COLORTERM`in env?1:min}function getSupportLevel(stream){return translateLevel(supportsColor(stream,stream&&stream.isTTY))}module.exports={supportsColor:getSupportLevel,stdout:translateLevel(supportsColor(!0,tty$1.isatty(1))),stderr:translateLevel(supportsColor(!0,tty$1.isatty(2)))}})),require_node=require_chunk.t(((exports,module)=>{let tty=require(`tty`),util=require(`util`);exports.init=init,exports.log=log,exports.formatArgs=formatArgs,exports.save=save,exports.load=load,exports.useColors=useColors,exports.destroy=util.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),exports.colors=[6,2,3,4,5,1];try{let supportsColor=require_supports_color();supportsColor&&(supportsColor.stderr||supportsColor).level>=2&&(exports.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}exports.inspectOpts=Object.keys(process.env).filter(key=>/^debug_/i.test(key)).reduce((obj,key)=>{let prop=key.substring(6).toLowerCase().replace(/_([a-z])/g,(_,k)=>k.toUpperCase()),val=process.env[key];return val=/^(yes|on|true|enabled)$/i.test(val)?!0:/^(no|off|false|disabled)$/i.test(val)?!1:val===`null`?null:Number(val),obj[prop]=val,obj},{});function useColors(){return`colors`in exports.inspectOpts?!!exports.inspectOpts.colors:tty.isatty(process.stderr.fd)}function formatArgs(args){let{namespace:name,useColors}=this;if(useColors){let c=this.color,colorCode=`\x1B[3`+(c<8?c:`8;5;`+c),prefix=` ${colorCode};1m${name} \u001B[0m`;args[0]=prefix+args[0].split(`
|
|
3
|
+
`).join(`
|
|
4
|
+
`+prefix),args.push(colorCode+`m+`+module.exports.humanize(this.diff)+`\x1B[0m`)}else args[0]=getDate()+name+` `+args[0]}function getDate(){return exports.inspectOpts.hideDate?``:new Date().toISOString()+` `}function log(...args){return process.stderr.write(util.formatWithOptions(exports.inspectOpts,...args)+`
|
|
5
|
+
`)}function save(namespaces){namespaces?process.env.DEBUG=namespaces:delete process.env.DEBUG}function load(){return process.env.DEBUG}function init(debug){debug.inspectOpts={};let keys=Object.keys(exports.inspectOpts);for(let i=0;i<keys.length;i++)debug.inspectOpts[keys[i]]=exports.inspectOpts[keys[i]]}module.exports=require_common$1()(exports);let{formatters}=module.exports;formatters.o=function(v){return this.inspectOpts.colors=this.useColors,util.inspect(v,this.inspectOpts).split(`
|
|
6
|
+
`).map(str=>str.trim()).join(` `)},formatters.O=function(v){return this.inspectOpts.colors=this.useColors,util.inspect(v,this.inspectOpts)}})),require_src$1=require_chunk.t(((exports,module)=>{typeof process>`u`||process.type===`renderer`||process.browser===!0||process.__nwjs?module.exports=require_browser():module.exports=require_node()})),require_package$1=require_chunk.t(((exports,module)=>{module.exports={name:`dotenv`,version:`16.3.1`,description:`Loads environment variables from .env file`,main:`lib/main.js`,types:`lib/main.d.ts`,exports:{".":{types:`./lib/main.d.ts`,require:`./lib/main.js`,default:`./lib/main.js`},"./config":`./config.js`,"./config.js":`./config.js`,"./lib/env-options":`./lib/env-options.js`,"./lib/env-options.js":`./lib/env-options.js`,"./lib/cli-options":`./lib/cli-options.js`,"./lib/cli-options.js":`./lib/cli-options.js`,"./package.json":`./package.json`},scripts:{"dts-check":`tsc --project tests/types/tsconfig.json`,lint:`standard`,"lint-readme":`standard-markdown`,pretest:`npm run lint && npm run dts-check`,test:`tap tests/*.js --100 -Rspec`,prerelease:`npm test`,release:`standard-version`},repository:{type:`git`,url:`git://github.com/motdotla/dotenv.git`},funding:`https://github.com/motdotla/dotenv?sponsor=1`,keywords:[`dotenv`,`env`,`.env`,`environment`,`variables`,`config`,`settings`],readmeFilename:`README.md`,license:`BSD-2-Clause`,devDependencies:{"@definitelytyped/dtslint":`^0.0.133`,"@types/node":`^18.11.3`,decache:`^4.6.1`,sinon:`^14.0.1`,standard:`^17.0.0`,"standard-markdown":`^7.1.0`,"standard-version":`^9.5.0`,tap:`^16.3.0`,tar:`^6.1.11`,typescript:`^4.8.4`},engines:{node:`>=12`},browser:{fs:!1}}})),require_main$1=require_chunk.t(((exports,module)=>{let fs$4=require(`fs`),path$6=require(`path`),os$3=require(`os`),crypto$1=require(`crypto`),version=require_package$1().version,LINE=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;function parse(src){let obj={},lines=src.toString();lines=lines.replace(/\r\n?/gm,`
|
|
7
|
+
`);let match;for(;(match=LINE.exec(lines))!=null;){let key=match[1],value=match[2]||``;value=value.trim();let maybeQuote=value[0];value=value.replace(/^(['"`])([\s\S]*)\1$/gm,`$2`),maybeQuote===`"`&&(value=value.replace(/\\n/g,`
|
|
8
|
+
`),value=value.replace(/\\r/g,`\r`)),obj[key]=value}return obj}function _parseVault(options){let vaultPath=_vaultPath(options),result=DotenvModule.configDotenv({path:vaultPath});if(!result.parsed)throw Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);let keys=_dotenvKey(options).split(`,`),length=keys.length,decrypted;for(let i=0;i<length;i++)try{let attrs=_instructions(result,keys[i].trim());decrypted=DotenvModule.decrypt(attrs.ciphertext,attrs.key);break}catch(error){if(i+1>=length)throw error}return DotenvModule.parse(decrypted)}function _log(message){console.log(`[dotenv@${version}][INFO] ${message}`)}function _warn(message){console.log(`[dotenv@${version}][WARN] ${message}`)}function _debug(message){console.log(`[dotenv@${version}][DEBUG] ${message}`)}function _dotenvKey(options){return options&&options.DOTENV_KEY&&options.DOTENV_KEY.length>0?options.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:``}function _instructions(result,dotenvKey){let uri;try{uri=new URL(dotenvKey)}catch(error){throw error.code===`ERR_INVALID_URL`?Error(`INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=development`):error}let key=uri.password;if(!key)throw Error(`INVALID_DOTENV_KEY: Missing key part`);let environment=uri.searchParams.get(`environment`);if(!environment)throw Error(`INVALID_DOTENV_KEY: Missing environment part`);let environmentKey=`DOTENV_VAULT_${environment.toUpperCase()}`,ciphertext=result.parsed[environmentKey];if(!ciphertext)throw Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);return{ciphertext,key}}function _vaultPath(options){let dotenvPath=path$6.resolve(process.cwd(),`.env`);return options&&options.path&&options.path.length>0&&(dotenvPath=options.path),dotenvPath.endsWith(`.vault`)?dotenvPath:`${dotenvPath}.vault`}function _resolveHome(envPath){return envPath[0]===`~`?path$6.join(os$3.homedir(),envPath.slice(1)):envPath}function _configVault(options){_log(`Loading env from encrypted .env.vault`);let parsed=DotenvModule._parseVault(options),processEnv=process.env;return options&&options.processEnv!=null&&(processEnv=options.processEnv),DotenvModule.populate(processEnv,parsed,options),{parsed}}function configDotenv(options){let dotenvPath=path$6.resolve(process.cwd(),`.env`),encoding=`utf8`,debug=!!(options&&options.debug);options&&(options.path!=null&&(dotenvPath=_resolveHome(options.path)),options.encoding!=null&&(encoding=options.encoding));try{let parsed=DotenvModule.parse(fs$4.readFileSync(dotenvPath,{encoding})),processEnv=process.env;return options&&options.processEnv!=null&&(processEnv=options.processEnv),DotenvModule.populate(processEnv,parsed,options),{parsed}}catch(e){return debug&&_debug(`Failed to load ${dotenvPath} ${e.message}`),{error:e}}}function config(options){let vaultPath=_vaultPath(options);return _dotenvKey(options).length===0?DotenvModule.configDotenv(options):fs$4.existsSync(vaultPath)?DotenvModule._configVault(options):(_warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`),DotenvModule.configDotenv(options))}function decrypt(encrypted,keyStr){let key=Buffer.from(keyStr.slice(-64),`hex`),ciphertext=Buffer.from(encrypted,`base64`),nonce=ciphertext.slice(0,12),authTag=ciphertext.slice(-16);ciphertext=ciphertext.slice(12,-16);try{let aesgcm=crypto$1.createDecipheriv(`aes-256-gcm`,key,nonce);return aesgcm.setAuthTag(authTag),`${aesgcm.update(ciphertext)}${aesgcm.final()}`}catch(error){let isRange=error instanceof RangeError,invalidKeyLength=error.message===`Invalid key length`,decryptionFailed=error.message===`Unsupported state or unable to authenticate data`;throw isRange||invalidKeyLength?Error(`INVALID_DOTENV_KEY: It must be 64 characters long (or more)`):decryptionFailed?Error(`DECRYPTION_FAILED: Please check your DOTENV_KEY`):(console.error(`Error: `,error.code),console.error(`Error: `,error.message),error)}}function populate(processEnv,parsed,options={}){let debug=!!(options&&options.debug),override=!!(options&&options.override);if(typeof parsed!=`object`)throw Error(`OBJECT_REQUIRED: Please check the processEnv argument being passed to populate`);for(let key of Object.keys(parsed))Object.prototype.hasOwnProperty.call(processEnv,key)?(override===!0&&(processEnv[key]=parsed[key]),debug&&_debug(override===!0?`"${key}" is already defined and WAS overwritten`:`"${key}" is already defined and was NOT overwritten`)):processEnv[key]=parsed[key]}let DotenvModule={configDotenv,_configVault,_parseVault,config,decrypt,parse,populate};module.exports.configDotenv=DotenvModule.configDotenv,module.exports._configVault=DotenvModule._configVault,module.exports._parseVault=DotenvModule._parseVault,module.exports.config=DotenvModule.config,module.exports.decrypt=DotenvModule.decrypt,module.exports.parse=DotenvModule.parse,module.exports.populate=DotenvModule.populate,module.exports=DotenvModule})),require_dotenv=require_chunk.t(((exports,module)=>{let fs$3=require(`fs`),path$5=require(`path`),envFile=Symbol.for(`aio-cli-config.envfile`),envVars=Symbol.for(`aio-cli-config.envVars`),debug=require_src$1()(`aio-cli-config`),dotenv=require_main$1(),parse=file=>{checkForDuplicates(file);let buf=Buffer.from(fs$3.readFileSync(file,`utf-8`));return dotenv.parse(buf)},checkForDuplicates=file=>{try{let NEWLINES_MATCH=/\n|\r|\r\n/,RE_INI_KEY_VAL=/^\s*([\w.-]+)\s*=\s*(.*)?\s*$/,buf=Buffer.from(fs$3.readFileSync(file,`utf-8`)),obj={},dupKeys=[];if(buf.toString().split(NEWLINES_MATCH).forEach(function(line,idx){let keyValueArr=line.match(RE_INI_KEY_VAL);if(keyValueArr!=null){let key=keyValueArr[1];obj[key]?dupKeys.push(`${key}`):obj[key]=`dummy`}}),dupKeys.length>0){let debugMsg=`duplicate declaration of environment variable(s)`;dupKeys.forEach(key=>{debugMsg+=` ${key},`}),debugMsg=debugMsg.slice(0,-1),debugMsg+=` in ${file}`,debug(debugMsg)}}catch{}},diff=(o1,o2)=>Object.keys(o1).filter(k=>!(k in o2)),clear=()=>{let existingKeys=global[envVars];if(existingKeys&&existingKeys.forEach){for(let key of existingKeys)delete process.env[key];delete global[envVars]}};module.exports=function(force=!1){let file=path$5.join(process.cwd(),`.env`);if(force||global[envFile]!==file)try{clear();let envs=parse(file);for(let key in envs){let keyName=key,uppercaseKeyName=keyName.toUpperCase(),keyValue=envs[key];uppercaseKeyName in envs||(envs[uppercaseKeyName]=keyValue,delete envs[keyName])}let newKeys=diff(envs,process.env).sort();debug(`loading environment variables from ${file}`),newKeys.length>0&&(process.env={...envs,...process.env},debug(`added environment variable(s): ${newKeys.join(`, `)}`),global[envVars]=newKeys)}catch(ex){ex.code!==`ENOENT`&&(debug(`cannot read environment variables from ${file}`),debug(` - ${ex}`),debug(`skipping ...`))}global[envFile]=file}})),require_common=require_chunk.t(((exports,module)=>{function isNothing(subject){return subject==null}function isObject(subject){return typeof subject==`object`&&!!subject}function toArray(sequence){return Array.isArray(sequence)?sequence:isNothing(sequence)?[]:[sequence]}function extend(target,source){var index,length,key,sourceKeys;if(source)for(sourceKeys=Object.keys(source),index=0,length=sourceKeys.length;index<length;index+=1)key=sourceKeys[index],target[key]=source[key];return target}function repeat(string,count){var result=``,cycle;for(cycle=0;cycle<count;cycle+=1)result+=string;return result}function isNegativeZero(number){return number===0&&1/number==-1/0}module.exports.isNothing=isNothing,module.exports.isObject=isObject,module.exports.toArray=toArray,module.exports.repeat=repeat,module.exports.isNegativeZero=isNegativeZero,module.exports.extend=extend})),require_exception=require_chunk.t(((exports,module)=>{function formatError(exception,compact){var where=``,message=exception.reason||`(unknown reason)`;return exception.mark?(exception.mark.name&&(where+=`in "`+exception.mark.name+`" `),where+=`(`+(exception.mark.line+1)+`:`+(exception.mark.column+1)+`)`,!compact&&exception.mark.snippet&&(where+=`
|
|
9
|
+
|
|
10
|
+
`+exception.mark.snippet),message+` `+where):message}function YAMLException(reason,mark){Error.call(this),this.name=`YAMLException`,this.reason=reason,this.mark=mark,this.message=formatError(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=Error().stack||``}YAMLException.prototype=Object.create(Error.prototype),YAMLException.prototype.constructor=YAMLException,YAMLException.prototype.toString=function(compact){return this.name+`: `+formatError(this,compact)},module.exports=YAMLException})),require_snippet=require_chunk.t(((exports,module)=>{var common=require_common();function getLine(buffer,lineStart,lineEnd,position,maxLineLength){var head=``,tail=``,maxHalfLength=Math.floor(maxLineLength/2)-1;return position-lineStart>maxHalfLength&&(head=` ... `,lineStart=position-maxHalfLength+head.length),lineEnd-position>maxHalfLength&&(tail=` ...`,lineEnd=position+maxHalfLength-tail.length),{str:head+buffer.slice(lineStart,lineEnd).replace(/\t/g,`→`)+tail,pos:position-lineStart+head.length}}function padStart(string,max){return common.repeat(` `,max-string.length)+string}function makeSnippet(mark,options){if(options=Object.create(options||null),!mark.buffer)return null;options.maxLength||=79,typeof options.indent!=`number`&&(options.indent=1),typeof options.linesBefore!=`number`&&(options.linesBefore=3),typeof options.linesAfter!=`number`&&(options.linesAfter=2);for(var re=/\r?\n|\r|\0/g,lineStarts=[0],lineEnds=[],match,foundLineNo=-1;match=re.exec(mark.buffer);)lineEnds.push(match.index),lineStarts.push(match.index+match[0].length),mark.position<=match.index&&foundLineNo<0&&(foundLineNo=lineStarts.length-2);foundLineNo<0&&(foundLineNo=lineStarts.length-1);var result=``,i,line,lineNoLength=Math.min(mark.line+options.linesAfter,lineEnds.length).toString().length,maxLineLength=options.maxLength-(options.indent+lineNoLength+3);for(i=1;i<=options.linesBefore&&!(foundLineNo-i<0);i++)line=getLine(mark.buffer,lineStarts[foundLineNo-i],lineEnds[foundLineNo-i],mark.position-(lineStarts[foundLineNo]-lineStarts[foundLineNo-i]),maxLineLength),result=common.repeat(` `,options.indent)+padStart((mark.line-i+1).toString(),lineNoLength)+` | `+line.str+`
|
|
11
|
+
`+result;for(line=getLine(mark.buffer,lineStarts[foundLineNo],lineEnds[foundLineNo],mark.position,maxLineLength),result+=common.repeat(` `,options.indent)+padStart((mark.line+1).toString(),lineNoLength)+` | `+line.str+`
|
|
12
|
+
`,result+=common.repeat(`-`,options.indent+lineNoLength+3+line.pos)+`^
|
|
13
|
+
`,i=1;i<=options.linesAfter&&!(foundLineNo+i>=lineEnds.length);i++)line=getLine(mark.buffer,lineStarts[foundLineNo+i],lineEnds[foundLineNo+i],mark.position-(lineStarts[foundLineNo]-lineStarts[foundLineNo+i]),maxLineLength),result+=common.repeat(` `,options.indent)+padStart((mark.line+i+1).toString(),lineNoLength)+` | `+line.str+`
|
|
14
|
+
`;return result.replace(/\n$/,``)}module.exports=makeSnippet})),require_type=require_chunk.t(((exports,module)=>{var YAMLException=require_exception(),TYPE_CONSTRUCTOR_OPTIONS=[`kind`,`multi`,`resolve`,`construct`,`instanceOf`,`predicate`,`represent`,`representName`,`defaultStyle`,`styleAliases`],YAML_NODE_KINDS=[`scalar`,`sequence`,`mapping`];function compileStyleAliases(map){var result={};return map!==null&&Object.keys(map).forEach(function(style){map[style].forEach(function(alias){result[String(alias)]=style})}),result}function Type(tag,options){if(options||={},Object.keys(options).forEach(function(name){if(TYPE_CONSTRUCTOR_OPTIONS.indexOf(name)===-1)throw new YAMLException(`Unknown option "`+name+`" is met in definition of "`+tag+`" YAML type.`)}),this.options=options,this.tag=tag,this.kind=options.kind||null,this.resolve=options.resolve||function(){return!0},this.construct=options.construct||function(data){return data},this.instanceOf=options.instanceOf||null,this.predicate=options.predicate||null,this.represent=options.represent||null,this.representName=options.representName||null,this.defaultStyle=options.defaultStyle||null,this.multi=options.multi||!1,this.styleAliases=compileStyleAliases(options.styleAliases||null),YAML_NODE_KINDS.indexOf(this.kind)===-1)throw new YAMLException(`Unknown kind "`+this.kind+`" is specified for "`+tag+`" YAML type.`)}module.exports=Type})),require_schema=require_chunk.t(((exports,module)=>{var YAMLException=require_exception(),Type=require_type();function compileList(schema,name){var result=[];return schema[name].forEach(function(currentType){var newIndex=result.length;result.forEach(function(previousType,previousIndex){previousType.tag===currentType.tag&&previousType.kind===currentType.kind&&previousType.multi===currentType.multi&&(newIndex=previousIndex)}),result[newIndex]=currentType}),result}function compileMap(){var result={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},index,length;function collectType(type){type.multi?(result.multi[type.kind].push(type),result.multi.fallback.push(type)):result[type.kind][type.tag]=result.fallback[type.tag]=type}for(index=0,length=arguments.length;index<length;index+=1)arguments[index].forEach(collectType);return result}function Schema(definition){return this.extend(definition)}Schema.prototype.extend=function(definition){var implicit=[],explicit=[];if(definition instanceof Type)explicit.push(definition);else if(Array.isArray(definition))explicit=explicit.concat(definition);else if(definition&&(Array.isArray(definition.implicit)||Array.isArray(definition.explicit)))definition.implicit&&(implicit=implicit.concat(definition.implicit)),definition.explicit&&(explicit=explicit.concat(definition.explicit));else throw new YAMLException(`Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })`);implicit.forEach(function(type){if(!(type instanceof Type))throw new YAMLException(`Specified list of YAML types (or a single Type object) contains a non-Type object.`);if(type.loadKind&&type.loadKind!==`scalar`)throw new YAMLException(`There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.`);if(type.multi)throw new YAMLException(`There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.`)}),explicit.forEach(function(type){if(!(type instanceof Type))throw new YAMLException(`Specified list of YAML types (or a single Type object) contains a non-Type object.`)});var result=Object.create(Schema.prototype);return result.implicit=(this.implicit||[]).concat(implicit),result.explicit=(this.explicit||[]).concat(explicit),result.compiledImplicit=compileList(result,`implicit`),result.compiledExplicit=compileList(result,`explicit`),result.compiledTypeMap=compileMap(result.compiledImplicit,result.compiledExplicit),result},module.exports=Schema})),require_str=require_chunk.t(((exports,module)=>{module.exports=new(require_type())(`tag:yaml.org,2002:str`,{kind:`scalar`,construct:function(data){return data===null?``:data}})})),require_seq=require_chunk.t(((exports,module)=>{module.exports=new(require_type())(`tag:yaml.org,2002:seq`,{kind:`sequence`,construct:function(data){return data===null?[]:data}})})),require_map=require_chunk.t(((exports,module)=>{module.exports=new(require_type())(`tag:yaml.org,2002:map`,{kind:`mapping`,construct:function(data){return data===null?{}:data}})})),require_failsafe=require_chunk.t(((exports,module)=>{module.exports=new(require_schema())({explicit:[require_str(),require_seq(),require_map()]})})),require_null=require_chunk.t(((exports,module)=>{var Type=require_type();function resolveYamlNull(data){if(data===null)return!0;var max=data.length;return max===1&&data===`~`||max===4&&(data===`null`||data===`Null`||data===`NULL`)}function constructYamlNull(){return null}function isNull(object){return object===null}module.exports=new Type(`tag:yaml.org,2002:null`,{kind:`scalar`,resolve:resolveYamlNull,construct:constructYamlNull,predicate:isNull,represent:{canonical:function(){return`~`},lowercase:function(){return`null`},uppercase:function(){return`NULL`},camelcase:function(){return`Null`},empty:function(){return``}},defaultStyle:`lowercase`})})),require_bool=require_chunk.t(((exports,module)=>{var Type=require_type();function resolveYamlBoolean(data){if(data===null)return!1;var max=data.length;return max===4&&(data===`true`||data===`True`||data===`TRUE`)||max===5&&(data===`false`||data===`False`||data===`FALSE`)}function constructYamlBoolean(data){return data===`true`||data===`True`||data===`TRUE`}function isBoolean(object){return Object.prototype.toString.call(object)===`[object Boolean]`}module.exports=new Type(`tag:yaml.org,2002:bool`,{kind:`scalar`,resolve:resolveYamlBoolean,construct:constructYamlBoolean,predicate:isBoolean,represent:{lowercase:function(object){return object?`true`:`false`},uppercase:function(object){return object?`TRUE`:`FALSE`},camelcase:function(object){return object?`True`:`False`}},defaultStyle:`lowercase`})})),require_int=require_chunk.t(((exports,module)=>{var common=require_common(),Type=require_type();function isHexCode(c){return 48<=c&&c<=57||65<=c&&c<=70||97<=c&&c<=102}function isOctCode(c){return 48<=c&&c<=55}function isDecCode(c){return 48<=c&&c<=57}function resolveYamlInteger(data){if(data===null)return!1;var max=data.length,index=0,hasDigits=!1,ch;if(!max)return!1;if(ch=data[index],(ch===`-`||ch===`+`)&&(ch=data[++index]),ch===`0`){if(index+1===max)return!0;if(ch=data[++index],ch===`b`){for(index++;index<max;index++)if(ch=data[index],ch!==`_`){if(ch!==`0`&&ch!==`1`)return!1;hasDigits=!0}return hasDigits&&ch!==`_`}if(ch===`x`){for(index++;index<max;index++)if(ch=data[index],ch!==`_`){if(!isHexCode(data.charCodeAt(index)))return!1;hasDigits=!0}return hasDigits&&ch!==`_`}if(ch===`o`){for(index++;index<max;index++)if(ch=data[index],ch!==`_`){if(!isOctCode(data.charCodeAt(index)))return!1;hasDigits=!0}return hasDigits&&ch!==`_`}}if(ch===`_`)return!1;for(;index<max;index++)if(ch=data[index],ch!==`_`){if(!isDecCode(data.charCodeAt(index)))return!1;hasDigits=!0}return!(!hasDigits||ch===`_`)}function constructYamlInteger(data){var value=data,sign=1,ch;if(value.indexOf(`_`)!==-1&&(value=value.replace(/_/g,``)),ch=value[0],(ch===`-`||ch===`+`)&&(ch===`-`&&(sign=-1),value=value.slice(1),ch=value[0]),value===`0`)return 0;if(ch===`0`){if(value[1]===`b`)return sign*parseInt(value.slice(2),2);if(value[1]===`x`)return sign*parseInt(value.slice(2),16);if(value[1]===`o`)return sign*parseInt(value.slice(2),8)}return sign*parseInt(value,10)}function isInteger(object){return Object.prototype.toString.call(object)===`[object Number]`&&object%1==0&&!common.isNegativeZero(object)}module.exports=new Type(`tag:yaml.org,2002:int`,{kind:`scalar`,resolve:resolveYamlInteger,construct:constructYamlInteger,predicate:isInteger,represent:{binary:function(obj){return obj>=0?`0b`+obj.toString(2):`-0b`+obj.toString(2).slice(1)},octal:function(obj){return obj>=0?`0o`+obj.toString(8):`-0o`+obj.toString(8).slice(1)},decimal:function(obj){return obj.toString(10)},hexadecimal:function(obj){return obj>=0?`0x`+obj.toString(16).toUpperCase():`-0x`+obj.toString(16).toUpperCase().slice(1)}},defaultStyle:`decimal`,styleAliases:{binary:[2,`bin`],octal:[8,`oct`],decimal:[10,`dec`],hexadecimal:[16,`hex`]}})})),require_float=require_chunk.t(((exports,module)=>{var common=require_common(),Type=require_type(),YAML_FLOAT_PATTERN=RegExp(`^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$`);function resolveYamlFloat(data){return!(data===null||!YAML_FLOAT_PATTERN.test(data)||data[data.length-1]===`_`)}function constructYamlFloat(data){var value=data.replace(/_/g,``).toLowerCase(),sign=value[0]===`-`?-1:1;return`+-`.indexOf(value[0])>=0&&(value=value.slice(1)),value===`.inf`?sign===1?1/0:-1/0:value===`.nan`?NaN:sign*parseFloat(value,10)}var SCIENTIFIC_WITHOUT_DOT=/^[-+]?[0-9]+e/;function representYamlFloat(object,style){var res;if(isNaN(object))switch(style){case`lowercase`:return`.nan`;case`uppercase`:return`.NAN`;case`camelcase`:return`.NaN`}else if(object===1/0)switch(style){case`lowercase`:return`.inf`;case`uppercase`:return`.INF`;case`camelcase`:return`.Inf`}else if(object===-1/0)switch(style){case`lowercase`:return`-.inf`;case`uppercase`:return`-.INF`;case`camelcase`:return`-.Inf`}else if(common.isNegativeZero(object))return`-0.0`;return res=object.toString(10),SCIENTIFIC_WITHOUT_DOT.test(res)?res.replace(`e`,`.e`):res}function isFloat(object){return Object.prototype.toString.call(object)===`[object Number]`&&(object%1!=0||common.isNegativeZero(object))}module.exports=new Type(`tag:yaml.org,2002:float`,{kind:`scalar`,resolve:resolveYamlFloat,construct:constructYamlFloat,predicate:isFloat,represent:representYamlFloat,defaultStyle:`lowercase`})})),require_json=require_chunk.t(((exports,module)=>{module.exports=require_failsafe().extend({implicit:[require_null(),require_bool(),require_int(),require_float()]})})),require_core=require_chunk.t(((exports,module)=>{module.exports=require_json()})),require_timestamp=require_chunk.t(((exports,module)=>{var Type=require_type(),YAML_DATE_REGEXP=RegExp(`^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$`),YAML_TIMESTAMP_REGEXP=RegExp(`^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$`);function resolveYamlTimestamp(data){return data===null?!1:YAML_DATE_REGEXP.exec(data)!==null||YAML_TIMESTAMP_REGEXP.exec(data)!==null}function constructYamlTimestamp(data){var match,year,month,day,hour,minute,second,fraction=0,delta=null,tz_hour,tz_minute,date;if(match=YAML_DATE_REGEXP.exec(data),match===null&&(match=YAML_TIMESTAMP_REGEXP.exec(data)),match===null)throw Error(`Date resolve error`);if(year=+match[1],month=match[2]-1,day=+match[3],!match[4])return new Date(Date.UTC(year,month,day));if(hour=+match[4],minute=+match[5],second=+match[6],match[7]){for(fraction=match[7].slice(0,3);fraction.length<3;)fraction+=`0`;fraction=+fraction}return match[9]&&(tz_hour=+match[10],tz_minute=+(match[11]||0),delta=(tz_hour*60+tz_minute)*6e4,match[9]===`-`&&(delta=-delta)),date=new Date(Date.UTC(year,month,day,hour,minute,second,fraction)),delta&&date.setTime(date.getTime()-delta),date}function representYamlTimestamp(object){return object.toISOString()}module.exports=new Type(`tag:yaml.org,2002:timestamp`,{kind:`scalar`,resolve:resolveYamlTimestamp,construct:constructYamlTimestamp,instanceOf:Date,represent:representYamlTimestamp})})),require_merge=require_chunk.t(((exports,module)=>{var Type=require_type();function resolveYamlMerge(data){return data===`<<`||data===null}module.exports=new Type(`tag:yaml.org,2002:merge`,{kind:`scalar`,resolve:resolveYamlMerge})})),require_binary=require_chunk.t(((exports,module)=>{var Type=require_type(),BASE64_MAP=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
15
|
+
\r`;function resolveYamlBinary(data){if(data===null)return!1;var code,idx,bitlen=0,max=data.length,map=BASE64_MAP;for(idx=0;idx<max;idx++)if(code=map.indexOf(data.charAt(idx)),!(code>64)){if(code<0)return!1;bitlen+=6}return bitlen%8==0}function constructYamlBinary(data){var idx,tailbits,input=data.replace(/[\r\n=]/g,``),max=input.length,map=BASE64_MAP,bits=0,result=[];for(idx=0;idx<max;idx++)idx%4==0&&idx&&(result.push(bits>>16&255),result.push(bits>>8&255),result.push(bits&255)),bits=bits<<6|map.indexOf(input.charAt(idx));return tailbits=max%4*6,tailbits===0?(result.push(bits>>16&255),result.push(bits>>8&255),result.push(bits&255)):tailbits===18?(result.push(bits>>10&255),result.push(bits>>2&255)):tailbits===12&&result.push(bits>>4&255),new Uint8Array(result)}function representYamlBinary(object){var result=``,bits=0,idx,tail,max=object.length,map=BASE64_MAP;for(idx=0;idx<max;idx++)idx%3==0&&idx&&(result+=map[bits>>18&63],result+=map[bits>>12&63],result+=map[bits>>6&63],result+=map[bits&63]),bits=(bits<<8)+object[idx];return tail=max%3,tail===0?(result+=map[bits>>18&63],result+=map[bits>>12&63],result+=map[bits>>6&63],result+=map[bits&63]):tail===2?(result+=map[bits>>10&63],result+=map[bits>>4&63],result+=map[bits<<2&63],result+=map[64]):tail===1&&(result+=map[bits>>2&63],result+=map[bits<<4&63],result+=map[64],result+=map[64]),result}function isBinary(obj){return Object.prototype.toString.call(obj)===`[object Uint8Array]`}module.exports=new Type(`tag:yaml.org,2002:binary`,{kind:`scalar`,resolve:resolveYamlBinary,construct:constructYamlBinary,predicate:isBinary,represent:representYamlBinary})})),require_omap=require_chunk.t(((exports,module)=>{var Type=require_type(),_hasOwnProperty=Object.prototype.hasOwnProperty,_toString=Object.prototype.toString;function resolveYamlOmap(data){if(data===null)return!0;var objectKeys=[],index,length,pair,pairKey,pairHasKey,object=data;for(index=0,length=object.length;index<length;index+=1){if(pair=object[index],pairHasKey=!1,_toString.call(pair)!==`[object Object]`)return!1;for(pairKey in pair)if(_hasOwnProperty.call(pair,pairKey))if(!pairHasKey)pairHasKey=!0;else return!1;if(!pairHasKey)return!1;if(objectKeys.indexOf(pairKey)===-1)objectKeys.push(pairKey);else return!1}return!0}function constructYamlOmap(data){return data===null?[]:data}module.exports=new Type(`tag:yaml.org,2002:omap`,{kind:`sequence`,resolve:resolveYamlOmap,construct:constructYamlOmap})})),require_pairs=require_chunk.t(((exports,module)=>{var Type=require_type(),_toString=Object.prototype.toString;function resolveYamlPairs(data){if(data===null)return!0;var index,length,pair,keys,result,object=data;for(result=Array(object.length),index=0,length=object.length;index<length;index+=1){if(pair=object[index],_toString.call(pair)!==`[object Object]`||(keys=Object.keys(pair),keys.length!==1))return!1;result[index]=[keys[0],pair[keys[0]]]}return!0}function constructYamlPairs(data){if(data===null)return[];var index,length,pair,keys,result,object=data;for(result=Array(object.length),index=0,length=object.length;index<length;index+=1)pair=object[index],keys=Object.keys(pair),result[index]=[keys[0],pair[keys[0]]];return result}module.exports=new Type(`tag:yaml.org,2002:pairs`,{kind:`sequence`,resolve:resolveYamlPairs,construct:constructYamlPairs})})),require_set=require_chunk.t(((exports,module)=>{var Type=require_type(),_hasOwnProperty=Object.prototype.hasOwnProperty;function resolveYamlSet(data){if(data===null)return!0;var key,object=data;for(key in object)if(_hasOwnProperty.call(object,key)&&object[key]!==null)return!1;return!0}function constructYamlSet(data){return data===null?{}:data}module.exports=new Type(`tag:yaml.org,2002:set`,{kind:`mapping`,resolve:resolveYamlSet,construct:constructYamlSet})})),require_default=require_chunk.t(((exports,module)=>{module.exports=require_core().extend({implicit:[require_timestamp(),require_merge()],explicit:[require_binary(),require_omap(),require_pairs(),require_set()]})})),require_loader=require_chunk.t(((exports,module)=>{var common=require_common(),YAMLException=require_exception(),makeSnippet=require_snippet(),DEFAULT_SCHEMA=require_default(),_hasOwnProperty=Object.prototype.hasOwnProperty,CONTEXT_FLOW_IN=1,CONTEXT_FLOW_OUT=2,CONTEXT_BLOCK_IN=3,CONTEXT_BLOCK_OUT=4,CHOMPING_CLIP=1,CHOMPING_STRIP=2,CHOMPING_KEEP=3,PATTERN_NON_PRINTABLE=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,PATTERN_NON_ASCII_LINE_BREAKS=/[\x85\u2028\u2029]/,PATTERN_FLOW_INDICATORS=/[,\[\]\{\}]/,PATTERN_TAG_HANDLE=/^(?:!|!!|![a-z\-]+!)$/i,PATTERN_TAG_URI=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function _class(obj){return Object.prototype.toString.call(obj)}function is_EOL(c){return c===10||c===13}function is_WHITE_SPACE(c){return c===9||c===32}function is_WS_OR_EOL(c){return c===9||c===32||c===10||c===13}function is_FLOW_INDICATOR(c){return c===44||c===91||c===93||c===123||c===125}function fromHexCode(c){var lc;return 48<=c&&c<=57?c-48:(lc=c|32,97<=lc&&lc<=102?lc-97+10:-1)}function escapedHexLen(c){return c===120?2:c===117?4:c===85?8:0}function fromDecimalCode(c){return 48<=c&&c<=57?c-48:-1}function simpleEscapeSequence(c){return c===48?`\0`:c===97?`\x07`:c===98?`\b`:c===116||c===9?` `:c===110?`
|
|
16
|
+
`:c===118?`\v`:c===102?`\f`:c===114?`\r`:c===101?`\x1B`:c===32?` `:c===34?`"`:c===47?`/`:c===92?`\\`:c===78?`
`:c===95?`\xA0`:c===76?`\u2028`:c===80?`\u2029`:``}function charFromCodepoint(c){return c<=65535?String.fromCharCode(c):String.fromCharCode((c-65536>>10)+55296,(c-65536&1023)+56320)}function setProperty(object,key,value){key===`__proto__`?Object.defineProperty(object,key,{configurable:!0,enumerable:!0,writable:!0,value}):object[key]=value}for(var simpleEscapeCheck=Array(256),simpleEscapeMap=Array(256),i=0;i<256;i++)simpleEscapeCheck[i]=simpleEscapeSequence(i)?1:0,simpleEscapeMap[i]=simpleEscapeSequence(i);function State(input,options){this.input=input,this.filename=options.filename||null,this.schema=options.schema||DEFAULT_SCHEMA,this.onWarning=options.onWarning||null,this.legacy=options.legacy||!1,this.json=options.json||!1,this.listener=options.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=input.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function generateError(state,message){var mark={name:state.filename,buffer:state.input.slice(0,-1),position:state.position,line:state.line,column:state.position-state.lineStart};return mark.snippet=makeSnippet(mark),new YAMLException(message,mark)}function throwError(state,message){throw generateError(state,message)}function throwWarning(state,message){state.onWarning&&state.onWarning.call(null,generateError(state,message))}var directiveHandlers={YAML:function(state,name,args){var match,major,minor;state.version!==null&&throwError(state,`duplication of %YAML directive`),args.length!==1&&throwError(state,`YAML directive accepts exactly one argument`),match=/^([0-9]+)\.([0-9]+)$/.exec(args[0]),match===null&&throwError(state,`ill-formed argument of the YAML directive`),major=parseInt(match[1],10),minor=parseInt(match[2],10),major!==1&&throwError(state,`unacceptable YAML version of the document`),state.version=args[0],state.checkLineBreaks=minor<2,minor!==1&&minor!==2&&throwWarning(state,`unsupported YAML version of the document`)},TAG:function(state,name,args){var handle,prefix;args.length!==2&&throwError(state,`TAG directive accepts exactly two arguments`),handle=args[0],prefix=args[1],PATTERN_TAG_HANDLE.test(handle)||throwError(state,`ill-formed tag handle (first argument) of the TAG directive`),_hasOwnProperty.call(state.tagMap,handle)&&throwError(state,`there is a previously declared suffix for "`+handle+`" tag handle`),PATTERN_TAG_URI.test(prefix)||throwError(state,`ill-formed tag prefix (second argument) of the TAG directive`);try{prefix=decodeURIComponent(prefix)}catch{throwError(state,`tag prefix is malformed: `+prefix)}state.tagMap[handle]=prefix}};function captureSegment(state,start,end,checkJson){var _position,_length,_character,_result;if(start<end){if(_result=state.input.slice(start,end),checkJson)for(_position=0,_length=_result.length;_position<_length;_position+=1)_character=_result.charCodeAt(_position),_character===9||32<=_character&&_character<=1114111||throwError(state,`expected valid JSON character`);else PATTERN_NON_PRINTABLE.test(_result)&&throwError(state,`the stream contains non-printable characters`);state.result+=_result}}function mergeMappings(state,destination,source,overridableKeys){var sourceKeys,key,index,quantity;for(common.isObject(source)||throwError(state,`cannot merge mappings; the provided source object is unacceptable`),sourceKeys=Object.keys(source),index=0,quantity=sourceKeys.length;index<quantity;index+=1)key=sourceKeys[index],_hasOwnProperty.call(destination,key)||(setProperty(destination,key,source[key]),overridableKeys[key]=!0)}function storeMappingPair(state,_result,overridableKeys,keyTag,keyNode,valueNode,startLine,startLineStart,startPos){var index,quantity;if(Array.isArray(keyNode))for(keyNode=Array.prototype.slice.call(keyNode),index=0,quantity=keyNode.length;index<quantity;index+=1)Array.isArray(keyNode[index])&&throwError(state,`nested arrays are not supported inside keys`),typeof keyNode==`object`&&_class(keyNode[index])===`[object Object]`&&(keyNode[index]=`[object Object]`);if(typeof keyNode==`object`&&_class(keyNode)===`[object Object]`&&(keyNode=`[object Object]`),keyNode=String(keyNode),_result===null&&(_result={}),keyTag===`tag:yaml.org,2002:merge`)if(Array.isArray(valueNode))for(index=0,quantity=valueNode.length;index<quantity;index+=1)mergeMappings(state,_result,valueNode[index],overridableKeys);else mergeMappings(state,_result,valueNode,overridableKeys);else !state.json&&!_hasOwnProperty.call(overridableKeys,keyNode)&&_hasOwnProperty.call(_result,keyNode)&&(state.line=startLine||state.line,state.lineStart=startLineStart||state.lineStart,state.position=startPos||state.position,throwError(state,`duplicated mapping key`)),setProperty(_result,keyNode,valueNode),delete overridableKeys[keyNode];return _result}function readLineBreak(state){var ch=state.input.charCodeAt(state.position);ch===10?state.position++:ch===13?(state.position++,state.input.charCodeAt(state.position)===10&&state.position++):throwError(state,`a line break is expected`),state.line+=1,state.lineStart=state.position,state.firstTabInLine=-1}function skipSeparationSpace(state,allowComments,checkIndent){for(var lineBreaks=0,ch=state.input.charCodeAt(state.position);ch!==0;){for(;is_WHITE_SPACE(ch);)ch===9&&state.firstTabInLine===-1&&(state.firstTabInLine=state.position),ch=state.input.charCodeAt(++state.position);if(allowComments&&ch===35)do ch=state.input.charCodeAt(++state.position);while(ch!==10&&ch!==13&&ch!==0);if(is_EOL(ch))for(readLineBreak(state),ch=state.input.charCodeAt(state.position),lineBreaks++,state.lineIndent=0;ch===32;)state.lineIndent++,ch=state.input.charCodeAt(++state.position);else break}return checkIndent!==-1&&lineBreaks!==0&&state.lineIndent<checkIndent&&throwWarning(state,`deficient indentation`),lineBreaks}function testDocumentSeparator(state){var _position=state.position,ch=state.input.charCodeAt(_position);return!!((ch===45||ch===46)&&ch===state.input.charCodeAt(_position+1)&&ch===state.input.charCodeAt(_position+2)&&(_position+=3,ch=state.input.charCodeAt(_position),ch===0||is_WS_OR_EOL(ch)))}function writeFoldedLines(state,count){count===1?state.result+=` `:count>1&&(state.result+=common.repeat(`
|
|
17
|
+
`,count-1))}function readPlainScalar(state,nodeIndent,withinFlowCollection){var preceding,following,captureStart,captureEnd,hasPendingContent,_line,_lineStart,_lineIndent,_kind=state.kind,_result=state.result,ch=state.input.charCodeAt(state.position);if(is_WS_OR_EOL(ch)||is_FLOW_INDICATOR(ch)||ch===35||ch===38||ch===42||ch===33||ch===124||ch===62||ch===39||ch===34||ch===37||ch===64||ch===96||(ch===63||ch===45)&&(following=state.input.charCodeAt(state.position+1),is_WS_OR_EOL(following)||withinFlowCollection&&is_FLOW_INDICATOR(following)))return!1;for(state.kind=`scalar`,state.result=``,captureStart=captureEnd=state.position,hasPendingContent=!1;ch!==0;){if(ch===58){if(following=state.input.charCodeAt(state.position+1),is_WS_OR_EOL(following)||withinFlowCollection&&is_FLOW_INDICATOR(following))break}else if(ch===35){if(preceding=state.input.charCodeAt(state.position-1),is_WS_OR_EOL(preceding))break}else if(state.position===state.lineStart&&testDocumentSeparator(state)||withinFlowCollection&&is_FLOW_INDICATOR(ch))break;else if(is_EOL(ch))if(_line=state.line,_lineStart=state.lineStart,_lineIndent=state.lineIndent,skipSeparationSpace(state,!1,-1),state.lineIndent>=nodeIndent){hasPendingContent=!0,ch=state.input.charCodeAt(state.position);continue}else{state.position=captureEnd,state.line=_line,state.lineStart=_lineStart,state.lineIndent=_lineIndent;break}hasPendingContent&&=(captureSegment(state,captureStart,captureEnd,!1),writeFoldedLines(state,state.line-_line),captureStart=captureEnd=state.position,!1),is_WHITE_SPACE(ch)||(captureEnd=state.position+1),ch=state.input.charCodeAt(++state.position)}return captureSegment(state,captureStart,captureEnd,!1),state.result?!0:(state.kind=_kind,state.result=_result,!1)}function readSingleQuotedScalar(state,nodeIndent){var ch=state.input.charCodeAt(state.position),captureStart,captureEnd;if(ch!==39)return!1;for(state.kind=`scalar`,state.result=``,state.position++,captureStart=captureEnd=state.position;(ch=state.input.charCodeAt(state.position))!==0;)if(ch===39)if(captureSegment(state,captureStart,state.position,!0),ch=state.input.charCodeAt(++state.position),ch===39)captureStart=state.position,state.position++,captureEnd=state.position;else return!0;else is_EOL(ch)?(captureSegment(state,captureStart,captureEnd,!0),writeFoldedLines(state,skipSeparationSpace(state,!1,nodeIndent)),captureStart=captureEnd=state.position):state.position===state.lineStart&&testDocumentSeparator(state)?throwError(state,`unexpected end of the document within a single quoted scalar`):(state.position++,captureEnd=state.position);throwError(state,`unexpected end of the stream within a single quoted scalar`)}function readDoubleQuotedScalar(state,nodeIndent){var captureStart,captureEnd,hexLength,hexResult,tmp,ch=state.input.charCodeAt(state.position);if(ch!==34)return!1;for(state.kind=`scalar`,state.result=``,state.position++,captureStart=captureEnd=state.position;(ch=state.input.charCodeAt(state.position))!==0;)if(ch===34)return captureSegment(state,captureStart,state.position,!0),state.position++,!0;else if(ch===92){if(captureSegment(state,captureStart,state.position,!0),ch=state.input.charCodeAt(++state.position),is_EOL(ch))skipSeparationSpace(state,!1,nodeIndent);else if(ch<256&&simpleEscapeCheck[ch])state.result+=simpleEscapeMap[ch],state.position++;else if((tmp=escapedHexLen(ch))>0){for(hexLength=tmp,hexResult=0;hexLength>0;hexLength--)ch=state.input.charCodeAt(++state.position),(tmp=fromHexCode(ch))>=0?hexResult=(hexResult<<4)+tmp:throwError(state,`expected hexadecimal character`);state.result+=charFromCodepoint(hexResult),state.position++}else throwError(state,`unknown escape sequence`);captureStart=captureEnd=state.position}else is_EOL(ch)?(captureSegment(state,captureStart,captureEnd,!0),writeFoldedLines(state,skipSeparationSpace(state,!1,nodeIndent)),captureStart=captureEnd=state.position):state.position===state.lineStart&&testDocumentSeparator(state)?throwError(state,`unexpected end of the document within a double quoted scalar`):(state.position++,captureEnd=state.position);throwError(state,`unexpected end of the stream within a double quoted scalar`)}function readFlowCollection(state,nodeIndent){var readNext=!0,_line,_lineStart,_pos,_tag=state.tag,_result,_anchor=state.anchor,following,terminator,isPair,isExplicitPair,isMapping,overridableKeys=Object.create(null),keyNode,keyTag,valueNode,ch=state.input.charCodeAt(state.position);if(ch===91)terminator=93,isMapping=!1,_result=[];else if(ch===123)terminator=125,isMapping=!0,_result={};else return!1;for(state.anchor!==null&&(state.anchorMap[state.anchor]=_result),ch=state.input.charCodeAt(++state.position);ch!==0;){if(skipSeparationSpace(state,!0,nodeIndent),ch=state.input.charCodeAt(state.position),ch===terminator)return state.position++,state.tag=_tag,state.anchor=_anchor,state.kind=isMapping?`mapping`:`sequence`,state.result=_result,!0;readNext?ch===44&&throwError(state,`expected the node content, but found ','`):throwError(state,`missed comma between flow collection entries`),keyTag=keyNode=valueNode=null,isPair=isExplicitPair=!1,ch===63&&(following=state.input.charCodeAt(state.position+1),is_WS_OR_EOL(following)&&(isPair=isExplicitPair=!0,state.position++,skipSeparationSpace(state,!0,nodeIndent))),_line=state.line,_lineStart=state.lineStart,_pos=state.position,composeNode(state,nodeIndent,CONTEXT_FLOW_IN,!1,!0),keyTag=state.tag,keyNode=state.result,skipSeparationSpace(state,!0,nodeIndent),ch=state.input.charCodeAt(state.position),(isExplicitPair||state.line===_line)&&ch===58&&(isPair=!0,ch=state.input.charCodeAt(++state.position),skipSeparationSpace(state,!0,nodeIndent),composeNode(state,nodeIndent,CONTEXT_FLOW_IN,!1,!0),valueNode=state.result),isMapping?storeMappingPair(state,_result,overridableKeys,keyTag,keyNode,valueNode,_line,_lineStart,_pos):isPair?_result.push(storeMappingPair(state,null,overridableKeys,keyTag,keyNode,valueNode,_line,_lineStart,_pos)):_result.push(keyNode),skipSeparationSpace(state,!0,nodeIndent),ch=state.input.charCodeAt(state.position),ch===44?(readNext=!0,ch=state.input.charCodeAt(++state.position)):readNext=!1}throwError(state,`unexpected end of the stream within a flow collection`)}function readBlockScalar(state,nodeIndent){var captureStart,folding,chomping=CHOMPING_CLIP,didReadContent=!1,detectedIndent=!1,textIndent=nodeIndent,emptyLines=0,atMoreIndented=!1,tmp,ch=state.input.charCodeAt(state.position);if(ch===124)folding=!1;else if(ch===62)folding=!0;else return!1;for(state.kind=`scalar`,state.result=``;ch!==0;)if(ch=state.input.charCodeAt(++state.position),ch===43||ch===45)CHOMPING_CLIP===chomping?chomping=ch===43?CHOMPING_KEEP:CHOMPING_STRIP:throwError(state,`repeat of a chomping mode identifier`);else if((tmp=fromDecimalCode(ch))>=0)tmp===0?throwError(state,`bad explicit indentation width of a block scalar; it cannot be less than one`):detectedIndent?throwError(state,`repeat of an indentation width identifier`):(textIndent=nodeIndent+tmp-1,detectedIndent=!0);else break;if(is_WHITE_SPACE(ch)){do ch=state.input.charCodeAt(++state.position);while(is_WHITE_SPACE(ch));if(ch===35)do ch=state.input.charCodeAt(++state.position);while(!is_EOL(ch)&&ch!==0)}for(;ch!==0;){for(readLineBreak(state),state.lineIndent=0,ch=state.input.charCodeAt(state.position);(!detectedIndent||state.lineIndent<textIndent)&&ch===32;)state.lineIndent++,ch=state.input.charCodeAt(++state.position);if(!detectedIndent&&state.lineIndent>textIndent&&(textIndent=state.lineIndent),is_EOL(ch)){emptyLines++;continue}if(state.lineIndent<textIndent){chomping===CHOMPING_KEEP?state.result+=common.repeat(`
|
|
18
|
+
`,didReadContent?1+emptyLines:emptyLines):chomping===CHOMPING_CLIP&&didReadContent&&(state.result+=`
|
|
19
|
+
`);break}for(folding?is_WHITE_SPACE(ch)?(atMoreIndented=!0,state.result+=common.repeat(`
|
|
20
|
+
`,didReadContent?1+emptyLines:emptyLines)):atMoreIndented?(atMoreIndented=!1,state.result+=common.repeat(`
|
|
21
|
+
`,emptyLines+1)):emptyLines===0?didReadContent&&(state.result+=` `):state.result+=common.repeat(`
|
|
22
|
+
`,emptyLines):state.result+=common.repeat(`
|
|
23
|
+
`,didReadContent?1+emptyLines:emptyLines),didReadContent=!0,detectedIndent=!0,emptyLines=0,captureStart=state.position;!is_EOL(ch)&&ch!==0;)ch=state.input.charCodeAt(++state.position);captureSegment(state,captureStart,state.position,!1)}return!0}function readBlockSequence(state,nodeIndent){var _line,_tag=state.tag,_anchor=state.anchor,_result=[],following,detected=!1,ch;if(state.firstTabInLine!==-1)return!1;for(state.anchor!==null&&(state.anchorMap[state.anchor]=_result),ch=state.input.charCodeAt(state.position);ch!==0&&(state.firstTabInLine!==-1&&(state.position=state.firstTabInLine,throwError(state,`tab characters must not be used in indentation`)),!(ch!==45||(following=state.input.charCodeAt(state.position+1),!is_WS_OR_EOL(following))));){if(detected=!0,state.position++,skipSeparationSpace(state,!0,-1)&&state.lineIndent<=nodeIndent){_result.push(null),ch=state.input.charCodeAt(state.position);continue}if(_line=state.line,composeNode(state,nodeIndent,CONTEXT_BLOCK_IN,!1,!0),_result.push(state.result),skipSeparationSpace(state,!0,-1),ch=state.input.charCodeAt(state.position),(state.line===_line||state.lineIndent>nodeIndent)&&ch!==0)throwError(state,`bad indentation of a sequence entry`);else if(state.lineIndent<nodeIndent)break}return detected?(state.tag=_tag,state.anchor=_anchor,state.kind=`sequence`,state.result=_result,!0):!1}function readBlockMapping(state,nodeIndent,flowIndent){var following,allowCompact,_line,_keyLine,_keyLineStart,_keyPos,_tag=state.tag,_anchor=state.anchor,_result={},overridableKeys=Object.create(null),keyTag=null,keyNode=null,valueNode=null,atExplicitKey=!1,detected=!1,ch;if(state.firstTabInLine!==-1)return!1;for(state.anchor!==null&&(state.anchorMap[state.anchor]=_result),ch=state.input.charCodeAt(state.position);ch!==0;){if(!atExplicitKey&&state.firstTabInLine!==-1&&(state.position=state.firstTabInLine,throwError(state,`tab characters must not be used in indentation`)),following=state.input.charCodeAt(state.position+1),_line=state.line,(ch===63||ch===58)&&is_WS_OR_EOL(following))ch===63?(atExplicitKey&&(storeMappingPair(state,_result,overridableKeys,keyTag,keyNode,null,_keyLine,_keyLineStart,_keyPos),keyTag=keyNode=valueNode=null),detected=!0,atExplicitKey=!0,allowCompact=!0):atExplicitKey?(atExplicitKey=!1,allowCompact=!0):throwError(state,`incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line`),state.position+=1,ch=following;else{if(_keyLine=state.line,_keyLineStart=state.lineStart,_keyPos=state.position,!composeNode(state,flowIndent,CONTEXT_FLOW_OUT,!1,!0))break;if(state.line===_line){for(ch=state.input.charCodeAt(state.position);is_WHITE_SPACE(ch);)ch=state.input.charCodeAt(++state.position);if(ch===58)ch=state.input.charCodeAt(++state.position),is_WS_OR_EOL(ch)||throwError(state,`a whitespace character is expected after the key-value separator within a block mapping`),atExplicitKey&&(storeMappingPair(state,_result,overridableKeys,keyTag,keyNode,null,_keyLine,_keyLineStart,_keyPos),keyTag=keyNode=valueNode=null),detected=!0,atExplicitKey=!1,allowCompact=!1,keyTag=state.tag,keyNode=state.result;else if(detected)throwError(state,`can not read an implicit mapping pair; a colon is missed`);else return state.tag=_tag,state.anchor=_anchor,!0}else if(detected)throwError(state,`can not read a block mapping entry; a multiline key may not be an implicit key`);else return state.tag=_tag,state.anchor=_anchor,!0}if((state.line===_line||state.lineIndent>nodeIndent)&&(atExplicitKey&&(_keyLine=state.line,_keyLineStart=state.lineStart,_keyPos=state.position),composeNode(state,nodeIndent,CONTEXT_BLOCK_OUT,!0,allowCompact)&&(atExplicitKey?keyNode=state.result:valueNode=state.result),atExplicitKey||(storeMappingPair(state,_result,overridableKeys,keyTag,keyNode,valueNode,_keyLine,_keyLineStart,_keyPos),keyTag=keyNode=valueNode=null),skipSeparationSpace(state,!0,-1),ch=state.input.charCodeAt(state.position)),(state.line===_line||state.lineIndent>nodeIndent)&&ch!==0)throwError(state,`bad indentation of a mapping entry`);else if(state.lineIndent<nodeIndent)break}return atExplicitKey&&storeMappingPair(state,_result,overridableKeys,keyTag,keyNode,null,_keyLine,_keyLineStart,_keyPos),detected&&(state.tag=_tag,state.anchor=_anchor,state.kind=`mapping`,state.result=_result),detected}function readTagProperty(state){var _position,isVerbatim=!1,isNamed=!1,tagHandle,tagName,ch=state.input.charCodeAt(state.position);if(ch!==33)return!1;if(state.tag!==null&&throwError(state,`duplication of a tag property`),ch=state.input.charCodeAt(++state.position),ch===60?(isVerbatim=!0,ch=state.input.charCodeAt(++state.position)):ch===33?(isNamed=!0,tagHandle=`!!`,ch=state.input.charCodeAt(++state.position)):tagHandle=`!`,_position=state.position,isVerbatim){do ch=state.input.charCodeAt(++state.position);while(ch!==0&&ch!==62);state.position<state.length?(tagName=state.input.slice(_position,state.position),ch=state.input.charCodeAt(++state.position)):throwError(state,`unexpected end of the stream within a verbatim tag`)}else{for(;ch!==0&&!is_WS_OR_EOL(ch);)ch===33&&(isNamed?throwError(state,`tag suffix cannot contain exclamation marks`):(tagHandle=state.input.slice(_position-1,state.position+1),PATTERN_TAG_HANDLE.test(tagHandle)||throwError(state,`named tag handle cannot contain such characters`),isNamed=!0,_position=state.position+1)),ch=state.input.charCodeAt(++state.position);tagName=state.input.slice(_position,state.position),PATTERN_FLOW_INDICATORS.test(tagName)&&throwError(state,`tag suffix cannot contain flow indicator characters`)}tagName&&!PATTERN_TAG_URI.test(tagName)&&throwError(state,`tag name cannot contain such characters: `+tagName);try{tagName=decodeURIComponent(tagName)}catch{throwError(state,`tag name is malformed: `+tagName)}return isVerbatim?state.tag=tagName:_hasOwnProperty.call(state.tagMap,tagHandle)?state.tag=state.tagMap[tagHandle]+tagName:tagHandle===`!`?state.tag=`!`+tagName:tagHandle===`!!`?state.tag=`tag:yaml.org,2002:`+tagName:throwError(state,`undeclared tag handle "`+tagHandle+`"`),!0}function readAnchorProperty(state){var _position,ch=state.input.charCodeAt(state.position);if(ch!==38)return!1;for(state.anchor!==null&&throwError(state,`duplication of an anchor property`),ch=state.input.charCodeAt(++state.position),_position=state.position;ch!==0&&!is_WS_OR_EOL(ch)&&!is_FLOW_INDICATOR(ch);)ch=state.input.charCodeAt(++state.position);return state.position===_position&&throwError(state,`name of an anchor node must contain at least one character`),state.anchor=state.input.slice(_position,state.position),!0}function readAlias(state){var _position,alias,ch=state.input.charCodeAt(state.position);if(ch!==42)return!1;for(ch=state.input.charCodeAt(++state.position),_position=state.position;ch!==0&&!is_WS_OR_EOL(ch)&&!is_FLOW_INDICATOR(ch);)ch=state.input.charCodeAt(++state.position);return state.position===_position&&throwError(state,`name of an alias node must contain at least one character`),alias=state.input.slice(_position,state.position),_hasOwnProperty.call(state.anchorMap,alias)||throwError(state,`unidentified alias "`+alias+`"`),state.result=state.anchorMap[alias],skipSeparationSpace(state,!0,-1),!0}function composeNode(state,parentIndent,nodeContext,allowToSeek,allowCompact){var allowBlockStyles,allowBlockScalars,allowBlockCollections,indentStatus=1,atNewLine=!1,hasContent=!1,typeIndex,typeQuantity,typeList,type,flowIndent,blockIndent;if(state.listener!==null&&state.listener(`open`,state),state.tag=null,state.anchor=null,state.kind=null,state.result=null,allowBlockStyles=allowBlockScalars=allowBlockCollections=CONTEXT_BLOCK_OUT===nodeContext||CONTEXT_BLOCK_IN===nodeContext,allowToSeek&&skipSeparationSpace(state,!0,-1)&&(atNewLine=!0,state.lineIndent>parentIndent?indentStatus=1:state.lineIndent===parentIndent?indentStatus=0:state.lineIndent<parentIndent&&(indentStatus=-1)),indentStatus===1)for(;readTagProperty(state)||readAnchorProperty(state);)skipSeparationSpace(state,!0,-1)?(atNewLine=!0,allowBlockCollections=allowBlockStyles,state.lineIndent>parentIndent?indentStatus=1:state.lineIndent===parentIndent?indentStatus=0:state.lineIndent<parentIndent&&(indentStatus=-1)):allowBlockCollections=!1;if(allowBlockCollections&&=atNewLine||allowCompact,(indentStatus===1||CONTEXT_BLOCK_OUT===nodeContext)&&(flowIndent=CONTEXT_FLOW_IN===nodeContext||CONTEXT_FLOW_OUT===nodeContext?parentIndent:parentIndent+1,blockIndent=state.position-state.lineStart,indentStatus===1?allowBlockCollections&&(readBlockSequence(state,blockIndent)||readBlockMapping(state,blockIndent,flowIndent))||readFlowCollection(state,flowIndent)?hasContent=!0:(allowBlockScalars&&readBlockScalar(state,flowIndent)||readSingleQuotedScalar(state,flowIndent)||readDoubleQuotedScalar(state,flowIndent)?hasContent=!0:readAlias(state)?(hasContent=!0,(state.tag!==null||state.anchor!==null)&&throwError(state,`alias node should not have any properties`)):readPlainScalar(state,flowIndent,CONTEXT_FLOW_IN===nodeContext)&&(hasContent=!0,state.tag===null&&(state.tag=`?`)),state.anchor!==null&&(state.anchorMap[state.anchor]=state.result)):indentStatus===0&&(hasContent=allowBlockCollections&&readBlockSequence(state,blockIndent))),state.tag===null)state.anchor!==null&&(state.anchorMap[state.anchor]=state.result);else if(state.tag===`?`){for(state.result!==null&&state.kind!==`scalar`&&throwError(state,`unacceptable node kind for !<?> tag; it should be "scalar", not "`+state.kind+`"`),typeIndex=0,typeQuantity=state.implicitTypes.length;typeIndex<typeQuantity;typeIndex+=1)if(type=state.implicitTypes[typeIndex],type.resolve(state.result)){state.result=type.construct(state.result),state.tag=type.tag,state.anchor!==null&&(state.anchorMap[state.anchor]=state.result);break}}else if(state.tag!==`!`){if(_hasOwnProperty.call(state.typeMap[state.kind||`fallback`],state.tag))type=state.typeMap[state.kind||`fallback`][state.tag];else for(type=null,typeList=state.typeMap.multi[state.kind||`fallback`],typeIndex=0,typeQuantity=typeList.length;typeIndex<typeQuantity;typeIndex+=1)if(state.tag.slice(0,typeList[typeIndex].tag.length)===typeList[typeIndex].tag){type=typeList[typeIndex];break}type||throwError(state,`unknown tag !<`+state.tag+`>`),state.result!==null&&type.kind!==state.kind&&throwError(state,`unacceptable node kind for !<`+state.tag+`> tag; it should be "`+type.kind+`", not "`+state.kind+`"`),type.resolve(state.result,state.tag)?(state.result=type.construct(state.result,state.tag),state.anchor!==null&&(state.anchorMap[state.anchor]=state.result)):throwError(state,`cannot resolve a node with !<`+state.tag+`> explicit tag`)}return state.listener!==null&&state.listener(`close`,state),state.tag!==null||state.anchor!==null||hasContent}function readDocument(state){var documentStart=state.position,_position,directiveName,directiveArgs,hasDirectives=!1,ch;for(state.version=null,state.checkLineBreaks=state.legacy,state.tagMap=Object.create(null),state.anchorMap=Object.create(null);(ch=state.input.charCodeAt(state.position))!==0&&(skipSeparationSpace(state,!0,-1),ch=state.input.charCodeAt(state.position),!(state.lineIndent>0||ch!==37));){for(hasDirectives=!0,ch=state.input.charCodeAt(++state.position),_position=state.position;ch!==0&&!is_WS_OR_EOL(ch);)ch=state.input.charCodeAt(++state.position);for(directiveName=state.input.slice(_position,state.position),directiveArgs=[],directiveName.length<1&&throwError(state,`directive name must not be less than one character in length`);ch!==0;){for(;is_WHITE_SPACE(ch);)ch=state.input.charCodeAt(++state.position);if(ch===35){do ch=state.input.charCodeAt(++state.position);while(ch!==0&&!is_EOL(ch));break}if(is_EOL(ch))break;for(_position=state.position;ch!==0&&!is_WS_OR_EOL(ch);)ch=state.input.charCodeAt(++state.position);directiveArgs.push(state.input.slice(_position,state.position))}ch!==0&&readLineBreak(state),_hasOwnProperty.call(directiveHandlers,directiveName)?directiveHandlers[directiveName](state,directiveName,directiveArgs):throwWarning(state,`unknown document directive "`+directiveName+`"`)}if(skipSeparationSpace(state,!0,-1),state.lineIndent===0&&state.input.charCodeAt(state.position)===45&&state.input.charCodeAt(state.position+1)===45&&state.input.charCodeAt(state.position+2)===45?(state.position+=3,skipSeparationSpace(state,!0,-1)):hasDirectives&&throwError(state,`directives end mark is expected`),composeNode(state,state.lineIndent-1,CONTEXT_BLOCK_OUT,!1,!0),skipSeparationSpace(state,!0,-1),state.checkLineBreaks&&PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart,state.position))&&throwWarning(state,`non-ASCII line breaks are interpreted as content`),state.documents.push(state.result),state.position===state.lineStart&&testDocumentSeparator(state)){state.input.charCodeAt(state.position)===46&&(state.position+=3,skipSeparationSpace(state,!0,-1));return}if(state.position<state.length-1)throwError(state,`end of the stream or a document separator is expected`);else return}function loadDocuments(input,options){input=String(input),options||={},input.length!==0&&(input.charCodeAt(input.length-1)!==10&&input.charCodeAt(input.length-1)!==13&&(input+=`
|
|
24
|
+
`),input.charCodeAt(0)===65279&&(input=input.slice(1)));var state=new State(input,options),nullpos=input.indexOf(`\0`);for(nullpos!==-1&&(state.position=nullpos,throwError(state,`null byte is not allowed in input`)),state.input+=`\0`;state.input.charCodeAt(state.position)===32;)state.lineIndent+=1,state.position+=1;for(;state.position<state.length-1;)readDocument(state);return state.documents}function loadAll(input,iterator,options){typeof iterator==`object`&&iterator&&options===void 0&&(options=iterator,iterator=null);var documents=loadDocuments(input,options);if(typeof iterator!=`function`)return documents;for(var index=0,length=documents.length;index<length;index+=1)iterator(documents[index])}function load(input,options){var documents=loadDocuments(input,options);if(documents.length!==0){if(documents.length===1)return documents[0];throw new YAMLException(`expected a single document in the stream, but found more`)}}module.exports.loadAll=loadAll,module.exports.load=load})),require_dumper=require_chunk.t(((exports,module)=>{var common=require_common(),YAMLException=require_exception(),DEFAULT_SCHEMA=require_default(),_toString=Object.prototype.toString,_hasOwnProperty=Object.prototype.hasOwnProperty,CHAR_BOM=65279,CHAR_TAB=9,CHAR_LINE_FEED=10,CHAR_CARRIAGE_RETURN=13,CHAR_SPACE=32,CHAR_EXCLAMATION=33,CHAR_DOUBLE_QUOTE=34,CHAR_SHARP=35,CHAR_PERCENT=37,CHAR_AMPERSAND=38,CHAR_SINGLE_QUOTE=39,CHAR_ASTERISK=42,CHAR_COMMA=44,CHAR_MINUS=45,CHAR_COLON=58,CHAR_EQUALS=61,CHAR_GREATER_THAN=62,CHAR_QUESTION=63,CHAR_COMMERCIAL_AT=64,CHAR_LEFT_SQUARE_BRACKET=91,CHAR_RIGHT_SQUARE_BRACKET=93,CHAR_GRAVE_ACCENT=96,CHAR_LEFT_CURLY_BRACKET=123,CHAR_VERTICAL_LINE=124,CHAR_RIGHT_CURLY_BRACKET=125,ESCAPE_SEQUENCES={};ESCAPE_SEQUENCES[0]=`\\0`,ESCAPE_SEQUENCES[7]=`\\a`,ESCAPE_SEQUENCES[8]=`\\b`,ESCAPE_SEQUENCES[9]=`\\t`,ESCAPE_SEQUENCES[10]=`\\n`,ESCAPE_SEQUENCES[11]=`\\v`,ESCAPE_SEQUENCES[12]=`\\f`,ESCAPE_SEQUENCES[13]=`\\r`,ESCAPE_SEQUENCES[27]=`\\e`,ESCAPE_SEQUENCES[34]=`\\"`,ESCAPE_SEQUENCES[92]=`\\\\`,ESCAPE_SEQUENCES[133]=`\\N`,ESCAPE_SEQUENCES[160]=`\\_`,ESCAPE_SEQUENCES[8232]=`\\L`,ESCAPE_SEQUENCES[8233]=`\\P`;var DEPRECATED_BOOLEANS_SYNTAX=[`y`,`Y`,`yes`,`Yes`,`YES`,`on`,`On`,`ON`,`n`,`N`,`no`,`No`,`NO`,`off`,`Off`,`OFF`],DEPRECATED_BASE60_SYNTAX=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function compileStyleMap(schema,map){var result,keys,index,length,tag,style,type;if(map===null)return{};for(result={},keys=Object.keys(map),index=0,length=keys.length;index<length;index+=1)tag=keys[index],style=String(map[tag]),tag.slice(0,2)===`!!`&&(tag=`tag:yaml.org,2002:`+tag.slice(2)),type=schema.compiledTypeMap.fallback[tag],type&&_hasOwnProperty.call(type.styleAliases,style)&&(style=type.styleAliases[style]),result[tag]=style;return result}function encodeHex(character){var string=character.toString(16).toUpperCase(),handle,length;if(character<=255)handle=`x`,length=2;else if(character<=65535)handle=`u`,length=4;else if(character<=4294967295)handle=`U`,length=8;else throw new YAMLException(`code point within a string may not be greater than 0xFFFFFFFF`);return`\\`+handle+common.repeat(`0`,length-string.length)+string}var QUOTING_TYPE_SINGLE=1,QUOTING_TYPE_DOUBLE=2;function State(options){this.schema=options.schema||DEFAULT_SCHEMA,this.indent=Math.max(1,options.indent||2),this.noArrayIndent=options.noArrayIndent||!1,this.skipInvalid=options.skipInvalid||!1,this.flowLevel=common.isNothing(options.flowLevel)?-1:options.flowLevel,this.styleMap=compileStyleMap(this.schema,options.styles||null),this.sortKeys=options.sortKeys||!1,this.lineWidth=options.lineWidth||80,this.noRefs=options.noRefs||!1,this.noCompatMode=options.noCompatMode||!1,this.condenseFlow=options.condenseFlow||!1,this.quotingType=options.quotingType===`"`?QUOTING_TYPE_DOUBLE:QUOTING_TYPE_SINGLE,this.forceQuotes=options.forceQuotes||!1,this.replacer=typeof options.replacer==`function`?options.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result=``,this.duplicates=[],this.usedDuplicates=null}function indentString(string,spaces){for(var ind=common.repeat(` `,spaces),position=0,next=-1,result=``,line,length=string.length;position<length;)next=string.indexOf(`
|
|
25
|
+
`,position),next===-1?(line=string.slice(position),position=length):(line=string.slice(position,next+1),position=next+1),line.length&&line!==`
|
|
26
|
+
`&&(result+=ind),result+=line;return result}function generateNextLine(state,level){return`
|
|
27
|
+
`+common.repeat(` `,state.indent*level)}function testImplicitResolving(state,str){var index,length,type;for(index=0,length=state.implicitTypes.length;index<length;index+=1)if(type=state.implicitTypes[index],type.resolve(str))return!0;return!1}function isWhitespace(c){return c===CHAR_SPACE||c===CHAR_TAB}function isPrintable(c){return 32<=c&&c<=126||161<=c&&c<=55295&&c!==8232&&c!==8233||57344<=c&&c<=65533&&c!==CHAR_BOM||65536<=c&&c<=1114111}function isNsCharOrWhitespace(c){return isPrintable(c)&&c!==CHAR_BOM&&c!==CHAR_CARRIAGE_RETURN&&c!==CHAR_LINE_FEED}function isPlainSafe(c,prev,inblock){var cIsNsCharOrWhitespace=isNsCharOrWhitespace(c),cIsNsChar=cIsNsCharOrWhitespace&&!isWhitespace(c);return(inblock?cIsNsCharOrWhitespace:cIsNsCharOrWhitespace&&c!==CHAR_COMMA&&c!==CHAR_LEFT_SQUARE_BRACKET&&c!==CHAR_RIGHT_SQUARE_BRACKET&&c!==CHAR_LEFT_CURLY_BRACKET&&c!==CHAR_RIGHT_CURLY_BRACKET)&&c!==CHAR_SHARP&&!(prev===CHAR_COLON&&!cIsNsChar)||isNsCharOrWhitespace(prev)&&!isWhitespace(prev)&&c===CHAR_SHARP||prev===CHAR_COLON&&cIsNsChar}function isPlainSafeFirst(c){return isPrintable(c)&&c!==CHAR_BOM&&!isWhitespace(c)&&c!==CHAR_MINUS&&c!==CHAR_QUESTION&&c!==CHAR_COLON&&c!==CHAR_COMMA&&c!==CHAR_LEFT_SQUARE_BRACKET&&c!==CHAR_RIGHT_SQUARE_BRACKET&&c!==CHAR_LEFT_CURLY_BRACKET&&c!==CHAR_RIGHT_CURLY_BRACKET&&c!==CHAR_SHARP&&c!==CHAR_AMPERSAND&&c!==CHAR_ASTERISK&&c!==CHAR_EXCLAMATION&&c!==CHAR_VERTICAL_LINE&&c!==CHAR_EQUALS&&c!==CHAR_GREATER_THAN&&c!==CHAR_SINGLE_QUOTE&&c!==CHAR_DOUBLE_QUOTE&&c!==CHAR_PERCENT&&c!==CHAR_COMMERCIAL_AT&&c!==CHAR_GRAVE_ACCENT}function isPlainSafeLast(c){return!isWhitespace(c)&&c!==CHAR_COLON}function codePointAt(string,pos){var first=string.charCodeAt(pos),second;return first>=55296&&first<=56319&&pos+1<string.length&&(second=string.charCodeAt(pos+1),second>=56320&&second<=57343)?(first-55296)*1024+second-56320+65536:first}function needIndentIndicator(string){return/^\n* /.test(string)}var STYLE_PLAIN=1,STYLE_SINGLE=2,STYLE_LITERAL=3,STYLE_FOLDED=4,STYLE_DOUBLE=5;function chooseScalarStyle(string,singleLineOnly,indentPerLevel,lineWidth,testAmbiguousType,quotingType,forceQuotes,inblock){var i,char=0,prevChar=null,hasLineBreak=!1,hasFoldableLine=!1,shouldTrackWidth=lineWidth!==-1,previousLineBreak=-1,plain=isPlainSafeFirst(codePointAt(string,0))&&isPlainSafeLast(codePointAt(string,string.length-1));if(singleLineOnly||forceQuotes)for(i=0;i<string.length;char>=65536?i+=2:i++){if(char=codePointAt(string,i),!isPrintable(char))return STYLE_DOUBLE;plain&&=isPlainSafe(char,prevChar,inblock),prevChar=char}else{for(i=0;i<string.length;char>=65536?i+=2:i++){if(char=codePointAt(string,i),char===CHAR_LINE_FEED)hasLineBreak=!0,shouldTrackWidth&&(hasFoldableLine||=i-previousLineBreak-1>lineWidth&&string[previousLineBreak+1]!==` `,previousLineBreak=i);else if(!isPrintable(char))return STYLE_DOUBLE;plain&&=isPlainSafe(char,prevChar,inblock),prevChar=char}hasFoldableLine||=shouldTrackWidth&&i-previousLineBreak-1>lineWidth&&string[previousLineBreak+1]!==` `}return!hasLineBreak&&!hasFoldableLine?plain&&!forceQuotes&&!testAmbiguousType(string)?STYLE_PLAIN:quotingType===QUOTING_TYPE_DOUBLE?STYLE_DOUBLE:STYLE_SINGLE:indentPerLevel>9&&needIndentIndicator(string)?STYLE_DOUBLE:forceQuotes?quotingType===QUOTING_TYPE_DOUBLE?STYLE_DOUBLE:STYLE_SINGLE:hasFoldableLine?STYLE_FOLDED:STYLE_LITERAL}function writeScalar(state,string,level,iskey,inblock){state.dump=function(){if(string.length===0)return state.quotingType===QUOTING_TYPE_DOUBLE?`""`:`''`;if(!state.noCompatMode&&(DEPRECATED_BOOLEANS_SYNTAX.indexOf(string)!==-1||DEPRECATED_BASE60_SYNTAX.test(string)))return state.quotingType===QUOTING_TYPE_DOUBLE?`"`+string+`"`:`'`+string+`'`;var indent=state.indent*Math.max(1,level),lineWidth=state.lineWidth===-1?-1:Math.max(Math.min(state.lineWidth,40),state.lineWidth-indent),singleLineOnly=iskey||state.flowLevel>-1&&level>=state.flowLevel;function testAmbiguity(string$1){return testImplicitResolving(state,string$1)}switch(chooseScalarStyle(string,singleLineOnly,state.indent,lineWidth,testAmbiguity,state.quotingType,state.forceQuotes&&!iskey,inblock)){case STYLE_PLAIN:return string;case STYLE_SINGLE:return`'`+string.replace(/'/g,`''`)+`'`;case STYLE_LITERAL:return`|`+blockHeader(string,state.indent)+dropEndingNewline(indentString(string,indent));case STYLE_FOLDED:return`>`+blockHeader(string,state.indent)+dropEndingNewline(indentString(foldString(string,lineWidth),indent));case STYLE_DOUBLE:return`"`+escapeString(string,lineWidth)+`"`;default:throw new YAMLException(`impossible error: invalid scalar style`)}}()}function blockHeader(string,indentPerLevel){var indentIndicator=needIndentIndicator(string)?String(indentPerLevel):``,clip=string[string.length-1]===`
|
|
28
|
+
`;return indentIndicator+(clip&&(string[string.length-2]===`
|
|
29
|
+
`||string===`
|
|
30
|
+
`)?`+`:clip?``:`-`)+`
|
|
31
|
+
`}function dropEndingNewline(string){return string[string.length-1]===`
|
|
32
|
+
`?string.slice(0,-1):string}function foldString(string,width){for(var lineRe=/(\n+)([^\n]*)/g,result=function(){var nextLF=string.indexOf(`
|
|
33
|
+
`);return nextLF=nextLF===-1?string.length:nextLF,lineRe.lastIndex=nextLF,foldLine(string.slice(0,nextLF),width)}(),prevMoreIndented=string[0]===`
|
|
34
|
+
`||string[0]===` `,moreIndented,match;match=lineRe.exec(string);){var prefix=match[1],line=match[2];moreIndented=line[0]===` `,result+=prefix+(!prevMoreIndented&&!moreIndented&&line!==``?`
|
|
35
|
+
`:``)+foldLine(line,width),prevMoreIndented=moreIndented}return result}function foldLine(line,width){if(line===``||line[0]===` `)return line;for(var breakRe=/ [^ ]/g,match,start=0,end,curr=0,next=0,result=``;match=breakRe.exec(line);)next=match.index,next-start>width&&(end=curr>start?curr:next,result+=`
|
|
36
|
+
`+line.slice(start,end),start=end+1),curr=next;return result+=`
|
|
37
|
+
`,line.length-start>width&&curr>start?result+=line.slice(start,curr)+`
|
|
38
|
+
`+line.slice(curr+1):result+=line.slice(start),result.slice(1)}function escapeString(string){for(var result=``,char=0,escapeSeq,i=0;i<string.length;char>=65536?i+=2:i++)char=codePointAt(string,i),escapeSeq=ESCAPE_SEQUENCES[char],!escapeSeq&&isPrintable(char)?(result+=string[i],char>=65536&&(result+=string[i+1])):result+=escapeSeq||encodeHex(char);return result}function writeFlowSequence(state,level,object){var _result=``,_tag=state.tag,index,length,value;for(index=0,length=object.length;index<length;index+=1)value=object[index],state.replacer&&(value=state.replacer.call(object,String(index),value)),(writeNode(state,level,value,!1,!1)||value===void 0&&writeNode(state,level,null,!1,!1))&&(_result!==``&&(_result+=`,`+(state.condenseFlow?``:` `)),_result+=state.dump);state.tag=_tag,state.dump=`[`+_result+`]`}function writeBlockSequence(state,level,object,compact){var _result=``,_tag=state.tag,index,length,value;for(index=0,length=object.length;index<length;index+=1)value=object[index],state.replacer&&(value=state.replacer.call(object,String(index),value)),(writeNode(state,level+1,value,!0,!0,!1,!0)||value===void 0&&writeNode(state,level+1,null,!0,!0,!1,!0))&&((!compact||_result!==``)&&(_result+=generateNextLine(state,level)),state.dump&&CHAR_LINE_FEED===state.dump.charCodeAt(0)?_result+=`-`:_result+=`- `,_result+=state.dump);state.tag=_tag,state.dump=_result||`[]`}function writeFlowMapping(state,level,object){var _result=``,_tag=state.tag,objectKeyList=Object.keys(object),index,length,objectKey,objectValue,pairBuffer;for(index=0,length=objectKeyList.length;index<length;index+=1)pairBuffer=``,_result!==``&&(pairBuffer+=`, `),state.condenseFlow&&(pairBuffer+=`"`),objectKey=objectKeyList[index],objectValue=object[objectKey],state.replacer&&(objectValue=state.replacer.call(object,objectKey,objectValue)),writeNode(state,level,objectKey,!1,!1)&&(state.dump.length>1024&&(pairBuffer+=`? `),pairBuffer+=state.dump+(state.condenseFlow?`"`:``)+`:`+(state.condenseFlow?``:` `),writeNode(state,level,objectValue,!1,!1)&&(pairBuffer+=state.dump,_result+=pairBuffer));state.tag=_tag,state.dump=`{`+_result+`}`}function writeBlockMapping(state,level,object,compact){var _result=``,_tag=state.tag,objectKeyList=Object.keys(object),index,length,objectKey,objectValue,explicitPair,pairBuffer;if(state.sortKeys===!0)objectKeyList.sort();else if(typeof state.sortKeys==`function`)objectKeyList.sort(state.sortKeys);else if(state.sortKeys)throw new YAMLException(`sortKeys must be a boolean or a function`);for(index=0,length=objectKeyList.length;index<length;index+=1)pairBuffer=``,(!compact||_result!==``)&&(pairBuffer+=generateNextLine(state,level)),objectKey=objectKeyList[index],objectValue=object[objectKey],state.replacer&&(objectValue=state.replacer.call(object,objectKey,objectValue)),writeNode(state,level+1,objectKey,!0,!0,!0)&&(explicitPair=state.tag!==null&&state.tag!==`?`||state.dump&&state.dump.length>1024,explicitPair&&(state.dump&&CHAR_LINE_FEED===state.dump.charCodeAt(0)?pairBuffer+=`?`:pairBuffer+=`? `),pairBuffer+=state.dump,explicitPair&&(pairBuffer+=generateNextLine(state,level)),writeNode(state,level+1,objectValue,!0,explicitPair)&&(state.dump&&CHAR_LINE_FEED===state.dump.charCodeAt(0)?pairBuffer+=`:`:pairBuffer+=`: `,pairBuffer+=state.dump,_result+=pairBuffer));state.tag=_tag,state.dump=_result||`{}`}function detectType(state,object,explicit){var _result,typeList=explicit?state.explicitTypes:state.implicitTypes,index,length,type,style;for(index=0,length=typeList.length;index<length;index+=1)if(type=typeList[index],(type.instanceOf||type.predicate)&&(!type.instanceOf||typeof object==`object`&&object instanceof type.instanceOf)&&(!type.predicate||type.predicate(object))){if(explicit?type.multi&&type.representName?state.tag=type.representName(object):state.tag=type.tag:state.tag=`?`,type.represent){if(style=state.styleMap[type.tag]||type.defaultStyle,_toString.call(type.represent)===`[object Function]`)_result=type.represent(object,style);else if(_hasOwnProperty.call(type.represent,style))_result=type.represent[style](object,style);else throw new YAMLException(`!<`+type.tag+`> tag resolver accepts not "`+style+`" style`);state.dump=_result}return!0}return!1}function writeNode(state,level,object,block,compact,iskey,isblockseq){state.tag=null,state.dump=object,detectType(state,object,!1)||detectType(state,object,!0);var type=_toString.call(state.dump),inblock=block,tagStr;block&&=state.flowLevel<0||state.flowLevel>level;var objectOrArray=type===`[object Object]`||type===`[object Array]`,duplicateIndex,duplicate;if(objectOrArray&&(duplicateIndex=state.duplicates.indexOf(object),duplicate=duplicateIndex!==-1),(state.tag!==null&&state.tag!==`?`||duplicate||state.indent!==2&&level>0)&&(compact=!1),duplicate&&state.usedDuplicates[duplicateIndex])state.dump=`*ref_`+duplicateIndex;else{if(objectOrArray&&duplicate&&!state.usedDuplicates[duplicateIndex]&&(state.usedDuplicates[duplicateIndex]=!0),type===`[object Object]`)block&&Object.keys(state.dump).length!==0?(writeBlockMapping(state,level,state.dump,compact),duplicate&&(state.dump=`&ref_`+duplicateIndex+state.dump)):(writeFlowMapping(state,level,state.dump),duplicate&&(state.dump=`&ref_`+duplicateIndex+` `+state.dump));else if(type===`[object Array]`)block&&state.dump.length!==0?(state.noArrayIndent&&!isblockseq&&level>0?writeBlockSequence(state,level-1,state.dump,compact):writeBlockSequence(state,level,state.dump,compact),duplicate&&(state.dump=`&ref_`+duplicateIndex+state.dump)):(writeFlowSequence(state,level,state.dump),duplicate&&(state.dump=`&ref_`+duplicateIndex+` `+state.dump));else if(type===`[object String]`)state.tag!==`?`&&writeScalar(state,state.dump,level,iskey,inblock);else if(type===`[object Undefined]`)return!1;else{if(state.skipInvalid)return!1;throw new YAMLException(`unacceptable kind of an object to dump `+type)}state.tag!==null&&state.tag!==`?`&&(tagStr=encodeURI(state.tag[0]===`!`?state.tag.slice(1):state.tag).replace(/!/g,`%21`),tagStr=state.tag[0]===`!`?`!`+tagStr:tagStr.slice(0,18)===`tag:yaml.org,2002:`?`!!`+tagStr.slice(18):`!<`+tagStr+`>`,state.dump=tagStr+` `+state.dump)}return!0}function getDuplicateReferences(object,state){var objects=[],duplicatesIndexes=[],index,length;for(inspectNode(object,objects,duplicatesIndexes),index=0,length=duplicatesIndexes.length;index<length;index+=1)state.duplicates.push(objects[duplicatesIndexes[index]]);state.usedDuplicates=Array(length)}function inspectNode(object,objects,duplicatesIndexes){var objectKeyList,index,length;if(typeof object==`object`&&object)if(index=objects.indexOf(object),index!==-1)duplicatesIndexes.indexOf(index)===-1&&duplicatesIndexes.push(index);else if(objects.push(object),Array.isArray(object))for(index=0,length=object.length;index<length;index+=1)inspectNode(object[index],objects,duplicatesIndexes);else for(objectKeyList=Object.keys(object),index=0,length=objectKeyList.length;index<length;index+=1)inspectNode(object[objectKeyList[index]],objects,duplicatesIndexes)}function dump(input,options){options||={};var state=new State(options);state.noRefs||getDuplicateReferences(input,state);var value=input;return state.replacer&&(value=state.replacer.call({"":value},``,value)),writeNode(state,0,value,!0,!0)?state.dump+`
|
|
39
|
+
`:``}module.exports.dump=dump})),require_js_yaml=require_chunk.t(((exports,module)=>{var loader=require_loader(),dumper=require_dumper();function renamed(from,to){return function(){throw Error(`Function yaml.`+from+` is removed in js-yaml 4. Use yaml.`+to+` instead, which is now safe by default.`)}}module.exports.Type=require_type(),module.exports.Schema=require_schema(),module.exports.FAILSAFE_SCHEMA=require_failsafe(),module.exports.JSON_SCHEMA=require_json(),module.exports.CORE_SCHEMA=require_core(),module.exports.DEFAULT_SCHEMA=require_default(),module.exports.load=loader.load,module.exports.loadAll=loader.loadAll,module.exports.dump=dumper.dump,module.exports.YAMLException=require_exception(),module.exports.types={binary:require_binary(),float:require_float(),map:require_map(),null:require_null(),pairs:require_pairs(),set:require_set(),timestamp:require_timestamp(),bool:require_bool(),int:require_int(),merge:require_merge(),omap:require_omap(),seq:require_seq(),str:require_str()},module.exports.safeLoad=renamed(`safeLoad`,`load`),module.exports.safeLoadAll=renamed(`safeLoadAll`,`loadAll`),module.exports.safeDump=renamed(`safeDump`,`dump`)})),require_hjson_common=require_chunk.t(((exports,module)=>{var os$2=require(`os`);function tryParseNumber(text,stopAtNext){var number,string=``,leadingZeros=0,testLeading=!0,at=0,ch;function next(){return ch=text.charAt(at),at++,ch}for(next(),ch===`-`&&(string=`-`,next());ch>=`0`&&ch<=`9`;)testLeading&&(ch==`0`?leadingZeros++:testLeading=!1),string+=ch,next();if(testLeading&&leadingZeros--,ch===`.`)for(string+=`.`;next()&&ch>=`0`&&ch<=`9`;)string+=ch;if(ch===`e`||ch===`E`)for(string+=ch,next(),(ch===`-`||ch===`+`)&&(string+=ch,next());ch>=`0`&&ch<=`9`;)string+=ch,next();for(;ch&&ch<=` `;)next();if(stopAtNext&&(ch===`,`||ch===`}`||ch===`]`||ch===`#`||ch===`/`&&(text[at]===`/`||text[at]===`*`))&&(ch=0),number=+string,!(ch||leadingZeros||!isFinite(number)))return number}function createComment(value,comment){return Object.defineProperty&&Object.defineProperty(value,`__COMMENTS__`,{enumerable:!1,writable:!0}),value.__COMMENTS__=comment||{}}function removeComment(value){Object.defineProperty(value,`__COMMENTS__`,{value:void 0})}function getComment(value){return value.__COMMENTS__}function forceComment(text){if(!text)return``;var a=text.split(`
|
|
40
|
+
`),str,i,j,len;for(j=0;j<a.length;j++)for(str=a[j],len=str.length,i=0;i<len;i++){var c=str[i];if(c===`#`)break;if(c===`/`&&(str[i+1]===`/`||str[i+1]===`*`)){str[i+1]===`*`&&(j=a.length);break}else if(c>` `){a[j]=`# `+str;break}}return a.join(`
|
|
41
|
+
`)}module.exports={EOL:os$2.EOL||`
|
|
42
|
+
`,tryParseNumber,createComment,removeComment,getComment,forceComment}})),require_hjson_version=require_chunk.t(((exports,module)=>{module.exports=`3.2.1`})),require_hjson_dsf=require_chunk.t(((exports,module)=>{function loadDsf(col,type){if(Object.prototype.toString.apply(col)!==`[object Array]`){if(col)throw Error(`dsf option must contain an array!`);return nopDsf}else if(col.length===0)return nopDsf;var dsf=[];function isFunction(f){return{}.toString.call(f)===`[object Function]`}return col.forEach(function(x){if(!x.name||!isFunction(x.parse)||!isFunction(x.stringify))throw Error(`extension does not match the DSF interface`);dsf.push(function(){try{if(type==`parse`)return x.parse.apply(null,arguments);if(type==`stringify`){var res=x.stringify.apply(null,arguments);if(res!==void 0&&(typeof res!=`string`||res.length===0||res[0]===`"`||[].some.call(res,function(c){return isInvalidDsfChar(c)})))throw Error(`value may not be empty, start with a quote or contain a punctuator character except colon: `+res);return res}else throw Error(`Invalid type`)}catch(e){throw Error(`DSF-`+x.name+` failed; `+e.message)}})}),runDsf.bind(null,dsf)}function runDsf(dsf,value){if(dsf)for(var i=0;i<dsf.length;i++){var res=dsf[i](value);if(res!==void 0)return res}}function nopDsf(){}function isInvalidDsfChar(c){return c===`{`||c===`}`||c===`[`||c===`]`||c===`,`}function math(){return{name:`math`,parse:function(value){switch(value){case`+inf`:case`inf`:case`+Inf`:case`Inf`:return 1/0;case`-inf`:case`-Inf`:return-1/0;case`nan`:case`NaN`:return NaN}},stringify:function(value){if(typeof value==`number`){if(1/value==-1/0)return`-0`;if(value===1/0)return`Inf`;if(value===-1/0)return`-Inf`;if(isNaN(value))return`NaN`}}}}math.description=`support for Inf/inf, -Inf/-inf, Nan/naN and -0`;function hex(opt){var out=opt&&opt.out;return{name:`hex`,parse:function(value){if(/^0x[0-9A-Fa-f]+$/.test(value))return parseInt(value,16)},stringify:function(value){if(out&&Number.isInteger(value))return`0x`+value.toString(16)}}}hex.description=`parse hexadecimal numbers prefixed with 0x`;function date(){return{name:`date`,parse:function(value){if(/^\d{4}-\d{2}-\d{2}$/.test(value)||/^\d{4}-\d{2}-\d{2}T\d{2}\:\d{2}\:\d{2}(?:.\d+)(?:Z|[+-]\d{2}:\d{2})$/.test(value)){var dt=Date.parse(value);if(!isNaN(dt))return new Date(dt)}},stringify:function(value){if(Object.prototype.toString.call(value)===`[object Date]`){var dt=value.toISOString();return dt.indexOf(`T00:00:00.000Z`,dt.length-14)===-1?dt:dt.substr(0,10)}}}}date.description=`support ISO dates`,module.exports={loadDsf,std:{math,hex,date}}})),require_hjson_parse=require_chunk.t(((exports,module)=>{module.exports=function(source,opt){var common=require_hjson_common(),dsf=require_hjson_dsf(),text,at,ch,escapee={'"':`"`,"'":`'`,"\\":`\\`,"/":`/`,b:`\b`,f:`\f`,n:`
|
|
43
|
+
`,r:`\r`,t:` `},keepComments,runDsf;function resetAt(){at=0,ch=` `}function isPunctuatorChar(c){return c===`{`||c===`}`||c===`[`||c===`]`||c===`,`||c===`:`}function error(m){var i,col=0,line=1;for(i=at-1;i>0&&text[i]!==`
|
|
44
|
+
`;i--,col++);for(;i>0;i--)text[i]===`
|
|
45
|
+
`&&line++;throw Error(m+` at line `+line+`,`+col+` >>>`+text.substr(at-col,20)+` ...`)}function next(){return ch=text.charAt(at),at++,ch}function peek(offs){return text.charAt(at+offs)}function string(allowML){for(var string$1=``,exitCh=ch;next();){if(ch===exitCh)return next(),allowML&&exitCh===`'`&&ch===`'`&&string$1.length===0?(next(),mlString()):string$1;if(ch===`\\`)if(next(),ch===`u`){for(var uffff=0,i=0;i<4;i++){next();var c=ch.charCodeAt(0),hex;ch>=`0`&&ch<=`9`?hex=c-48:ch>=`a`&&ch<=`f`?hex=c-97+10:ch>=`A`&&ch<=`F`?hex=c-65+10:error(`Bad \\u char `+ch),uffff=uffff*16+hex}string$1+=String.fromCharCode(uffff)}else if(typeof escapee[ch]==`string`)string$1+=escapee[ch];else break;else ch===`
|
|
46
|
+
`||ch===`\r`?error(`Bad string containing newline`):string$1+=ch}error(`Bad string`)}function mlString(){for(var string$1=``,triple=0,indent=0;;){var c=peek(-indent-5);if(!c||c===`
|
|
47
|
+
`)break;indent++}function skipIndent(){for(var skip=indent;ch&&ch<=` `&&ch!==`
|
|
48
|
+
`&&skip-- >0;)next()}for(;ch&&ch<=` `&&ch!==`
|
|
49
|
+
`;)next();for(ch===`
|
|
50
|
+
`&&(next(),skipIndent());;){if(!ch)error(`Bad multiline string`);else if(ch===`'`){if(triple++,next(),triple===3)return string$1.slice(-1)===`
|
|
51
|
+
`&&(string$1=string$1.slice(0,-1)),string$1;continue}else for(;triple>0;)string$1+=`'`,triple--;ch===`
|
|
52
|
+
`?(string$1+=`
|
|
53
|
+
`,next(),skipIndent()):(ch!==`\r`&&(string$1+=ch),next())}}function keyname(){if(ch===`"`||ch===`'`)return string(!1);for(var name=``,start=at,space=-1;;){if(ch===`:`)return name?space>=0&&space!==name.length&&(at=start+space,error(`Found whitespace in your key name (use quotes to include)`)):error(`Found ':' but no key name (for an empty key name use quotes)`),name;ch<=` `?ch?space<0&&(space=name.length):error(`Found EOF while looking for a key name (check your syntax)`):isPunctuatorChar(ch)?error(`Found '`+ch+`' where a key name was expected (check your syntax or use quotes if the key name includes {}[],: or whitespace)`):name+=ch,next()}}function white(){for(;ch;){for(;ch&&ch<=` `;)next();if(ch===`#`||ch===`/`&&peek(0)===`/`)for(;ch&&ch!==`
|
|
54
|
+
`;)next();else if(ch===`/`&&peek(0)===`*`){for(next(),next();ch&&!(ch===`*`&&peek(0)===`/`);)next();ch&&(next(),next())}else break}}function tfnns(){var value$1=ch;for(isPunctuatorChar(ch)&&error(`Found a punctuator character '`+ch+`' when expecting a quoteless string (check your syntax)`);;){next();var isEol=ch===`\r`||ch===`
|
|
55
|
+
`||ch===``;if(isEol||ch===`,`||ch===`}`||ch===`]`||ch===`#`||ch===`/`&&(peek(0)===`/`||peek(0)===`*`)){var chf=value$1[0];switch(chf){case`f`:if(value$1.trim()===`false`)return!1;break;case`n`:if(value$1.trim()===`null`)return null;break;case`t`:if(value$1.trim()===`true`)return!0;break;default:if(chf===`-`||chf>=`0`&&chf<=`9`){var n=common.tryParseNumber(value$1);if(n!==void 0)return n}}if(isEol){value$1=value$1.trim();var dsfValue=runDsf(value$1);return dsfValue===void 0?value$1:dsfValue}}value$1+=ch}}function getComment(cAt,first){var i;for(cAt--,i=at-2;i>cAt&&text[i]<=` `&&text[i]!==`
|
|
56
|
+
`;i--);text[i]===`
|
|
57
|
+
`&&i--,text[i]===`\r`&&i--;var res=text.substr(cAt,i-cAt+1);for(i=0;i<res.length;i++)if(res[i]>` `){var j=res.indexOf(`
|
|
58
|
+
`);if(j>=0){var c=[res.substr(0,j),res.substr(j+1)];return first&&c[0].trim().length===0&&c.shift(),c}else return[res]}return[]}function errorClosingHint(value$1){function search(value$2,ch$1){var i,k,length,res;switch(typeof value$2){case`string`:value$2.indexOf(ch$1)>=0&&(res=value$2);break;case`object`:if(Object.prototype.toString.apply(value$2)===`[object Array]`)for(i=0,length=value$2.length;i<length;i++)res=search(value$2[i],ch$1)||res;else for(k in value$2)Object.prototype.hasOwnProperty.call(value$2,k)&&(res=search(value$2[k],ch$1)||res)}return res}function report(ch$1){var possibleErr=search(value$1,ch$1);return possibleErr?`found '`+ch$1+`' in a string value, your mistake could be with:
|
|
59
|
+
> `+possibleErr+`
|
|
60
|
+
(unquoted strings contain everything up to the next line!)`:``}return report(`}`)||report(`]`)}function array(){var array$1=[],comments,cAt,nextComment;try{if(keepComments&&(comments=common.createComment(array$1,{a:[]})),next(),cAt=at,white(),comments&&(nextComment=getComment(cAt,!0).join(`
|
|
61
|
+
`)),ch===`]`)return next(),comments&&(comments.e=[nextComment]),array$1;for(;ch;){if(array$1.push(value()),cAt=at,white(),ch===`,`&&(next(),cAt=at,white()),comments){var c=getComment(cAt);comments.a.push([nextComment||``,c[0]||``]),nextComment=c[1]}if(ch===`]`)return next(),comments&&(comments.a[comments.a.length-1][1]+=nextComment||``),array$1;white()}error(`End of input while parsing an array (missing ']')`)}catch(e){throw e.hint=e.hint||errorClosingHint(array$1),e}}function object(withoutBraces){var key=``,object$1={},comments,cAt,nextComment;try{if(keepComments&&(comments=common.createComment(object$1,{c:{},o:[]})),withoutBraces?cAt=1:(next(),cAt=at),white(),comments&&(nextComment=getComment(cAt,!0).join(`
|
|
62
|
+
`)),ch===`}`&&!withoutBraces)return comments&&(comments.e=[nextComment]),next(),object$1;for(;ch;){if(key=keyname(),white(),ch!==`:`&&error(`Expected ':' instead of '`+ch+`'`),next(),object$1[key]=value(),cAt=at,white(),ch===`,`&&(next(),cAt=at,white()),comments){var c=getComment(cAt);comments.c[key]=[nextComment||``,c[0]||``],nextComment=c[1],comments.o.push(key)}if(ch===`}`&&!withoutBraces)return next(),comments&&(comments.c[key][1]+=nextComment||``),object$1;white()}if(withoutBraces)return object$1;error(`End of input while parsing an object (missing '}')`)}catch(e){throw e.hint=e.hint||errorClosingHint(object$1),e}}function value(){switch(white(),ch){case`{`:return object();case`[`:return array();case`'`:case`"`:return string(!0);default:return tfnns()}}function checkTrailing(v,c){var cAt=at;if(white(),ch&&error(`Syntax error, found trailing characters`),keepComments){var b=c.join(`
|
|
63
|
+
`),a=getComment(cAt).join(`
|
|
64
|
+
`);if(a||b){var comments=common.createComment(v,common.getComment(v));comments.r=[b,a]}}return v}function rootValue(){white();var c=keepComments?getComment(1):null;switch(ch){case`{`:return checkTrailing(object(),c);case`[`:return checkTrailing(array(),c);default:return checkTrailing(value(),c)}}function legacyRootValue(){white();var c=keepComments?getComment(1):null;switch(ch){case`{`:return checkTrailing(object(),c);case`[`:return checkTrailing(array(),c)}try{return checkTrailing(object(!0),c)}catch(e){resetAt();try{return checkTrailing(value(),c)}catch{throw e}}}if(typeof source!=`string`)throw Error(`source is not a string`);var dsfDef=null,legacyRoot=!0;return opt&&typeof opt==`object`&&(keepComments=opt.keepWsc,dsfDef=opt.dsf,legacyRoot=opt.legacyRoot!==!1),runDsf=dsf.loadDsf(dsfDef,`parse`),text=source,resetAt(),legacyRoot?legacyRootValue():rootValue()}})),require_hjson_stringify=require_chunk.t(((exports,module)=>{module.exports=function(data,opt){var common=require_hjson_common(),dsf=require_hjson_dsf(),plainToken={obj:[`{`,`}`],arr:[`[`,`]`],key:[``,``],qkey:[`"`,`"`],col:[`:`,``],com:[`,`,``],str:[``,``],qstr:[`"`,`"`],mstr:[`'''`,`'''`],num:[``,``],lit:[``,``],dsf:[``,``],esc:[`\\`,``],uni:[`\\u`,``],rem:[``,``]},eol=common.EOL,indent=` `,keepComments=!1,bracesSameLine=!1,quoteKeys=!1,quoteStrings=!1,condense=0,multiline=1,separator=``,dsfDef=null,sortProps=!1,token=plainToken;if(opt&&typeof opt==`object`){opt.quotes=opt.quotes===`always`?`strings`:opt.quotes,(opt.eol===`
|
|
65
|
+
`||opt.eol===`\r
|
|
66
|
+
`)&&(eol=opt.eol),keepComments=opt.keepWsc,condense=opt.condense||0,bracesSameLine=opt.bracesSameLine,quoteKeys=opt.quotes===`all`||opt.quotes===`keys`,quoteStrings=opt.quotes===`all`||opt.quotes===`strings`||opt.separator===!0,multiline=quoteStrings||opt.multiline==`off`?0:opt.multiline==`no-tabs`?2:1,separator=opt.separator===!0?token.com[0]:``,dsfDef=opt.dsf,sortProps=opt.sortProps,typeof opt.space==`number`?indent=Array(opt.space+1).join(` `):typeof opt.space==`string`&&(indent=opt.space),opt.colors===!0&&(token={obj:[`\x1B[37m{\x1B[0m`,`\x1B[37m}\x1B[0m`],arr:[`\x1B[37m[\x1B[0m`,`\x1B[37m]\x1B[0m`],key:[`\x1B[33m`,`\x1B[0m`],qkey:[`\x1B[33m"`,`"\x1B[0m`],col:[`\x1B[37m:\x1B[0m`,``],com:[`\x1B[37m,\x1B[0m`,``],str:[`\x1B[37;1m`,`\x1B[0m`],qstr:[`\x1B[37;1m"`,`"\x1B[0m`],mstr:[`\x1B[37;1m'''`,`'''\x1B[0m`],num:[`\x1B[36;1m`,`\x1B[0m`],lit:[`\x1B[36m`,`\x1B[0m`],dsf:[`\x1B[37m`,`\x1B[0m`],esc:[`\x1B[31m\\`,`\x1B[0m`],uni:[`\x1B[31m\\u`,`\x1B[0m`],rem:[`\x1B[35m`,`\x1B[0m`]});var i,ckeys=Object.keys(plainToken);for(i=ckeys.length-1;i>=0;i--){var k=ckeys[i];token[k].push(plainToken[k][0].length,plainToken[k][1].length)}}var runDsf,commonRange=`--឴឵-\u2028- --`,needsEscape=RegExp(`[\\\\\\"\0-`+commonRange+`]`,`g`),needsQuotes=RegExp(`^\\s|^"|^'|^#|^\\/\\*|^\\/\\/|^\\{|^\\}|^\\[|^\\]|^:|^,|\\s$|[\0-`+commonRange+`]`,`g`),needsEscapeML=RegExp(`'''|^[\\s]+$|[\0-`+(multiline===2?` `:`\b`)+`\v\f-`+commonRange+`]`,`g`),startsWithKeyword=RegExp(`^(true|false|null)\\s*((,|\\]|\\}|#|//|/\\*).*)?$`),meta={"\b":`b`," ":`t`,"\n":`n`,"\f":`f`,"\r":`r`,'"':`"`,"\\":`\\`},needsEscapeName=/[,\{\[\}\]\s:#"']|\/\/|\/\*/,gap=``,wrapLen=0;function wrap(tk,v){return wrapLen+=tk[0].length+tk[1].length-tk[2]-tk[3],tk[0]+v+tk[1]}function quoteReplace(string){return string.replace(needsEscape,function(a){var c=meta[a];return typeof c==`string`?wrap(token.esc,c):wrap(token.uni,(`0000`+a.charCodeAt(0).toString(16)).slice(-4))})}function quote(string,gap$1,hasComment,isRootObject){return string?(needsQuotes.lastIndex=0,startsWithKeyword.lastIndex=0,quoteStrings||hasComment||needsQuotes.test(string)||common.tryParseNumber(string,!0)!==void 0||startsWithKeyword.test(string)?(needsEscape.lastIndex=0,needsEscapeML.lastIndex=0,needsEscape.test(string)?!needsEscapeML.test(string)&&!isRootObject&&multiline?mlString(string,gap$1):wrap(token.qstr,quoteReplace(string)):wrap(token.qstr,string)):wrap(token.str,string)):wrap(token.qstr,``)}function mlString(string,gap$1){var i$1,a=string.replace(/\r/g,``).split(`
|
|
67
|
+
`);if(gap$1+=indent,a.length===1)return wrap(token.mstr,a[0]);var res$1=eol+gap$1+token.mstr[0];for(i$1=0;i$1<a.length;i$1++)res$1+=eol,a[i$1]&&(res$1+=gap$1+a[i$1]);return res$1+eol+gap$1+token.mstr[1]}function quoteKey(name){return name?quoteKeys||needsEscapeName.test(name)?(needsEscape.lastIndex=0,wrap(token.qkey,needsEscape.test(name)?quoteReplace(name):name)):wrap(token.key,name):`""`}function str(value,hasComment,noIndent,isRootObject){function startsWithNL(str$1){return str$1&&str$1[str$1[0]===`\r`?1:0]===`
|
|
68
|
+
`}function commentOnThisLine(str$1){return str$1&&!startsWithNL(str$1)}function makeComment(str$1,prefix$1,trim){if(!str$1)return``;str$1=common.forceComment(str$1);var i$2,len=str$1.length;for(i$2=0;i$2<len&&str$1[i$2]<=` `;i$2++);return trim&&i$2>0&&(str$1=str$1.substr(i$2)),i$2<len?prefix$1+wrap(token.rem,str$1):str$1}var dsfValue=runDsf(value);if(dsfValue!==void 0)return wrap(token.dsf,dsfValue);switch(typeof value){case`string`:return quote(value,gap,hasComment,isRootObject);case`number`:return isFinite(value)?wrap(token.num,String(value)):wrap(token.lit,`null`);case`boolean`:return wrap(token.lit,String(value));case`object`:if(!value)return wrap(token.lit,`null`);var comments$1;keepComments&&(comments$1=common.getComment(value));var isArray=Object.prototype.toString.apply(value)===`[object Array]`,mind=gap;gap+=indent;var eolMind=eol+mind,eolGap=eol+gap,prefix=noIndent||bracesSameLine?``:eolMind,partial=[],setsep,cpartial=condense?[]:null,saveQuoteStrings=quoteStrings,saveMultiline=multiline,iseparator=separator?``:token.com[0],cwrapLen=0,i$1,length,k$1,v,vs,c,ca,res$1,cres;if(isArray){for(i$1=0,length=value.length;i$1<length;i$1++){if(setsep=i$1<length-1,comments$1?(c=comments$1.a[i$1]||[],ca=commentOnThisLine(c[1]),partial.push(makeComment(c[0],`
|
|
69
|
+
`)+eolGap),cpartial&&(c[0]||c[1]||ca)&&(cpartial=null)):partial.push(eolGap),wrapLen=0,v=value[i$1],partial.push(str(v,comments$1?ca:!1,!0)+(setsep?separator:``)),cpartial){switch(typeof v){case`string`:wrapLen=0,quoteStrings=!0,multiline=0,cpartial.push(str(v,!1,!0)+(setsep?token.com[0]:``)),quoteStrings=saveQuoteStrings,multiline=saveMultiline;break;case`object`:if(v){cpartial=null;break}default:cpartial.push(partial[partial.length-1]+(setsep?iseparator:``));break}setsep&&(wrapLen+=token.com[0].length-token.com[2]),cwrapLen+=wrapLen}comments$1&&c[1]&&partial.push(makeComment(c[1],ca?` `:`
|
|
70
|
+
`,ca))}length===0?comments$1&&comments$1.e&&partial.push(makeComment(comments$1.e[0],`
|
|
71
|
+
`)+eolMind):partial.push(eolMind),partial.length===0?res$1=wrap(token.arr,``):(res$1=prefix+wrap(token.arr,partial.join(``)),cpartial&&(cres=cpartial.join(` `),cres.length-cwrapLen<=condense&&(res$1=wrap(token.arr,cres))))}else{var commentKeys=comments$1?comments$1.o.slice():[],objectKeys=[];for(k$1 in value)Object.prototype.hasOwnProperty.call(value,k$1)&&commentKeys.indexOf(k$1)<0&&objectKeys.push(k$1);sortProps&&objectKeys.sort();var keys=commentKeys.concat(objectKeys);for(i$1=0,length=keys.length;i$1<length;i$1++)if(setsep=i$1<length-1,k$1=keys[i$1],comments$1?(c=comments$1.c[k$1]||[],ca=commentOnThisLine(c[1]),partial.push(makeComment(c[0],`
|
|
72
|
+
`)+eolGap),cpartial&&(c[0]||c[1]||ca)&&(cpartial=null)):partial.push(eolGap),wrapLen=0,v=value[k$1],vs=str(v,comments$1&&ca),partial.push(quoteKey(k$1)+token.col[0]+(startsWithNL(vs)?``:` `)+vs+(setsep?separator:``)),comments$1&&c[1]&&partial.push(makeComment(c[1],ca?` `:`
|
|
73
|
+
`,ca)),cpartial){switch(typeof v){case`string`:wrapLen=0,quoteStrings=!0,multiline=0,vs=str(v,!1),quoteStrings=saveQuoteStrings,multiline=saveMultiline,cpartial.push(quoteKey(k$1)+token.col[0]+` `+vs+(setsep?token.com[0]:``));break;case`object`:if(v){cpartial=null;break}default:cpartial.push(partial[partial.length-1]+(setsep?iseparator:``));break}wrapLen+=token.col[0].length-token.col[2],setsep&&(wrapLen+=token.com[0].length-token.com[2]),cwrapLen+=wrapLen}length===0?comments$1&&comments$1.e&&partial.push(makeComment(comments$1.e[0],`
|
|
74
|
+
`)+eolMind):partial.push(eolMind),partial.length===0?res$1=wrap(token.obj,``):(res$1=prefix+wrap(token.obj,partial.join(``)),cpartial&&(cres=cpartial.join(` `),cres.length-cwrapLen<=condense&&(res$1=wrap(token.obj,cres))))}return gap=mind,res$1}}runDsf=dsf.loadDsf(dsfDef,`stringify`);var res=``,comments=keepComments?comments=(common.getComment(data)||{}).r:null;return comments&&comments[0]&&(res=comments[0]+`
|
|
75
|
+
`),res+=str(data,null,!0,!0),comments&&(res+=comments[1]||``),res}})),require_hjson_comments=require_chunk.t(((exports,module)=>{var common=require_hjson_common();function makeComment(b,a,x){var c;return b&&(c={b}),a&&((c||={}).a=a),x&&((c||={}).x=x),c}function extractComments(value,root){if(!(typeof value!=`object`||!value)){var comments=common.getComment(value);comments&&common.removeComment(value);var i,length,any,res;if(Object.prototype.toString.apply(value)===`[object Array]`){for(res={a:{}},i=0,length=value.length;i<length;i++)saveComment(res.a,i,comments.a[i],extractComments(value[i]))&&(any=!0);!any&&comments.e&&(res.e=makeComment(comments.e[0],comments.e[1]),any=!0)}else{res={s:{}};var keys,currentKeys=Object.keys(value);for(comments&&comments.o?(keys=[],comments.o.concat(currentKeys).forEach(function(key$1){Object.prototype.hasOwnProperty.call(value,key$1)&&keys.indexOf(key$1)<0&&keys.push(key$1)})):keys=currentKeys,res.o=keys,i=0,length=keys.length;i<length;i++){var key=keys[i];saveComment(res.s,key,comments.c[key],extractComments(value[key]))&&(any=!0)}!any&&comments.e&&(res.e=makeComment(comments.e[0],comments.e[1]),any=!0)}return root&&comments&&comments.r&&(res.r=makeComment(comments.r[0],comments.r[1])),any?res:void 0}}function mergeStr(){var res=``;return[].forEach.call(arguments,function(c){c&&c.trim()!==``&&(res&&(res+=`; `),res+=c.trim())}),res}function mergeComments(comments,value){var dropped=[];if(merge(comments,value,dropped,[]),dropped.length>0){var text=rootComment(value,null,1);text+=`
|
|
76
|
+
# Orphaned comments:
|
|
77
|
+
`,dropped.forEach(function(c){text+=(`# `+c.path.join(`/`)+`: `+mergeStr(c.b,c.a,c.e)).replace(`
|
|
78
|
+
`,`\\n `)+`
|
|
79
|
+
`}),rootComment(value,text,1)}}function saveComment(res,key,item,col){var c=makeComment(item?item[0]:void 0,item?item[1]:void 0,col);return c&&(res[key]=c),c}function droppedComment(path$7,c){var res=makeComment(c.b,c.a);return res.path=path$7,res}function dropAll(comments,dropped,path$7){if(comments){var i,length;if(comments.a)for(i=0,length=comments.a.length;i<length;i++){var kpath=path$7.slice().concat([i]),c=comments.a[i];c&&(dropped.push(droppedComment(kpath,c)),dropAll(c.x,dropped,kpath))}else comments.o&&comments.o.forEach(function(key){var kpath$1=path$7.slice().concat([key]),c$1=comments.s[key];c$1&&(dropped.push(droppedComment(kpath$1,c$1)),dropAll(c$1.x,dropped,kpath$1))});comments.e&&dropped.push(droppedComment(path$7,comments.e))}}function merge(comments,value,dropped,path$7){if(comments){if(typeof value!=`object`||!value){dropAll(comments,dropped,path$7);return}var i,setComments=common.createComment(value);if(path$7.length===0&&comments.r&&(setComments.r=[comments.r.b,comments.r.a]),Object.prototype.toString.apply(value)===`[object Array]`){setComments.a=[];var a=comments.a||{};for(var key in a)if(a.hasOwnProperty(key)){i=parseInt(key);var c=comments.a[key];if(c){var kpath=path$7.slice().concat([i]);i<value.length?(setComments.a[i]=[c.b,c.a],merge(c.x,value[i],dropped,kpath)):(dropped.push(droppedComment(kpath,c)),dropAll(c.x,dropped,kpath))}}i===0&&comments.e&&(setComments.e=[comments.e.b,comments.e.a])}else setComments.c={},setComments.o=[],(comments.o||[]).forEach(function(key$1){var kpath$1=path$7.slice().concat([key$1]),c$1=comments.s[key$1];Object.prototype.hasOwnProperty.call(value,key$1)?(setComments.o.push(key$1),c$1&&(setComments.c[key$1]=[c$1.b,c$1.a],merge(c$1.x,value[key$1],dropped,kpath$1))):c$1&&(dropped.push(droppedComment(kpath$1,c$1)),dropAll(c$1.x,dropped,kpath$1))}),comments.e&&(setComments.e=[comments.e.b,comments.e.a])}}function rootComment(value,setText,header){var comment=common.createComment(value,common.getComment(value));return comment.r||=[``,``],(setText||setText===``)&&(comment.r[header]=common.forceComment(setText)),comment.r[header]||``}module.exports={extract:function(value){return extractComments(value,!0)},merge:mergeComments,header:function(value,setText){return rootComment(value,setText,0)},footer:function(value,setText){return rootComment(value,setText,1)}}})),require_hjson=require_chunk.t(((exports,module)=>{var common=require_hjson_common(),version=require_hjson_version(),parse=require_hjson_parse(),stringify=require_hjson_stringify();module.exports={parse,stringify,endOfLine:function(){return common.EOL},setEndOfLine:function(eol){(eol===`
|
|
80
|
+
`||eol===`\r
|
|
81
|
+
`)&&(common.EOL=eol)},version,rt:{parse:function(text,options){return(options||={}).keepWsc=!0,parse(text,options)},stringify:function(value,options){return(options||={}).keepWsc=!0,stringify(value,options)}},comments:require_hjson_comments(),dsf:require_hjson_dsf().std}})),require_cjs=require_chunk.t(((exports,module)=>{var isMergeableObject=function(value){return isNonNullObject(value)&&!isSpecial(value)};function isNonNullObject(value){return!!value&&typeof value==`object`}function isSpecial(value){var stringValue=Object.prototype.toString.call(value);return stringValue===`[object RegExp]`||stringValue===`[object Date]`||isReactElement(value)}var REACT_ELEMENT_TYPE=typeof Symbol==`function`&&Symbol.for?Symbol.for(`react.element`):60103;function isReactElement(value){return value.$$typeof===REACT_ELEMENT_TYPE}function emptyTarget(val){return Array.isArray(val)?[]:{}}function cloneUnlessOtherwiseSpecified(value,options){return options.clone!==!1&&options.isMergeableObject(value)?deepmerge(emptyTarget(value),value,options):value}function defaultArrayMerge(target,source,options){return target.concat(source).map(function(element){return cloneUnlessOtherwiseSpecified(element,options)})}function getMergeFunction(key,options){if(!options.customMerge)return deepmerge;var customMerge=options.customMerge(key);return typeof customMerge==`function`?customMerge:deepmerge}function getEnumerableOwnPropertySymbols(target){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(target).filter(function(symbol){return Object.propertyIsEnumerable.call(target,symbol)}):[]}function getKeys(target){return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))}function propertyIsOnObject(object,property){try{return property in object}catch{return!1}}function propertyIsUnsafe(target,key){return propertyIsOnObject(target,key)&&!(Object.hasOwnProperty.call(target,key)&&Object.propertyIsEnumerable.call(target,key))}function mergeObject(target,source,options){var destination={};return options.isMergeableObject(target)&&getKeys(target).forEach(function(key){destination[key]=cloneUnlessOtherwiseSpecified(target[key],options)}),getKeys(source).forEach(function(key){propertyIsUnsafe(target,key)||(propertyIsOnObject(target,key)&&options.isMergeableObject(source[key])?destination[key]=getMergeFunction(key,options)(target[key],source[key],options):destination[key]=cloneUnlessOtherwiseSpecified(source[key],options))}),destination}function deepmerge(target,source,options){options||={},options.arrayMerge=options.arrayMerge||defaultArrayMerge,options.isMergeableObject=options.isMergeableObject||isMergeableObject,options.cloneUnlessOtherwiseSpecified=cloneUnlessOtherwiseSpecified;var sourceIsArray=Array.isArray(source);return sourceIsArray===Array.isArray(target)?sourceIsArray?options.arrayMerge(target,source,options):mergeObject(target,source,options):cloneUnlessOtherwiseSpecified(source,options)}deepmerge.all=function(array,options){if(!Array.isArray(array))throw Error(`first argument should be an array`);return array.reduce(function(prev,next){return deepmerge(prev,next,options)},{})},module.exports=deepmerge})),require_util=require_chunk.t(((exports,module)=>{let fs$2=require(`fs`),path$4=require(`path`),yaml=require_js_yaml(),hjson=require_hjson(),deepmerge=require_cjs(),mkdirp=dir=>{dir||=``;let parts=path$4.resolve(dir).split(path$4.sep);for(let i=1;i<parts.length;i++){let segment=path$4.join(parts.slice(0,i+1).join(path$4.sep)+path$4.sep);fs$2.existsSync(segment)||fs$2.mkdirSync(segment)}},getProp=(obj,key)=>obj[Object.keys(obj).find(k=>k.toLowerCase()===key.toLowerCase())],getValue=(obj,key)=>(key||``).toString().split(`.`).filter(o=>o.trim()).reduce((o,i)=>o&&getProp(o,i),obj),setValue=(key,value,obj)=>{let parts=(key||``).split(`.`).filter(o=>o.trim());if(parts.length===0)return value;let result={...obj},node=result;for(;parts.length>1;){let k=parts.shift();node[k]=typeof node[k]==`object`?{...node[k]}:{},node=node[k]}return node[parts.shift()]=value,result},merge=(...objs)=>{let overwriteMerge=(destinationArray,sourceArray)=>sourceArray,objArray=[...objs].filter(Boolean);return deepmerge.all(objArray,{arrayMerge:overwriteMerge})},shake=obj=>{let shakeObject=o=>{for(let prop in o)o[prop]&&o[prop].constructor===Object?(o[prop]=shakeObject(o[prop]),Object.keys(o[prop]).length===0&&delete o[prop]):o[prop]??delete o[prop];return o};return shakeObject(obj)};module.exports={mkdirp,getValue,setValue,merge,loadFile:file=>{let contents=fs$2.readFileSync(file,`utf-8`).trim();if(contents)if(contents[0]===`{`)try{return{values:hjson.parse(contents),format:`json`}}catch{throw Error(`Cannot parse json`)}else try{return{values:yaml.load(contents,{json:!0}),format:`yaml`}}catch{throw Error(`Cannot parse yaml`)}return{values:{},format:`json`}},saveFile:(file,obj,format)=>{obj||={},mkdirp(path$4.dirname(file)),obj=shake(obj);let str;return str=Object.keys(obj).length===0?``:format===`json`?hjson.stringify(obj,{condense:!0,emitRootBraces:!0,separator:!0,bracesSameLine:!0,multiline:`off`}):yaml.dump(obj,{sortKeys:!0,lineWidth:1024,noCompatMode:!0}),fs$2.writeFileSync(file,str),!0}}})),require_Config=require_chunk.t(((exports,module)=>{let path$3=require(`path`),os$1=require(`os`),dotenv=require_dotenv(),debug=require_src$1()(`aio-cli-config`),{merge,loadFile,saveFile,getValue,setValue}=require_util(),readFile=file=>{debug(`reading config: ${file}`);try{return loadFile(file)}catch(ex){ex.code!==`ENOENT`&&debug(ex.toString())}return{format:`json`}};module.exports=class{reload(){dotenv(!0);let configRootKey=process.env.AIO_CONFIG_KEY||`aio`,configBasePath=process.env.XDG_CONFIG_HOME||path$3.join(os$1.homedir(),`.config`);this.global={file:process.env.AIO_CONFIG_FILE||path$3.join(configBasePath,configRootKey)},this.local={file:path$3.join(process.cwd(),`.${configRootKey}`)},this.global={...this.global,...readFile(this.global.file)},this.local={...this.local,...readFile(this.local.file)},this.envs={};let envKeys=[];for(let key in process.env){let dynamicKey=RegExp(`^${configRootKey.toUpperCase()}_(.+)`,`i`),match=key.match(dynamicKey);if(match){let newKey=match[1].toLowerCase().split(/(?<!_)_(?!_)/).join(`.`).replace(/__/gi,`_`);envKeys.push(newKey),this.envs=setValue(newKey,process.env[key],this.envs)}}return envKeys.length>0&&debug(`reading env variables: ${envKeys.join(`, `)}`),this.values=merge(this.global.values,this.local.values,this.envs),this}get(key=``,source){this.values||this.reload();let vals=this.values;source===`global`?vals=this.global.values:source===`local`?vals=this.local.values:source===`env`&&(vals=this.envs);let value=getValue(vals,key);return value==null?value:JSON.parse(JSON.stringify(value))}set(key,value,local=!1){this.values||this.reload();let config$1=local?this.local:this.global,obj=setValue(key,value,config$1.values);return debug(`writing config: ${key||`<all>`} at ${config$1.file}`),saveFile(config$1.file,obj,config$1.format),this.reload()}}})),require_pipe=require_chunk.t(((exports,module)=>{let status=Symbol.for(`aio-cli-config.pipe`);module.exports=()=>new Promise(resolve=>{if(global[status]||process.stdin.isTTY)return resolve(global[status]);let data=[];process.stdin.on(`data`,line=>data.push(line.toString())),process.stdin.once(`end`,()=>{let result=data.join(``);global[status]=result,resolve(result)})})})),require_src=require_chunk.t(((exports,module)=>{let Config=require_Config(),pipe=require_pipe(),dotenv=require_dotenv(),config=new Config;module.exports=new class{get(key,source){return config.get(key,source)}set(key,value,local){return config.set(key,value,local)&&this}delete(key,local){return config.set(key,null,local)&&this}reload(){return config.reload()&&this}get getPipedData(){return pipe}get dotenv(){return dotenv}}})),require_package=require_chunk.t(((exports,module)=>{module.exports={name:`dotenv`,version:`17.2.3`,description:`Loads environment variables from .env file`,main:`lib/main.js`,types:`lib/main.d.ts`,exports:{".":{types:`./lib/main.d.ts`,require:`./lib/main.js`,default:`./lib/main.js`},"./config":`./config.js`,"./config.js":`./config.js`,"./lib/env-options":`./lib/env-options.js`,"./lib/env-options.js":`./lib/env-options.js`,"./lib/cli-options":`./lib/cli-options.js`,"./lib/cli-options.js":`./lib/cli-options.js`,"./package.json":`./package.json`},scripts:{"dts-check":`tsc --project tests/types/tsconfig.json`,lint:`standard`,pretest:`npm run lint && npm run dts-check`,test:`tap run tests/**/*.js --allow-empty-coverage --disable-coverage --timeout=60000`,"test:coverage":`tap run tests/**/*.js --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov`,prerelease:`npm test`,release:`standard-version`},repository:{type:`git`,url:`git://github.com/motdotla/dotenv.git`},homepage:`https://github.com/motdotla/dotenv#readme`,funding:`https://dotenvx.com`,keywords:[`dotenv`,`env`,`.env`,`environment`,`variables`,`config`,`settings`],readmeFilename:`README.md`,license:`BSD-2-Clause`,devDependencies:{"@types/node":`^18.11.3`,decache:`^4.6.2`,sinon:`^14.0.1`,standard:`^17.0.0`,"standard-version":`^9.5.0`,tap:`^19.2.0`,typescript:`^4.8.4`},engines:{node:`>=12`},browser:{fs:!1}}})),require_main=require_chunk.t(((exports,module)=>{let fs$1=require(`fs`),path$2=require(`path`),os=require(`os`),crypto=require(`crypto`),version=require_package().version,TIPS=[`🔐 encrypt with Dotenvx: https://dotenvx.com`,`🔐 prevent committing .env to code: https://dotenvx.com/precommit`,`🔐 prevent building .env in docker: https://dotenvx.com/prebuild`,`📡 add observability to secrets: https://dotenvx.com/ops`,`👥 sync secrets across teammates & machines: https://dotenvx.com/ops`,`🗂️ backup and recover secrets: https://dotenvx.com/ops`,`✅ audit secrets and track compliance: https://dotenvx.com/ops`,`🔄 add secrets lifecycle management: https://dotenvx.com/ops`,`🔑 add access controls to secrets: https://dotenvx.com/ops`,"🛠️ run anywhere with `dotenvx run -- yourcommand`",`⚙️ specify custom .env file path with { path: '/custom/path/.env' }`,`⚙️ enable debug logging with { debug: true }`,`⚙️ override existing env vars with { override: true }`,`⚙️ suppress all logs with { quiet: true }`,`⚙️ write to custom object with { processEnv: myObject }`,`⚙️ load multiple .env files with { path: ['.env.local', '.env'] }`];function _getRandomTip(){return TIPS[Math.floor(Math.random()*TIPS.length)]}function parseBoolean(value){return typeof value==`string`?![`false`,`0`,`no`,`off`,``].includes(value.toLowerCase()):!!value}function supportsAnsi(){return process.stdout.isTTY}function dim(text){return supportsAnsi()?`\x1b[2m${text}\x1b[0m`:text}let LINE=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;function parse(src){let obj={},lines=src.toString();lines=lines.replace(/\r\n?/gm,`
|
|
82
|
+
`);let match;for(;(match=LINE.exec(lines))!=null;){let key=match[1],value=match[2]||``;value=value.trim();let maybeQuote=value[0];value=value.replace(/^(['"`])([\s\S]*)\1$/gm,`$2`),maybeQuote===`"`&&(value=value.replace(/\\n/g,`
|
|
83
|
+
`),value=value.replace(/\\r/g,`\r`)),obj[key]=value}return obj}function _parseVault(options){options||={};let vaultPath=_vaultPath(options);options.path=vaultPath;let result=DotenvModule.configDotenv(options);if(!result.parsed){let err=Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);throw err.code=`MISSING_DATA`,err}let keys=_dotenvKey(options).split(`,`),length=keys.length,decrypted;for(let i=0;i<length;i++)try{let attrs=_instructions(result,keys[i].trim());decrypted=DotenvModule.decrypt(attrs.ciphertext,attrs.key);break}catch(error){if(i+1>=length)throw error}return DotenvModule.parse(decrypted)}function _warn(message){console.error(`[dotenv@${version}][WARN] ${message}`)}function _debug(message){console.log(`[dotenv@${version}][DEBUG] ${message}`)}function _log(message){console.log(`[dotenv@${version}] ${message}`)}function _dotenvKey(options){return options&&options.DOTENV_KEY&&options.DOTENV_KEY.length>0?options.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:``}function _instructions(result,dotenvKey){let uri;try{uri=new URL(dotenvKey)}catch(error){if(error.code===`ERR_INVALID_URL`){let err=Error(`INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development`);throw err.code=`INVALID_DOTENV_KEY`,err}throw error}let key=uri.password;if(!key){let err=Error(`INVALID_DOTENV_KEY: Missing key part`);throw err.code=`INVALID_DOTENV_KEY`,err}let environment=uri.searchParams.get(`environment`);if(!environment){let err=Error(`INVALID_DOTENV_KEY: Missing environment part`);throw err.code=`INVALID_DOTENV_KEY`,err}let environmentKey=`DOTENV_VAULT_${environment.toUpperCase()}`,ciphertext=result.parsed[environmentKey];if(!ciphertext){let err=Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);throw err.code=`NOT_FOUND_DOTENV_ENVIRONMENT`,err}return{ciphertext,key}}function _vaultPath(options){let possibleVaultPath=null;if(options&&options.path&&options.path.length>0)if(Array.isArray(options.path))for(let filepath of options.path)fs$1.existsSync(filepath)&&(possibleVaultPath=filepath.endsWith(`.vault`)?filepath:`${filepath}.vault`);else possibleVaultPath=options.path.endsWith(`.vault`)?options.path:`${options.path}.vault`;else possibleVaultPath=path$2.resolve(process.cwd(),`.env.vault`);return fs$1.existsSync(possibleVaultPath)?possibleVaultPath:null}function _resolveHome(envPath){return envPath[0]===`~`?path$2.join(os.homedir(),envPath.slice(1)):envPath}function _configVault(options){let debug=parseBoolean(process.env.DOTENV_CONFIG_DEBUG||options&&options.debug),quiet=parseBoolean(process.env.DOTENV_CONFIG_QUIET||options&&options.quiet);(debug||!quiet)&&_log(`Loading env from encrypted .env.vault`);let parsed=DotenvModule._parseVault(options),processEnv=process.env;return options&&options.processEnv!=null&&(processEnv=options.processEnv),DotenvModule.populate(processEnv,parsed,options),{parsed}}function configDotenv(options){let dotenvPath=path$2.resolve(process.cwd(),`.env`),encoding=`utf8`,processEnv=process.env;options&&options.processEnv!=null&&(processEnv=options.processEnv);let debug=parseBoolean(processEnv.DOTENV_CONFIG_DEBUG||options&&options.debug),quiet=parseBoolean(processEnv.DOTENV_CONFIG_QUIET||options&&options.quiet);options&&options.encoding?encoding=options.encoding:debug&&_debug(`No encoding is specified. UTF-8 is used by default`);let optionPaths=[dotenvPath];if(options&&options.path)if(!Array.isArray(options.path))optionPaths=[_resolveHome(options.path)];else{optionPaths=[];for(let filepath of options.path)optionPaths.push(_resolveHome(filepath))}let lastError,parsedAll={};for(let path$7 of optionPaths)try{let parsed=DotenvModule.parse(fs$1.readFileSync(path$7,{encoding}));DotenvModule.populate(parsedAll,parsed,options)}catch(e){debug&&_debug(`Failed to load ${path$7} ${e.message}`),lastError=e}let populated=DotenvModule.populate(processEnv,parsedAll,options);if(debug=parseBoolean(processEnv.DOTENV_CONFIG_DEBUG||debug),quiet=parseBoolean(processEnv.DOTENV_CONFIG_QUIET||quiet),debug||!quiet){let keysCount=Object.keys(populated).length,shortPaths=[];for(let filePath of optionPaths)try{let relative=path$2.relative(process.cwd(),filePath);shortPaths.push(relative)}catch(e){debug&&_debug(`Failed to load ${filePath} ${e.message}`),lastError=e}_log(`injecting env (${keysCount}) from ${shortPaths.join(`,`)} ${dim(`-- tip: ${_getRandomTip()}`)}`)}return lastError?{parsed:parsedAll,error:lastError}:{parsed:parsedAll}}function config(options){if(_dotenvKey(options).length===0)return DotenvModule.configDotenv(options);let vaultPath=_vaultPath(options);return vaultPath?DotenvModule._configVault(options):(_warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`),DotenvModule.configDotenv(options))}function decrypt(encrypted,keyStr){let key=Buffer.from(keyStr.slice(-64),`hex`),ciphertext=Buffer.from(encrypted,`base64`),nonce=ciphertext.subarray(0,12),authTag=ciphertext.subarray(-16);ciphertext=ciphertext.subarray(12,-16);try{let aesgcm=crypto.createDecipheriv(`aes-256-gcm`,key,nonce);return aesgcm.setAuthTag(authTag),`${aesgcm.update(ciphertext)}${aesgcm.final()}`}catch(error){let isRange=error instanceof RangeError,invalidKeyLength=error.message===`Invalid key length`,decryptionFailed=error.message===`Unsupported state or unable to authenticate data`;if(isRange||invalidKeyLength){let err=Error(`INVALID_DOTENV_KEY: It must be 64 characters long (or more)`);throw err.code=`INVALID_DOTENV_KEY`,err}else if(decryptionFailed){let err=Error(`DECRYPTION_FAILED: Please check your DOTENV_KEY`);throw err.code=`DECRYPTION_FAILED`,err}else throw error}}function populate(processEnv,parsed,options={}){let debug=!!(options&&options.debug),override=!!(options&&options.override),populated={};if(typeof parsed!=`object`){let err=Error(`OBJECT_REQUIRED: Please check the processEnv argument being passed to populate`);throw err.code=`OBJECT_REQUIRED`,err}for(let key of Object.keys(parsed))Object.prototype.hasOwnProperty.call(processEnv,key)?(override===!0&&(processEnv[key]=parsed[key],populated[key]=parsed[key]),debug&&_debug(override===!0?`"${key}" is already defined and WAS overwritten`:`"${key}" is already defined and was NOT overwritten`)):(processEnv[key]=parsed[key],populated[key]=parsed[key]);return populated}let DotenvModule={configDotenv,_configVault,_parseVault,config,decrypt,parse,populate};module.exports.configDotenv=DotenvModule.configDotenv,module.exports._configVault=DotenvModule._configVault,module.exports._parseVault=DotenvModule._parseVault,module.exports.config=DotenvModule.config,module.exports.decrypt=DotenvModule.decrypt,module.exports.parse=DotenvModule.parse,module.exports.populate=DotenvModule.populate,module.exports=DotenvModule})),import_src=require_chunk.n(require_src(),1),import_main=require_chunk.n(require_main(),1);const{context}=_adobe_aio_lib_ims.default,IMS_KEYS={client_id:`AIO_COMMERCE_AUTH_IMS_CLIENT_ID`,client_secrets:`AIO_COMMERCE_AUTH_IMS_CLIENT_SECRETS`,technical_account_email:`AIO_COMMERCE_AUTH_IMS_TECHNICAL_ACCOUNT_EMAIL`,technical_account_id:`AIO_COMMERCE_AUTH_IMS_TECHNICAL_ACCOUNT_ID`,scopes:`AIO_COMMERCE_AUTH_IMS_SCOPES`,ims_org_id:`AIO_COMMERCE_AUTH_IMS_ORG_ID`};function replaceEnvVar(filePath,key,value){let envPath=path.default.resolve(filePath),envLines=(0,fs.readFileSync)(envPath,`utf8`).split(`
|
|
84
|
+
`),formattedValue=value.includes(` `)?`"${value}"`:value,keyExists=!1,updatedLines=envLines.map(line=>{if(line.trim().startsWith(`#`)||!line.includes(`=`))return line;let[currentKey]=line.split(`=`);return currentKey===key?(keyExists=!0,`${key}=${formattedValue}`):line});keyExists||updatedLines.push(`${key}=${formattedValue}`),(0,fs.writeFileSync)(envPath,updatedLines.join(`
|
|
85
|
+
`),`utf8`)}function resolveEnvPath(){let envPath=process.env.INIT_CWD?`${process.env.INIT_CWD}/.env`:`.env`;return path.default.resolve(envPath)}function resolveImsS2SContext(){let[credential]=(import_src.default.get(`project.workspace.details.credentials`)??[]).filter(({integration_type})=>integration_type===`oauth_server_to_server`).map(({name})=>name)??[];return credential?context.get(credential):Promise.resolve(null)}async function syncImsCredentials(){let envPath=resolveEnvPath(),envVars=import_main.default.parse((0,fs.readFileSync)(envPath,`utf8`)),imsContext=await resolveImsS2SContext();if(!imsContext)return;let{data}=imsContext;for(let[key,value]of Object.entries(data)){let oauthKey=IMS_KEYS[key];oauthKey&&(!envVars[oauthKey]||envVars[oauthKey]!==value)&&replaceEnvVar(envPath,oauthKey,value)}}async function run(){consola.default.start(`Syncing IMS credentials...`);try{await syncImsCredentials(),consola.default.success(`IMS credentials successfully synced to their AIO_COMMERCE_IMS_AUTH counterparts!`)}catch(error){consola.default.error(stringifyError(error)),process.exit(1)}}const NAMESPACE=`@adobe/aio-commerce-lib-auth`,[command,subcommand]=process.argv.slice(2),USAGE=`
|
|
86
|
+
Usage: ${NAMESPACE} <command> [target]
|
|
87
|
+
|
|
88
|
+
Commands:
|
|
89
|
+
sync-ims-credentials Syncs the IMS credentials from the current context to the .env file.
|
|
90
|
+
|
|
91
|
+
help Show this help message
|
|
92
|
+
|
|
93
|
+
Examples:
|
|
94
|
+
${NAMESPACE} sync-ims-credentials
|
|
95
|
+
`,COMMANDS={"sync-ims-credentials":run};async function handleCommand(commandName,target,handlers){if(!target){let availableTargets=Object.keys(handlers).join(`, `);consola.default.error(`No ${commandName} target specified`),consola.default.info(`Available targets: ${availableTargets}`),process.exit(1)}let handler=handlers[target];if(!handler){let availableTargets=Object.keys(handlers).join(`, `);consola.default.error(`Unknown ${commandName} target: ${target}`),consola.default.info(`Available targets: ${availableTargets}`),process.exit(1)}await handler()}async function main(){(!command||command===`help`||command===`--help`||command===`-h`)&&(consola.default.log.raw(USAGE),process.exit(0));try{let handlers=COMMANDS[command];if(handlers||(consola.default.error(`Unknown command: ${command}`),consola.default.log.raw(USAGE),process.exit(1)),typeof handlers==`function`){await handlers();return}await handleCommand(command,subcommand,handlers)}catch(error){consola.default.error(stringifyError(error)),process.exit(1)}}main();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,14 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
*
|
|
4
|
-
* Copyright 2025 Adobe. All rights reserved.
|
|
5
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
*
|
|
9
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
-
* governing permissions and limitations under the License.
|
|
13
|
-
*/
|
|
14
|
-
var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__copyProps=(to,from,except,desc)=>{if(from&&typeof from==`object`||typeof from==`function`)for(var keys=__getOwnPropNames(from),i=0,n=keys.length,key;i<n;i++)key=keys[i],!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:(k=>from[k]).bind(null,key),enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toESM=(mod,isNodeMode,target)=>(target=mod==null?{}:__create(__getProtoOf(mod)),__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,`default`,{value:mod,enumerable:!0}):target,mod));let __adobe_aio_lib_ims=require(`@adobe/aio-lib-ims`);__adobe_aio_lib_ims=__toESM(__adobe_aio_lib_ims);let __adobe_aio_commerce_lib_core_error=require(`@adobe/aio-commerce-lib-core/error`);__adobe_aio_commerce_lib_core_error=__toESM(__adobe_aio_commerce_lib_core_error);let valibot=require(`valibot`);valibot=__toESM(valibot);let crypto=require(`crypto`);crypto=__toESM(crypto);let oauth_1_0a=require(`oauth-1.0a`);oauth_1_0a=__toESM(oauth_1_0a);let __adobe_aio_commerce_lib_core_params=require(`@adobe/aio-commerce-lib-core/params`);__adobe_aio_commerce_lib_core_params=__toESM(__adobe_aio_commerce_lib_core_params);const{context,getToken}=__adobe_aio_lib_ims.default;function toImsAuthConfig(config){return{scopes:config.scopes,env:config?.environment??`prod`,context:config.context??`aio-commerce-lib-auth-creds`,client_id:config.clientId,client_secrets:config.clientSecrets,technical_account_id:config.technicalAccountId,technical_account_email:config.technicalAccountEmail,ims_org_id:config.imsOrgId}}function isImsAuthProvider(provider){return typeof provider==`object`&&!!provider&&`getAccessToken`in provider&&`getHeaders`in provider&&typeof provider.getAccessToken==`function`&&typeof provider.getHeaders==`function`}function getImsAuthProvider(authParams){let getAccessToken=async()=>{let imsAuthConfig=toImsAuthConfig(authParams);return await context.set(imsAuthConfig.context,imsAuthConfig),getToken(imsAuthConfig.context,{})};return{getAccessToken,getHeaders:async()=>({Authorization:`Bearer ${await getAccessToken()}`,"x-api-key":authParams.clientId})}}const imsAuthParameter=name=>(0,valibot.pipe)((0,valibot.string)(`Expected a string value for the IMS auth parameter ${name}`),(0,valibot.nonEmpty)(`Expected a non-empty string value for the IMS auth parameter ${name}`)),stringArray=(name,minimumLength)=>(0,valibot.pipe)((0,valibot.array)((0,valibot.string)(),`Expected a string array value for the IMS auth parameter ${name}`),(0,valibot.minLength)(minimumLength,`Expected at least ${minimumLength} items for the IMS auth parameter ${name}`)),StringArrayTransformSchema=name=>(0,valibot.pipe)((0,valibot.union)([stringArray(name,1),(0,valibot.pipe)((0,valibot.string)(),(0,valibot.rawTransform)(({dataset:{value:v},addIssue,NEVER})=>{if(v.startsWith(`[`)&&v.endsWith(`]`))try{let parsed=JSON.parse(v);return Array.isArray(parsed)?parsed:(addIssue({received:v,message:`Expected a valid JSON array for the IMS auth parameter ${name}: ${v}`}),NEVER)}catch(error){let errorMessage=error.message;return addIssue({received:v,message:`Expected a valid JSON array for the IMS auth parameter ${name}: ${errorMessage}`}),NEVER}return[v]}))]),stringArray(`value`,1)),ImsAuthEnvSchema=(0,valibot.picklist)([`prod`,`stage`]),ImsAuthParamsSchema=(0,valibot.object)({clientId:imsAuthParameter(`clientId`),clientSecrets:stringArray(`clientSecrets`,1),technicalAccountId:imsAuthParameter(`technicalAccountId`),technicalAccountEmail:(0,valibot.pipe)((0,valibot.string)(`Expected a string value for the IMS auth parameter technicalAccountEmail`),(0,valibot.email)(`Expected a valid email format for technicalAccountEmail`)),imsOrgId:imsAuthParameter(`imsOrgId`),environment:(0,valibot.pipe)((0,valibot.optional)(ImsAuthEnvSchema)),context:(0,valibot.pipe)((0,valibot.optional)((0,valibot.string)())),scopes:stringArray(`scopes`,1)});function __transformStringArray(name,value){if(value===void 0)return;let result=(0,valibot.safeParse)(StringArrayTransformSchema(name),value);if(!result.success)throw new __adobe_aio_commerce_lib_core_error.CommerceSdkValidationError(`Invalid ImsAuthProvider configuration`,{issues:result.issues});return result.output}function __parseImsAuthParams(config){let result=(0,valibot.safeParse)(ImsAuthParamsSchema,config);if(!result.success)throw new __adobe_aio_commerce_lib_core_error.CommerceSdkValidationError(`Invalid ImsAuthProvider configuration`,{issues:result.issues});return result.output}function assertImsAuthParams(config){__parseImsAuthParams(config)}function resolveImsAuthParams(params){return __parseImsAuthParams({clientId:params.AIO_COMMERCE_AUTH_IMS_CLIENT_ID,clientSecrets:__transformStringArray(`AIO_COMMERCE_AUTH_IMS_CLIENT_SECRETS`,params.AIO_COMMERCE_AUTH_IMS_CLIENT_SECRETS),technicalAccountId:params.AIO_COMMERCE_AUTH_IMS_TECHNICAL_ACCOUNT_ID,technicalAccountEmail:params.AIO_COMMERCE_AUTH_IMS_TECHNICAL_ACCOUNT_EMAIL,imsOrgId:params.AIO_COMMERCE_AUTH_IMS_ORG_ID,scopes:__transformStringArray(`AIO_COMMERCE_AUTH_IMS_SCOPES`,params.AIO_COMMERCE_AUTH_IMS_SCOPES),environment:params.AIO_COMMERCE_AUTH_IMS_ENVIRONMENT,context:params.AIO_COMMERCE_AUTH_IMS_CONTEXT})}const integrationAuthParameter=name=>(0,valibot.pipe)((0,valibot.string)(`Expected a string value for the Commerce Integration parameter ${name}`),(0,valibot.nonEmpty)(`Expected a non-empty string value for the Commerce Integration parameter ${name}`)),BaseUrlSchema=(0,valibot.pipe)((0,valibot.string)(`Expected a string for the Adobe Commerce endpoint`),(0,valibot.nonEmpty)(`Expected a non-empty string for the Adobe Commerce endpoint`),(0,valibot.url)(`Expected a valid url for the Adobe Commerce endpoint`)),UrlSchema=(0,valibot.pipe)((0,valibot.union)([BaseUrlSchema,(0,valibot.instance)(URL)]),(0,valibot.transform)(url=>url instanceof URL?url.toString():url)),IntegrationAuthParamsSchema=(0,valibot.nonOptional)((0,valibot.object)({consumerKey:integrationAuthParameter(`consumerKey`),consumerSecret:integrationAuthParameter(`consumerSecret`),accessToken:integrationAuthParameter(`accessToken`),accessTokenSecret:integrationAuthParameter(`accessTokenSecret`)}));function isIntegrationAuthProvider(provider){return typeof provider==`object`&&!!provider&&`getHeaders`in provider&&typeof provider.getHeaders==`function`}function getIntegrationAuthProvider(authParams){let oauth=new oauth_1_0a.default({consumer:{key:authParams.consumerKey,secret:authParams.consumerSecret},signature_method:`HMAC-SHA256`,hash_function:(baseString,key)=>crypto.default.createHmac(`sha256`,key).update(baseString).digest(`base64`)}),oauthToken={key:authParams.accessToken,secret:authParams.accessTokenSecret};return{getHeaders:(method,url)=>{let urlString=(0,valibot.parse)(UrlSchema,url);return oauth.toHeader(oauth.authorize({url:urlString,method},oauthToken))}}}function __parseIntegrationAuthParams(config){let result=(0,valibot.safeParse)(IntegrationAuthParamsSchema,config);if(!result.success)throw new __adobe_aio_commerce_lib_core_error.CommerceSdkValidationError(`Invalid IntegrationAuthProvider configuration`,{issues:result.issues});return result.output}function assertIntegrationAuthParams(config){__parseIntegrationAuthParams(config)}function resolveIntegrationAuthParams(params){return __parseIntegrationAuthParams({consumerKey:params.AIO_COMMERCE_AUTH_INTEGRATION_CONSUMER_KEY,consumerSecret:params.AIO_COMMERCE_AUTH_INTEGRATION_CONSUMER_SECRET,accessToken:params.AIO_COMMERCE_AUTH_INTEGRATION_ACCESS_TOKEN,accessTokenSecret:params.AIO_COMMERCE_AUTH_INTEGRATION_ACCESS_TOKEN_SECRET})}const IMS_AUTH_PARAMS=[`AIO_COMMERCE_AUTH_IMS_CLIENT_ID`,`AIO_COMMERCE_AUTH_IMS_CLIENT_SECRETS`,`AIO_COMMERCE_AUTH_IMS_TECHNICAL_ACCOUNT_ID`,`AIO_COMMERCE_AUTH_IMS_TECHNICAL_ACCOUNT_EMAIL`,`AIO_COMMERCE_AUTH_IMS_ORG_ID`,`AIO_COMMERCE_AUTH_IMS_SCOPES`],INTEGRATION_AUTH_PARAMS=[`AIO_COMMERCE_AUTH_INTEGRATION_CONSUMER_KEY`,`AIO_COMMERCE_AUTH_INTEGRATION_CONSUMER_SECRET`,`AIO_COMMERCE_AUTH_INTEGRATION_ACCESS_TOKEN`,`AIO_COMMERCE_AUTH_INTEGRATION_ACCESS_TOKEN_SECRET`];function resolveAuthParams(params){if((0,__adobe_aio_commerce_lib_core_params.allNonEmpty)(params,IMS_AUTH_PARAMS))return Object.assign(resolveImsAuthParams(params),{strategy:`ims`});if((0,__adobe_aio_commerce_lib_core_params.allNonEmpty)(params,INTEGRATION_AUTH_PARAMS))return Object.assign(resolveIntegrationAuthParams(params),{strategy:`integration`});throw Error(`Can't resolve authentication options for the given params. Please provide either IMS options (${IMS_AUTH_PARAMS.join(`, `)}) or Commerce integration options (${INTEGRATION_AUTH_PARAMS.join(`, `)}).`)}exports.assertImsAuthParams=assertImsAuthParams,exports.assertIntegrationAuthParams=assertIntegrationAuthParams,exports.getImsAuthProvider=getImsAuthProvider,exports.getIntegrationAuthProvider=getIntegrationAuthProvider,exports.isImsAuthProvider=isImsAuthProvider,exports.isIntegrationAuthProvider=isIntegrationAuthProvider,exports.resolveAuthParams=resolveAuthParams;
|
|
1
|
+
const require_chunk=require(`./chunk-YD6SZpHm.cjs`);let _adobe_aio_commerce_lib_core_headers=require(`@adobe/aio-commerce-lib-core/headers`),valibot=require(`valibot`);valibot=require_chunk.n(valibot);let _adobe_aio_commerce_lib_core_error=require(`@adobe/aio-commerce-lib-core/error`),_adobe_aio_lib_ims=require(`@adobe/aio-lib-ims`);_adobe_aio_lib_ims=require_chunk.n(_adobe_aio_lib_ims);let crypto=require(`crypto`);crypto=require_chunk.n(crypto);let oauth_1_0a=require(`oauth-1.0a`);oauth_1_0a=require_chunk.n(oauth_1_0a);let _adobe_aio_commerce_lib_core_params=require(`@adobe/aio-commerce-lib-core/params`);function stringValueSchema(name){return valibot.string(`Expected a string value for '${name}'`)}function parseOrThrow(schema,input,message){let result=valibot.safeParse(schema,input);if(!result.success)throw new _adobe_aio_commerce_lib_core_error.CommerceSdkValidationError(message??`Invalid input`,{issues:result.issues});return result.output}const imsAuthParameter=name=>(0,valibot.pipe)((0,valibot.string)(`Expected a string value for the IMS auth parameter ${name}`),(0,valibot.nonEmpty)(`Expected a non-empty string value for the IMS auth parameter ${name}`)),stringArray=(name,minimumLength)=>(0,valibot.pipe)((0,valibot.array)((0,valibot.string)(),`Expected a string array value for the IMS auth parameter ${name}`),(0,valibot.minLength)(minimumLength,`Expected at least ${minimumLength} items for the IMS auth parameter ${name}`)),StringArrayTransformSchema=name=>(0,valibot.pipe)((0,valibot.union)([stringArray(name,1),(0,valibot.pipe)((0,valibot.string)(),(0,valibot.rawTransform)(({dataset:{value:v},addIssue,NEVER})=>{if(v.startsWith(`[`)&&v.endsWith(`]`))try{let parsed=JSON.parse(v);return Array.isArray(parsed)?parsed:(addIssue({received:v,message:`Expected a valid JSON array for the IMS auth parameter ${name}: ${v}`}),NEVER)}catch(error){let errorMessage=error.message;return addIssue({received:v,message:`Expected a valid JSON array for the IMS auth parameter ${name}: ${errorMessage}`}),NEVER}return[v]}))]),stringArray(`value`,1)),ImsAuthEnvSchema=(0,valibot.picklist)([`prod`,`stage`]),ImsAuthParamsSchema=(0,valibot.object)({clientId:imsAuthParameter(`clientId`),clientSecrets:stringArray(`clientSecrets`,1),technicalAccountId:imsAuthParameter(`technicalAccountId`),technicalAccountEmail:(0,valibot.pipe)((0,valibot.string)(`Expected a string value for the IMS auth parameter technicalAccountEmail`),(0,valibot.email)(`Expected a valid email format for technicalAccountEmail`)),imsOrgId:imsAuthParameter(`imsOrgId`),environment:(0,valibot.pipe)((0,valibot.optional)(ImsAuthEnvSchema)),context:(0,valibot.pipe)((0,valibot.optional)((0,valibot.string)())),scopes:stringArray(`scopes`,1)});function __transformStringArray(name,value){if(value===void 0)return;let result=(0,valibot.safeParse)(StringArrayTransformSchema(name),value);if(!result.success)throw new _adobe_aio_commerce_lib_core_error.CommerceSdkValidationError(`Invalid ImsAuthProvider configuration`,{issues:result.issues});return result.output}function __parseImsAuthParams(config){let result=(0,valibot.safeParse)(ImsAuthParamsSchema,config);if(!result.success)throw new _adobe_aio_commerce_lib_core_error.CommerceSdkValidationError(`Invalid ImsAuthProvider configuration`,{issues:result.issues});return result.output}function assertImsAuthParams(config){__parseImsAuthParams(config)}function resolveImsAuthParams(params){return __parseImsAuthParams({clientId:params.AIO_COMMERCE_AUTH_IMS_CLIENT_ID,clientSecrets:__transformStringArray(`AIO_COMMERCE_AUTH_IMS_CLIENT_SECRETS`,params.AIO_COMMERCE_AUTH_IMS_CLIENT_SECRETS),technicalAccountId:params.AIO_COMMERCE_AUTH_IMS_TECHNICAL_ACCOUNT_ID,technicalAccountEmail:params.AIO_COMMERCE_AUTH_IMS_TECHNICAL_ACCOUNT_EMAIL,imsOrgId:params.AIO_COMMERCE_AUTH_IMS_ORG_ID,scopes:__transformStringArray(`AIO_COMMERCE_AUTH_IMS_SCOPES`,params.AIO_COMMERCE_AUTH_IMS_SCOPES),environment:params.AIO_COMMERCE_AUTH_IMS_ENVIRONMENT,context:params.AIO_COMMERCE_AUTH_IMS_CONTEXT})}function buildImsHeaders(accessToken,apiKey){let imsHeaders={Authorization:`Bearer ${accessToken}`};return apiKey&&(imsHeaders[`x-api-key`]=apiKey),imsHeaders}const IMS_AUTH_TOKEN_PARAM=`AIO_COMMERCE_AUTH_IMS_TOKEN`,IMS_AUTH_API_KEY_PARAM=`AIO_COMMERCE_AUTH_IMS_API_KEY`,ImsAuthParamsInputSchema=valibot.looseObject({[IMS_AUTH_TOKEN_PARAM]:stringValueSchema(IMS_AUTH_TOKEN_PARAM),[IMS_AUTH_API_KEY_PARAM]:valibot.optional(stringValueSchema(IMS_AUTH_API_KEY_PARAM))}),ForwardedImsAuthSourceSchema=valibot.variant(`from`,[valibot.object({from:valibot.literal(`headers`),headers:valibot.record(valibot.string(),valibot.optional(valibot.string()))}),valibot.object({from:valibot.literal(`getter`),getHeaders:valibot.custom(input=>typeof input==`function`,`Expected a function for getHeaders`)}),valibot.object({from:valibot.literal(`params`),params:ImsAuthParamsInputSchema})]);function getForwardedImsAuthProvider(source){let validatedSource=parseOrThrow(ForwardedImsAuthSourceSchema,source,`Invalid forwarded IMS auth source`);switch(validatedSource.from){case`headers`:{let{authorization}=(0,_adobe_aio_commerce_lib_core_headers.createHeaderAccessor)(validatedSource.headers,[`Authorization`]),apiKey=(0,_adobe_aio_commerce_lib_core_headers.getHeader)(validatedSource.headers,`x-api-key`),{token}=(0,_adobe_aio_commerce_lib_core_headers.parseBearerToken)(authorization);return{getAccessToken:()=>token,getHeaders:()=>buildImsHeaders(token,apiKey)}}case`getter`:return{getHeaders:validatedSource.getHeaders,getAccessToken:async()=>{let{token}=(0,_adobe_aio_commerce_lib_core_headers.parseBearerToken)((await validatedSource.getHeaders()).Authorization);return token}};case`params`:{let{params}=validatedSource,accessToken=params[IMS_AUTH_TOKEN_PARAM],apiKey=params[IMS_AUTH_API_KEY_PARAM];return{getAccessToken:()=>accessToken,getHeaders:()=>buildImsHeaders(accessToken,apiKey)}}}}function forwardImsAuthProviderFromRequest(params){return getForwardedImsAuthProvider({from:`headers`,headers:(0,_adobe_aio_commerce_lib_core_headers.getHeadersFromParams)(params)})}function forwardImsAuthProviderFromParams(params){return getForwardedImsAuthProvider({from:`params`,params:parseOrThrow(ImsAuthParamsInputSchema,params,`Missing AIO_COMMERCE_AUTH_IMS_TOKEN in params`)})}function forwardImsAuthProvider(params){try{return forwardImsAuthProviderFromParams(params)}catch{}try{return forwardImsAuthProviderFromRequest(params)}catch{}throw Error(`Can't forward IMS authentication from the given params. Make sure your params contain an AIO_COMMERCE_AUTH_IMS_TOKEN input or an Authorization header with an IMS token.`)}const{context,getToken}=_adobe_aio_lib_ims.default;function toImsAuthConfig(config){return{scopes:config.scopes,env:config?.environment??`prod`,context:config.context??`aio-commerce-lib-auth-creds`,client_id:config.clientId,client_secrets:config.clientSecrets,technical_account_id:config.technicalAccountId,technical_account_email:config.technicalAccountEmail,ims_org_id:config.imsOrgId}}function isImsAuthProvider(provider){return typeof provider==`object`&&!!provider&&`getAccessToken`in provider&&`getHeaders`in provider&&typeof provider.getAccessToken==`function`&&typeof provider.getHeaders==`function`}function getImsAuthProvider(authParams){let getAccessToken=async()=>{let imsAuthConfig=toImsAuthConfig(authParams);return await context.set(imsAuthConfig.context,imsAuthConfig),getToken(imsAuthConfig.context,{})};return{getAccessToken,getHeaders:async()=>buildImsHeaders(await getAccessToken(),authParams.clientId)}}const integrationAuthParameter=name=>(0,valibot.pipe)((0,valibot.string)(`Expected a string value for the Commerce Integration parameter ${name}`),(0,valibot.nonEmpty)(`Expected a non-empty string value for the Commerce Integration parameter ${name}`)),BaseUrlSchema=(0,valibot.pipe)((0,valibot.string)(`Expected a string for the Adobe Commerce endpoint`),(0,valibot.nonEmpty)(`Expected a non-empty string for the Adobe Commerce endpoint`),(0,valibot.url)(`Expected a valid url for the Adobe Commerce endpoint`)),UrlSchema=(0,valibot.pipe)((0,valibot.union)([BaseUrlSchema,(0,valibot.instance)(URL)]),(0,valibot.transform)(url=>url instanceof URL?url.toString():url)),IntegrationAuthParamsSchema=(0,valibot.nonOptional)((0,valibot.object)({consumerKey:integrationAuthParameter(`consumerKey`),consumerSecret:integrationAuthParameter(`consumerSecret`),accessToken:integrationAuthParameter(`accessToken`),accessTokenSecret:integrationAuthParameter(`accessTokenSecret`)}));function isIntegrationAuthProvider(provider){return typeof provider==`object`&&!!provider&&`getHeaders`in provider&&typeof provider.getHeaders==`function`}function getIntegrationAuthProvider(authParams){let oauth=new oauth_1_0a.default({consumer:{key:authParams.consumerKey,secret:authParams.consumerSecret},signature_method:`HMAC-SHA256`,hash_function:(baseString,key)=>crypto.default.createHmac(`sha256`,key).update(baseString).digest(`base64`)}),oauthToken={key:authParams.accessToken,secret:authParams.accessTokenSecret};return{getHeaders:(method,url)=>{let urlString=(0,valibot.parse)(UrlSchema,url);return oauth.toHeader(oauth.authorize({url:urlString,method},oauthToken))}}}function __parseIntegrationAuthParams(config){let result=(0,valibot.safeParse)(IntegrationAuthParamsSchema,config);if(!result.success)throw new _adobe_aio_commerce_lib_core_error.CommerceSdkValidationError(`Invalid IntegrationAuthProvider configuration`,{issues:result.issues});return result.output}function assertIntegrationAuthParams(config){__parseIntegrationAuthParams(config)}function resolveIntegrationAuthParams(params){return __parseIntegrationAuthParams({consumerKey:params.AIO_COMMERCE_AUTH_INTEGRATION_CONSUMER_KEY,consumerSecret:params.AIO_COMMERCE_AUTH_INTEGRATION_CONSUMER_SECRET,accessToken:params.AIO_COMMERCE_AUTH_INTEGRATION_ACCESS_TOKEN,accessTokenSecret:params.AIO_COMMERCE_AUTH_INTEGRATION_ACCESS_TOKEN_SECRET})}const IMS_AUTH_PARAMS=[`AIO_COMMERCE_AUTH_IMS_CLIENT_ID`,`AIO_COMMERCE_AUTH_IMS_CLIENT_SECRETS`,`AIO_COMMERCE_AUTH_IMS_TECHNICAL_ACCOUNT_ID`,`AIO_COMMERCE_AUTH_IMS_TECHNICAL_ACCOUNT_EMAIL`,`AIO_COMMERCE_AUTH_IMS_ORG_ID`,`AIO_COMMERCE_AUTH_IMS_SCOPES`],INTEGRATION_AUTH_PARAMS=[`AIO_COMMERCE_AUTH_INTEGRATION_CONSUMER_KEY`,`AIO_COMMERCE_AUTH_INTEGRATION_CONSUMER_SECRET`,`AIO_COMMERCE_AUTH_INTEGRATION_ACCESS_TOKEN`,`AIO_COMMERCE_AUTH_INTEGRATION_ACCESS_TOKEN_SECRET`];function resolveAuthParams(params){if((0,_adobe_aio_commerce_lib_core_params.allNonEmpty)(params,IMS_AUTH_PARAMS))return{...resolveImsAuthParams(params),strategy:`ims`};if((0,_adobe_aio_commerce_lib_core_params.allNonEmpty)(params,INTEGRATION_AUTH_PARAMS))return{...resolveIntegrationAuthParams(params),strategy:`integration`};throw Error(`Can't resolve authentication options for the given params. Please provide either IMS options (${IMS_AUTH_PARAMS.join(`, `)}) or Commerce integration options (${INTEGRATION_AUTH_PARAMS.join(`, `)}).`)}exports.assertImsAuthParams=assertImsAuthParams,exports.assertIntegrationAuthParams=assertIntegrationAuthParams,exports.forwardImsAuthProvider=forwardImsAuthProvider,exports.getForwardedImsAuthProvider=getForwardedImsAuthProvider,exports.getImsAuthProvider=getImsAuthProvider,exports.getIntegrationAuthProvider=getIntegrationAuthProvider,exports.isImsAuthProvider=isImsAuthProvider,exports.isIntegrationAuthProvider=isIntegrationAuthProvider,exports.resolveAuthParams=resolveAuthParams;
|