"use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.parseDependency=void 0;const t=require("../../../tools/ohpa/Ohpa"),o=require("../../../tools/ohpa/OhpaType"),r=require("../../../common/message"),p=e(require("path")),a=require("../../../config"),s=/[.]har$/i;exports.parseDependency=function(e,n){try{const r=t.ohpa.parse(e,n||"");return(r.type===o.OhpaType.File||r.type===o.OhpaType.SourceCode)&&r.type===o.OhpaType.SourceCode&&s.test(r.getRawSpec())&&r.setType(o.OhpaType.File),n&&n!==a.config.getProjectRoot()&&r.type===o.OhpaType.SourceCode&&function(e,t){const o=p.default.resolve(e),r=p.default.resolve(t),a=p.default.normalize(`${o}/`);return p.default.normalize(r).startsWith(a)}(n,r.getFetchSpec())&&r.setIsNativeSoType(!0),r}catch(t){throw new Error((0,r.format)(r.Messages.Common.ParseDependencyFailed,{pkg:e,msg:(null==t?void 0:t.message)||t}))}};