/* eslint-disable */ module.exports = { name: "@yarnpkg/plugin-licenses", factory: function (require) { var plugin;plugin=(()=>{"use strict";var __webpack_modules__={195:(e,t,n)=>{n.r(t),n.d(t,{default:()=>E});var r={};n.r(r),n.d(r,{fs:()=>u,getPackagePath:()=>l});const i=require("@yarnpkg/cli");var o=n(966);const a=require("clipanion");var s=n(688),c=n(300);const _=require("@yarnpkg/parsers"),l=async(e,t)=>{await d(e);const n=o.structUtils.convertPackageToLocator(t),r=p[o.structUtils.stringifyLocator(n)];if(!r)return null;const i=r.locations[0];return i?s.ppath.join(e.cwd,i):e.cwd};let p;const d=async e=>{if(!p){const t=s.ppath.join(e.configuration.projectCwd,s.Filename.nodeModules,".yarn-state.yml");p=(0,_.parseSyml)(await s.xfs.readFilePromise(t,"utf8"))}},u=s.xfs,f=e=>{switch(e){case"pnp":return c;case"node-modules":return r;default:throw new Error("Unsupported linker")}},m=("@yarnpkg"===s.npath.basename(__dirname)?s.ppath.join(s.npath.toPortablePath(__dirname),"../.."):s.ppath.join(s.npath.toPortablePath(__dirname),".."),async(e,t,n)=>{const r=new Map;let i;if(t){if(n){for(const t of e.workspaces)t.manifest.devDependencies.clear();const t=await o.Cache.find(e.configuration);await e.resolveEverything({report:new o.ThrowReport,cache:t})}i=e.storedDescriptors.values()}else i=e.workspaces.flatMap(e=>{const t=[e.anchoredDescriptor];for(const[r,i]of e.dependencies.entries())n&&e.manifest.devDependencies.has(r)||t.push(i);return t});const a=o.miscUtils.sortMap(i,[e=>o.structUtils.stringifyIdent(e),e=>o.structUtils.isVirtualDescriptor(e)?"0":"1",e=>e.range]),s=new Set;for(const t of a.values()){const n=e.storedResolutions.get(t.descriptorHash);if(!n)continue;const i=e.storedPackages.get(n);if(!i)continue;const{descriptorHash:a}=o.structUtils.isVirtualDescriptor(t)?o.structUtils.devirtualizeDescriptor(t):t;s.has(a)||(s.add(a),r.set(t,i))}return r}),g=e=>{const{license:t,licenses:n,repository:r,homepage:i,author:o}=e;return{license:(()=>{if(t)return w(t);if(n){if(1===n.length)return w(n[0]);if(n.length)return`(${n.map(w).join(" OR ")})`}return h})(),url:(null==r?void 0:r.url)||i,vendorName:null==o?void 0:o.name,vendorUrl:i||(null==o?void 0:o.url)}},h="UNKNOWN",w=e=>("string"!=typeof e?e.type:e)||h,y=(e,t,n)=>n?t:`${e}: ${t}`;var P=function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};class k extends a.Command{constructor(){super(...arguments),this.recursive=!1,this.production=!1,this.json=!1,this.excludeMetadata=!1}async execute(){const e=await o.Configuration.find(this.context.cwd,this.context.plugins),{project:t,workspace:n}=await o.Project.find(e,this.context.cwd);if(!n)throw new i.WorkspaceRequiredError(t.cwd,this.context.cwd);await t.restoreInstallState();const r=await(async(e,t,n,r,i)=>{const a={},c={children:a},_=await m(e,n,r),l=f(e.configuration.get("nodeLinker"));for(const[n,r]of _.entries()){const c=await l.getPackagePath(e,r);if(null===c)continue;const _=JSON.parse(await l.fs.readFilePromise(s.ppath.join(c,s.Filename.manifest),"utf8")),{license:p,url:d,vendorName:u,vendorUrl:f}=g(_);a[p]||(a[p]={value:o.formatUtils.tuple(o.formatUtils.Type.NO_HINT,p),children:{}});const m=o.structUtils.convertPackageToLocator(r),h={value:o.formatUtils.tuple(o.formatUtils.Type.DEPENDENT,{locator:m,descriptor:n}),children:i?{}:{...d?{url:{value:o.formatUtils.tuple(o.formatUtils.Type.NO_HINT,y("URL",d,t))}}:{},...u?{vendorName:{value:o.formatUtils.tuple(o.formatUtils.Type.NO_HINT,y("VendorName",u,t))}}:{},...f?{vendorUrl:{value:o.formatUtils.tuple(o.formatUtils.Type.NO_HINT,y("VendorUrl",f,t))}}:{}}},w=o.structUtils.stringifyLocator(m);a[p].children[w]=h}return c})(t,this.json,this.recursive,this.production,this.excludeMetadata);o.treeUtils.emitTree(r,{configuration:e,stdout:this.context.stdout,json:this.json,separators:1})}}k.usage=a.Command.Usage({description:"display the licenses for all packages in the project",details:"\n This command prints the license information for packages in the project. By default, only direct dependencies are listed.\n\n If `-R,--recursive` is set, the listing will include transitive dependencies (dependencies of direct dependencies).\n\n If `--production` is set, the listing will exclude development dependencies.\n ",examples:[["List all licenses of direct dependencies","$0 licenses list"],["List all licenses of direct and transitive dependencies","$0 licenses list --recursive"],["List all licenses of production dependencies only","$0 licenses list --production"]]}),P([a.Command.Boolean("-R,--recursive")],k.prototype,"recursive",void 0),P([a.Command.Boolean("--production")],k.prototype,"production",void 0),P([a.Command.Boolean("--json")],k.prototype,"json",void 0),P([a.Command.Boolean("--exclude-metadata")],k.prototype,"excludeMetadata",void 0),P([a.Command.Path("licenses","list")],k.prototype,"execute",null);var v=function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a};class O extends a.Command{constructor(){super(...arguments),this.recursive=!1,this.production=!1}async execute(){const e=await o.Configuration.find(this.context.cwd,this.context.plugins),{project:t,workspace:n}=await o.Project.find(e,this.context.cwd);if(!n)throw new i.WorkspaceRequiredError(t.cwd,this.context.cwd);await t.restoreInstallState();const r=await(async(e,t,n)=>{const r=await m(e,t,n),i=f(e.configuration.get("nodeLinker")),o=new Map;for(const t of r.values()){const n=await i.getPackagePath(e,t);if(null===n)continue;const r=JSON.parse(await i.fs.readFilePromise(s.ppath.join(n,s.Filename.manifest),"utf8")),a=(await i.fs.readdirPromise(n,{withFileTypes:!0})).filter(e=>e.isFile()).map(({name:e})=>e),c=a.find(e=>{const t=e.toLowerCase();return"license"===t||t.startsWith("license.")||"unlicense"===t||t.startsWith("unlicense.")});if(!c)continue;const _=await i.fs.readFilePromise(s.ppath.join(n,c),"utf8"),l=a.find(e=>{const t=e.toLowerCase();return"notice"===t||t.startsWith("notice.")});let p;l&&(p=await i.fs.readFilePromise(s.ppath.join(n,l),"utf8"));const d=p?`${_}\n\nNOTICE\n\n${p}`:_,u=o.get(d);u?u.set(r.name,r):o.set(d,new Map([[r.name,r]]))}let a=`THE FOLLOWING SETS FORTH ATTRIBUTION NOTICES FOR THIRD PARTY SOFTWARE THAT MAY BE CONTAINED IN PORTIONS OF THE ${String(e.topLevelWorkspace.manifest.raw.name).toUpperCase().replace(/-/g," ")} PRODUCT.\n\n`;for(const[e,t]of o.entries()){a+="-----\n\n";const n=[],r=[];for(const{name:e,repository:i}of t.values())n.push(e),(null==i?void 0:i.url)&&r.push(1===t.size?i.url:`${i.url} (${e})`);const i=[];i.push(`The following software may be included in this product: ${n.join(", ")}.`),r.length>0&&i.push(`A copy of the source code may be downloaded from ${r.join(", ")}.`),i.push("This software contains the following license and notice below:"),a+=i.join(" ")+"\n\n",a+=e.trim()+"\n\n"}return a})(t,this.recursive,this.production);this.context.stdout.write(r)}}O.usage=a.Command.Usage({description:"display the license disclaimer including all packages in the project",details:"\n This command prints the license disclaimer for packages in the project. By default, only direct dependencies are listed.\n\n If `-R,--recursive` is set, the disclaimer will include transitive dependencies (dependencies of direct dependencies).\n\n If `--production` is set, the disclaimer will exclude development dependencies.\n ",examples:[["Include licenses of direct dependencies","$0 licenses generate-disclaimer"],["Include licenses of direct and transitive dependencies","$0 licenses generate-disclaimer --recursive"],["Include licenses of production dependencies only","$0 licenses list --production"]]}),v([a.Command.Boolean("-R,--recursive")],O.prototype,"recursive",void 0),v([a.Command.Boolean("--production")],O.prototype,"production",void 0),v([a.Command.Path("licenses","generate-disclaimer")],O.prototype,"execute",null);const E={commands:[k,O]}},300:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{getPackagePath:()=>getPackagePath,fs:()=>fs});var _yarnpkg_plugin_pnp__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(798),_yarnpkg_plugin_pnp__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_yarnpkg_plugin_pnp__WEBPACK_IMPORTED_MODULE_0__),_yarnpkg_core__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(966),_yarnpkg_core__WEBPACK_IMPORTED_MODULE_1___default=__webpack_require__.n(_yarnpkg_core__WEBPACK_IMPORTED_MODULE_1__),_yarnpkg_fslib__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(688),_yarnpkg_fslib__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(_yarnpkg_fslib__WEBPACK_IMPORTED_MODULE_2__),_yarnpkg_libzip__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(76),_yarnpkg_libzip__WEBPACK_IMPORTED_MODULE_3___default=__webpack_require__.n(_yarnpkg_libzip__WEBPACK_IMPORTED_MODULE_3__);const getPackagePath=async(e,t)=>{makePnPApi(e);const n=_yarnpkg_core__WEBPACK_IMPORTED_MODULE_1__.structUtils.convertPackageToLocator(t),r={name:_yarnpkg_core__WEBPACK_IMPORTED_MODULE_1__.structUtils.stringifyIdent(n),reference:n.reference},i=pnpApi.getPackageInformation(r);if(!i)return null;const{packageLocation:o}=i;return o};let pnpApi;const makePnPApi=project=>{pnpApi||(pnpApi=eval("module.require")((0,_yarnpkg_plugin_pnp__WEBPACK_IMPORTED_MODULE_0__.getPnpPath)(project).main))},fs=new _yarnpkg_fslib__WEBPACK_IMPORTED_MODULE_2__.VirtualFS({baseFs:new _yarnpkg_fslib__WEBPACK_IMPORTED_MODULE_2__.ZipOpenFS({libzip:(0,_yarnpkg_libzip__WEBPACK_IMPORTED_MODULE_3__.getLibzipSync)(),readOnlyArchives:!0})})},966:e=>{e.exports=require("@yarnpkg/core")},688:e=>{e.exports=require("@yarnpkg/fslib")},76:e=>{e.exports=require("@yarnpkg/libzip")},798:e=>{e.exports=require("@yarnpkg/plugin-pnp")}},__webpack_module_cache__={};function __webpack_require__(e){if(__webpack_module_cache__[e])return __webpack_module_cache__[e].exports;var t=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](t,t.exports,__webpack_require__),t.exports}return __webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__(195)})(); return plugin; } };