(self.webpackChunk_postman_app_scratchpad=self.webpackChunk_postman_app_scratchpad||[]).push([[3],{7981:function(e,t,r){var s=r(12),n=r(7982),a={validateRunscope:function(e){if("string"==typeof e&&(e=JSON.parse(e)),e.hasOwnProperty("name")&&e.hasOwnProperty("trigger_url"))return e;throw{message:"Not a runscope test"}},initCollection:function(e){return{id:n(),name:e.name,description:e.description,order:[],folders:[],requests:[],timestamp:(new Date).getTime()}},getPostmanHeadersFromRunscopeHeaders:function(e){var t="";for(var r in e)e.hasOwnProperty(r)&&(t+=r+":"+e[r]+"\n");return t},addRequest:function(e,t){e.order.push(t.id),t.collectionId=e.id,e.requests.push(t)},handleAuth:function(e,t){t.auth&&"basic"===t.auth.auth_type&&(e.currentHelper="basicAuth",e.helperAttributes={id:"basic",saveToRequest:!0,username:t.auth.username,password:t.auth.password})},handleData:function(e,t){if("string"==typeof t.body&&"{}"==JSON.stringify(t.form))e.dataMode="raw",e.data=t.body;else if(t.form){e.dataMode="urlencoded";var r=[];for(var s in t.form)t.form.hasOwnProperty(s)&&r.push({key:s,value:t.form[s][0]});e.data=r}},handleScripts:function(e,t){t.before_scripts||(t.before_scripts=[]),e.preRequestScript="";var r=t.before_scripts.join("\n");r=r.replace(/\n/g,"\n//"),s.isEmpty(r)||(e.preRequestScript="//==== You will need to convert this to a Postman-compliant script ====\n//==== (Select text and use Ctrl + / (Win) or Cmd + / (Mac) to uncomment ====\n//"+r),t.scripts||(t.scripts=[]);var n=t.scripts.join("\n");n=n.replace(/\n/g,"\n//"),s.isEmpty(n)||(e.tests+="//==== You will need to convert this to a Postman-compliant script ====\n//==== (Select text and use Ctrl + / (Win) or Cmd + / (Mac) to uncomment ====\n//"+n)},getRHSFromComparisonAndOperands:function(e,t,r){switch(e){case"equal_number":case"equal":return t+" == "+r;case"not_equal":return t+"!="+r;case"empty":return"_.isEmpty("+t+")";case"not_empty":return"!_.isEmpty("+t+")";case"contains":return"_.contains("+t+")";case"does_not_contain":return"!_.contains("+t+")";case"is_a_number":return"!isNaN("+t+")";case"is_less_than":return t+" < "+r;case"is_less_than_or_equal":return t+" <= "+r;case"is_greater_than":return t+" > "+r;case"is_greater_than_or_equal":return t+" >= "+r;case"has_key":return t+".hasOwnProperty("+r+")";case"has_value":return"_.contains(_.values("+t+"), "+r+")";default:return"<comparison here>"}},handleAssertions:function(e,t){var r="",n=this;s.each(t.assertions,(function(e){var t="",s=null,a="'"+e.value+"'",o="";switch(e.source){case"response_status":t+="Status Code is correct",s="responseCode.code";break;case"response_headers":t+="'"+e.property+"' Response Header is correct",s="postman.getResponseHeader('"+e.property+"')";break;case"response_json":e.property?(t+="Response."+e.property+" is correct",s="JSON.parse(responseBody)."+e.property):(t+="JSON Response is correct",s="JSON.parse(responseBody)");break;case"response_size":t+="//";break;case"response_text":t+="Response text is correct",s="responseBody";break;case"response_time":t+="Response time is correct",s="responseTime"}s&&((o='tests["'+t+'"] = '+n.getRHSFromComparisonAndOperands(e.comparison,s,a)+";").indexOf("JSON.parse")>-1&&(o="try {\n\t"+o+'\n}\ncatch(e) {\n\ttests["'+t+'"] = false;\n\tconsole.log("Could not parse JSON");\n}'),r+=o+"\n\n")})),s.isEmpty(r)||(e.tests+="//==== This section is Postman-compliant ====\n"+r+"\n")},getRequestFromStep:function(e){var t=this,r={id:n(),url:e.url,headers:t.getPostmanHeadersFromRunscopeHeaders(e.headers),pathVariables:{},method:e.method,name:e.url,description:e.note,tests:""};return t.handleData(r,e),t.handleAuth(r,e),t.handleAssertions(r,e),t.handleScripts(r,e),r},convert:function(e){var t=this;e=this.validateRunscope(e);var r=this.initCollection(e);return s.each(e.steps,(function(e){t.addRequest(r,t.getRequestFromStep(e))})),r}};e.exports=a},7984:function(e){for(var t=[],r=0;r<256;++r)t[r]=(r+256).toString(16).substr(1);e.exports=function(e,r){var s=r||0,n=t;return[n[e[s++]],n[e[s++]],n[e[s++]],n[e[s++]],"-",n[e[s++]],n[e[s++]],"-",n[e[s++]],n[e[s++]],"-",n[e[s++]],n[e[s++]],"-",n[e[s++]],n[e[s++]],n[e[s++]],n[e[s++]],n[e[s++]],n[e[s++]]].join("")}},7983:function(e){var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var r=new Uint8Array(16);e.exports=function(){return t(r),r}}else{var s=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)3&t||(e=4294967296*Math.random()),s[t]=e>>>((3&t)<<3)&255;return s}}},7982:function(e,t,r){var s=r(7983),n=r(7984);e.exports=function(e,t,r){var a=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||s)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var i=0;i<16;++i)t[a+i]=o[i];return t||n(o)}}}]);