(self.webpackChunk_postman_app_scratchpad=self.webpackChunk_postman_app_scratchpad||[]).push([[2],{7756:function(e,t,o){var a=o(526),r=o(523),n={requestGroups:[],folderGroups:[],headerGroups:[],zidRidMap:{},collection:{},methodsWithBody:["POST","PUT","PATCH","DELETE","LINK","UNLINK","LOCK","PROPFIND","VIEW","OPTIONS"],createCollection:function(e){return{id:r(),name:e,description:"New collection (imported from DHC)",order:[],folders:[],requests:[],timestamp:(new Date).getTime()}},addRequestToCollection:function(e,t){-1===t.order.indexOf(e.id)&&t.order.push(e.id),a.find(t.requests,function(t){t.id,e.id})||(e.collectionId=t.id,t.requests.push(e))},convertToPmRequest:function(e){var t={id:e.id.toLowerCase(),name:e.name,description:"",folder:null,pathVariables:{},url:e.uri.scheme.name+"://"+e.uri.path,method:e.method.name,headers:"",preRequestScript:null,tests:null,currentHelper:"normal",data:null,dataMode:"params",rawModeData:null};if(a.each(e.headers,function(e){var o=!1===e.enabled?"//":"";o+=e.name+": "+e.value+"\n",t.headers+=o}),this.methodsWithBody.indexOf(t.method.toUpperCase())>-1){var o=e.body;"Form"===o.bodyType&&o.formBody&&"multipart/form-data"===o.formBody.encoding?(t.dataMode="params",t.data=[],a.each(o.formBody.items,function(e){"Text"===e.type&&t.data.push({key:e.name,value:e.value,type:"text",enabled:e.enabled})})):"Form"===o.bodyType&&o.formBody&&"application/x-www-form-urlencoded"===o.formBody.encoding?(t.dataMode="urlencoded",t.data=[],a.each(o.formBody.items,function(e){"Text"===e.type&&t.data.push({key:e.name,value:e.value,type:"text",enabled:e.enabled})})):"Text"===o.bodyType&&o.textBody&&(t.dataMode="raw",t.rawModeData=o.textBody)}return t},convertDhcProject:function(e){var t=a.find(e.nodes,function(e){return"Project"===e.type}),o=this.createCollection(t.name),r=a.filter(e.nodes,function(e){return"Request"===e.type}),n=this;return a.each(r,function(e){var t=n.convertToPmRequest(e);n.addRequestToCollection(t,o)}),o},convert:function(e){return"string"==typeof e&&(e=JSON.parse(e)),this.convertDhcProject(e)}};e.exports=n}}]);