"use strict";var t=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,s){function o(t){try{u(i.next(t))}catch(t){s(t)}}function a(t){try{u(i.throw(t))}catch(t){s(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}u((i=i.apply(t,e||[])).next())}))},e=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.hspDetect=void 0;const n=require("../../publish/common"),i=e(require("tar")),r=require("../../../common/Constants");exports.hspDetect=function(e){return t(this,void 0,void 0,(function*(){if(!(0,n.isTgzFile)(e))return;const t=[];if(yield i.default.list({file:e,onentry:e=>{(e.path.endsWith(r.Constants.HSP_SUFFIX)||e.path.endsWith(r.Constants.HAR_SUFFIX))&&t.push(e.path)}}),2!==t.length)return;const s={interfaceHar:"",hsp:""};return t.forEach((t=>{t.endsWith(r.Constants.HAR_SUFFIX)?s.interfaceHar=t:t.endsWith(r.Constants.HSP_SUFFIX)&&(s.hsp=t)})),s.interfaceHar&&s.hsp?s:void 0}))};