apiuikit 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,50 +1,50 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ge=require("react/jsx-runtime"),re=require("react"),ce=require("./index-BJ0X8yP3.cjs");function Qr(t,e=new Set){if(e.has(t))return t;if(t.type==="object"&&t.properties&&typeof t.properties=="object"){e.add(t);try{const r={};for(const[n,s]of Object.entries(t.properties)){const o=/id$/i.test(n)&&s.type==="string"&&!s.format&&!s.examples,a=s.type==="string"&&!s.format&&!s.examples&&!s.enum;r[n]=o?{...s,format:"uuid"}:a?{...s,examples:["string"]}:Qr(s,e)}return{...t,properties:r}}finally{e.delete(t)}}return t}async function kn(t){try{const{generate:e}=await Promise.resolve().then(()=>require("./index-d8kJa7YD.cjs"));return await e(Qr(t),{seed:42,useExamplesValue:!0,optionalsProbability:1})}catch{return}}const ar="",sr=`
2
- `;var j=class{constructor({indent:t,join:e}={}){this.postProcessors=[],this.code=[],this.indentationCharacter=ar,this.lineJoin=sr,this.indentLine=(r,n=0)=>`${this.indentationCharacter.repeat(n)}${r}`,this.unshift=(r,n)=>{const s=this.indentLine(r,n);this.code.unshift(s)},this.push=(r,n)=>{const s=this.indentLine(r,n);this.code.push(s)},this.pushToLast=r=>{this.code||this.push(r);const n=`${this.code[this.code.length-1]}${r}`;this.code[this.code.length-1]=n},this.blank=()=>{this.code.push("")},this.join=()=>{const r=this.code.join(this.lineJoin);return this.postProcessors.reduce((n,s)=>s(n),r)},this.addPostProcessor=r=>{this.postProcessors=[...this.postProcessors,r]},this.indentationCharacter=t||ar,this.lineJoin=e??sr}},An=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},Rn=function(t){var e=typeof t;return t!==null&&(e==="object"||e==="function")},Xt={};Object.defineProperty(Xt,"__esModule",{value:!0});Xt.default=t=>Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e));const qn=An,Nn=Rn,_n=Xt.default;var Ln=(t,e,r)=>{const n=[];return(function s(o,a,i){a=a||{},a.indent=a.indent||" ",i=i||"";let c;a.inlineCharacterLimit===void 0?c={newLine:`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ge=require("react/jsx-runtime"),re=require("react"),ce=require("./index-D_7O8w46.cjs");function Jr(t,e=new Set){if(e.has(t))return t;if(t.type==="object"&&t.properties&&typeof t.properties=="object"){e.add(t);try{const r={};for(const[n,s]of Object.entries(t.properties)){const o=/id$/i.test(n)&&s.type==="string"&&!s.format&&!s.examples,a=s.type==="string"&&!s.format&&!s.examples&&!s.enum;r[n]=o?{...s,format:"uuid"}:a?{...s,examples:["string"]}:Jr(s,e)}return{...t,properties:r}}finally{e.delete(t)}}return t}async function xn(t){try{const{generate:e}=await Promise.resolve().then(()=>require("./index-d8kJa7YD.cjs"));return await e(Jr(t),{seed:42,useExamplesValue:!0,optionalsProbability:1})}catch{return}}const nr="",or=`
2
+ `;var j=class{constructor({indent:t,join:e}={}){this.postProcessors=[],this.code=[],this.indentationCharacter=nr,this.lineJoin=or,this.indentLine=(r,n=0)=>`${this.indentationCharacter.repeat(n)}${r}`,this.unshift=(r,n)=>{const s=this.indentLine(r,n);this.code.unshift(s)},this.push=(r,n)=>{const s=this.indentLine(r,n);this.code.push(s)},this.pushToLast=r=>{this.code||this.push(r);const n=`${this.code[this.code.length-1]}${r}`;this.code[this.code.length-1]=n},this.blank=()=>{this.code.push("")},this.join=()=>{const r=this.code.join(this.lineJoin);return this.postProcessors.reduce((n,s)=>s(n),r)},this.addPostProcessor=r=>{this.postProcessors=[...this.postProcessors,r]},this.indentationCharacter=t||nr,this.lineJoin=e??or}},jn=function(t){return Object.prototype.toString.call(t)==="[object RegExp]"},En=function(t){var e=typeof t;return t!==null&&(e==="object"||e==="function")},Dt={};Object.defineProperty(Dt,"__esModule",{value:!0});Dt.default=t=>Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e));const Pn=jn,Cn=En,kn=Dt.default;var An=(t,e,r)=>{const n=[];return(function s(o,a,i){a=a||{},a.indent=a.indent||" ",i=i||"";let c;a.inlineCharacterLimit===void 0?c={newLine:`
3
3
  `,newLineOrSpace:`
4
4
  `,pad:i,indent:i+a.indent}:c={newLine:"@@__STRINGIFY_OBJECT_NEW_LINE__@@",newLineOrSpace:"@@__STRINGIFY_OBJECT_NEW_LINE_OR_SPACE__@@",pad:"@@__STRINGIFY_OBJECT_PAD__@@",indent:"@@__STRINGIFY_OBJECT_INDENT__@@"};const l=f=>{if(a.inlineCharacterLimit===void 0)return f;const u=f.replace(new RegExp(c.newLine,"g"),"").replace(new RegExp(c.newLineOrSpace,"g")," ").replace(new RegExp(c.pad+"|"+c.indent,"g"),"");return u.length<=a.inlineCharacterLimit?u:f.replace(new RegExp(c.newLine+"|"+c.newLineOrSpace,"g"),`
5
- `).replace(new RegExp(c.pad,"g"),i).replace(new RegExp(c.indent,"g"),i+a.indent)};if(n.indexOf(o)!==-1)return'"[Circular]"';if(o==null||typeof o=="number"||typeof o=="boolean"||typeof o=="function"||typeof o=="symbol"||qn(o))return String(o);if(o instanceof Date)return`new Date('${o.toISOString()}')`;if(Array.isArray(o)){if(o.length===0)return"[]";n.push(o);const f="["+c.newLine+o.map((u,p)=>{const d=o.length-1===p?c.newLine:","+c.newLineOrSpace;let h=s(u,a,i+a.indent);return a.transform&&(h=a.transform(o,p,h)),c.indent+h+d}).join("")+c.pad+"]";return n.pop(),l(f)}if(Nn(o)){let f=Object.keys(o).concat(_n(o));if(a.filter&&(f=f.filter(p=>a.filter(o,p))),f.length===0)return"{}";n.push(o);const u="{"+c.newLine+f.map((p,d)=>{const h=f.length-1===d?c.newLine:","+c.newLineOrSpace,y=typeof p=="symbol",g=!y&&/^[a-z$_][a-z$_0-9]*$/i.test(p),v=y||g?p:s(p,a);let m=s(o[p],a,i+a.indent);return a.transform&&(m=a.transform(o,p,m)),c.indent+String(v)+": "+m+h}).join("")+c.pad+"}";return n.pop(),l(u)}return o=String(o).replace(/[\r\n]/g,f=>f===`
6
- `?"\\n":"\\r"),a.singleQuotes===!1?(o=o.replace(/"/g,'\\"'),`"${o}"`):(o=o.replace(/\\?'/g,"\\'"),`'${o}'`)})(t,e,r)};const ie=ce.getDefaultExportFromCjs(Ln),G=(t,e)=>Object.keys(t).find(r=>r.toLowerCase()===e.toLowerCase()),le=(t,e)=>{const r=G(t,e);if(r)return t[r]},nt=(t,e)=>!!G(t,e),In=t=>["application/json","application/x-json","text/json","text/x-json","+json"].some(e=>t.indexOf(e)>-1),Un={info:{key:"agent",title:"Agent",default:"prompt"},clientsById:{prompt:{info:{key:"prompt",title:"Agent Prompt",link:"https://github.com/readmeio/httpsnippet",description:"A copy-and-pastable prompt, for any AI agent, describing how to make the request.",extname:".txt"},convert:({method:t,fullUrl:e,allHeaders:r,postData:n},s)=>{const o={indent:" ",join:`
5
+ `).replace(new RegExp(c.pad,"g"),i).replace(new RegExp(c.indent,"g"),i+a.indent)};if(n.indexOf(o)!==-1)return'"[Circular]"';if(o==null||typeof o=="number"||typeof o=="boolean"||typeof o=="function"||typeof o=="symbol"||Pn(o))return String(o);if(o instanceof Date)return`new Date('${o.toISOString()}')`;if(Array.isArray(o)){if(o.length===0)return"[]";n.push(o);const f="["+c.newLine+o.map((u,d)=>{const p=o.length-1===d?c.newLine:","+c.newLineOrSpace;let h=s(u,a,i+a.indent);return a.transform&&(h=a.transform(o,d,h)),c.indent+h+p}).join("")+c.pad+"]";return n.pop(),l(f)}if(Cn(o)){let f=Object.keys(o).concat(kn(o));if(a.filter&&(f=f.filter(d=>a.filter(o,d))),f.length===0)return"{}";n.push(o);const u="{"+c.newLine+f.map((d,p)=>{const h=f.length-1===p?c.newLine:","+c.newLineOrSpace,y=typeof d=="symbol",g=!y&&/^[a-z$_][a-z$_0-9]*$/i.test(d),$=y||g?d:s(d,a);let m=s(o[d],a,i+a.indent);return a.transform&&(m=a.transform(o,d,m)),c.indent+String($)+": "+m+h}).join("")+c.pad+"}";return n.pop(),l(u)}return o=String(o).replace(/[\r\n]/g,f=>f===`
6
+ `?"\\n":"\\r"),a.singleQuotes===!1?(o=o.replace(/"/g,'\\"'),`"${o}"`):(o=o.replace(/\\?'/g,"\\'"),`'${o}'`)})(t,e,r)};const ie=ce.getDefaultExportFromCjs(An),G=(t,e)=>Object.keys(t).find(r=>r.toLowerCase()===e.toLowerCase()),le=(t,e)=>{const r=G(t,e);if(r)return t[r]},nt=(t,e)=>!!G(t,e),Rn=t=>["application/json","application/x-json","text/json","text/x-json","+json"].some(e=>t.indexOf(e)>-1),qn={info:{key:"agent",title:"Agent",default:"prompt"},clientsById:{prompt:{info:{key:"prompt",title:"Agent Prompt",link:"https://github.com/readmeio/httpsnippet",description:"A copy-and-pastable prompt, for any AI agent, describing how to make the request.",extname:".txt"},convert:({method:t,fullUrl:e,allHeaders:r,postData:n},s)=>{const o={indent:" ",join:`
7
7
  `,...s},{blank:a,push:i,join:c}=new j(o);i("Write code that makes the HTTP request described below. Use my preferred programming language and HTTP client library — if I haven't told you what those are, ask me before writing any code."),a(),i(`Method: ${t}`),i(`URL: ${e}`);const l=Object.keys(r);return l.length&&(a(),i("Headers:"),l.forEach(f=>{i(`${f}: ${r[f]}`,1)})),n.text&&(a(),i(`Body (${n.mimeType}):`),i(n.text)),a(),i("The request the code makes must match the method, URL, headers, and body exactly as described above."),o.markdownURL&&(a(),i(`Check ${o.markdownURL} for more info.`)),c()}}}};function Be(t,e={}){const{delimiter:r='"',escapeChar:n="\\",escapeNewlines:s=!0}=e;return[...t.toString()].map(o=>o==="\b"?`${n}b`:o===" "?`${n}t`:o===`
8
- `?s?`${n}n`:o:o==="\f"?`${n}f`:o==="\r"?s?`${n}r`:o:o===n?n+n:o===r?n+r:o<" "||o>"~"?JSON.stringify(o).slice(1,-1):o).join("")}const Re=t=>Be(t,{delimiter:"'"}),I=t=>Be(t,{delimiter:'"'}),Fn={info:{key:"c",title:"C",default:"libcurl",cli:"c"},clientsById:{libcurl:{info:{key:"libcurl",title:"Libcurl",link:"http://curl.haxx.se/libcurl",description:"Simple REST and HTTP API Client for C",extname:".c"},convert:({method:t,fullUrl:e,headersObj:r,allHeaders:n,postData:s})=>{const{push:o,blank:a,join:i}=new j;o("CURL *hnd = curl_easy_init();"),a(),o(`curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "${t.toUpperCase()}");`),o("curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);"),o(`curl_easy_setopt(hnd, CURLOPT_URL, "${e}");`);const c=Object.keys(r);return c.length&&(a(),o("struct curl_slist *headers = NULL;"),c.forEach(l=>{o(`headers = curl_slist_append(headers, "${l}: ${I(r[l])}");`)}),o("curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);")),n.cookie&&(a(),o(`curl_easy_setopt(hnd, CURLOPT_COOKIE, "${n.cookie}");`)),s.text&&(a(),o(`curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, ${JSON.stringify(s.text)});`)),a(),o("CURLcode ret = curl_easy_perform(hnd);"),i()}}}};var cr=class{constructor(t){this.name="",this.toString=()=>`:${this.name}`,this.name=t}},Mn=class{constructor(t){this.path="",this.toString=()=>`(clojure.java.io/file "${this.path}")`,this.path=t}};const Yr=t=>t===void 0?null:t===null?"null":t.constructor.name.toLowerCase(),Xr=t=>t===void 0?!0:Yr(t)==="object"?Object.keys(t).length===0:!1,lr=t=>(Object.keys(t).filter(e=>Xr(t[e])).forEach(e=>{delete t[e]}),t),Ye=(t,e)=>{const r=" ".repeat(t);return e.replace(/\n/g,`
9
- ${r}`)},Ft=t=>{switch(Yr(t)){case"string":return`"${t.replace(/"/g,'\\"')}"`;case"file":return t.toString();case"keyword":return t.toString();case"null":return"nil";case"regexp":return`#"${t.source}"`;case"object":{const e=Object.keys(t).reduce((r,n)=>`${r}:${n} ${Ye(n.length+2,Ft(t[n]))}
10
- `,"").trim();return`{${Ye(1,e)}}`}case"array":{const e=t.reduce((r,n)=>`${r} ${Ft(n)}`,"").trim();return`[${Ye(1,e)}]`}default:return t.toString()}},Hn={info:{key:"clojure",title:"Clojure",default:"clj_http"},clientsById:{clj_http:{info:{key:"clj_http",title:"clj-http",link:"https://github.com/dakrone/clj-http",description:"An idiomatic clojure http client wrapping the apache client.",extname:".clj"},convert:({queryObj:t,method:e,postData:r,url:n,allHeaders:s},o)=>{const{push:a,join:i}=new j({indent:o==null?void 0:o.indent}),c=["get","post","put","delete","patch","head","options"];if(e=e.toLowerCase(),!c.includes(e))return a("Method not supported"),i();const l={headers:s,"query-params":t};switch(r.mimeType){case"application/json":{l["content-type"]=new cr("json"),l["form-params"]=r.jsonObj;const f=G(l.headers,"content-type");f&&delete l.headers[f]}break;case"application/x-www-form-urlencoded":{l["form-params"]=r.paramsObj;const f=G(l.headers,"content-type");f&&delete l.headers[f]}break;case"text/plain":{l.body=r.text;const f=G(l.headers,"content-type");f&&delete l.headers[f]}break;case"multipart/form-data":if(r.params){l.multipart=r.params.map(u=>u.fileName&&!u.value?{name:u.name,content:new Mn(u.fileName)}:{name:u.name,content:u.value});const f=G(l.headers,"content-type");f&&delete l.headers[f]}break}switch(le(l.headers,"accept")){case"application/json":{l.accept=new cr("json");const f=G(l.headers,"accept");f&&delete l.headers[f]}break}if(a(`(require '[clj-http.client :as client])
11
- `),Xr(lr(l)))a(`(client/${e} "${n}")`);else{const f=11+e.length+n.length,u=Ye(f,Ft(lr(l)));a(`(client/${e} "${n}" ${u})`)}return i()}}}},Bn={info:{key:"crystal",title:"Crystal",default:"native"},clientsById:{native:{info:{key:"native",title:"http::client",link:"https://crystal-lang.org/api/master/HTTP/Client.html",description:"Crystal HTTP client",extname:".cr"},convert:({method:t,fullUrl:e,postData:r,allHeaders:n},s={})=>{const{insecureSkipVerify:o=!1}=s,{push:a,blank:i,join:c}=new j;a('require "http/client"'),i(),a(`url = "${e}"`);const l=Object.keys(n);l.length&&(a("headers = HTTP::Headers{"),l.forEach(y=>{a(` "${y}" => "${I(n[y])}"`)}),a("}")),r.text&&a(`reqBody = ${JSON.stringify(r.text)}`),i();const f=t.toUpperCase(),u=["GET","POST","HEAD","DELETE","PATCH","PUT","OPTIONS"],p=l.length?", headers: headers":"",d=r.text?", body: reqBody":"",h=o?", tls: OpenSSL::SSL::Context::Client.insecure":"";return u.includes(f)?a(`response = HTTP::Client.${f.toLowerCase()} url${p}${d}${h}`):a(`response = HTTP::Client.exec "${f}", url${p}${d}${h}`),a("puts response.body"),c()}}}},Wn=t=>{let e=le(t,"accept-encoding");if(!e)return[];const r={gzip:"DecompressionMethods.GZip",deflate:"DecompressionMethods.Deflate"},n=[];return typeof e=="string"&&(e=[e]),e.forEach(s=>{s.split(",").forEach(o=>{const a=/\s*([^;\s]+)/.exec(o);if(a){const i=r[a[1]];i&&n.push(i)}})}),n},Gn={info:{key:"httpclient",title:"HttpClient",link:"https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient",description:".NET Standard HTTP Client",extname:".cs"},convert:({allHeaders:t,postData:e,method:r,fullUrl:n},s)=>{var p,d;const{push:o,join:a}=new j({indent:{indent:" ",...s}.indent});o("using System.Net.Http.Headers;");let i="";const c=!!t.cookie,l=Wn(t);(c||l.length)&&(i="clientHandler",o("var clientHandler = new HttpClientHandler"),o("{"),c&&o("UseCookies = false,",1),l.length&&o(`AutomaticDecompression = ${l.join(" | ")},`,1),o("};")),o(`var client = new HttpClient(${i});`),o("var request = new HttpRequestMessage"),o("{");const f=["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS","TRACE"];r=r.toUpperCase(),r&&f.includes(r)?r=`HttpMethod.${r[0]}${r.substring(1).toLowerCase()}`:r=`new HttpMethod("${r}")`,o(`Method = ${r},`,1),o(`RequestUri = new Uri("${n}"),`,1);const u=Object.keys(t).filter(h=>{switch(h.toLowerCase()){case"content-type":case"content-length":case"accept-encoding":return!1;default:return!0}});if(u.length&&(o("Headers =",1),o("{",1),u.forEach(h=>{o(`{ "${h}", "${I(t[h])}" },`,2)}),o("},",1)),e.text){const h=e.mimeType;switch(h){case"application/x-www-form-urlencoded":o("Content = new FormUrlEncodedContent(new Dictionary<string, string>",1),o("{",1),(p=e.params)==null||p.forEach(y=>{o(`{ "${y.name}", "${y.value}" },`,2)}),o("}),",1);break;case"multipart/form-data":o("Content = new MultipartFormDataContent",1),o("{",1),(d=e.params)==null||d.forEach(y=>{o(`new StringContent(${JSON.stringify(y.value||"")})`,2),o("{",2),o("Headers =",3),o("{",3),y.contentType&&o(`ContentType = new MediaTypeHeaderValue("${y.contentType}"),`,4),o('ContentDisposition = new ContentDispositionHeaderValue("form-data")',4),o("{",4),o(`Name = "${y.name}",`,5),y.fileName&&o(`FileName = "${y.fileName}",`,5),o("}",4),o("}",3),o("},",2)}),o("},",1);break;default:o(`Content = new StringContent(${JSON.stringify(e.text||"")})`,1),o("{",1),o("Headers =",2),o("{",2),o(`ContentType = new MediaTypeHeaderValue("${h}")`,3),o("}",2),o("}",1);break}}return o("};"),o("using (var response = await client.SendAsync(request))"),o("{"),o("response.EnsureSuccessStatusCode();",1),o("var body = await response.Content.ReadAsStringAsync();",1),o("Console.WriteLine(body);",1),o("}"),a()}};function Jn(t){return t[0].toUpperCase()+t.slice(1).toLowerCase()}const zn={info:{key:"csharp",title:"C#",default:"restsharp",cli:"dotnet"},clientsById:{httpclient:Gn,restsharp:{info:{key:"restsharp",title:"RestSharp",link:"http://restsharp.org/",description:"Simple REST and HTTP API Client for .NET",extname:".cs",installation:()=>"dotnet add package RestSharp"},convert:({method:t,fullUrl:e,headersObj:r,cookies:n,postData:s,uriObj:o})=>{const{push:a,join:i}=new j;if(!["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"].includes(t.toUpperCase()))return"Method not supported";a(`using RestSharp;
8
+ `?s?`${n}n`:o:o==="\f"?`${n}f`:o==="\r"?s?`${n}r`:o:o===n?n+n:o===r?n+r:o<" "||o>"~"?JSON.stringify(o).slice(1,-1):o).join("")}const Re=t=>Be(t,{delimiter:"'"}),I=t=>Be(t,{delimiter:'"'}),Nn={info:{key:"c",title:"C",default:"libcurl",cli:"c"},clientsById:{libcurl:{info:{key:"libcurl",title:"Libcurl",link:"http://curl.haxx.se/libcurl",description:"Simple REST and HTTP API Client for C",extname:".c"},convert:({method:t,fullUrl:e,headersObj:r,allHeaders:n,postData:s})=>{const{push:o,blank:a,join:i}=new j;o("CURL *hnd = curl_easy_init();"),a(),o(`curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "${t.toUpperCase()}");`),o("curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);"),o(`curl_easy_setopt(hnd, CURLOPT_URL, "${e}");`);const c=Object.keys(r);return c.length&&(a(),o("struct curl_slist *headers = NULL;"),c.forEach(l=>{o(`headers = curl_slist_append(headers, "${l}: ${I(r[l])}");`)}),o("curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);")),n.cookie&&(a(),o(`curl_easy_setopt(hnd, CURLOPT_COOKIE, "${n.cookie}");`)),s.text&&(a(),o(`curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, ${JSON.stringify(s.text)});`)),a(),o("CURLcode ret = curl_easy_perform(hnd);"),i()}}}};var ir=class{constructor(t){this.name="",this.toString=()=>`:${this.name}`,this.name=t}},_n=class{constructor(t){this.path="",this.toString=()=>`(clojure.java.io/file "${this.path}")`,this.path=t}};const zr=t=>t===void 0?null:t===null?"null":t.constructor.name.toLowerCase(),Vr=t=>t===void 0?!0:zr(t)==="object"?Object.keys(t).length===0:!1,ar=t=>(Object.keys(t).filter(e=>Vr(t[e])).forEach(e=>{delete t[e]}),t),Ye=(t,e)=>{const r=" ".repeat(t);return e.replace(/\n/g,`
9
+ ${r}`)},Lt=t=>{switch(zr(t)){case"string":return`"${t.replace(/"/g,'\\"')}"`;case"file":return t.toString();case"keyword":return t.toString();case"null":return"nil";case"regexp":return`#"${t.source}"`;case"object":{const e=Object.keys(t).reduce((r,n)=>`${r}:${n} ${Ye(n.length+2,Lt(t[n]))}
10
+ `,"").trim();return`{${Ye(1,e)}}`}case"array":{const e=t.reduce((r,n)=>`${r} ${Lt(n)}`,"").trim();return`[${Ye(1,e)}]`}default:return t.toString()}},Ln={info:{key:"clojure",title:"Clojure",default:"clj_http"},clientsById:{clj_http:{info:{key:"clj_http",title:"clj-http",link:"https://github.com/dakrone/clj-http",description:"An idiomatic clojure http client wrapping the apache client.",extname:".clj"},convert:({queryObj:t,method:e,postData:r,url:n,allHeaders:s},o)=>{const{push:a,join:i}=new j({indent:o==null?void 0:o.indent}),c=["get","post","put","delete","patch","head","options"];if(e=e.toLowerCase(),!c.includes(e))return a("Method not supported"),i();const l={headers:s,"query-params":t};switch(r.mimeType){case"application/json":{l["content-type"]=new ir("json"),l["form-params"]=r.jsonObj;const f=G(l.headers,"content-type");f&&delete l.headers[f]}break;case"application/x-www-form-urlencoded":{l["form-params"]=r.paramsObj;const f=G(l.headers,"content-type");f&&delete l.headers[f]}break;case"text/plain":{l.body=r.text;const f=G(l.headers,"content-type");f&&delete l.headers[f]}break;case"multipart/form-data":if(r.params){l.multipart=r.params.map(u=>u.fileName&&!u.value?{name:u.name,content:new _n(u.fileName)}:{name:u.name,content:u.value});const f=G(l.headers,"content-type");f&&delete l.headers[f]}break}switch(le(l.headers,"accept")){case"application/json":{l.accept=new ir("json");const f=G(l.headers,"accept");f&&delete l.headers[f]}break}if(a(`(require '[clj-http.client :as client])
11
+ `),Vr(ar(l)))a(`(client/${e} "${n}")`);else{const f=11+e.length+n.length,u=Ye(f,Lt(ar(l)));a(`(client/${e} "${n}" ${u})`)}return i()}}}},In={info:{key:"crystal",title:"Crystal",default:"native"},clientsById:{native:{info:{key:"native",title:"http::client",link:"https://crystal-lang.org/api/master/HTTP/Client.html",description:"Crystal HTTP client",extname:".cr"},convert:({method:t,fullUrl:e,postData:r,allHeaders:n},s={})=>{const{insecureSkipVerify:o=!1}=s,{push:a,blank:i,join:c}=new j;a('require "http/client"'),i(),a(`url = "${e}"`);const l=Object.keys(n);l.length&&(a("headers = HTTP::Headers{"),l.forEach(y=>{a(` "${y}" => "${I(n[y])}"`)}),a("}")),r.text&&a(`reqBody = ${JSON.stringify(r.text)}`),i();const f=t.toUpperCase(),u=["GET","POST","HEAD","DELETE","PATCH","PUT","OPTIONS"],d=l.length?", headers: headers":"",p=r.text?", body: reqBody":"",h=o?", tls: OpenSSL::SSL::Context::Client.insecure":"";return u.includes(f)?a(`response = HTTP::Client.${f.toLowerCase()} url${d}${p}${h}`):a(`response = HTTP::Client.exec "${f}", url${d}${p}${h}`),a("puts response.body"),c()}}}},Un=t=>{let e=le(t,"accept-encoding");if(!e)return[];const r={gzip:"DecompressionMethods.GZip",deflate:"DecompressionMethods.Deflate"},n=[];return typeof e=="string"&&(e=[e]),e.forEach(s=>{s.split(",").forEach(o=>{const a=/\s*([^;\s]+)/.exec(o);if(a){const i=r[a[1]];i&&n.push(i)}})}),n},Fn={info:{key:"httpclient",title:"HttpClient",link:"https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient",description:".NET Standard HTTP Client",extname:".cs"},convert:({allHeaders:t,postData:e,method:r,fullUrl:n},s)=>{var d,p;const{push:o,join:a}=new j({indent:{indent:" ",...s}.indent});o("using System.Net.Http.Headers;");let i="";const c=!!t.cookie,l=Un(t);(c||l.length)&&(i="clientHandler",o("var clientHandler = new HttpClientHandler"),o("{"),c&&o("UseCookies = false,",1),l.length&&o(`AutomaticDecompression = ${l.join(" | ")},`,1),o("};")),o(`var client = new HttpClient(${i});`),o("var request = new HttpRequestMessage"),o("{");const f=["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS","TRACE"];r=r.toUpperCase(),r&&f.includes(r)?r=`HttpMethod.${r[0]}${r.substring(1).toLowerCase()}`:r=`new HttpMethod("${r}")`,o(`Method = ${r},`,1),o(`RequestUri = new Uri("${n}"),`,1);const u=Object.keys(t).filter(h=>{switch(h.toLowerCase()){case"content-type":case"content-length":case"accept-encoding":return!1;default:return!0}});if(u.length&&(o("Headers =",1),o("{",1),u.forEach(h=>{o(`{ "${h}", "${I(t[h])}" },`,2)}),o("},",1)),e.text){const h=e.mimeType;switch(h){case"application/x-www-form-urlencoded":o("Content = new FormUrlEncodedContent(new Dictionary<string, string>",1),o("{",1),(d=e.params)==null||d.forEach(y=>{o(`{ "${y.name}", "${y.value}" },`,2)}),o("}),",1);break;case"multipart/form-data":o("Content = new MultipartFormDataContent",1),o("{",1),(p=e.params)==null||p.forEach(y=>{o(`new StringContent(${JSON.stringify(y.value||"")})`,2),o("{",2),o("Headers =",3),o("{",3),y.contentType&&o(`ContentType = new MediaTypeHeaderValue("${y.contentType}"),`,4),o('ContentDisposition = new ContentDispositionHeaderValue("form-data")',4),o("{",4),o(`Name = "${y.name}",`,5),y.fileName&&o(`FileName = "${y.fileName}",`,5),o("}",4),o("}",3),o("},",2)}),o("},",1);break;default:o(`Content = new StringContent(${JSON.stringify(e.text||"")})`,1),o("{",1),o("Headers =",2),o("{",2),o(`ContentType = new MediaTypeHeaderValue("${h}")`,3),o("}",2),o("}",1);break}}return o("};"),o("using (var response = await client.SendAsync(request))"),o("{"),o("response.EnsureSuccessStatusCode();",1),o("var body = await response.Content.ReadAsStringAsync();",1),o("Console.WriteLine(body);",1),o("}"),a()}};function Mn(t){return t[0].toUpperCase()+t.slice(1).toLowerCase()}const Hn={info:{key:"csharp",title:"C#",default:"restsharp",cli:"dotnet"},clientsById:{httpclient:Fn,restsharp:{info:{key:"restsharp",title:"RestSharp",link:"http://restsharp.org/",description:"Simple REST and HTTP API Client for .NET",extname:".cs",installation:()=>"dotnet add package RestSharp"},convert:({method:t,fullUrl:e,headersObj:r,cookies:n,postData:s,uriObj:o})=>{const{push:a,join:i}=new j;if(!["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"].includes(t.toUpperCase()))return"Method not supported";a(`using RestSharp;
12
12
 
13
- `),a(`var options = new RestClientOptions("${e}");`),a("var client = new RestClient(options);"),a('var request = new RestRequest("");');const c=s.mimeType&&s.mimeType==="multipart/form-data";switch(c&&a("request.AlwaysMultipartFormData = true;"),Object.keys(r).forEach(l=>{if(s.mimeType&&l.toLowerCase()==="content-type"&&s.text){c&&s.boundary&&a(`request.FormBoundary = "${s.boundary}";`);return}a(`request.AddHeader("${l}", "${I(r[l])}");`)}),n.forEach(({name:l,value:f})=>{a(`request.AddCookie("${l}", "${I(f)}", "${o.pathname}", "${o.host}");`)}),s.mimeType){case"multipart/form-data":if(!s.params)break;s.params.forEach(l=>{l.fileName?a(`request.AddFile("${l.name}", "${l.fileName}");`):a(`request.AddParameter("${l.name}", "${l.value}");`)});break;case"application/x-www-form-urlencoded":if(!s.params)break;s.params.forEach(l=>{a(`request.AddParameter("${l.name}", "${l.value}");`)});break;case"application/json":if(!s.text)break;a(`request.AddJsonBody(${JSON.stringify(s.text)}, false);`);break;default:if(!s.text)break;a(`request.AddStringBody("${s.text}", "${s.mimeType}");`)}return a(`var response = await client.${Jn(t)}Async(request);
13
+ `),a(`var options = new RestClientOptions("${e}");`),a("var client = new RestClient(options);"),a('var request = new RestRequest("");');const c=s.mimeType&&s.mimeType==="multipart/form-data";switch(c&&a("request.AlwaysMultipartFormData = true;"),Object.keys(r).forEach(l=>{if(s.mimeType&&l.toLowerCase()==="content-type"&&s.text){c&&s.boundary&&a(`request.FormBoundary = "${s.boundary}";`);return}a(`request.AddHeader("${l}", "${I(r[l])}");`)}),n.forEach(({name:l,value:f})=>{a(`request.AddCookie("${l}", "${I(f)}", "${o.pathname}", "${o.host}");`)}),s.mimeType){case"multipart/form-data":if(!s.params)break;s.params.forEach(l=>{l.fileName?a(`request.AddFile("${l.name}", "${l.fileName}");`):a(`request.AddParameter("${l.name}", "${l.value}");`)});break;case"application/x-www-form-urlencoded":if(!s.params)break;s.params.forEach(l=>{a(`request.AddParameter("${l.name}", "${l.value}");`)});break;case"application/json":if(!s.text)break;a(`request.AddJsonBody(${JSON.stringify(s.text)}, false);`);break;default:if(!s.text)break;a(`request.AddStringBody("${s.text}", "${s.mimeType}");`)}return a(`var response = await client.${Mn(t)}Async(request);
14
14
  `),a(`Console.WriteLine("{0}", response.Content);
15
- `),i()}}}},Vn={info:{key:"go",title:"Go",default:"native",cli:"go"},clientsById:{native:{info:{key:"native",title:"NewRequest",link:"http://golang.org/pkg/net/http/#NewRequest",description:"Golang HTTP client request",extname:".go"},convert:({postData:t,method:e,allHeaders:r,fullUrl:n},s={})=>{const{blank:o,push:a,join:i}=new j({indent:" "}),{showBoilerplate:c=!0,checkErrors:l=!1,printBody:f=!0,timeout:u=-1,insecureSkipVerify:p=!1}=s,d=l?"err":"_",h=c?1:0,y=()=>{l&&(a("if err != nil {",h),a("panic(err)",h+1),a("}",h))};c&&(a("package main"),o(),a("import ("),a('"fmt"',h),u>0&&a('"time"',h),p&&a('"crypto/tls"',h),t.text&&a('"strings"',h),a('"net/http"',h),f&&a('"io"',h),a(")"),o(),a("func main() {"),o()),p&&(a("insecureTransport := http.DefaultTransport.(*http.Transport).Clone()",h),a("insecureTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}",h));const g=u>0,v=g||p,m=v?"client":"http.DefaultClient";return v&&(a("client := http.Client{",h),g&&a(`Timeout: time.Duration(${u} * time.Second),`,h+1),p&&a("Transport: insecureTransport,",h+1),a("}",h),o()),a(`url := "${n}"`,h),o(),t.text?(a(`payload := strings.NewReader(${JSON.stringify(t.text)})`,h),o(),a(`req, ${d} := http.NewRequest("${e}", url, payload)`,h),o()):(a(`req, ${d} := http.NewRequest("${e}", url, nil)`,h),o()),y(),Object.keys(r).length&&(Object.keys(r).forEach(b=>{a(`req.Header.Add("${b}", "${I(r[b])}")`,h)}),o()),a(`res, ${d} := ${m}.Do(req)`,h),y(),f&&(o(),a("defer res.Body.Close()",h),a(`body, ${d} := io.ReadAll(res.Body)`,h),y()),o(),f&&a("fmt.Println(string(body))",h),c&&(o(),a("}")),i()}}}},fr=`\r
16
- `,Kn={info:{key:"http",title:"HTTP",default:"http1.1"},clientsById:{"http1.1":{info:{key:"http1.1",title:"HTTP/1.1",link:"https://tools.ietf.org/html/rfc7230",description:"HTTP/1.1 request string in accordance with RFC 7230",extname:null},convert:({method:t,fullUrl:e,uriObj:r,httpVersion:n,allHeaders:s,postData:o},a)=>{const i={absoluteURI:!1,autoContentLength:!0,autoHost:!0,...a},{blank:c,push:l,join:f}=new j({indent:"",join:fr});l(`${t} ${i.absoluteURI?e:r.path} ${n}`);const u=Object.keys(s);u.forEach(h=>{const y=h.toLowerCase().replace(/(^|-)(\w)/g,g=>g.toUpperCase());l(`${y}: ${s[h]}`)}),i.autoHost&&!u.includes("host")&&l(`Host: ${r.host}`),i.autoContentLength&&o.text&&!u.includes("content-length")&&l(`Content-Length: ${Buffer.byteLength(o.text,"ascii").toString()}`),c();const p=f(),d=o.text||"";return`${p}${fr}${d}`}}}},Dn={info:{key:"java",title:"Java",default:"unirest"},clientsById:{asynchttp:{info:{key:"asynchttp",title:"AsyncHttp",link:"https://github.com/AsyncHttpClient/async-http-client",description:"Asynchronous Http and WebSocket Client library for Java",extname:".java"},convert:({method:t,allHeaders:e,postData:r,fullUrl:n},s)=>{const{blank:o,push:a,join:i}=new j({indent:{indent:" ",...s}.indent});return a("AsyncHttpClient client = new DefaultAsyncHttpClient();"),a(`client.prepare("${t.toUpperCase()}", "${n}")`),Object.keys(e).forEach(c=>{a(`.setHeader("${c}", "${I(e[c])}")`,1)}),r.text&&a(`.setBody(${JSON.stringify(r.text)})`,1),a(".execute()",1),a(".toCompletableFuture()",1),a(".thenAccept(System.out::println)",1),a(".join();",1),o(),a("client.close();"),i()}},nethttp:{info:{key:"nethttp",title:"java.net.http",link:"https://openjdk.java.net/groups/net/httpclient/intro.html",description:"Java Standardized HTTP Client API",extname:".java"},convert:({allHeaders:t,fullUrl:e,method:r,postData:n},s)=>{const{push:o,join:a}=new j({indent:{indent:" ",...s}.indent});return o("HttpRequest request = HttpRequest.newBuilder()"),o(`.uri(URI.create("${e}"))`,2),Object.keys(t).forEach(i=>{o(`.header("${i}", "${I(t[i])}")`,2)}),n.text?o(`.method("${r.toUpperCase()}", HttpRequest.BodyPublishers.ofString(${JSON.stringify(n.text)}))`,2):o(`.method("${r.toUpperCase()}", HttpRequest.BodyPublishers.noBody())`,2),o(".build();",2),o("HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());"),o("System.out.println(response.body());"),a()}},okhttp:{info:{key:"okhttp",title:"OkHttp",link:"http://square.github.io/okhttp/",description:"An HTTP Request Client Library",extname:".java"},convert:({postData:t,method:e,fullUrl:r,allHeaders:n},s)=>{const{push:o,blank:a,join:i}=new j({indent:{indent:" ",...s}.indent}),c=["GET","POST","PUT","DELETE","PATCH","HEAD"],l=["POST","PUT","DELETE","PATCH"];return o("OkHttpClient client = new OkHttpClient();"),a(),t.text&&(t.boundary?o(`MediaType mediaType = MediaType.parse("${t.mimeType}; boundary=${t.boundary}");`):o(`MediaType mediaType = MediaType.parse("${t.mimeType}");`),o(`RequestBody body = RequestBody.create(mediaType, ${JSON.stringify(t.text)});`)),o("Request request = new Request.Builder()"),o(`.url("${r}")`,1),c.includes(e.toUpperCase())?l.includes(e.toUpperCase())?t.text?o(`.${e.toLowerCase()}(body)`,1):o(`.${e.toLowerCase()}(null)`,1):o(`.${e.toLowerCase()}()`,1):t.text?o(`.method("${e.toUpperCase()}", body)`,1):o(`.method("${e.toUpperCase()}", null)`,1),Object.keys(n).forEach(f=>{o(`.addHeader("${f}", "${I(n[f])}")`,1)}),o(".build();",1),a(),o("Response response = client.newCall(request).execute();"),i()}},unirest:{info:{key:"unirest",title:"Unirest",link:"http://unirest.io/java.html",description:"Lightweight HTTP Request Client Library",extname:".java"},convert:({method:t,allHeaders:e,postData:r,fullUrl:n},s)=>{const{join:o,push:a}=new j({indent:{indent:" ",...s}.indent});return["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"].includes(t.toUpperCase())?a(`HttpResponse<String> response = Unirest.${t.toLowerCase()}("${n}")`):a(`HttpResponse<String> response = Unirest.customMethod("${t.toUpperCase()}","${n}")`),Object.keys(e).forEach(i=>{a(`.header("${i}", "${I(e[i])}")`,1)}),r.text&&a(`.body(${JSON.stringify(r.text)})`,1),a(".asString();",1),o()}}}},Qn={info:{key:"javascript",title:"JavaScript",default:"fetch"},clientsById:{xhr:{info:{key:"xhr",title:"XMLHttpRequest",link:"https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest",description:"W3C Standard API that provides scripted client functionality",extname:".js"},convert:({postData:t,allHeaders:e,method:r,fullUrl:n},s)=>{var l;const o={indent:" ",cors:!0,...s},{blank:a,push:i,join:c}=new j({indent:o.indent});switch(t.mimeType){case"application/json":i(`const data = JSON.stringify(${ie(t.jsonObj,{indent:o.indent})});`),a();break;case"multipart/form-data":if(!t.params)break;if(i("const data = new FormData();"),t.params.forEach(f=>{i(`data.append('${f.name}', '${f.value||f.fileName||""}');`)}),nt(e,"content-type")&&(l=le(e,"content-type"))!=null&&l.includes("boundary")){const f=G(e,"content-type");f&&delete e[f]}a();break;default:i(`const data = ${t.text?`'${t.text}'`:"null"};`),a()}return i("const xhr = new XMLHttpRequest();"),o.cors&&i("xhr.withCredentials = true;"),a(),i("xhr.addEventListener('readystatechange', function () {"),i("if (this.readyState === this.DONE) {",1),i("console.log(this.responseText);",2),i("}",1),i("});"),a(),i(`xhr.open('${r}', '${n}');`),Object.keys(e).forEach(f=>{i(`xhr.setRequestHeader('${f}', '${Re(e[f])}');`)}),a(),i("xhr.send(data);"),c()}},axios:{info:{key:"axios",title:"Axios",link:"https://github.com/axios/axios",description:"Promise based HTTP client for the browser and node.js",extname:".js",installation:()=>"npm install axios --save"},convert:({allHeaders:t,method:e,url:r,queryObj:n,postData:s},o)=>{const{blank:a,push:i,join:c,addPostProcessor:l}=new j({indent:{indent:" ",...o}.indent});i("import axios from 'axios';"),a();const f={method:e,url:r};switch(Object.keys(n).length&&(f.params=n),Object.keys(t).length&&(f.headers=t),s.mimeType){case"application/x-www-form-urlencoded":s.params&&(i("const encodedParams = new URLSearchParams();"),s.params.forEach(u=>{i(`encodedParams.set('${u.name}', '${u.value}');`)}),a(),f.data="encodedParams,",l(u=>u.replace(/'encodedParams,'/,"encodedParams,")));break;case"application/json":s.jsonObj&&(f.data=s.jsonObj);break;case"multipart/form-data":if(!s.params)break;i("const form = new FormData();"),s.params.forEach(u=>{i(`form.append('${u.name}', '${u.value||u.fileName||""}');`)}),a(),f.data="[form]";break;default:s.text&&(f.data=s.text)}return i(`const options = ${ie(f,{indent:" ",inlineCharacterLimit:80}).replace('"[form]"',"form")};`),a(),i("try {"),i("const { data } = await axios.request(options);",1),i("console.log(data);",1),i("} catch (error) {"),i("console.error(error);",1),i("}"),c()}},fetch:{info:{key:"fetch",title:"fetch",link:"https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch",description:"Perform asynchronous HTTP requests with the Fetch API",extname:".js"},convert:({method:t,allHeaders:e,postData:r,fullUrl:n},s)=>{const o={indent:" ",credentials:null,...s},{blank:a,join:i,push:c}=new j({indent:o.indent}),l={method:t};switch(Object.keys(e).length&&(l.headers=e),o.credentials!==null&&(l.credentials=o.credentials),r.mimeType){case"application/x-www-form-urlencoded":l.body=r.paramsObj?r.paramsObj:r.text;break;case"application/json":r.jsonObj&&(l.body=r.jsonObj);break;case"multipart/form-data":{if(!r.params)break;const f=G(e,"content-type");f&&delete e[f],c("const form = new FormData();"),r.params.forEach(u=>{c(`form.append('${u.name}', '${u.value||u.fileName||""}');`)}),a();break}default:r.text&&(l.body=r.text)}return l.headers&&!Object.keys(l.headers).length&&delete l.headers,c(`const options = ${ie(l,{indent:o.indent,inlineCharacterLimit:80,transform:(f,u,p)=>{if(u==="body"){if(r.mimeType==="application/x-www-form-urlencoded")return`new URLSearchParams(${p})`;if(r.mimeType==="application/json")return`JSON.stringify(${p})`}return p}})};`),a(),r.params&&r.mimeType==="multipart/form-data"&&(c("options.body = form;"),a()),c(`fetch('${n}', options)`),c(".then(res => res.json())",1),c(".then(res => console.log(res))",1),c(".catch(err => console.error(err));",1),i()}},jquery:{info:{key:"jquery",title:"jQuery",link:"http://api.jquery.com/jquery.ajax/",description:"Perform an asynchronous HTTP (Ajax) requests with jQuery",extname:".js"},convert:({fullUrl:t,method:e,allHeaders:r,postData:n},s)=>{var f;const o={indent:" ",...s},{blank:a,push:i,join:c}=new j({indent:o.indent}),l={async:!0,crossDomain:!0,url:t,method:e,headers:r};switch(n.mimeType){case"application/x-www-form-urlencoded":l.data=n.paramsObj?n.paramsObj:n.text;break;case"application/json":l.processData=!1,l.data=n.text;break;case"multipart/form-data":if(!n.params)break;if(i("const form = new FormData();"),n.params.forEach(u=>{i(`form.append('${u.name}', '${u.value||u.fileName||""}');`)}),l.processData=!1,l.contentType=!1,l.mimeType="multipart/form-data",l.data="[form]",nt(r,"content-type")&&(f=le(r,"content-type"))!=null&&f.includes("boundary")){const u=G(r,"content-type");u&&delete l.headers[u]}a();break;default:n.text&&(l.data=n.text)}return i(`const settings = ${ie(l,{indent:o.indent}).replace("'[form]'","form")};`),a(),i("$.ajax(settings).done(res => {"),i("console.log(res);",1),i("});"),c()}}}},Yn={info:{key:"json",title:"JSON",default:"native"},clientsById:{native:{info:{key:"native",title:"Native JSON",link:"https://www.json.org/json-en.html",description:"A JSON represetation of any HAR payload.",extname:".json"},convert:({postData:t},e)=>{const r={indent:" ",...e};let n="";switch(t.mimeType){case"application/x-www-form-urlencoded":n=t.paramsObj?t.paramsObj:t.text;break;case"application/json":t.jsonObj&&(n=t.jsonObj);break;case"multipart/form-data":{if(!t.params)break;const s={};t.params.forEach(o=>{s[o.name]=o.value}),n=s;break}default:t.text&&(n=t.text)}return typeof n>"u"||n===""?"No JSON body":JSON.stringify(n,null,r.indent)}}}},Xn={info:{key:"kotlin",title:"Kotlin",default:"okhttp"},clientsById:{okhttp:{info:{key:"okhttp",title:"OkHttp",link:"http://square.github.io/okhttp/",description:"An HTTP Request Client Library",extname:".kt"},convert:({postData:t,fullUrl:e,method:r,allHeaders:n},s)=>{const{blank:o,join:a,push:i}=new j({indent:{indent:" ",...s}.indent}),c=["GET","POST","PUT","DELETE","PATCH","HEAD"],l=["POST","PUT","DELETE","PATCH"];return i("val client = OkHttpClient()"),o(),t.text&&(t.boundary?i(`val mediaType = MediaType.parse("${t.mimeType}; boundary=${t.boundary}")`):i(`val mediaType = MediaType.parse("${t.mimeType}")`),i(`val body = RequestBody.create(mediaType, ${JSON.stringify(t.text)})`)),i("val request = Request.Builder()"),i(`.url("${e}")`,1),c.includes(r.toUpperCase())?l.includes(r.toUpperCase())?t.text?i(`.${r.toLowerCase()}(body)`,1):i(`.${r.toLowerCase()}(null)`,1):i(`.${r.toLowerCase()}()`,1):t.text?i(`.method("${r.toUpperCase()}", body)`,1):i(`.method("${r.toUpperCase()}", null)`,1),Object.keys(n).forEach(f=>{i(`.addHeader("${f}", "${I(n[f])}")`,1)}),i(".build()",1),o(),i("val response = client.newCall(request).execute()"),a()}}}},Zn={info:{key:"node",title:"Node.js",default:"fetch",cli:"node %s"},clientsById:{native:{info:{key:"native",title:"HTTP",link:"http://nodejs.org/api/http.html#http_http_request_options_callback",description:"Node.js native HTTP interface",extname:".cjs"},convert:({uriObj:t,method:e,allHeaders:r,postData:n},s={})=>{var u;const{indent:o=" "}=s,{blank:a,join:i,push:c,unshift:l}=new j({indent:o}),f={method:e,hostname:t.hostname,port:t.port,path:t.path,headers:r};switch(c(`const http = require('${(u=t.protocol)==null?void 0:u.replace(":","")}');`),a(),c(`const options = ${ie(f,{indent:o})};`),a(),c("const req = http.request(options, function (res) {"),c("const chunks = [];",1),a(),c("res.on('data', function (chunk) {",1),c("chunks.push(chunk);",2),c("});",1),a(),c("res.on('end', function () {",1),c("const body = Buffer.concat(chunks);",2),c("console.log(body.toString());",2),c("});",1),c("});"),a(),n.mimeType){case"application/x-www-form-urlencoded":n.paramsObj&&(l("const qs = require('querystring');"),c(`req.write(qs.stringify(${ie(n.paramsObj,{indent:" ",inlineCharacterLimit:80})}));`));break;case"application/json":n.jsonObj&&c(`req.write(JSON.stringify(${ie(n.jsonObj,{indent:" ",inlineCharacterLimit:80})}));`);break;default:n.text&&c(`req.write(${ie(n.text,{indent:o})});`)}return c("req.end();"),i()}},axios:{info:{key:"axios",title:"Axios",link:"https://github.com/axios/axios",description:"Promise based HTTP client for the browser and node.js",extname:".js",installation:()=>"npm install axios --save"},convert:({method:t,fullUrl:e,allHeaders:r,postData:n},s)=>{const{blank:o,join:a,push:i,addPostProcessor:c}=new j({indent:{indent:" ",...s}.indent});i("import axios from 'axios';"),o();const l={method:t,url:e};switch(Object.keys(r).length&&(l.headers=r),n.mimeType){case"application/x-www-form-urlencoded":n.params&&(i("const encodedParams = new URLSearchParams();"),n.params.forEach(f=>{i(`encodedParams.set('${f.name}', '${f.value}');`)}),o(),l.data="encodedParams,",c(f=>f.replace(/'encodedParams,'/,"encodedParams,")));break;case"application/json":n.jsonObj&&(l.data=n.jsonObj);break;default:n.text&&(l.data=n.text)}return i(`const options = ${ie(l,{indent:" ",inlineCharacterLimit:80})};`),o(),i("axios"),i(".request(options)",1),i(".then(res => console.log(res.data))",1),i(".catch(err => console.error(err));",1),a()}},fetch:{info:{key:"fetch",title:"fetch",link:"https://nodejs.org/docs/latest/api/globals.html#fetch",description:"Perform asynchronous HTTP requests with the Fetch API",extname:".js"},convert:({method:t,fullUrl:e,postData:r,headersObj:n,cookies:s},o)=>{var h;const a={indent:" ",...o};let i=!1;const{blank:c,push:l,join:f,unshift:u}=new j({indent:a.indent}),p=e,d={method:t};switch(Object.keys(n).length&&(d.headers=n),r.mimeType){case"application/x-www-form-urlencoded":l("const encodedParams = new URLSearchParams();"),(h=r.params)==null||h.forEach(y=>{l(`encodedParams.set('${y.name}', '${y.value}');`)}),d.body="encodedParams",c();break;case"application/json":r.jsonObj&&(d.body=r.jsonObj);break;case"multipart/form-data":{if(!r.params)break;const y=G(n,"content-type");y&&delete n[y],l("const formData = new FormData();"),r.params.forEach(g=>{if(!g.fileName&&!g.contentType){l(`formData.append('${g.name}', '${g.value}');`);return}g.fileName&&(i=!0,l(`formData.append('${g.name}', await new Response(fs.createReadStream('${g.fileName}')).blob());`))}),d.body="formData",c();break}default:r.text&&(d.body=r.text)}if(s.length){const y=s.map(({name:g,value:v})=>`${encodeURIComponent(g)}=${encodeURIComponent(v)}`).join("; ");d.headers||(d.headers={}),d.headers.cookie=y}return l(`const url = '${p}';`),d.headers&&!Object.keys(d.headers).length&&delete d.headers,l(`const options = ${ie(d,{indent:" ",inlineCharacterLimit:80,transform:(y,g,v)=>g==="body"&&r.mimeType==="application/json"?`JSON.stringify(${v})`:v})};`),c(),i&&u(`import fs from 'fs';
17
- `),l("fetch(url, options)"),l(".then(res => res.json())",1),l(".then(json => console.log(json))",1),l(".catch(err => console.error(err));",1),f().replace(/'encodedParams'/,"encodedParams").replace(/'formData'/,"formData")}}}},gt=(t,e,r,n)=>{const s=`${t} *${e} = `;return`${s}${Mt(r,n?s.length:void 0)};`},Mt=(t,e)=>{const r=e===void 0?", ":`,
18
- ${" ".repeat(e)}`;switch(Object.prototype.toString.call(t)){case"[object Number]":return`@${t}`;case"[object Array]":return`@[ ${t.map(n=>Mt(n)).join(r)} ]`;case"[object Object]":{const n=[];return Object.keys(t).forEach(s=>{n.push(`@"${s}": ${Mt(t[s])}`)}),`@{ ${n.join(r)} }`}case"[object Boolean]":return t?"@YES":"@NO";default:return t==null?"":`@"${t.toString().replace(/"/g,'\\"')}"`}},eo={info:{key:"objc",title:"Objective-C",default:"nsurlsession"},clientsById:{nsurlsession:{info:{key:"nsurlsession",title:"NSURLSession",link:"https://developer.apple.com/library/mac/documentation/Foundation/Reference/NSURLSession_class/index.html",description:"Foundation's NSURLSession request",extname:".m"},convert:({allHeaders:t,postData:e,method:r,fullUrl:n},s)=>{var f;const o={indent:" ",pretty:!0,timeout:10,...s},{push:a,join:i,blank:c}=new j({indent:o.indent}),l={hasHeaders:!1,hasBody:!1};if(a("#import <Foundation/Foundation.h>"),Object.keys(t).length&&(l.hasHeaders=!0,c(),a(gt("NSDictionary","headers",t,o.pretty))),e.text||e.jsonObj||e.params)switch(l.hasBody=!0,e.mimeType){case"application/x-www-form-urlencoded":if((f=e.params)!=null&&f.length){c();const[u,...p]=e.params;a(`NSMutableData *postData = [[NSMutableData alloc] initWithData:[@"${u.name}=${u.value}" dataUsingEncoding:NSUTF8StringEncoding]];`),p.forEach(({name:d,value:h})=>{a(`[postData appendData:[@"&${d}=${h}" dataUsingEncoding:NSUTF8StringEncoding]];`)})}else l.hasBody=!1;break;case"application/json":e.jsonObj&&(a(gt("NSDictionary","parameters",e.jsonObj,o.pretty)),c(),a("NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];"));break;case"multipart/form-data":a(gt("NSArray","parameters",e.params||[],o.pretty)),a(`NSString *boundary = @"${e.boundary}";`),c(),a("NSError *error;"),a("NSMutableString *body = [NSMutableString string];"),a("for (NSDictionary *param in parameters) {"),a('[body appendFormat:@"--%@\\r\\n", boundary];',1),a('if (param[@"fileName"]) {',1),a('[body appendFormat:@"Content-Disposition:form-data; name=\\"%@\\"; filename=\\"%@\\"\\r\\n", param[@"name"], param[@"fileName"]];',2),a('[body appendFormat:@"Content-Type: %@\\r\\n\\r\\n", param[@"contentType"]];',2),a('[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];',2),a("if (error) {",2),a('NSLog(@"%@", error);',3),a("}",2),a("} else {",1),a('[body appendFormat:@"Content-Disposition:form-data; name=\\"%@\\"\\r\\n\\r\\n", param[@"name"]];',2),a('[body appendFormat:@"%@", param[@"value"]];',2),a("}",1),a("}"),a('[body appendFormat:@"\\r\\n--%@--\\r\\n", boundary];'),a("NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];");break;default:c(),a(`NSData *postData = [[NSData alloc] initWithData:[@"${e.text}" dataUsingEncoding:NSUTF8StringEncoding]];`)}return c(),a(`NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"${n}"]`),a(" cachePolicy:NSURLRequestUseProtocolCachePolicy"),a(` timeoutInterval:${o.timeout.toFixed(1)}];`),a(`[request setHTTPMethod:@"${r}"];`),l.hasHeaders&&a("[request setAllHTTPHeaderFields:headers];"),l.hasBody&&a("[request setHTTPBody:postData];"),c(),a("NSURLSession *session = [NSURLSession sharedSession];"),a("NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request"),a(" completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {"),a(" if (error) {",1),a(' NSLog(@"%@", error);',2),a(" } else {",1),a(" NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;",2),a(' NSLog(@"%@", httpResponse);',2),a(" }",1),a(" }];"),a("[dataTask resume];"),i()}}}},to={info:{key:"ocaml",title:"OCaml",default:"cohttp"},clientsById:{cohttp:{info:{key:"cohttp",title:"CoHTTP",link:"https://github.com/mirage/ocaml-cohttp",description:"Cohttp is a very lightweight HTTP server using Lwt or Async for OCaml",extname:".ml",installation:()=>"opam install cohttp-lwt-unix cohttp-async"},convert:({fullUrl:t,allHeaders:e,postData:r,method:n},s)=>{const o={indent:" ",...s},a=["get","post","head","delete","patch","put","options"],{push:i,blank:c,join:l}=new j({indent:o.indent});i("open Cohttp_lwt_unix"),i("open Cohttp"),i("open Lwt"),c(),i(`let uri = Uri.of_string "${t}" in`);const f=Object.keys(e);return f.length===1?i(`let headers = Header.add (Header.init ()) "${f[0]}" "${I(e[f[0]])}" in`):f.length>1&&(i("let headers = Header.add_list (Header.init ()) ["),f.forEach(u=>{i(`("${u}", "${I(e[u])}");`,1)}),i("] in")),r.text&&i(`let body = Cohttp_lwt_body.of_string ${JSON.stringify(r.text)} in`),c(),i(`Client.call ${f.length?"~headers ":""}${r.text?"~body ":""}${a.includes(n.toLowerCase())?`\`${n.toUpperCase()}`:`(Code.method_of_string "${n}")`} uri`),i(">>= fun (res, body_stream) ->"),i("(* Do stuff with the result *)",1),l()}}}},k=(t,e,r)=>{switch(r=r||"",e=e||"",Object.prototype.toString.call(t)){case"[object Boolean]":return t;case"[object Null]":return"null";case"[object Undefined]":return"null";case"[object String]":return`'${Be(t,{delimiter:"'",escapeNewlines:!1})}'`;case"[object Number]":return t.toString();case"[object Array]":{const n=t.map(s=>k(s,`${e}${e}`,e)).join(`,
15
+ `),i()}}}},Bn={info:{key:"go",title:"Go",default:"native",cli:"go"},clientsById:{native:{info:{key:"native",title:"NewRequest",link:"http://golang.org/pkg/net/http/#NewRequest",description:"Golang HTTP client request",extname:".go"},convert:({postData:t,method:e,allHeaders:r,fullUrl:n},s={})=>{const{blank:o,push:a,join:i}=new j({indent:" "}),{showBoilerplate:c=!0,checkErrors:l=!1,printBody:f=!0,timeout:u=-1,insecureSkipVerify:d=!1}=s,p=l?"err":"_",h=c?1:0,y=()=>{l&&(a("if err != nil {",h),a("panic(err)",h+1),a("}",h))};c&&(a("package main"),o(),a("import ("),a('"fmt"',h),u>0&&a('"time"',h),d&&a('"crypto/tls"',h),t.text&&a('"strings"',h),a('"net/http"',h),f&&a('"io"',h),a(")"),o(),a("func main() {"),o()),d&&(a("insecureTransport := http.DefaultTransport.(*http.Transport).Clone()",h),a("insecureTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}",h));const g=u>0,$=g||d,m=$?"client":"http.DefaultClient";return $&&(a("client := http.Client{",h),g&&a(`Timeout: time.Duration(${u} * time.Second),`,h+1),d&&a("Transport: insecureTransport,",h+1),a("}",h),o()),a(`url := "${n}"`,h),o(),t.text?(a(`payload := strings.NewReader(${JSON.stringify(t.text)})`,h),o(),a(`req, ${p} := http.NewRequest("${e}", url, payload)`,h),o()):(a(`req, ${p} := http.NewRequest("${e}", url, nil)`,h),o()),y(),Object.keys(r).length&&(Object.keys(r).forEach(b=>{a(`req.Header.Add("${b}", "${I(r[b])}")`,h)}),o()),a(`res, ${p} := ${m}.Do(req)`,h),y(),f&&(o(),a("defer res.Body.Close()",h),a(`body, ${p} := io.ReadAll(res.Body)`,h),y()),o(),f&&a("fmt.Println(string(body))",h),c&&(o(),a("}")),i()}}}},sr=`\r
16
+ `,Wn={info:{key:"http",title:"HTTP",default:"http1.1"},clientsById:{"http1.1":{info:{key:"http1.1",title:"HTTP/1.1",link:"https://tools.ietf.org/html/rfc7230",description:"HTTP/1.1 request string in accordance with RFC 7230",extname:null},convert:({method:t,fullUrl:e,uriObj:r,httpVersion:n,allHeaders:s,postData:o},a)=>{const i={absoluteURI:!1,autoContentLength:!0,autoHost:!0,...a},{blank:c,push:l,join:f}=new j({indent:"",join:sr});l(`${t} ${i.absoluteURI?e:r.path} ${n}`);const u=Object.keys(s);u.forEach(h=>{const y=h.toLowerCase().replace(/(^|-)(\w)/g,g=>g.toUpperCase());l(`${y}: ${s[h]}`)}),i.autoHost&&!u.includes("host")&&l(`Host: ${r.host}`),i.autoContentLength&&o.text&&!u.includes("content-length")&&l(`Content-Length: ${Buffer.byteLength(o.text,"ascii").toString()}`),c();const d=f(),p=o.text||"";return`${d}${sr}${p}`}}}},Gn={info:{key:"java",title:"Java",default:"unirest"},clientsById:{asynchttp:{info:{key:"asynchttp",title:"AsyncHttp",link:"https://github.com/AsyncHttpClient/async-http-client",description:"Asynchronous Http and WebSocket Client library for Java",extname:".java"},convert:({method:t,allHeaders:e,postData:r,fullUrl:n},s)=>{const{blank:o,push:a,join:i}=new j({indent:{indent:" ",...s}.indent});return a("AsyncHttpClient client = new DefaultAsyncHttpClient();"),a(`client.prepare("${t.toUpperCase()}", "${n}")`),Object.keys(e).forEach(c=>{a(`.setHeader("${c}", "${I(e[c])}")`,1)}),r.text&&a(`.setBody(${JSON.stringify(r.text)})`,1),a(".execute()",1),a(".toCompletableFuture()",1),a(".thenAccept(System.out::println)",1),a(".join();",1),o(),a("client.close();"),i()}},nethttp:{info:{key:"nethttp",title:"java.net.http",link:"https://openjdk.java.net/groups/net/httpclient/intro.html",description:"Java Standardized HTTP Client API",extname:".java"},convert:({allHeaders:t,fullUrl:e,method:r,postData:n},s)=>{const{push:o,join:a}=new j({indent:{indent:" ",...s}.indent});return o("HttpRequest request = HttpRequest.newBuilder()"),o(`.uri(URI.create("${e}"))`,2),Object.keys(t).forEach(i=>{o(`.header("${i}", "${I(t[i])}")`,2)}),n.text?o(`.method("${r.toUpperCase()}", HttpRequest.BodyPublishers.ofString(${JSON.stringify(n.text)}))`,2):o(`.method("${r.toUpperCase()}", HttpRequest.BodyPublishers.noBody())`,2),o(".build();",2),o("HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());"),o("System.out.println(response.body());"),a()}},okhttp:{info:{key:"okhttp",title:"OkHttp",link:"http://square.github.io/okhttp/",description:"An HTTP Request Client Library",extname:".java"},convert:({postData:t,method:e,fullUrl:r,allHeaders:n},s)=>{const{push:o,blank:a,join:i}=new j({indent:{indent:" ",...s}.indent}),c=["GET","POST","PUT","DELETE","PATCH","HEAD"],l=["POST","PUT","DELETE","PATCH"];return o("OkHttpClient client = new OkHttpClient();"),a(),t.text&&(t.boundary?o(`MediaType mediaType = MediaType.parse("${t.mimeType}; boundary=${t.boundary}");`):o(`MediaType mediaType = MediaType.parse("${t.mimeType}");`),o(`RequestBody body = RequestBody.create(mediaType, ${JSON.stringify(t.text)});`)),o("Request request = new Request.Builder()"),o(`.url("${r}")`,1),c.includes(e.toUpperCase())?l.includes(e.toUpperCase())?t.text?o(`.${e.toLowerCase()}(body)`,1):o(`.${e.toLowerCase()}(null)`,1):o(`.${e.toLowerCase()}()`,1):t.text?o(`.method("${e.toUpperCase()}", body)`,1):o(`.method("${e.toUpperCase()}", null)`,1),Object.keys(n).forEach(f=>{o(`.addHeader("${f}", "${I(n[f])}")`,1)}),o(".build();",1),a(),o("Response response = client.newCall(request).execute();"),i()}},unirest:{info:{key:"unirest",title:"Unirest",link:"http://unirest.io/java.html",description:"Lightweight HTTP Request Client Library",extname:".java"},convert:({method:t,allHeaders:e,postData:r,fullUrl:n},s)=>{const{join:o,push:a}=new j({indent:{indent:" ",...s}.indent});return["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"].includes(t.toUpperCase())?a(`HttpResponse<String> response = Unirest.${t.toLowerCase()}("${n}")`):a(`HttpResponse<String> response = Unirest.customMethod("${t.toUpperCase()}","${n}")`),Object.keys(e).forEach(i=>{a(`.header("${i}", "${I(e[i])}")`,1)}),r.text&&a(`.body(${JSON.stringify(r.text)})`,1),a(".asString();",1),o()}}}},Jn={info:{key:"javascript",title:"JavaScript",default:"fetch"},clientsById:{xhr:{info:{key:"xhr",title:"XMLHttpRequest",link:"https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest",description:"W3C Standard API that provides scripted client functionality",extname:".js"},convert:({postData:t,allHeaders:e,method:r,fullUrl:n},s)=>{var l;const o={indent:" ",cors:!0,...s},{blank:a,push:i,join:c}=new j({indent:o.indent});switch(t.mimeType){case"application/json":i(`const data = JSON.stringify(${ie(t.jsonObj,{indent:o.indent})});`),a();break;case"multipart/form-data":if(!t.params)break;if(i("const data = new FormData();"),t.params.forEach(f=>{i(`data.append('${f.name}', '${f.value||f.fileName||""}');`)}),nt(e,"content-type")&&(l=le(e,"content-type"))!=null&&l.includes("boundary")){const f=G(e,"content-type");f&&delete e[f]}a();break;default:i(`const data = ${t.text?`'${t.text}'`:"null"};`),a()}return i("const xhr = new XMLHttpRequest();"),o.cors&&i("xhr.withCredentials = true;"),a(),i("xhr.addEventListener('readystatechange', function () {"),i("if (this.readyState === this.DONE) {",1),i("console.log(this.responseText);",2),i("}",1),i("});"),a(),i(`xhr.open('${r}', '${n}');`),Object.keys(e).forEach(f=>{i(`xhr.setRequestHeader('${f}', '${Re(e[f])}');`)}),a(),i("xhr.send(data);"),c()}},axios:{info:{key:"axios",title:"Axios",link:"https://github.com/axios/axios",description:"Promise based HTTP client for the browser and node.js",extname:".js",installation:()=>"npm install axios --save"},convert:({allHeaders:t,method:e,url:r,queryObj:n,postData:s},o)=>{const{blank:a,push:i,join:c,addPostProcessor:l}=new j({indent:{indent:" ",...o}.indent});i("import axios from 'axios';"),a();const f={method:e,url:r};switch(Object.keys(n).length&&(f.params=n),Object.keys(t).length&&(f.headers=t),s.mimeType){case"application/x-www-form-urlencoded":s.params&&(i("const encodedParams = new URLSearchParams();"),s.params.forEach(u=>{i(`encodedParams.set('${u.name}', '${u.value}');`)}),a(),f.data="encodedParams,",l(u=>u.replace(/'encodedParams,'/,"encodedParams,")));break;case"application/json":s.jsonObj&&(f.data=s.jsonObj);break;case"multipart/form-data":if(!s.params)break;i("const form = new FormData();"),s.params.forEach(u=>{i(`form.append('${u.name}', '${u.value||u.fileName||""}');`)}),a(),f.data="[form]";break;default:s.text&&(f.data=s.text)}return i(`const options = ${ie(f,{indent:" ",inlineCharacterLimit:80}).replace('"[form]"',"form")};`),a(),i("try {"),i("const { data } = await axios.request(options);",1),i("console.log(data);",1),i("} catch (error) {"),i("console.error(error);",1),i("}"),c()}},fetch:{info:{key:"fetch",title:"fetch",link:"https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch",description:"Perform asynchronous HTTP requests with the Fetch API",extname:".js"},convert:({method:t,allHeaders:e,postData:r,fullUrl:n},s)=>{const o={indent:" ",credentials:null,...s},{blank:a,join:i,push:c}=new j({indent:o.indent}),l={method:t};switch(Object.keys(e).length&&(l.headers=e),o.credentials!==null&&(l.credentials=o.credentials),r.mimeType){case"application/x-www-form-urlencoded":l.body=r.paramsObj?r.paramsObj:r.text;break;case"application/json":r.jsonObj&&(l.body=r.jsonObj);break;case"multipart/form-data":{if(!r.params)break;const f=G(e,"content-type");f&&delete e[f],c("const form = new FormData();"),r.params.forEach(u=>{c(`form.append('${u.name}', '${u.value||u.fileName||""}');`)}),a();break}default:r.text&&(l.body=r.text)}return l.headers&&!Object.keys(l.headers).length&&delete l.headers,c(`const options = ${ie(l,{indent:o.indent,inlineCharacterLimit:80,transform:(f,u,d)=>{if(u==="body"){if(r.mimeType==="application/x-www-form-urlencoded")return`new URLSearchParams(${d})`;if(r.mimeType==="application/json")return`JSON.stringify(${d})`}return d}})};`),a(),r.params&&r.mimeType==="multipart/form-data"&&(c("options.body = form;"),a()),c(`fetch('${n}', options)`),c(".then(res => res.json())",1),c(".then(res => console.log(res))",1),c(".catch(err => console.error(err));",1),i()}},jquery:{info:{key:"jquery",title:"jQuery",link:"http://api.jquery.com/jquery.ajax/",description:"Perform an asynchronous HTTP (Ajax) requests with jQuery",extname:".js"},convert:({fullUrl:t,method:e,allHeaders:r,postData:n},s)=>{var f;const o={indent:" ",...s},{blank:a,push:i,join:c}=new j({indent:o.indent}),l={async:!0,crossDomain:!0,url:t,method:e,headers:r};switch(n.mimeType){case"application/x-www-form-urlencoded":l.data=n.paramsObj?n.paramsObj:n.text;break;case"application/json":l.processData=!1,l.data=n.text;break;case"multipart/form-data":if(!n.params)break;if(i("const form = new FormData();"),n.params.forEach(u=>{i(`form.append('${u.name}', '${u.value||u.fileName||""}');`)}),l.processData=!1,l.contentType=!1,l.mimeType="multipart/form-data",l.data="[form]",nt(r,"content-type")&&(f=le(r,"content-type"))!=null&&f.includes("boundary")){const u=G(r,"content-type");u&&delete l.headers[u]}a();break;default:n.text&&(l.data=n.text)}return i(`const settings = ${ie(l,{indent:o.indent}).replace("'[form]'","form")};`),a(),i("$.ajax(settings).done(res => {"),i("console.log(res);",1),i("});"),c()}}}},zn={info:{key:"json",title:"JSON",default:"native"},clientsById:{native:{info:{key:"native",title:"Native JSON",link:"https://www.json.org/json-en.html",description:"A JSON represetation of any HAR payload.",extname:".json"},convert:({postData:t},e)=>{const r={indent:" ",...e};let n="";switch(t.mimeType){case"application/x-www-form-urlencoded":n=t.paramsObj?t.paramsObj:t.text;break;case"application/json":t.jsonObj&&(n=t.jsonObj);break;case"multipart/form-data":{if(!t.params)break;const s={};t.params.forEach(o=>{s[o.name]=o.value}),n=s;break}default:t.text&&(n=t.text)}return typeof n>"u"||n===""?"No JSON body":JSON.stringify(n,null,r.indent)}}}},Vn={info:{key:"kotlin",title:"Kotlin",default:"okhttp"},clientsById:{okhttp:{info:{key:"okhttp",title:"OkHttp",link:"http://square.github.io/okhttp/",description:"An HTTP Request Client Library",extname:".kt"},convert:({postData:t,fullUrl:e,method:r,allHeaders:n},s)=>{const{blank:o,join:a,push:i}=new j({indent:{indent:" ",...s}.indent}),c=["GET","POST","PUT","DELETE","PATCH","HEAD"],l=["POST","PUT","DELETE","PATCH"];return i("val client = OkHttpClient()"),o(),t.text&&(t.boundary?i(`val mediaType = MediaType.parse("${t.mimeType}; boundary=${t.boundary}")`):i(`val mediaType = MediaType.parse("${t.mimeType}")`),i(`val body = RequestBody.create(mediaType, ${JSON.stringify(t.text)})`)),i("val request = Request.Builder()"),i(`.url("${e}")`,1),c.includes(r.toUpperCase())?l.includes(r.toUpperCase())?t.text?i(`.${r.toLowerCase()}(body)`,1):i(`.${r.toLowerCase()}(null)`,1):i(`.${r.toLowerCase()}()`,1):t.text?i(`.method("${r.toUpperCase()}", body)`,1):i(`.method("${r.toUpperCase()}", null)`,1),Object.keys(n).forEach(f=>{i(`.addHeader("${f}", "${I(n[f])}")`,1)}),i(".build()",1),o(),i("val response = client.newCall(request).execute()"),a()}}}},Kn={info:{key:"node",title:"Node.js",default:"fetch",cli:"node %s"},clientsById:{native:{info:{key:"native",title:"HTTP",link:"http://nodejs.org/api/http.html#http_http_request_options_callback",description:"Node.js native HTTP interface",extname:".cjs"},convert:({uriObj:t,method:e,allHeaders:r,postData:n},s={})=>{var u;const{indent:o=" "}=s,{blank:a,join:i,push:c,unshift:l}=new j({indent:o}),f={method:e,hostname:t.hostname,port:t.port,path:t.path,headers:r};switch(c(`const http = require('${(u=t.protocol)==null?void 0:u.replace(":","")}');`),a(),c(`const options = ${ie(f,{indent:o})};`),a(),c("const req = http.request(options, function (res) {"),c("const chunks = [];",1),a(),c("res.on('data', function (chunk) {",1),c("chunks.push(chunk);",2),c("});",1),a(),c("res.on('end', function () {",1),c("const body = Buffer.concat(chunks);",2),c("console.log(body.toString());",2),c("});",1),c("});"),a(),n.mimeType){case"application/x-www-form-urlencoded":n.paramsObj&&(l("const qs = require('querystring');"),c(`req.write(qs.stringify(${ie(n.paramsObj,{indent:" ",inlineCharacterLimit:80})}));`));break;case"application/json":n.jsonObj&&c(`req.write(JSON.stringify(${ie(n.jsonObj,{indent:" ",inlineCharacterLimit:80})}));`);break;default:n.text&&c(`req.write(${ie(n.text,{indent:o})});`)}return c("req.end();"),i()}},axios:{info:{key:"axios",title:"Axios",link:"https://github.com/axios/axios",description:"Promise based HTTP client for the browser and node.js",extname:".js",installation:()=>"npm install axios --save"},convert:({method:t,fullUrl:e,allHeaders:r,postData:n},s)=>{const{blank:o,join:a,push:i,addPostProcessor:c}=new j({indent:{indent:" ",...s}.indent});i("import axios from 'axios';"),o();const l={method:t,url:e};switch(Object.keys(r).length&&(l.headers=r),n.mimeType){case"application/x-www-form-urlencoded":n.params&&(i("const encodedParams = new URLSearchParams();"),n.params.forEach(f=>{i(`encodedParams.set('${f.name}', '${f.value}');`)}),o(),l.data="encodedParams,",c(f=>f.replace(/'encodedParams,'/,"encodedParams,")));break;case"application/json":n.jsonObj&&(l.data=n.jsonObj);break;default:n.text&&(l.data=n.text)}return i(`const options = ${ie(l,{indent:" ",inlineCharacterLimit:80})};`),o(),i("axios"),i(".request(options)",1),i(".then(res => console.log(res.data))",1),i(".catch(err => console.error(err));",1),a()}},fetch:{info:{key:"fetch",title:"fetch",link:"https://nodejs.org/docs/latest/api/globals.html#fetch",description:"Perform asynchronous HTTP requests with the Fetch API",extname:".js"},convert:({method:t,fullUrl:e,postData:r,headersObj:n,cookies:s},o)=>{var h;const a={indent:" ",...o};let i=!1;const{blank:c,push:l,join:f,unshift:u}=new j({indent:a.indent}),d=e,p={method:t};switch(Object.keys(n).length&&(p.headers=n),r.mimeType){case"application/x-www-form-urlencoded":l("const encodedParams = new URLSearchParams();"),(h=r.params)==null||h.forEach(y=>{l(`encodedParams.set('${y.name}', '${y.value}');`)}),p.body="encodedParams",c();break;case"application/json":r.jsonObj&&(p.body=r.jsonObj);break;case"multipart/form-data":{if(!r.params)break;const y=G(n,"content-type");y&&delete n[y],l("const formData = new FormData();"),r.params.forEach(g=>{if(!g.fileName&&!g.contentType){l(`formData.append('${g.name}', '${g.value}');`);return}g.fileName&&(i=!0,l(`formData.append('${g.name}', await new Response(fs.createReadStream('${g.fileName}')).blob());`))}),p.body="formData",c();break}default:r.text&&(p.body=r.text)}if(s.length){const y=s.map(({name:g,value:$})=>`${encodeURIComponent(g)}=${encodeURIComponent($)}`).join("; ");p.headers||(p.headers={}),p.headers.cookie=y}return l(`const url = '${d}';`),p.headers&&!Object.keys(p.headers).length&&delete p.headers,l(`const options = ${ie(p,{indent:" ",inlineCharacterLimit:80,transform:(y,g,$)=>g==="body"&&r.mimeType==="application/json"?`JSON.stringify(${$})`:$})};`),c(),i&&u(`import fs from 'fs';
17
+ `),l("fetch(url, options)"),l(".then(res => res.json())",1),l(".then(json => console.log(json))",1),l(".catch(err => console.error(err));",1),f().replace(/'encodedParams'/,"encodedParams").replace(/'formData'/,"formData")}}}},gt=(t,e,r,n)=>{const s=`${t} *${e} = `;return`${s}${It(r,n?s.length:void 0)};`},It=(t,e)=>{const r=e===void 0?", ":`,
18
+ ${" ".repeat(e)}`;switch(Object.prototype.toString.call(t)){case"[object Number]":return`@${t}`;case"[object Array]":return`@[ ${t.map(n=>It(n)).join(r)} ]`;case"[object Object]":{const n=[];return Object.keys(t).forEach(s=>{n.push(`@"${s}": ${It(t[s])}`)}),`@{ ${n.join(r)} }`}case"[object Boolean]":return t?"@YES":"@NO";default:return t==null?"":`@"${t.toString().replace(/"/g,'\\"')}"`}},Dn={info:{key:"objc",title:"Objective-C",default:"nsurlsession"},clientsById:{nsurlsession:{info:{key:"nsurlsession",title:"NSURLSession",link:"https://developer.apple.com/library/mac/documentation/Foundation/Reference/NSURLSession_class/index.html",description:"Foundation's NSURLSession request",extname:".m"},convert:({allHeaders:t,postData:e,method:r,fullUrl:n},s)=>{var f;const o={indent:" ",pretty:!0,timeout:10,...s},{push:a,join:i,blank:c}=new j({indent:o.indent}),l={hasHeaders:!1,hasBody:!1};if(a("#import <Foundation/Foundation.h>"),Object.keys(t).length&&(l.hasHeaders=!0,c(),a(gt("NSDictionary","headers",t,o.pretty))),e.text||e.jsonObj||e.params)switch(l.hasBody=!0,e.mimeType){case"application/x-www-form-urlencoded":if((f=e.params)!=null&&f.length){c();const[u,...d]=e.params;a(`NSMutableData *postData = [[NSMutableData alloc] initWithData:[@"${u.name}=${u.value}" dataUsingEncoding:NSUTF8StringEncoding]];`),d.forEach(({name:p,value:h})=>{a(`[postData appendData:[@"&${p}=${h}" dataUsingEncoding:NSUTF8StringEncoding]];`)})}else l.hasBody=!1;break;case"application/json":e.jsonObj&&(a(gt("NSDictionary","parameters",e.jsonObj,o.pretty)),c(),a("NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];"));break;case"multipart/form-data":a(gt("NSArray","parameters",e.params||[],o.pretty)),a(`NSString *boundary = @"${e.boundary}";`),c(),a("NSError *error;"),a("NSMutableString *body = [NSMutableString string];"),a("for (NSDictionary *param in parameters) {"),a('[body appendFormat:@"--%@\\r\\n", boundary];',1),a('if (param[@"fileName"]) {',1),a('[body appendFormat:@"Content-Disposition:form-data; name=\\"%@\\"; filename=\\"%@\\"\\r\\n", param[@"name"], param[@"fileName"]];',2),a('[body appendFormat:@"Content-Type: %@\\r\\n\\r\\n", param[@"contentType"]];',2),a('[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];',2),a("if (error) {",2),a('NSLog(@"%@", error);',3),a("}",2),a("} else {",1),a('[body appendFormat:@"Content-Disposition:form-data; name=\\"%@\\"\\r\\n\\r\\n", param[@"name"]];',2),a('[body appendFormat:@"%@", param[@"value"]];',2),a("}",1),a("}"),a('[body appendFormat:@"\\r\\n--%@--\\r\\n", boundary];'),a("NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];");break;default:c(),a(`NSData *postData = [[NSData alloc] initWithData:[@"${e.text}" dataUsingEncoding:NSUTF8StringEncoding]];`)}return c(),a(`NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"${n}"]`),a(" cachePolicy:NSURLRequestUseProtocolCachePolicy"),a(` timeoutInterval:${o.timeout.toFixed(1)}];`),a(`[request setHTTPMethod:@"${r}"];`),l.hasHeaders&&a("[request setAllHTTPHeaderFields:headers];"),l.hasBody&&a("[request setHTTPBody:postData];"),c(),a("NSURLSession *session = [NSURLSession sharedSession];"),a("NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request"),a(" completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {"),a(" if (error) {",1),a(' NSLog(@"%@", error);',2),a(" } else {",1),a(" NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;",2),a(' NSLog(@"%@", httpResponse);',2),a(" }",1),a(" }];"),a("[dataTask resume];"),i()}}}},Qn={info:{key:"ocaml",title:"OCaml",default:"cohttp"},clientsById:{cohttp:{info:{key:"cohttp",title:"CoHTTP",link:"https://github.com/mirage/ocaml-cohttp",description:"Cohttp is a very lightweight HTTP server using Lwt or Async for OCaml",extname:".ml",installation:()=>"opam install cohttp-lwt-unix cohttp-async"},convert:({fullUrl:t,allHeaders:e,postData:r,method:n},s)=>{const o={indent:" ",...s},a=["get","post","head","delete","patch","put","options"],{push:i,blank:c,join:l}=new j({indent:o.indent});i("open Cohttp_lwt_unix"),i("open Cohttp"),i("open Lwt"),c(),i(`let uri = Uri.of_string "${t}" in`);const f=Object.keys(e);return f.length===1?i(`let headers = Header.add (Header.init ()) "${f[0]}" "${I(e[f[0]])}" in`):f.length>1&&(i("let headers = Header.add_list (Header.init ()) ["),f.forEach(u=>{i(`("${u}", "${I(e[u])}");`,1)}),i("] in")),r.text&&i(`let body = Cohttp_lwt_body.of_string ${JSON.stringify(r.text)} in`),c(),i(`Client.call ${f.length?"~headers ":""}${r.text?"~body ":""}${a.includes(n.toLowerCase())?`\`${n.toUpperCase()}`:`(Code.method_of_string "${n}")`} uri`),i(">>= fun (res, body_stream) ->"),i("(* Do stuff with the result *)",1),l()}}}},k=(t,e,r)=>{switch(r=r||"",e=e||"",Object.prototype.toString.call(t)){case"[object Boolean]":return t;case"[object Null]":return"null";case"[object Undefined]":return"null";case"[object String]":return`'${Be(t,{delimiter:"'",escapeNewlines:!1})}'`;case"[object Number]":return t.toString();case"[object Array]":{const n=t.map(s=>k(s,`${e}${e}`,e)).join(`,
19
19
  ${e}`);return`[
20
20
  ${e}${n}
21
21
  ${r}]`}case"[object Object]":{const n=[];for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&n.push(`${k(s,e)} => ${k(t[s],`${e}${e}`,e)}`);return`[
22
22
  ${e}${n.join(`,
23
23
  ${e}`)}
24
- ${r}]`}default:return"null"}},ur=["ACL","BASELINE_CONTROL","CHECKIN","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LABEL","LOCK","MERGE","MKACTIVITY","MKCOL","MKWORKSPACE","MOVE","OPTIONS","POST","PROPFIND","PROPPATCH","PUT","REPORT","TRACE","UNCHECKOUT","UNLOCK","UPDATE","VERSION_CONTROL"],ro={info:{key:"php",title:"PHP",default:"curl",cli:"php %s"},clientsById:{curl:{info:{key:"curl",title:"cURL",link:"http://php.net/manual/en/book.curl.php",description:"PHP with ext-curl",extname:".php"},convert:({uriObj:t,postData:e,fullUrl:r,method:n,httpVersion:s,cookies:o,headersObj:a},i={})=>{const{closingTag:c=!1,indent:l=" ",maxRedirects:f=10,namedErrors:u=!1,noTags:p=!1,shortTags:d=!1,timeout:h=30}=i,{push:y,blank:g,join:v}=new j({indent:l});p||(y(d?"<?":"<?php"),g()),y("$curl = curl_init();"),g();const m=[{escape:!0,name:"CURLOPT_PORT",value:t.port},{escape:!0,name:"CURLOPT_URL",value:r},{escape:!1,name:"CURLOPT_RETURNTRANSFER",value:"true"},{escape:!0,name:"CURLOPT_ENCODING",value:""},{escape:!1,name:"CURLOPT_MAXREDIRS",value:f},{escape:!1,name:"CURLOPT_TIMEOUT",value:h},{escape:!1,name:"CURLOPT_HTTP_VERSION",value:s==="HTTP/1.0"?"CURL_HTTP_VERSION_1_0":"CURL_HTTP_VERSION_1_1"},{escape:!0,name:"CURLOPT_CUSTOMREQUEST",value:n},{escape:!e.jsonObj,name:"CURLOPT_POSTFIELDS",value:e?e.jsonObj?`json_encode(${k(e.jsonObj,l.repeat(2),l)})`:e.text:void 0}];y("curl_setopt_array($curl, [");const b=new j({indent:l,join:`
25
- ${l}`});m.forEach(({value:$,name:T,escape:P})=>{$!=null&&b.push(`${T} => ${P?JSON.stringify($):$},`)});const S=o.map($=>`${encodeURIComponent($.name)}=${encodeURIComponent($.value)}`);S.length&&b.push(`CURLOPT_COOKIE => "${S.join("; ")}",`);const O=Object.keys(a).sort().map($=>`"${$}: ${I(a[$])}"`);return O.length&&(b.push("CURLOPT_HTTPHEADER => ["),b.push(O.join(`,
26
- ${l}${l}`),1),b.push("],")),y(b.join(),1),y("]);"),g(),y("$response = curl_exec($curl);"),y("$err = curl_error($curl);"),g(),y("curl_close($curl);"),g(),y("if ($err) {"),y(u?'echo array_flip(get_defined_constants(true)["curl"])[$err];':'echo "cURL Error #:" . $err;',1),y("} else {"),y("echo $response;",1),y("}"),!p&&c&&(g(),y("?>")),v()}},guzzle:{info:{key:"guzzle",title:"Guzzle",link:"http://docs.guzzlephp.org/en/stable/",description:"PHP with Guzzle",extname:".php",installation:()=>"composer require guzzlehttp/guzzle"},convert:({postData:t,fullUrl:e,method:r,cookies:n,headersObj:s},o)=>{var y;const a={closingTag:!1,indent:" ",noTags:!1,shortTags:!1,...o},{push:i,blank:c,join:l}=new j({indent:a.indent}),{code:f,push:u,join:p}=new j({indent:a.indent});switch(a.noTags||i(a.shortTags?"<?":"<?php"),i("require_once('vendor/autoload.php');"),c(),t.mimeType){case"application/x-www-form-urlencoded":u(`'form_params' => ${k(t.paramsObj,a.indent+a.indent,a.indent)},`,1);break;case"multipart/form-data":{const g=[];if(t.params&&t.params.forEach(v=>{if(v.fileName){const m={name:v.name,filename:v.fileName,contents:v.value};v.contentType&&(m.headers={"Content-Type":v.contentType}),g.push(m)}else v.value&&g.push({name:v.name,contents:v.value})}),g.length&&(u(`'multipart' => ${k(g,a.indent+a.indent,a.indent)}`,1),nt(s,"content-type")&&(y=le(s,"content-type"))!=null&&y.indexOf("boundary"))){const v=G(s,"content-type");v&&delete s[v]}break}default:t.text&&u(`'body' => ${k(t.text)},`,1)}const d=Object.keys(s).sort().map(g=>`${a.indent}${a.indent}'${g}' => '${Re(s[g])}',`),h=n.map(g=>`${encodeURIComponent(g.name)}=${encodeURIComponent(g.value)}`).join("; ");return h.length&&d.push(`${a.indent}${a.indent}'cookie' => '${Re(h)}',`),d.length&&(u("'headers' => [",1),u(d.join(`
27
- `)),u("],",1)),i("$client = new \\GuzzleHttp\\Client();"),c(),f.length?(i(`$response = $client->request('${r}', '${e}', [`),i(p()),i("]);")):i(`$response = $client->request('${r}', '${e}');`),c(),i("echo $response->getBody();"),!a.noTags&&a.closingTag&&(c(),i("?>")),l()}},http1:{info:{key:"http1",title:"HTTP v1",link:"http://php.net/manual/en/book.http.php",description:"PHP with pecl/http v1",extname:".php"},convert:({method:t,url:e,postData:r,queryObj:n,headersObj:s,cookiesObj:o},a={})=>{const{closingTag:i=!1,indent:c=" ",noTags:l=!1,shortTags:f=!1}=a,{push:u,blank:p,join:d}=new j({indent:c});switch(l||(u(f?"<?":"<?php"),p()),ur.includes(t.toUpperCase())||u(`HttpRequest::methodRegister('${t}');`),u("$request = new HttpRequest();"),u(`$request->setUrl(${k(e)});`),ur.includes(t.toUpperCase())?u(`$request->setMethod(HTTP_METH_${t.toUpperCase()});`):u(`$request->setMethod(HttpRequest::HTTP_METH_${t.toUpperCase()});`),p(),Object.keys(n).length&&(u(`$request->setQueryData(${k(n,c)});`),p()),Object.keys(s).length&&(u(`$request->setHeaders(${k(s,c)});`),p()),Object.keys(o).length&&(u(`$request->setCookies(${k(o,c)});`),p()),r.mimeType){case"application/x-www-form-urlencoded":u(`$request->setContentType(${k(r.mimeType)});`),u(`$request->setPostFields(${k(r.paramsObj,c)});`),p();break;case"application/json":u(`$request->setContentType(${k(r.mimeType)});`),u(`$request->setBody(json_encode(${k(r.jsonObj,c)}));`),p();break;default:r.text&&(u(`$request->setBody(${k(r.text)});`),p())}return u("try {"),u("$response = $request->send();",1),p(),u("echo $response->getBody();",1),u("} catch (HttpException $ex) {"),u("echo $ex;",1),u("}"),!l&&i&&(p(),u("?>")),d()}},http2:{info:{key:"http2",title:"HTTP v2",link:"http://devel-m6w6.rhcloud.com/mdref/http",description:"PHP with pecl/http v2",extname:".php"},convert:({postData:t,headersObj:e,method:r,queryObj:n,cookiesObj:s,url:o},a={})=>{var y;const{closingTag:i=!1,indent:c=" ",noTags:l=!1,shortTags:f=!1}=a,{push:u,blank:p,join:d}=new j({indent:c});let h=!1;switch(l||(u(f?"<?":"<?php"),p()),u("$client = new http\\Client;"),u("$request = new http\\Client\\Request;"),p(),t.mimeType){case"application/x-www-form-urlencoded":u("$body = new http\\Message\\Body;"),u(`$body->append(new http\\QueryString(${k(t.paramsObj,c)}));`),p(),h=!0;break;case"multipart/form-data":{if(!t.params)break;const g=[],v={};t.params.forEach(({name:S,fileName:O,value:$,contentType:T})=>{if(O){g.push({name:S,type:T,file:O,data:$});return}$&&(v[S]=$)});const m=Object.keys(v).length?k(v,c):"null",b=g.length?k(g,c):"null";if(u("$body = new http\\Message\\Body;"),u(`$body->addForm(${m}, ${b});`),nt(e,"content-type")&&(y=le(e,"content-type"))!=null&&y.indexOf("boundary")){const S=G(e,"content-type");S&&delete e[S]}p(),h=!0;break}case"application/json":u("$body = new http\\Message\\Body;"),u(`$body->append(json_encode(${k(t.jsonObj,c)}));`),h=!0;break;default:t.text&&(u("$body = new http\\Message\\Body;"),u(`$body->append(${k(t.text)});`),p(),h=!0)}return u(`$request->setRequestUrl(${k(o)});`),u(`$request->setRequestMethod(${k(r)});`),h&&(u("$request->setBody($body);"),p()),Object.keys(n).length&&(u(`$request->setQuery(new http\\QueryString(${k(n,c)}));`),p()),Object.keys(e).length&&(u(`$request->setHeaders(${k(e,c)});`),p()),Object.keys(s).length&&(p(),u(`$client->setCookies(${k(s,c)});`),p()),u("$client->enqueue($request)->send();"),u("$response = $client->getResponse();"),p(),u("echo $response->getBody();"),!l&&i&&(p(),u("?>")),d()}}}},Zr=t=>({method:r,headersObj:n,cookies:s,uriObj:o,fullUrl:a,postData:i,allHeaders:c})=>{const{push:l,join:f}=new j;if(!["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"].includes(r.toUpperCase()))return"Method not supported";const u=[],p=Object.keys(n);return p.length&&(l("$headers=@{}"),p.forEach(d=>{d!=="connection"&&l(`$headers.Add("${d}", "${Be(n[d],{escapeChar:"`"})}")`)}),u.push("-Headers $headers")),s.length&&(l("$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession"),s.forEach(d=>{l("$cookie = New-Object System.Net.Cookie"),l(`$cookie.Name = '${d.name}'`),l(`$cookie.Value = '${d.value}'`),l(`$cookie.Domain = '${o.host}'`),l("$session.Cookies.Add($cookie)")}),u.push("-WebSession $session")),i.text&&(u.push(`-ContentType '${Be(le(c,"content-type"),{delimiter:"'",escapeChar:"`"})}'`),u.push(`-Body '${i.text}'`)),l(`$response = ${t} -Uri '${a}' -Method ${r} ${u.join(" ")}`.trim()),f()},no={info:{key:"restmethod",title:"Invoke-RestMethod",link:"https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Invoke-RestMethod",description:"Powershell Invoke-RestMethod client",extname:".ps1"},convert:Zr("Invoke-RestMethod")},oo={info:{key:"powershell",title:"Powershell",default:"webrequest"},clientsById:{webrequest:{info:{key:"webrequest",title:"Invoke-WebRequest",link:"https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Invoke-WebRequest",description:"Powershell Invoke-WebRequest client",extname:".ps1"},convert:Zr("Invoke-WebRequest")},restmethod:no}};function pr(t,e,r,n,s){const o=n.repeat(s),a=n.repeat(s-1),i=r?`,
24
+ ${r}]`}default:return"null"}},cr=["ACL","BASELINE_CONTROL","CHECKIN","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LABEL","LOCK","MERGE","MKACTIVITY","MKCOL","MKWORKSPACE","MOVE","OPTIONS","POST","PROPFIND","PROPPATCH","PUT","REPORT","TRACE","UNCHECKOUT","UNLOCK","UPDATE","VERSION_CONTROL"],Yn={info:{key:"php",title:"PHP",default:"curl",cli:"php %s"},clientsById:{curl:{info:{key:"curl",title:"cURL",link:"http://php.net/manual/en/book.curl.php",description:"PHP with ext-curl",extname:".php"},convert:({uriObj:t,postData:e,fullUrl:r,method:n,httpVersion:s,cookies:o,headersObj:a},i={})=>{const{closingTag:c=!1,indent:l=" ",maxRedirects:f=10,namedErrors:u=!1,noTags:d=!1,shortTags:p=!1,timeout:h=30}=i,{push:y,blank:g,join:$}=new j({indent:l});d||(y(p?"<?":"<?php"),g()),y("$curl = curl_init();"),g();const m=[{escape:!0,name:"CURLOPT_PORT",value:t.port},{escape:!0,name:"CURLOPT_URL",value:r},{escape:!1,name:"CURLOPT_RETURNTRANSFER",value:"true"},{escape:!0,name:"CURLOPT_ENCODING",value:""},{escape:!1,name:"CURLOPT_MAXREDIRS",value:f},{escape:!1,name:"CURLOPT_TIMEOUT",value:h},{escape:!1,name:"CURLOPT_HTTP_VERSION",value:s==="HTTP/1.0"?"CURL_HTTP_VERSION_1_0":"CURL_HTTP_VERSION_1_1"},{escape:!0,name:"CURLOPT_CUSTOMREQUEST",value:n},{escape:!e.jsonObj,name:"CURLOPT_POSTFIELDS",value:e?e.jsonObj?`json_encode(${k(e.jsonObj,l.repeat(2),l)})`:e.text:void 0}];y("curl_setopt_array($curl, [");const b=new j({indent:l,join:`
25
+ ${l}`});m.forEach(({value:v,name:T,escape:P})=>{v!=null&&b.push(`${T} => ${P?JSON.stringify(v):v},`)});const S=o.map(v=>`${encodeURIComponent(v.name)}=${encodeURIComponent(v.value)}`);S.length&&b.push(`CURLOPT_COOKIE => "${S.join("; ")}",`);const O=Object.keys(a).sort().map(v=>`"${v}: ${I(a[v])}"`);return O.length&&(b.push("CURLOPT_HTTPHEADER => ["),b.push(O.join(`,
26
+ ${l}${l}`),1),b.push("],")),y(b.join(),1),y("]);"),g(),y("$response = curl_exec($curl);"),y("$err = curl_error($curl);"),g(),y("curl_close($curl);"),g(),y("if ($err) {"),y(u?'echo array_flip(get_defined_constants(true)["curl"])[$err];':'echo "cURL Error #:" . $err;',1),y("} else {"),y("echo $response;",1),y("}"),!d&&c&&(g(),y("?>")),$()}},guzzle:{info:{key:"guzzle",title:"Guzzle",link:"http://docs.guzzlephp.org/en/stable/",description:"PHP with Guzzle",extname:".php",installation:()=>"composer require guzzlehttp/guzzle"},convert:({postData:t,fullUrl:e,method:r,cookies:n,headersObj:s},o)=>{var y;const a={closingTag:!1,indent:" ",noTags:!1,shortTags:!1,...o},{push:i,blank:c,join:l}=new j({indent:a.indent}),{code:f,push:u,join:d}=new j({indent:a.indent});switch(a.noTags||i(a.shortTags?"<?":"<?php"),i("require_once('vendor/autoload.php');"),c(),t.mimeType){case"application/x-www-form-urlencoded":u(`'form_params' => ${k(t.paramsObj,a.indent+a.indent,a.indent)},`,1);break;case"multipart/form-data":{const g=[];if(t.params&&t.params.forEach($=>{if($.fileName){const m={name:$.name,filename:$.fileName,contents:$.value};$.contentType&&(m.headers={"Content-Type":$.contentType}),g.push(m)}else $.value&&g.push({name:$.name,contents:$.value})}),g.length&&(u(`'multipart' => ${k(g,a.indent+a.indent,a.indent)}`,1),nt(s,"content-type")&&(y=le(s,"content-type"))!=null&&y.indexOf("boundary"))){const $=G(s,"content-type");$&&delete s[$]}break}default:t.text&&u(`'body' => ${k(t.text)},`,1)}const p=Object.keys(s).sort().map(g=>`${a.indent}${a.indent}'${g}' => '${Re(s[g])}',`),h=n.map(g=>`${encodeURIComponent(g.name)}=${encodeURIComponent(g.value)}`).join("; ");return h.length&&p.push(`${a.indent}${a.indent}'cookie' => '${Re(h)}',`),p.length&&(u("'headers' => [",1),u(p.join(`
27
+ `)),u("],",1)),i("$client = new \\GuzzleHttp\\Client();"),c(),f.length?(i(`$response = $client->request('${r}', '${e}', [`),i(d()),i("]);")):i(`$response = $client->request('${r}', '${e}');`),c(),i("echo $response->getBody();"),!a.noTags&&a.closingTag&&(c(),i("?>")),l()}},http1:{info:{key:"http1",title:"HTTP v1",link:"http://php.net/manual/en/book.http.php",description:"PHP with pecl/http v1",extname:".php"},convert:({method:t,url:e,postData:r,queryObj:n,headersObj:s,cookiesObj:o},a={})=>{const{closingTag:i=!1,indent:c=" ",noTags:l=!1,shortTags:f=!1}=a,{push:u,blank:d,join:p}=new j({indent:c});switch(l||(u(f?"<?":"<?php"),d()),cr.includes(t.toUpperCase())||u(`HttpRequest::methodRegister('${t}');`),u("$request = new HttpRequest();"),u(`$request->setUrl(${k(e)});`),cr.includes(t.toUpperCase())?u(`$request->setMethod(HTTP_METH_${t.toUpperCase()});`):u(`$request->setMethod(HttpRequest::HTTP_METH_${t.toUpperCase()});`),d(),Object.keys(n).length&&(u(`$request->setQueryData(${k(n,c)});`),d()),Object.keys(s).length&&(u(`$request->setHeaders(${k(s,c)});`),d()),Object.keys(o).length&&(u(`$request->setCookies(${k(o,c)});`),d()),r.mimeType){case"application/x-www-form-urlencoded":u(`$request->setContentType(${k(r.mimeType)});`),u(`$request->setPostFields(${k(r.paramsObj,c)});`),d();break;case"application/json":u(`$request->setContentType(${k(r.mimeType)});`),u(`$request->setBody(json_encode(${k(r.jsonObj,c)}));`),d();break;default:r.text&&(u(`$request->setBody(${k(r.text)});`),d())}return u("try {"),u("$response = $request->send();",1),d(),u("echo $response->getBody();",1),u("} catch (HttpException $ex) {"),u("echo $ex;",1),u("}"),!l&&i&&(d(),u("?>")),p()}},http2:{info:{key:"http2",title:"HTTP v2",link:"http://devel-m6w6.rhcloud.com/mdref/http",description:"PHP with pecl/http v2",extname:".php"},convert:({postData:t,headersObj:e,method:r,queryObj:n,cookiesObj:s,url:o},a={})=>{var y;const{closingTag:i=!1,indent:c=" ",noTags:l=!1,shortTags:f=!1}=a,{push:u,blank:d,join:p}=new j({indent:c});let h=!1;switch(l||(u(f?"<?":"<?php"),d()),u("$client = new http\\Client;"),u("$request = new http\\Client\\Request;"),d(),t.mimeType){case"application/x-www-form-urlencoded":u("$body = new http\\Message\\Body;"),u(`$body->append(new http\\QueryString(${k(t.paramsObj,c)}));`),d(),h=!0;break;case"multipart/form-data":{if(!t.params)break;const g=[],$={};t.params.forEach(({name:S,fileName:O,value:v,contentType:T})=>{if(O){g.push({name:S,type:T,file:O,data:v});return}v&&($[S]=v)});const m=Object.keys($).length?k($,c):"null",b=g.length?k(g,c):"null";if(u("$body = new http\\Message\\Body;"),u(`$body->addForm(${m}, ${b});`),nt(e,"content-type")&&(y=le(e,"content-type"))!=null&&y.indexOf("boundary")){const S=G(e,"content-type");S&&delete e[S]}d(),h=!0;break}case"application/json":u("$body = new http\\Message\\Body;"),u(`$body->append(json_encode(${k(t.jsonObj,c)}));`),h=!0;break;default:t.text&&(u("$body = new http\\Message\\Body;"),u(`$body->append(${k(t.text)});`),d(),h=!0)}return u(`$request->setRequestUrl(${k(o)});`),u(`$request->setRequestMethod(${k(r)});`),h&&(u("$request->setBody($body);"),d()),Object.keys(n).length&&(u(`$request->setQuery(new http\\QueryString(${k(n,c)}));`),d()),Object.keys(e).length&&(u(`$request->setHeaders(${k(e,c)});`),d()),Object.keys(s).length&&(d(),u(`$client->setCookies(${k(s,c)});`),d()),u("$client->enqueue($request)->send();"),u("$response = $client->getResponse();"),d(),u("echo $response->getBody();"),!l&&i&&(d(),u("?>")),p()}}}},Kr=t=>({method:r,headersObj:n,cookies:s,uriObj:o,fullUrl:a,postData:i,allHeaders:c})=>{const{push:l,join:f}=new j;if(!["GET","POST","PUT","DELETE","PATCH","HEAD","OPTIONS"].includes(r.toUpperCase()))return"Method not supported";const u=[],d=Object.keys(n);return d.length&&(l("$headers=@{}"),d.forEach(p=>{p!=="connection"&&l(`$headers.Add("${p}", "${Be(n[p],{escapeChar:"`"})}")`)}),u.push("-Headers $headers")),s.length&&(l("$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession"),s.forEach(p=>{l("$cookie = New-Object System.Net.Cookie"),l(`$cookie.Name = '${p.name}'`),l(`$cookie.Value = '${p.value}'`),l(`$cookie.Domain = '${o.host}'`),l("$session.Cookies.Add($cookie)")}),u.push("-WebSession $session")),i.text&&(u.push(`-ContentType '${Be(le(c,"content-type"),{delimiter:"'",escapeChar:"`"})}'`),u.push(`-Body '${i.text}'`)),l(`$response = ${t} -Uri '${a}' -Method ${r} ${u.join(" ")}`.trim()),f()},Xn={info:{key:"restmethod",title:"Invoke-RestMethod",link:"https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Invoke-RestMethod",description:"Powershell Invoke-RestMethod client",extname:".ps1"},convert:Kr("Invoke-RestMethod")},Zn={info:{key:"powershell",title:"Powershell",default:"webrequest"},clientsById:{webrequest:{info:{key:"webrequest",title:"Invoke-WebRequest",link:"https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Invoke-WebRequest",description:"Powershell Invoke-WebRequest client",extname:".ps1"},convert:Kr("Invoke-WebRequest")},restmethod:Xn}};function lr(t,e,r,n,s){const o=n.repeat(s),a=n.repeat(s-1),i=r?`,
28
28
  ${o}`:", ",c=t==="object"?"{":"[",l=t==="object"?"}":"]";return r?`${c}
29
29
  ${o}${e.join(i)}
30
- ${a}${l}`:t==="object"&&e.length>0?`${c} ${e.join(i)} ${l}`:`${c}${e.join(i)}${l}`}const je=(t,e,r)=>{switch(r=r===void 0?1:r+1,Object.prototype.toString.call(t)){case"[object Number]":return t;case"[object Array]":{let n=!1;return pr("array",t.map(s=>(Object.prototype.toString.call(s)==="[object Object]"&&(n=Object.keys(s).length>1),je(s,e,r))),n,e.indent,r)}case"[object Object]":{const n=[];for(const s in t)n.push(`"${s}": ${je(t[s],e,r)}`);return pr("object",n,e.pretty&&n.length>1,e.indent,r)}case"[object Null]":return"None";case"[object Boolean]":return t?"True":"False";default:return t==null?"":`"${t.toString().replace(/"/g,'\\"')}"`}},io=["HEAD","GET","POST","PUT","PATCH","DELETE","OPTIONS"],ao={info:{key:"python",title:"Python",default:"requests",cli:"python3 %s"},clientsById:{requests:{info:{key:"requests",title:"Requests",link:"http://docs.python-requests.org/en/latest/api/#requests.request",description:"Requests HTTP library",extname:".py",installation:()=>"python -m pip install requests"},convert:({fullUrl:t,postData:e,allHeaders:r,method:n},s)=>{const o={indent:" ",pretty:!0,...s},{push:a,blank:i,join:c,addPostProcessor:l}=new j({indent:o.indent});a("import requests"),i(),a(`url = "${t}"`),i();const f=r;let u={};const p={};let d=!1,h=!1,y=!1;switch(e.mimeType){case"application/json":e.jsonObj&&(a(`payload = ${je(e.jsonObj,o)}`),y=!0,h=!0);break;case"multipart/form-data":if(!e.params)break;if(u={},e.params.forEach(m=>{m.fileName?(m.contentType?p[m.name]=`('${m.fileName}', open('${m.fileName}', 'rb'), '${m.contentType}')`:p[m.name]=`('${m.fileName}', open('${m.fileName}', 'rb'))`,d=!0):(u[m.name]=m.value,h=!0)}),d){a(`files = ${je(p,o)}`),h&&a(`payload = ${je(u,o)}`);const m=G(f,"content-type");m&&delete f[m]}else{const m=JSON.stringify(e.text);m&&(a(`payload = ${m}`),h=!0)}l(m=>m.replace(/"\('(.+)', open\('(.+)', 'rb'\)\)"/g,'("$1", open("$2", "rb"))').replace(/"\('(.+)', open\('(.+)', 'rb'\), '(.+)'\)"/g,'("$1", open("$2", "rb"), "$3")'));break;default:{if(e.mimeType==="application/x-www-form-urlencoded"&&e.paramsObj){a(`payload = ${je(e.paramsObj,o)}`),h=!0;break}const m=JSON.stringify(e.text);m&&(a(`payload = ${m}`),h=!0)}}const g=Object.keys(f).length;if(g===0&&(h||d))i();else if(g===1)Object.keys(f).forEach(m=>{a(`headers = {"${m}": "${I(f[m])}"}`),i()});else if(g>1){let m=1;a("headers = {"),Object.keys(f).forEach(b=>{a(m!==g?`"${b}": "${I(f[b])}",`:`"${b}": "${I(f[b])}"`,1),m+=1}),a("}"),i()}let v=io.includes(n)?`response = requests.${n.toLowerCase()}(url`:`response = requests.request("${n}", url`;return h&&(y?v+=", json=payload":v+=", data=payload"),d&&(v+=", files=files"),g>0&&(v+=", headers=headers"),v+=")",a(v),i(),a("print(response.text)"),c()}}}},so={info:{key:"r",title:"R",default:"httr"},clientsById:{httr:{info:{key:"httr",title:"httr",link:"https://cran.r-project.org/web/packages/httr/vignettes/quickstart.html",description:"httr: Tools for Working with URLs and HTTP",extname:".r"},convert:({url:t,queryObj:e,queryString:r,postData:n,allHeaders:s,method:o})=>{const{push:a,blank:i,join:c}=new j;a("library(httr)"),i(),a(`url <- "${t}"`),i();const l=e;delete e.key;const f=Object.keys(l).length;r.length===1?(a(`queryString <- list(${Object.keys(l)} = "${Object.values(l).toString()}")`),i()):r.length>1&&(a("queryString <- list("),Object.keys(l).forEach((O,$)=>{$!==f-1?a(` ${O} = "${l[O].toString()}",`):a(` ${O} = "${l[O].toString()}"`)}),a(")"),i());const u=JSON.stringify(n.text);if(u&&(a(`payload <- ${u}`),i()),n.text||n.jsonObj||n.params)switch(n.mimeType){case"application/x-www-form-urlencoded":a('encode <- "form"'),i();break;case"application/json":a('encode <- "json"'),i();break;case"multipart/form-data":a('encode <- "multipart"'),i();break;default:a('encode <- "raw"'),i();break}const p=le(s,"cookie"),d=le(s,"accept"),h=p?`set_cookies(\`${String(p).replace(/;/g,'", `').replace(/` /g,"`").replace(/[=]/g,'` = "')}")`:void 0,y=d?`accept("${I(d)}")`:void 0,g=`content_type("${I(n.mimeType)}")`,v=Object.entries(s).filter(([O])=>!["cookie","accept","content-type"].includes(O.toLowerCase())).map(([O,$])=>`'${O}' = '${Re($)}'`).join(", "),m=v?`add_headers(${v})`:void 0;let b=`response <- VERB("${o}", url`;u&&(b+=", body = payload"),r.length&&(b+=", query = queryString");const S=[m,g,y,h].filter(O=>!!O).join(", ");return S&&(b+=`, ${S}`),(n.text||n.jsonObj||n.params)&&(b+=", encode = encode"),b+=")",a(b),i(),a('content(response, "text")'),c()}}}},co={info:{key:"ruby",title:"Ruby",default:"native"},clientsById:{native:{info:{key:"native",title:"net::http",link:"http://ruby-doc.org/stdlib-2.2.1/libdoc/net/http/rdoc/Net/HTTP.html",description:"Ruby HTTP client",extname:".rb"},convert:({uriObj:t,method:e,fullUrl:r,postData:n,allHeaders:s})=>{const{push:o,blank:a,join:i}=new j;o("require 'uri'"),o("require 'net/http'"),a();const c=e.toUpperCase(),l=["GET","POST","HEAD","DELETE","PATCH","PUT","OPTIONS","COPY","LOCK","UNLOCK","MOVE","TRACE"],f=c.charAt(0)+c.substring(1).toLowerCase();l.includes(c)||(o(`class Net::HTTP::${f} < Net::HTTPRequest`),o(` METHOD = '${c.toUpperCase()}'`),o(` REQUEST_HAS_BODY = '${n.text?"true":"false"}'`),o(" RESPONSE_HAS_BODY = true"),o("end"),a()),o(`url = URI("${r}")`),a(),o("http = Net::HTTP.new(url.host, url.port)"),t.protocol==="https:"&&o("http.use_ssl = true"),a(),o(`request = Net::HTTP::${f}.new(url)`);const u=Object.keys(s);return u.length&&u.forEach(p=>{o(`request["${p}"] = '${Re(s[p])}'`)}),n.text&&o(`request.body = ${JSON.stringify(n.text)}`),a(),o("response = http.request(request)"),o("puts response.read_body"),i()}},faraday:{info:{key:"faraday",title:"faraday",link:"https://github.com/lostisland/faraday",description:"Faraday HTTP client",extname:".rb"},convert:({uriObj:t,queryObj:e,method:r,postData:n,allHeaders:s})=>{const{push:o,blank:a,join:i}=new j,c=r.toUpperCase();if(!["GET","POST","HEAD","DELETE","PATCH","PUT","OPTIONS","COPY","LOCK","UNLOCK","MOVE","TRACE"].includes(c))return o(`# Faraday cannot currently run ${c} requests. Please use another client.`),i();o("require 'faraday'"),a(),n.mimeType==="application/x-www-form-urlencoded"&&n.params&&(o("data = {"),n.params.forEach(f=>{o(` :${f.name} => ${JSON.stringify(f.value)},`)}),o("}"),a()),o("conn = Faraday.new("),o(` url: '${t.protocol}//${t.host}',`),(s["content-type"]||s["Content-Type"])&&o(` headers: {'Content-Type' => '${s["content-type"]||s["Content-Type"]}'}`),o(")"),a(),o(`response = conn.${c.toLowerCase()}('${t.pathname}') do |req|`);const l=Object.keys(s);switch(l.length&&l.forEach(f=>{f.toLowerCase()!=="content-type"&&o(` req.headers['${f}'] = '${Re(s[f])}'`)}),Object.keys(e).forEach(f=>{const u=e[f];Array.isArray(u)?o(` req.params['${f}'] = ${JSON.stringify(u)}`):o(` req.params['${f}'] = '${u}'`)}),n.mimeType){case"application/x-www-form-urlencoded":n.params&&o(" req.body = URI.encode_www_form(data)");break;case"application/json":n.jsonObj&&o(` req.body = ${JSON.stringify(n.text)}`);break;default:n.text&&o(` req.body = ${JSON.stringify(n.text)}`)}return o("end"),a(),o("puts response.status"),o("puts response.body"),i()}}}};function dr(t,e,r,n,s){const o=n.repeat(s),a=n.repeat(s-1),i=r?`,
30
+ ${a}${l}`:t==="object"&&e.length>0?`${c} ${e.join(i)} ${l}`:`${c}${e.join(i)}${l}`}const je=(t,e,r)=>{switch(r=r===void 0?1:r+1,Object.prototype.toString.call(t)){case"[object Number]":return t;case"[object Array]":{let n=!1;return lr("array",t.map(s=>(Object.prototype.toString.call(s)==="[object Object]"&&(n=Object.keys(s).length>1),je(s,e,r))),n,e.indent,r)}case"[object Object]":{const n=[];for(const s in t)n.push(`"${s}": ${je(t[s],e,r)}`);return lr("object",n,e.pretty&&n.length>1,e.indent,r)}case"[object Null]":return"None";case"[object Boolean]":return t?"True":"False";default:return t==null?"":`"${t.toString().replace(/"/g,'\\"')}"`}},eo=["HEAD","GET","POST","PUT","PATCH","DELETE","OPTIONS"],to={info:{key:"python",title:"Python",default:"requests",cli:"python3 %s"},clientsById:{requests:{info:{key:"requests",title:"Requests",link:"http://docs.python-requests.org/en/latest/api/#requests.request",description:"Requests HTTP library",extname:".py",installation:()=>"python -m pip install requests"},convert:({fullUrl:t,postData:e,allHeaders:r,method:n},s)=>{const o={indent:" ",pretty:!0,...s},{push:a,blank:i,join:c,addPostProcessor:l}=new j({indent:o.indent});a("import requests"),i(),a(`url = "${t}"`),i();const f=r;let u={};const d={};let p=!1,h=!1,y=!1;switch(e.mimeType){case"application/json":e.jsonObj&&(a(`payload = ${je(e.jsonObj,o)}`),y=!0,h=!0);break;case"multipart/form-data":if(!e.params)break;if(u={},e.params.forEach(m=>{m.fileName?(m.contentType?d[m.name]=`('${m.fileName}', open('${m.fileName}', 'rb'), '${m.contentType}')`:d[m.name]=`('${m.fileName}', open('${m.fileName}', 'rb'))`,p=!0):(u[m.name]=m.value,h=!0)}),p){a(`files = ${je(d,o)}`),h&&a(`payload = ${je(u,o)}`);const m=G(f,"content-type");m&&delete f[m]}else{const m=JSON.stringify(e.text);m&&(a(`payload = ${m}`),h=!0)}l(m=>m.replace(/"\('(.+)', open\('(.+)', 'rb'\)\)"/g,'("$1", open("$2", "rb"))').replace(/"\('(.+)', open\('(.+)', 'rb'\), '(.+)'\)"/g,'("$1", open("$2", "rb"), "$3")'));break;default:{if(e.mimeType==="application/x-www-form-urlencoded"&&e.paramsObj){a(`payload = ${je(e.paramsObj,o)}`),h=!0;break}const m=JSON.stringify(e.text);m&&(a(`payload = ${m}`),h=!0)}}const g=Object.keys(f).length;if(g===0&&(h||p))i();else if(g===1)Object.keys(f).forEach(m=>{a(`headers = {"${m}": "${I(f[m])}"}`),i()});else if(g>1){let m=1;a("headers = {"),Object.keys(f).forEach(b=>{a(m!==g?`"${b}": "${I(f[b])}",`:`"${b}": "${I(f[b])}"`,1),m+=1}),a("}"),i()}let $=eo.includes(n)?`response = requests.${n.toLowerCase()}(url`:`response = requests.request("${n}", url`;return h&&(y?$+=", json=payload":$+=", data=payload"),p&&($+=", files=files"),g>0&&($+=", headers=headers"),$+=")",a($),i(),a("print(response.text)"),c()}}}},ro={info:{key:"r",title:"R",default:"httr"},clientsById:{httr:{info:{key:"httr",title:"httr",link:"https://cran.r-project.org/web/packages/httr/vignettes/quickstart.html",description:"httr: Tools for Working with URLs and HTTP",extname:".r"},convert:({url:t,queryObj:e,queryString:r,postData:n,allHeaders:s,method:o})=>{const{push:a,blank:i,join:c}=new j;a("library(httr)"),i(),a(`url <- "${t}"`),i();const l=e;delete e.key;const f=Object.keys(l).length;r.length===1?(a(`queryString <- list(${Object.keys(l)} = "${Object.values(l).toString()}")`),i()):r.length>1&&(a("queryString <- list("),Object.keys(l).forEach((O,v)=>{v!==f-1?a(` ${O} = "${l[O].toString()}",`):a(` ${O} = "${l[O].toString()}"`)}),a(")"),i());const u=JSON.stringify(n.text);if(u&&(a(`payload <- ${u}`),i()),n.text||n.jsonObj||n.params)switch(n.mimeType){case"application/x-www-form-urlencoded":a('encode <- "form"'),i();break;case"application/json":a('encode <- "json"'),i();break;case"multipart/form-data":a('encode <- "multipart"'),i();break;default:a('encode <- "raw"'),i();break}const d=le(s,"cookie"),p=le(s,"accept"),h=d?`set_cookies(\`${String(d).replace(/;/g,'", `').replace(/` /g,"`").replace(/[=]/g,'` = "')}")`:void 0,y=p?`accept("${I(p)}")`:void 0,g=`content_type("${I(n.mimeType)}")`,$=Object.entries(s).filter(([O])=>!["cookie","accept","content-type"].includes(O.toLowerCase())).map(([O,v])=>`'${O}' = '${Re(v)}'`).join(", "),m=$?`add_headers(${$})`:void 0;let b=`response <- VERB("${o}", url`;u&&(b+=", body = payload"),r.length&&(b+=", query = queryString");const S=[m,g,y,h].filter(O=>!!O).join(", ");return S&&(b+=`, ${S}`),(n.text||n.jsonObj||n.params)&&(b+=", encode = encode"),b+=")",a(b),i(),a('content(response, "text")'),c()}}}},no={info:{key:"ruby",title:"Ruby",default:"native"},clientsById:{native:{info:{key:"native",title:"net::http",link:"http://ruby-doc.org/stdlib-2.2.1/libdoc/net/http/rdoc/Net/HTTP.html",description:"Ruby HTTP client",extname:".rb"},convert:({uriObj:t,method:e,fullUrl:r,postData:n,allHeaders:s})=>{const{push:o,blank:a,join:i}=new j;o("require 'uri'"),o("require 'net/http'"),a();const c=e.toUpperCase(),l=["GET","POST","HEAD","DELETE","PATCH","PUT","OPTIONS","COPY","LOCK","UNLOCK","MOVE","TRACE"],f=c.charAt(0)+c.substring(1).toLowerCase();l.includes(c)||(o(`class Net::HTTP::${f} < Net::HTTPRequest`),o(` METHOD = '${c.toUpperCase()}'`),o(` REQUEST_HAS_BODY = '${n.text?"true":"false"}'`),o(" RESPONSE_HAS_BODY = true"),o("end"),a()),o(`url = URI("${r}")`),a(),o("http = Net::HTTP.new(url.host, url.port)"),t.protocol==="https:"&&o("http.use_ssl = true"),a(),o(`request = Net::HTTP::${f}.new(url)`);const u=Object.keys(s);return u.length&&u.forEach(d=>{o(`request["${d}"] = '${Re(s[d])}'`)}),n.text&&o(`request.body = ${JSON.stringify(n.text)}`),a(),o("response = http.request(request)"),o("puts response.read_body"),i()}},faraday:{info:{key:"faraday",title:"faraday",link:"https://github.com/lostisland/faraday",description:"Faraday HTTP client",extname:".rb"},convert:({uriObj:t,queryObj:e,method:r,postData:n,allHeaders:s})=>{const{push:o,blank:a,join:i}=new j,c=r.toUpperCase();if(!["GET","POST","HEAD","DELETE","PATCH","PUT","OPTIONS","COPY","LOCK","UNLOCK","MOVE","TRACE"].includes(c))return o(`# Faraday cannot currently run ${c} requests. Please use another client.`),i();o("require 'faraday'"),a(),n.mimeType==="application/x-www-form-urlencoded"&&n.params&&(o("data = {"),n.params.forEach(f=>{o(` :${f.name} => ${JSON.stringify(f.value)},`)}),o("}"),a()),o("conn = Faraday.new("),o(` url: '${t.protocol}//${t.host}',`),(s["content-type"]||s["Content-Type"])&&o(` headers: {'Content-Type' => '${s["content-type"]||s["Content-Type"]}'}`),o(")"),a(),o(`response = conn.${c.toLowerCase()}('${t.pathname}') do |req|`);const l=Object.keys(s);switch(l.length&&l.forEach(f=>{f.toLowerCase()!=="content-type"&&o(` req.headers['${f}'] = '${Re(s[f])}'`)}),Object.keys(e).forEach(f=>{const u=e[f];Array.isArray(u)?o(` req.params['${f}'] = ${JSON.stringify(u)}`):o(` req.params['${f}'] = '${u}'`)}),n.mimeType){case"application/x-www-form-urlencoded":n.params&&o(" req.body = URI.encode_www_form(data)");break;case"application/json":n.jsonObj&&o(` req.body = ${JSON.stringify(n.text)}`);break;default:n.text&&o(` req.body = ${JSON.stringify(n.text)}`)}return o("end"),a(),o("puts response.status"),o("puts response.body"),i()}}}};function fr(t,e,r,n,s){const o=n.repeat(s),a=n.repeat(s-1),i=r?`,
31
31
  ${o}`:", ",c=t==="object"?"json!({":"(",l=t==="object"?"})":")";return r?`${c}
32
32
  ${o}${e.join(i)}
33
- ${a}${l}`:`${c}${e.join(i)}${l}`}const Ee=(t,e,r)=>{switch(r=r===void 0?1:r+1,Object.prototype.toString.call(t)){case"[object Number]":return t;case"[object Array]":{if(t.length===0)return"json!([])";let n=!1;return dr("array",t.map(s=>(Object.prototype.toString.call(s)==="[object Object]"&&(n=Object.keys(s).length>1),Ee(s,e,r))),n,e.indent,r)}case"[object Object]":{const n=[];for(const s in t)n.push(`"${s}": ${Ee(t[s],e,r)}`);return dr("object",n,e.pretty&&n.length>1,e.indent,r)}case"[object Null]":return"json!(null)";case"[object Boolean]":return t?"true":"false";default:return t==null?"":`"${t.toString().replace(/"/g,'\\"')}"`}},lo={info:{key:"reqwest",title:"reqwest",link:"https://docs.rs/reqwest/latest/reqwest/",description:"reqwest HTTP library",extname:".rs"},convert:({queryObj:t,url:e,postData:r,allHeaders:n,method:s},o)=>{const a={indent:" ",pretty:!0,...o};let i=0;const{push:c,blank:l,join:f,pushToLast:u,unshift:p}=new j({indent:a.indent});c("use reqwest;",i),l(),c("#[tokio::main]",i),c("pub async fn main() {",i),i+=1,c(`let url = "${e}";`,i),l();let d=!1;if(Object.keys(t).length){d=!0,c("let querystring = [",i),i+=1;for(const[$,T]of Object.entries(t))if(Array.isArray(T))for(const P of T)c(`("${$}", "${decodeURIComponent(P)}"),`,i);else c(`("${$}", "${decodeURIComponent(String(T))}"),`,i);i-=1,c("];",i),l()}let h={};const y={};let g=!1,v=!1,m=!1,b=!1,S=!1;switch(r.mimeType){case"application/json":r.jsonObj&&c(`let payload = ${Ee(r.jsonObj,a,i)};`,i),b=!0;break;case"multipart/form-data":if(S=!0,!r.params){c("let form = reqwest::multipart::Form::new()",i),c('.text("", "");',i+1);break}if(h={},r.params.forEach($=>{$.fileName?(y[$.name]=$.fileName,g=!0):h[$.name]=$.value}),g){for(const $ of fo)c($,i);l()}c("let form = reqwest::multipart::Form::new()",i);for(const[$,T]of Object.entries(y))c(`.part("${$}", file_to_part("${T}").await)`,i+1);for(const[$,T]of Object.entries(h))c(`.text("${$}", "${T}")`,i+1);u(";");break;default:if(r.mimeType==="application/x-www-form-urlencoded"&&r.paramsObj){c(`let payload = ${Ee(r.paramsObj,a,i)};`,i),v=!0;break}if(r.text){c(`let payload = ${Ee(r.text,a,i)};`,i),m=!0;break}}(v||b)&&p("use serde_json::json;"),(v||b||m||S)&&l();const O=Object.entries(n).filter(([$])=>!($.toLowerCase()==="content-type"&&S));switch(c("let client = reqwest::Client::new();",i),s){case"POST":c("let response = client.post(url)",i);break;case"GET":c("let response = client.get(url)",i);break;default:c(`let response = client.request(reqwest::Method::from_str("${s}").unwrap(), url)`,i),p("use std::str::FromStr;");break}d&&c(".query(&querystring)",i+1),S&&c(".multipart(form)",i+1);for(const[$,T]of O)c(`.header("${$}", ${Ee(T,a)})`,i+1);return b&&c(".json(&payload)",i+1),v&&c(".form(&payload)",i+1),m&&c(".body(payload)",i+1),c(".send()",i+1),c(".await;",i+1),l(),c("let results = response.unwrap()",i),c(".json::<serde_json::Value>()",i+1),c(".await",i+1),c(".unwrap();",i+1),l(),c('println!("{}", results);',i),c(`}
34
- `),f()}},fo=["async fn file_to_part(file_name: &'static str) -> reqwest::multipart::Part {"," let bytes = tokio::fs::read(file_name).await.unwrap();"," reqwest::multipart::Part::bytes(bytes)"," .file_name(file_name)",' .mime_str("text/plain").unwrap()',"}"],uo={info:{key:"rust",title:"Rust",default:"reqwest",cli:"rust"},clientsById:{reqwest:lo}},H=(t="")=>/^[a-z0-9-_/.@%^=:]+$/i.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`,po=t=>t.replace(/\r/g,"\\r").replace(/\n/g,"\\n"),ho={"http1.0":"0","url ":"",cookie:"b",data:"d",form:"F",globoff:"g",header:"H",insecure:"k",request:"X"},yo=t=>e=>{if(t){const r=ho[e];return r?`-${r}`:""}return`--${e}`},mo={info:{key:"shell",title:"Shell",default:"curl",cli:"%s"},clientsById:{curl:{info:{key:"curl",title:"cURL",link:"http://curl.haxx.se/",description:"cURL is a command line tool and library for transferring data with URL syntax",extname:".sh"},convert:({fullUrl:t,method:e,httpVersion:r,headersObj:n,allHeaders:s,postData:o},a={})=>{var v;const{binary:i=!1,globOff:c=!1,indent:l=" ",insecureSkipVerify:f=!1,short:u=!1}=a,p=" ",{push:d,join:h}=new j({...typeof l=="string"?{indent:l}:{},join:l!==!1?` \\
35
- ${l}`:" "}),y=yo(u);let g=H(t);if(d(`curl ${y("request")} ${e}`),c&&(g=unescape(g),d(y("globoff"))),d(`${y("url ")}${g}`),f&&d(y("insecure")),r==="HTTP/1.0"&&d(y("http1.0")),le(s,"accept-encoding")&&d("--compressed"),o.mimeType==="multipart/form-data"){const m=G(n,"content-type");if(m){const b=n[m];if(m&&b){const S=String(b).replace(/; boundary.+?(?=(;|$))/,"");n[m]=S,s[m]=S}}}switch(Object.keys(n).sort().forEach(m=>{const b=`${m}: ${n[m]}`;d(`${y("header")} ${H(b)}`)}),s.cookie&&d(`${y("cookie")} ${H(s.cookie)}`),o.mimeType){case"multipart/form-data":(v=o.params)==null||v.forEach(m=>{let b="";m.fileName?b=`${m.name}='@${m.fileName}'`:b=H(`${m.name}=${m.value}`),d(`${y("form")} ${b}`)});break;case"application/x-www-form-urlencoded":o.params?o.params.forEach(m=>{const b=encodeURIComponent(m.name),S=b!==m.name?b:m.name;d(`${i?"--data-binary":"--data-urlencode"} ${H(`${S}=${m.value}`)}`)}):d(`${i?"--data-binary":y("data")} ${H(o.text)}`);break;default:{if(!o.text)break;let m=!1;if(In(o.mimeType)&&o.text.length>20)try{const b=JSON.parse(o.text);m=!0,o.text.indexOf("'")>0?d(`${i?"--data-binary":y("data")} @- <<EOF
36
- ${JSON.stringify(b,null,p)}
37
- EOF`):d(`${i?"--data-binary":y("data")} '
38
- ${JSON.stringify(b,null,p)}
39
- '`)}catch{}m||d(`${i?"--data-binary":y("data")} ${H(o.text)}`)}}return h()}},httpie:{info:{key:"httpie",title:"HTTPie",link:"http://httpie.org/",description:"a CLI, cURL-like tool for humans",extname:".sh",installation:()=>"brew install httpie"},convert:({allHeaders:t,postData:e,queryObj:r,fullUrl:n,method:s,url:o},a)=>{var h;const i={body:!1,cert:!1,headers:!1,indent:" ",pretty:!1,print:!1,queryParams:!1,short:!1,style:!1,timeout:!1,verbose:!1,verify:!1,...a},{push:c,join:l,unshift:f}=new j({indent:i.indent,join:i.indent!==!1?` \\
40
- ${i.indent}`:" "});let u=!1;const p=[];i.headers&&p.push(i.short?"-h":"--headers"),i.body&&p.push(i.short?"-b":"--body"),i.verbose&&p.push(i.short?"-v":"--verbose"),i.print&&p.push(`${i.short?"-p":"--print"}=${i.print}`),i.verify&&p.push(`--verify=${i.verify}`),i.cert&&p.push(`--cert=${i.cert}`),i.pretty&&p.push(`--pretty=${i.pretty}`),i.style&&p.push(`--style=${i.style}`),i.timeout&&p.push(`--timeout=${i.timeout}`),i.queryParams&&Object.keys(r).forEach(y=>{const g=r[y];Array.isArray(g)?g.forEach(v=>{c(`${y}==${H(v)}`)}):c(`${y}==${H(g)}`)}),Object.keys(t).sort().forEach(y=>{c(`${y}:${H(t[y])}`)}),e.mimeType==="application/x-www-form-urlencoded"?(h=e.params)!=null&&h.length&&(p.push(i.short?"-f":"--form"),e.params.forEach(y=>{c(`${y.name}=${H(y.value)}`)})):u=!0;const d=p.length?`${p.join(" ")} `:"";return o=H(i.queryParams?o:n),f(`http ${d}${s} ${o}`),u&&e.text&&f(`echo ${H(e.text)} | `),l()}},wget:{info:{key:"wget",title:"Wget",link:"https://www.gnu.org/software/wget/",description:"a free software package for retrieving files using HTTP, HTTPS",extname:".sh"},convert:({method:t,postData:e,allHeaders:r,fullUrl:n},s)=>{const o={indent:" ",short:!1,verbose:!1,...s},{push:a,join:i}=new j({...typeof o.indent=="string"?{indent:o.indent}:{},join:o.indent!==!1?` \\
41
- ${o.indent}`:" "});return o.verbose?a(`wget ${o.short?"-v":"--verbose"}`):a(`wget ${o.short?"-q":"--quiet"}`),a(`--method ${H(t)}`),Object.keys(r).forEach(c=>{const l=`${c}: ${r[c]}`;a(`--header ${H(l)}`)}),e.text&&a(`--body-data ${po(H(e.text))}`),a(o.short?"-O":"--output-document"),a(`- ${H(n)}`),i()}}}},hr=(t,e)=>e.repeat(t),yr=(t,e,r,n)=>{const s=hr(n,r),o=hr(n-1,r),a=e?`,
33
+ ${a}${l}`:`${c}${e.join(i)}${l}`}const Ee=(t,e,r)=>{switch(r=r===void 0?1:r+1,Object.prototype.toString.call(t)){case"[object Number]":return t;case"[object Array]":{if(t.length===0)return"json!([])";let n=!1;return fr("array",t.map(s=>(Object.prototype.toString.call(s)==="[object Object]"&&(n=Object.keys(s).length>1),Ee(s,e,r))),n,e.indent,r)}case"[object Object]":{const n=[];for(const s in t)n.push(`"${s}": ${Ee(t[s],e,r)}`);return fr("object",n,e.pretty&&n.length>1,e.indent,r)}case"[object Null]":return"json!(null)";case"[object Boolean]":return t?"true":"false";default:return t==null?"":`"${t.toString().replace(/"/g,'\\"')}"`}},oo={info:{key:"reqwest",title:"reqwest",link:"https://docs.rs/reqwest/latest/reqwest/",description:"reqwest HTTP library",extname:".rs"},convert:({queryObj:t,url:e,postData:r,allHeaders:n,method:s},o)=>{const a={indent:" ",pretty:!0,...o};let i=0;const{push:c,blank:l,join:f,pushToLast:u,unshift:d}=new j({indent:a.indent});c("use reqwest;",i),l(),c("#[tokio::main]",i),c("pub async fn main() {",i),i+=1,c(`let url = "${e}";`,i),l();let p=!1;if(Object.keys(t).length){p=!0,c("let querystring = [",i),i+=1;for(const[v,T]of Object.entries(t))if(Array.isArray(T))for(const P of T)c(`("${v}", "${decodeURIComponent(P)}"),`,i);else c(`("${v}", "${decodeURIComponent(String(T))}"),`,i);i-=1,c("];",i),l()}let h={};const y={};let g=!1,$=!1,m=!1,b=!1,S=!1;switch(r.mimeType){case"application/json":r.jsonObj&&c(`let payload = ${Ee(r.jsonObj,a,i)};`,i),b=!0;break;case"multipart/form-data":if(S=!0,!r.params){c("let form = reqwest::multipart::Form::new()",i),c('.text("", "");',i+1);break}if(h={},r.params.forEach(v=>{v.fileName?(y[v.name]=v.fileName,g=!0):h[v.name]=v.value}),g){for(const v of io)c(v,i);l()}c("let form = reqwest::multipart::Form::new()",i);for(const[v,T]of Object.entries(y))c(`.part("${v}", file_to_part("${T}").await)`,i+1);for(const[v,T]of Object.entries(h))c(`.text("${v}", "${T}")`,i+1);u(";");break;default:if(r.mimeType==="application/x-www-form-urlencoded"&&r.paramsObj){c(`let payload = ${Ee(r.paramsObj,a,i)};`,i),$=!0;break}if(r.text){c(`let payload = ${Ee(r.text,a,i)};`,i),m=!0;break}}($||b)&&d("use serde_json::json;"),($||b||m||S)&&l();const O=Object.entries(n).filter(([v])=>!(v.toLowerCase()==="content-type"&&S));switch(c("let client = reqwest::Client::new();",i),s){case"POST":c("let response = client.post(url)",i);break;case"GET":c("let response = client.get(url)",i);break;default:c(`let response = client.request(reqwest::Method::from_str("${s}").unwrap(), url)`,i),d("use std::str::FromStr;");break}p&&c(".query(&querystring)",i+1),S&&c(".multipart(form)",i+1);for(const[v,T]of O)c(`.header("${v}", ${Ee(T,a)})`,i+1);return b&&c(".json(&payload)",i+1),$&&c(".form(&payload)",i+1),m&&c(".body(payload)",i+1),c(".send()",i+1),c(".await;",i+1),l(),c("let results = response.unwrap()",i),c(".json::<serde_json::Value>()",i+1),c(".await",i+1),c(".unwrap();",i+1),l(),c('println!("{}", results);',i),c(`}
34
+ `),f()}},io=["async fn file_to_part(file_name: &'static str) -> reqwest::multipart::Part {"," let bytes = tokio::fs::read(file_name).await.unwrap();"," reqwest::multipart::Part::bytes(bytes)"," .file_name(file_name)",' .mime_str("text/plain").unwrap()',"}"],ao={info:{key:"rust",title:"Rust",default:"reqwest",cli:"rust"},clientsById:{reqwest:oo}},H=(t="")=>/^[a-z0-9-_/.@%^=:]+$/i.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`,so=t=>t.replace(/\r/g,"\\r").replace(/\n/g,"\\n"),co={"http1.0":"0","url ":"",cookie:"b",data:"d",form:"F",globoff:"g",header:"H",insecure:"k",request:"X"},lo=t=>e=>{if(t){const r=co[e];return r?`-${r}`:""}return`--${e}`},fo={info:{key:"shell",title:"Shell",default:"curl",cli:"%s"},clientsById:{curl:{info:{key:"curl",title:"cURL",link:"http://curl.haxx.se/",description:"cURL is a command line tool and library for transferring data with URL syntax",extname:".sh"},convert:({fullUrl:t,method:e,httpVersion:r,headersObj:n,allHeaders:s,postData:o},a={})=>{var $;const{binary:i=!1,globOff:c=!1,indent:l=" ",insecureSkipVerify:f=!1,short:u=!1}=a,d=" ",{push:p,join:h}=new j({...typeof l=="string"?{indent:l}:{},join:l!==!1?` \\
35
+ ${l}`:" "}),y=lo(u);let g=H(t);if(p(`curl ${y("request")} ${e}`),c&&(g=unescape(g),p(y("globoff"))),p(`${y("url ")}${g}`),f&&p(y("insecure")),r==="HTTP/1.0"&&p(y("http1.0")),le(s,"accept-encoding")&&p("--compressed"),o.mimeType==="multipart/form-data"){const m=G(n,"content-type");if(m){const b=n[m];if(m&&b){const S=String(b).replace(/; boundary.+?(?=(;|$))/,"");n[m]=S,s[m]=S}}}switch(Object.keys(n).sort().forEach(m=>{const b=`${m}: ${n[m]}`;p(`${y("header")} ${H(b)}`)}),s.cookie&&p(`${y("cookie")} ${H(s.cookie)}`),o.mimeType){case"multipart/form-data":($=o.params)==null||$.forEach(m=>{let b="";m.fileName?b=`${m.name}='@${m.fileName}'`:b=H(`${m.name}=${m.value}`),p(`${y("form")} ${b}`)});break;case"application/x-www-form-urlencoded":o.params?o.params.forEach(m=>{const b=encodeURIComponent(m.name),S=b!==m.name?b:m.name;p(`${i?"--data-binary":"--data-urlencode"} ${H(`${S}=${m.value}`)}`)}):p(`${i?"--data-binary":y("data")} ${H(o.text)}`);break;default:{if(!o.text)break;let m=!1;if(Rn(o.mimeType)&&o.text.length>20)try{const b=JSON.parse(o.text);m=!0,o.text.indexOf("'")>0?p(`${i?"--data-binary":y("data")} @- <<EOF
36
+ ${JSON.stringify(b,null,d)}
37
+ EOF`):p(`${i?"--data-binary":y("data")} '
38
+ ${JSON.stringify(b,null,d)}
39
+ '`)}catch{}m||p(`${i?"--data-binary":y("data")} ${H(o.text)}`)}}return h()}},httpie:{info:{key:"httpie",title:"HTTPie",link:"http://httpie.org/",description:"a CLI, cURL-like tool for humans",extname:".sh",installation:()=>"brew install httpie"},convert:({allHeaders:t,postData:e,queryObj:r,fullUrl:n,method:s,url:o},a)=>{var h;const i={body:!1,cert:!1,headers:!1,indent:" ",pretty:!1,print:!1,queryParams:!1,short:!1,style:!1,timeout:!1,verbose:!1,verify:!1,...a},{push:c,join:l,unshift:f}=new j({indent:i.indent,join:i.indent!==!1?` \\
40
+ ${i.indent}`:" "});let u=!1;const d=[];i.headers&&d.push(i.short?"-h":"--headers"),i.body&&d.push(i.short?"-b":"--body"),i.verbose&&d.push(i.short?"-v":"--verbose"),i.print&&d.push(`${i.short?"-p":"--print"}=${i.print}`),i.verify&&d.push(`--verify=${i.verify}`),i.cert&&d.push(`--cert=${i.cert}`),i.pretty&&d.push(`--pretty=${i.pretty}`),i.style&&d.push(`--style=${i.style}`),i.timeout&&d.push(`--timeout=${i.timeout}`),i.queryParams&&Object.keys(r).forEach(y=>{const g=r[y];Array.isArray(g)?g.forEach($=>{c(`${y}==${H($)}`)}):c(`${y}==${H(g)}`)}),Object.keys(t).sort().forEach(y=>{c(`${y}:${H(t[y])}`)}),e.mimeType==="application/x-www-form-urlencoded"?(h=e.params)!=null&&h.length&&(d.push(i.short?"-f":"--form"),e.params.forEach(y=>{c(`${y.name}=${H(y.value)}`)})):u=!0;const p=d.length?`${d.join(" ")} `:"";return o=H(i.queryParams?o:n),f(`http ${p}${s} ${o}`),u&&e.text&&f(`echo ${H(e.text)} | `),l()}},wget:{info:{key:"wget",title:"Wget",link:"https://www.gnu.org/software/wget/",description:"a free software package for retrieving files using HTTP, HTTPS",extname:".sh"},convert:({method:t,postData:e,allHeaders:r,fullUrl:n},s)=>{const o={indent:" ",short:!1,verbose:!1,...s},{push:a,join:i}=new j({...typeof o.indent=="string"?{indent:o.indent}:{},join:o.indent!==!1?` \\
41
+ ${o.indent}`:" "});return o.verbose?a(`wget ${o.short?"-v":"--verbose"}`):a(`wget ${o.short?"-q":"--quiet"}`),a(`--method ${H(t)}`),Object.keys(r).forEach(c=>{const l=`${c}: ${r[c]}`;a(`--header ${H(l)}`)}),e.text&&a(`--body-data ${so(H(e.text))}`),a(o.short?"-O":"--output-document"),a(`- ${H(n)}`),i()}}}},ur=(t,e)=>e.repeat(t),pr=(t,e,r,n)=>{const s=ur(n,r),o=ur(n-1,r),a=e?`,
42
42
  ${s}`:", ";return e?`[
43
43
  ${s}${t.join(a)}
44
- ${o}]`:`[${t.join(a)}]`},mr=(t,e,r)=>`let ${t} = ${ot(e,r)}`,ot=(t,e,r)=>{switch(r=r===void 0?1:r+1,Object.prototype.toString.call(t)){case"[object Number]":return t;case"[object Array]":{let n=!1;const s=t.map(o=>(Object.prototype.toString.call(o)==="[object Object]"&&(n=Object.keys(o).length>1),ot(o,e,r)));return yr(s,n,e.indent,r)}case"[object Object]":{const n=[];for(const s in t)n.push(`"${s}": ${ot(t[s],e,r)}`);return yr(n,e.pretty&&n.length>1,e.indent,r)}case"[object Boolean]":return t.toString();default:return t==null?"nil":`"${t.toString().replace(/"/g,'\\"')}"`}},Pe={agent:Un,c:Fn,clojure:Hn,crystal:Bn,csharp:zn,go:Vn,http:Kn,java:Dn,javascript:Qn,json:Yn,kotlin:Xn,node:Zn,objc:eo,ocaml:to,php:ro,powershell:oo,python:ao,r:so,ruby:co,rust:uo,shell:mo,swift:{info:{key:"swift",title:"Swift",default:"urlsession"},clientsById:{urlsession:{info:{key:"urlsession",title:"URLSession",link:"https://developer.apple.com/documentation/foundation/urlsession",description:"Foundation's URLSession request",extname:".swift"},convert:({allHeaders:t,postData:e,uriObj:r,queryObj:n,method:s},o)=>{var p;const a={indent:" ",pretty:!0,timeout:10,...o},{push:i,blank:c,join:l}=new j({indent:a.indent});i("import Foundation"),c();const f=e.text||e.jsonObj||e.params;if(f)switch(e.mimeType){case"application/x-www-form-urlencoded":if((p=e.params)!=null&&p.length){const d=e.params.map(h=>`"${h.name}": "${h.value}"`);a.pretty?(i("let parameters = ["),d.forEach(h=>{i(`${h},`,1)}),i("]")):i(`let parameters = [${d.join(", ")}]`),i('let joinedParameters = parameters.map { "\\($0.key)=\\($0.value)" }.joined(separator: "&")'),i("let postData = Data(joinedParameters.utf8)"),c()}break;case"application/json":e.jsonObj&&(i(`${mr("parameters",e.jsonObj,a)} as [String : Any?]`),c(),i("let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])"),c());break;case"multipart/form-data":i(mr("parameters",e.params,a)),c(),i(`let boundary = "${e.boundary}"`),c(),i('var body = ""'),i("for param in parameters {"),i('let paramName = param["name"]!',1),i('body += "--\\(boundary)\\r\\n"',1),i('body += "Content-Disposition:form-data; name=\\"\\(paramName)\\""',1),i('if let filename = param["fileName"] {',1),i('let contentType = param["contentType"]!',2),i("let fileContent = try String(contentsOfFile: filename, encoding: .utf8)",2),i('body += "; filename=\\"\\(filename)\\"\\r\\n"',2),i('body += "Content-Type: \\(contentType)\\r\\n\\r\\n"',2),i("body += fileContent",2),i('} else if let paramValue = param["value"] {',1),i('body += "\\r\\n\\r\\n\\(paramValue)"',2),i("}",1),i("}"),c(),i("let postData = Data(body.utf8)"),c();break;default:i(`let postData = Data("${e.text}".utf8)`),c()}i(`let url = URL(string: "${r.href}")!`);const u=n?Object.entries(n):[];return u.length<1?i("var request = URLRequest(url: url)"):(i("var components = URLComponents(url: url, resolvingAgainstBaseURL: true)!"),i("let queryItems: [URLQueryItem] = ["),u.forEach(d=>{const h=d[0],y=d[1];switch(Object.prototype.toString.call(y)){case"[object String]":i(`URLQueryItem(name: "${h}", value: "${y}"),`,1);break;case"[object Array]":y.forEach(g=>{i(`URLQueryItem(name: "${h}", value: "${g}"),`,1)});break}}),i("]"),i("components.queryItems = components.queryItems.map { $0 + queryItems } ?? queryItems"),c(),i("var request = URLRequest(url: components.url!)")),i(`request.httpMethod = "${s}"`),i(`request.timeoutInterval = ${a.timeout}`),Object.keys(t).length&&i(`request.allHTTPHeaderFields = ${ot(t,a)}`),f&&i("request.httpBody = postData"),c(),i("let (data, _) = try await URLSession.shared.data(for: request)"),i("print(String(decoding: data, as: UTF8.self))"),l()}}}}},gr=(t,e)=>{const r=t[e.name];return r===void 0?(t[e.name]=e.value,t):Array.isArray(r)?(r.push(e.value),t):(t[e.name]=[r,e.value],t)};var it={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */var go=it.exports;(function(t,e){(function(r){var n=e&&!e.nodeType&&e,s=t&&!t.nodeType&&t,o=typeof ce.commonjsGlobal=="object"&&ce.commonjsGlobal;(o.global===o||o.window===o||o.self===o)&&(r=o);var a,i=2147483647,c=36,l=1,f=26,u=38,p=700,d=72,h=128,y="-",g=/^xn--/,v=/[^\x20-\x7E]/,m=/[\x2E\u3002\uFF0E\uFF61]/g,b={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},S=c-l,O=Math.floor,$=String.fromCharCode,T;function P(w){throw new RangeError(b[w])}function A(w,x){for(var C=w.length,R=[];C--;)R[C]=x(w[C]);return R}function U(w,x){var C=w.split("@"),R="";C.length>1&&(R=C[0]+"@",w=C[1]),w=w.replace(m,".");var N=w.split("."),z=A(N,x).join(".");return R+z}function Q(w){for(var x=[],C=0,R=w.length,N,z;C<R;)N=w.charCodeAt(C++),N>=55296&&N<=56319&&C<R?(z=w.charCodeAt(C++),(z&64512)==56320?x.push(((N&1023)<<10)+(z&1023)+65536):(x.push(N),C--)):x.push(N);return x}function Y(w){return A(w,function(x){var C="";return x>65535&&(x-=65536,C+=$(x>>>10&1023|55296),x=56320|x&1023),C+=$(x),C}).join("")}function _(w){return w-48<10?w-22:w-65<26?w-65:w-97<26?w-97:c}function J(w,x){return w+22+75*(w<26)-((x!=0)<<5)}function B(w,x,C){var R=0;for(w=C?O(w/p):w>>1,w+=O(w/x);w>S*f>>1;R+=c)w=O(w/S);return O(R+(S+1)*w/(w+u))}function V(w){var x=[],C=w.length,R,N=0,z=h,M=d,K,X,te,fe,W,D,Z,de,me;for(K=w.lastIndexOf(y),K<0&&(K=0),X=0;X<K;++X)w.charCodeAt(X)>=128&&P("not-basic"),x.push(w.charCodeAt(X));for(te=K>0?K+1:0;te<C;){for(fe=N,W=1,D=c;te>=C&&P("invalid-input"),Z=_(w.charCodeAt(te++)),(Z>=c||Z>O((i-N)/W))&&P("overflow"),N+=Z*W,de=D<=M?l:D>=M+f?f:D-M,!(Z<de);D+=c)me=c-de,W>O(i/me)&&P("overflow"),W*=me;R=x.length+1,M=B(N-fe,R,fe==0),O(N/R)>i-z&&P("overflow"),z+=O(N/R),N%=R,x.splice(N++,0,z)}return Y(x)}function pe(w){var x,C,R,N,z,M,K,X,te,fe,W,D=[],Z,de,me,mt;for(w=Q(w),Z=w.length,x=h,C=0,z=d,M=0;M<Z;++M)W=w[M],W<128&&D.push($(W));for(R=N=D.length,N&&D.push(y);R<Z;){for(K=i,M=0;M<Z;++M)W=w[M],W>=x&&W<K&&(K=W);for(de=R+1,K-x>O((i-C)/de)&&P("overflow"),C+=(K-x)*de,x=K,M=0;M<Z;++M)if(W=w[M],W<x&&++C>i&&P("overflow"),W==x){for(X=C,te=c;fe=te<=z?l:te>=z+f?f:te-z,!(X<fe);te+=c)mt=X-fe,me=c-fe,D.push($(J(fe+mt%me,0))),X=O(mt/me);D.push($(J(X,0))),z=B(C,de,R==N),C=0,++R}++C,++x}return D.join("")}function yt(w){return U(w,function(x){return g.test(x)?V(x.slice(4).toLowerCase()):x})}function Ve(w){return U(w,function(x){return v.test(x)?"xn--"+pe(x):x})}if(a={version:"1.4.1",ucs2:{decode:Q,encode:Y},decode:V,encode:pe,toASCII:Ve,toUnicode:yt},n&&s)if(t.exports==n)s.exports=a;else for(T in a)a.hasOwnProperty(T)&&(n[T]=a[T]);else r.punycode=a})(go)})(it,it.exports);var bo=it.exports,_e=TypeError;const en=t=>String(t);Object.assign(en,{custom:Symbol.for("nodejs.util.inspect.custom")});const vo=Object.freeze(Object.defineProperty({__proto__:null,default:en},Symbol.toStringTag,{value:"Module"})),$o=ce.getAugmentedNamespace(vo);var Zt=typeof Map=="function"&&Map.prototype,bt=Object.getOwnPropertyDescriptor&&Zt?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,at=Zt&&bt&&typeof bt.get=="function"?bt.get:null,br=Zt&&Map.prototype.forEach,er=typeof Set=="function"&&Set.prototype,vt=Object.getOwnPropertyDescriptor&&er?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,st=er&&vt&&typeof vt.get=="function"?vt.get:null,vr=er&&Set.prototype.forEach,wo=typeof WeakMap=="function"&&WeakMap.prototype,Ue=wo?WeakMap.prototype.has:null,So=typeof WeakSet=="function"&&WeakSet.prototype,Fe=So?WeakSet.prototype.has:null,Oo=typeof WeakRef=="function"&&WeakRef.prototype,$r=Oo?WeakRef.prototype.deref:null,To=Boolean.prototype.valueOf,xo=Object.prototype.toString,jo=Function.prototype.toString,Eo=String.prototype.match,tr=String.prototype.slice,he=String.prototype.replace,Po=String.prototype.toUpperCase,wr=String.prototype.toLowerCase,tn=RegExp.prototype.test,Sr=Array.prototype.concat,ae=Array.prototype.join,Co=Array.prototype.slice,Or=Math.floor,Ht=typeof BigInt=="function"?BigInt.prototype.valueOf:null,$t=Object.getOwnPropertySymbols,Bt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,qe=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Me=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===qe||!0)?Symbol.toStringTag:null,rn=Object.prototype.propertyIsEnumerable,Tr=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function xr(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||tn.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-Or(-t):Or(t);if(n!==t){var s=String(n),o=tr.call(e,s.length+1);return he.call(s,r,"$&_")+"."+he.call(he.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return he.call(e,r,"$&_")}var Wt=$o,jr=Wt.custom,Er=an(jr)?jr:null,nn={__proto__:null,double:'"',single:"'"},ko={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},ft=function t(e,r,n,s){var o=r||{};if(ue(o,"quoteStyle")&&!ue(nn,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ue(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=ue(o,"customInspect")?o.customInspect:!0;if(typeof a!="boolean"&&a!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ue(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ue(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var i=o.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return cn(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var c=String(e);return i?xr(e,c):c}if(typeof e=="bigint"){var l=String(e)+"n";return i?xr(e,l):l}var f=typeof o.depth>"u"?5:o.depth;if(typeof n>"u"&&(n=0),n>=f&&f>0&&typeof e=="object")return Gt(e)?"[Array]":"[Object]";var u=Ko(o,n);if(typeof s>"u")s=[];else if(sn(s,e)>=0)return"[Circular]";function p(_,J,B){if(J&&(s=Co.call(s),s.push(J)),B){var V={depth:o.depth};return ue(o,"quoteStyle")&&(V.quoteStyle=o.quoteStyle),t(_,V,n+1,s)}return t(_,o,n+1,s)}if(typeof e=="function"&&!Pr(e)){var d=Fo(e),h=Ke(e,p);return"[Function"+(d?": "+d:" (anonymous)")+"]"+(h.length>0?" { "+ae.call(h,", ")+" }":"")}if(an(e)){var y=qe?he.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Bt.call(e);return typeof e=="object"&&!qe?Le(y):y}if(Jo(e)){for(var g="<"+wr.call(String(e.nodeName)),v=e.attributes||[],m=0;m<v.length;m++)g+=" "+v[m].name+"="+on(Ao(v[m].value),"double",o);return g+=">",e.childNodes&&e.childNodes.length&&(g+="..."),g+="</"+wr.call(String(e.nodeName))+">",g}if(Gt(e)){if(e.length===0)return"[]";var b=Ke(e,p);return u&&!Vo(b)?"["+Jt(b,u)+"]":"[ "+ae.call(b,", ")+" ]"}if(qo(e)){var S=Ke(e,p);return!("cause"in Error.prototype)&&"cause"in e&&!rn.call(e,"cause")?"{ ["+String(e)+"] "+ae.call(Sr.call("[cause]: "+p(e.cause),S),", ")+" }":S.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+ae.call(S,", ")+" }"}if(typeof e=="object"&&a){if(Er&&typeof e[Er]=="function"&&Wt)return Wt(e,{depth:f-n});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Mo(e)){var O=[];return br&&br.call(e,function(_,J){O.push(p(J,e,!0)+" => "+p(_,e))}),Cr("Map",at.call(e),O,u)}if(Wo(e)){var $=[];return vr&&vr.call(e,function(_){$.push(p(_,e))}),Cr("Set",st.call(e),$,u)}if(Ho(e))return wt("WeakMap");if(Go(e))return wt("WeakSet");if(Bo(e))return wt("WeakRef");if(_o(e))return Le(p(Number(e)));if(Io(e))return Le(p(Ht.call(e)));if(Lo(e))return Le(To.call(e));if(No(e))return Le(p(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof ce.commonjsGlobal<"u"&&e===ce.commonjsGlobal)return"{ [object globalThis] }";if(!Ro(e)&&!Pr(e)){var T=Ke(e,p),P=Tr?Tr(e)===Object.prototype:e instanceof Object||e.constructor===Object,A=e instanceof Object?"":"null prototype",U=!P&&Me&&Object(e)===e&&Me in e?tr.call(ye(e),8,-1):A?"Object":"",Q=P||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",Y=Q+(U||A?"["+ae.call(Sr.call([],U||[],A||[]),": ")+"] ":"");return T.length===0?Y+"{}":u?Y+"{"+Jt(T,u)+"}":Y+"{ "+ae.call(T,", ")+" }"}return String(e)};function on(t,e,r){var n=r.quoteStyle||e,s=nn[n];return s+t+s}function Ao(t){return he.call(String(t),/"/g,"&quot;")}function Se(t){return!Me||!(typeof t=="object"&&(Me in t||typeof t[Me]<"u"))}function Gt(t){return ye(t)==="[object Array]"&&Se(t)}function Ro(t){return ye(t)==="[object Date]"&&Se(t)}function Pr(t){return ye(t)==="[object RegExp]"&&Se(t)}function qo(t){return ye(t)==="[object Error]"&&Se(t)}function No(t){return ye(t)==="[object String]"&&Se(t)}function _o(t){return ye(t)==="[object Number]"&&Se(t)}function Lo(t){return ye(t)==="[object Boolean]"&&Se(t)}function an(t){if(qe)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!Bt)return!1;try{return Bt.call(t),!0}catch{}return!1}function Io(t){if(!t||typeof t!="object"||!Ht)return!1;try{return Ht.call(t),!0}catch{}return!1}var Uo=Object.prototype.hasOwnProperty||function(t){return t in this};function ue(t,e){return Uo.call(t,e)}function ye(t){return xo.call(t)}function Fo(t){if(t.name)return t.name;var e=Eo.call(jo.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function sn(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}function Mo(t){if(!at||!t||typeof t!="object")return!1;try{at.call(t);try{st.call(t)}catch{return!0}return t instanceof Map}catch{}return!1}function Ho(t){if(!Ue||!t||typeof t!="object")return!1;try{Ue.call(t,Ue);try{Fe.call(t,Fe)}catch{return!0}return t instanceof WeakMap}catch{}return!1}function Bo(t){if(!$r||!t||typeof t!="object")return!1;try{return $r.call(t),!0}catch{}return!1}function Wo(t){if(!st||!t||typeof t!="object")return!1;try{st.call(t);try{at.call(t)}catch{return!0}return t instanceof Set}catch{}return!1}function Go(t){if(!Fe||!t||typeof t!="object")return!1;try{Fe.call(t,Fe);try{Ue.call(t,Ue)}catch{return!0}return t instanceof WeakSet}catch{}return!1}function Jo(t){return!t||typeof t!="object"?!1:typeof HTMLElement<"u"&&t instanceof HTMLElement?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"}function cn(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return cn(tr.call(t,0,e.maxStringLength),e)+n}var s=ko[e.quoteStyle||"single"];s.lastIndex=0;var o=he.call(he.call(t,s,"\\$1"),/[\x00-\x1f]/g,zo);return on(o,"single",e)}function zo(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+Po.call(e.toString(16))}function Le(t){return"Object("+t+")"}function wt(t){return t+" { ? }"}function Cr(t,e,r,n){var s=n?Jt(r,n):ae.call(r,", ");return t+" ("+e+") {"+s+"}"}function Vo(t){for(var e=0;e<t.length;e++)if(sn(t[e],`
45
- `)>=0)return!1;return!0}function Ko(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=ae.call(Array(t.indent+1)," ");else return null;return{base:r,prev:ae.call(Array(e+1),r)}}function Jt(t,e){if(t.length===0)return"";var r=`
44
+ ${o}]`:`[${t.join(a)}]`},dr=(t,e,r)=>`let ${t} = ${ot(e,r)}`,ot=(t,e,r)=>{switch(r=r===void 0?1:r+1,Object.prototype.toString.call(t)){case"[object Number]":return t;case"[object Array]":{let n=!1;const s=t.map(o=>(Object.prototype.toString.call(o)==="[object Object]"&&(n=Object.keys(o).length>1),ot(o,e,r)));return pr(s,n,e.indent,r)}case"[object Object]":{const n=[];for(const s in t)n.push(`"${s}": ${ot(t[s],e,r)}`);return pr(n,e.pretty&&n.length>1,e.indent,r)}case"[object Boolean]":return t.toString();default:return t==null?"nil":`"${t.toString().replace(/"/g,'\\"')}"`}},Pe={agent:qn,c:Nn,clojure:Ln,crystal:In,csharp:Hn,go:Bn,http:Wn,java:Gn,javascript:Jn,json:zn,kotlin:Vn,node:Kn,objc:Dn,ocaml:Qn,php:Yn,powershell:Zn,python:to,r:ro,ruby:no,rust:ao,shell:fo,swift:{info:{key:"swift",title:"Swift",default:"urlsession"},clientsById:{urlsession:{info:{key:"urlsession",title:"URLSession",link:"https://developer.apple.com/documentation/foundation/urlsession",description:"Foundation's URLSession request",extname:".swift"},convert:({allHeaders:t,postData:e,uriObj:r,queryObj:n,method:s},o)=>{var d;const a={indent:" ",pretty:!0,timeout:10,...o},{push:i,blank:c,join:l}=new j({indent:a.indent});i("import Foundation"),c();const f=e.text||e.jsonObj||e.params;if(f)switch(e.mimeType){case"application/x-www-form-urlencoded":if((d=e.params)!=null&&d.length){const p=e.params.map(h=>`"${h.name}": "${h.value}"`);a.pretty?(i("let parameters = ["),p.forEach(h=>{i(`${h},`,1)}),i("]")):i(`let parameters = [${p.join(", ")}]`),i('let joinedParameters = parameters.map { "\\($0.key)=\\($0.value)" }.joined(separator: "&")'),i("let postData = Data(joinedParameters.utf8)"),c()}break;case"application/json":e.jsonObj&&(i(`${dr("parameters",e.jsonObj,a)} as [String : Any?]`),c(),i("let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])"),c());break;case"multipart/form-data":i(dr("parameters",e.params,a)),c(),i(`let boundary = "${e.boundary}"`),c(),i('var body = ""'),i("for param in parameters {"),i('let paramName = param["name"]!',1),i('body += "--\\(boundary)\\r\\n"',1),i('body += "Content-Disposition:form-data; name=\\"\\(paramName)\\""',1),i('if let filename = param["fileName"] {',1),i('let contentType = param["contentType"]!',2),i("let fileContent = try String(contentsOfFile: filename, encoding: .utf8)",2),i('body += "; filename=\\"\\(filename)\\"\\r\\n"',2),i('body += "Content-Type: \\(contentType)\\r\\n\\r\\n"',2),i("body += fileContent",2),i('} else if let paramValue = param["value"] {',1),i('body += "\\r\\n\\r\\n\\(paramValue)"',2),i("}",1),i("}"),c(),i("let postData = Data(body.utf8)"),c();break;default:i(`let postData = Data("${e.text}".utf8)`),c()}i(`let url = URL(string: "${r.href}")!`);const u=n?Object.entries(n):[];return u.length<1?i("var request = URLRequest(url: url)"):(i("var components = URLComponents(url: url, resolvingAgainstBaseURL: true)!"),i("let queryItems: [URLQueryItem] = ["),u.forEach(p=>{const h=p[0],y=p[1];switch(Object.prototype.toString.call(y)){case"[object String]":i(`URLQueryItem(name: "${h}", value: "${y}"),`,1);break;case"[object Array]":y.forEach(g=>{i(`URLQueryItem(name: "${h}", value: "${g}"),`,1)});break}}),i("]"),i("components.queryItems = components.queryItems.map { $0 + queryItems } ?? queryItems"),c(),i("var request = URLRequest(url: components.url!)")),i(`request.httpMethod = "${s}"`),i(`request.timeoutInterval = ${a.timeout}`),Object.keys(t).length&&i(`request.allHTTPHeaderFields = ${ot(t,a)}`),f&&i("request.httpBody = postData"),c(),i("let (data, _) = try await URLSession.shared.data(for: request)"),i("print(String(decoding: data, as: UTF8.self))"),l()}}}}},hr=(t,e)=>{const r=t[e.name];return r===void 0?(t[e.name]=e.value,t):Array.isArray(r)?(r.push(e.value),t):(t[e.name]=[r,e.value],t)};var it={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */var uo=it.exports;(function(t,e){(function(r){var n=e&&!e.nodeType&&e,s=t&&!t.nodeType&&t,o=typeof ce.commonjsGlobal=="object"&&ce.commonjsGlobal;(o.global===o||o.window===o||o.self===o)&&(r=o);var a,i=2147483647,c=36,l=1,f=26,u=38,d=700,p=72,h=128,y="-",g=/^xn--/,$=/[^\x20-\x7E]/,m=/[\x2E\u3002\uFF0E\uFF61]/g,b={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},S=c-l,O=Math.floor,v=String.fromCharCode,T;function P(w){throw new RangeError(b[w])}function A(w,x){for(var C=w.length,R=[];C--;)R[C]=x(w[C]);return R}function U(w,x){var C=w.split("@"),R="";C.length>1&&(R=C[0]+"@",w=C[1]),w=w.replace(m,".");var N=w.split("."),z=A(N,x).join(".");return R+z}function Q(w){for(var x=[],C=0,R=w.length,N,z;C<R;)N=w.charCodeAt(C++),N>=55296&&N<=56319&&C<R?(z=w.charCodeAt(C++),(z&64512)==56320?x.push(((N&1023)<<10)+(z&1023)+65536):(x.push(N),C--)):x.push(N);return x}function Y(w){return A(w,function(x){var C="";return x>65535&&(x-=65536,C+=v(x>>>10&1023|55296),x=56320|x&1023),C+=v(x),C}).join("")}function _(w){return w-48<10?w-22:w-65<26?w-65:w-97<26?w-97:c}function J(w,x){return w+22+75*(w<26)-((x!=0)<<5)}function B(w,x,C){var R=0;for(w=C?O(w/d):w>>1,w+=O(w/x);w>S*f>>1;R+=c)w=O(w/S);return O(R+(S+1)*w/(w+u))}function V(w){var x=[],C=w.length,R,N=0,z=h,M=p,K,X,te,fe,W,D,Z,de,me;for(K=w.lastIndexOf(y),K<0&&(K=0),X=0;X<K;++X)w.charCodeAt(X)>=128&&P("not-basic"),x.push(w.charCodeAt(X));for(te=K>0?K+1:0;te<C;){for(fe=N,W=1,D=c;te>=C&&P("invalid-input"),Z=_(w.charCodeAt(te++)),(Z>=c||Z>O((i-N)/W))&&P("overflow"),N+=Z*W,de=D<=M?l:D>=M+f?f:D-M,!(Z<de);D+=c)me=c-de,W>O(i/me)&&P("overflow"),W*=me;R=x.length+1,M=B(N-fe,R,fe==0),O(N/R)>i-z&&P("overflow"),z+=O(N/R),N%=R,x.splice(N++,0,z)}return Y(x)}function pe(w){var x,C,R,N,z,M,K,X,te,fe,W,D=[],Z,de,me,mt;for(w=Q(w),Z=w.length,x=h,C=0,z=p,M=0;M<Z;++M)W=w[M],W<128&&D.push(v(W));for(R=N=D.length,N&&D.push(y);R<Z;){for(K=i,M=0;M<Z;++M)W=w[M],W>=x&&W<K&&(K=W);for(de=R+1,K-x>O((i-C)/de)&&P("overflow"),C+=(K-x)*de,x=K,M=0;M<Z;++M)if(W=w[M],W<x&&++C>i&&P("overflow"),W==x){for(X=C,te=c;fe=te<=z?l:te>=z+f?f:te-z,!(X<fe);te+=c)mt=X-fe,me=c-fe,D.push(v(J(fe+mt%me,0))),X=O(mt/me);D.push(v(J(X,0))),z=B(C,de,R==N),C=0,++R}++C,++x}return D.join("")}function yt(w){return U(w,function(x){return g.test(x)?V(x.slice(4).toLowerCase()):x})}function Ve(w){return U(w,function(x){return $.test(x)?"xn--"+pe(x):x})}if(a={version:"1.4.1",ucs2:{decode:Q,encode:Y},decode:V,encode:pe,toASCII:Ve,toUnicode:yt},n&&s)if(t.exports==n)s.exports=a;else for(T in a)a.hasOwnProperty(T)&&(n[T]=a[T]);else r.punycode=a})(uo)})(it,it.exports);var po=it.exports,_e=TypeError;const Dr=t=>String(t);Object.assign(Dr,{custom:Symbol.for("nodejs.util.inspect.custom")});const ho=Object.freeze(Object.defineProperty({__proto__:null,default:Dr},Symbol.toStringTag,{value:"Module"})),yo=ce.getAugmentedNamespace(ho);var Qt=typeof Map=="function"&&Map.prototype,bt=Object.getOwnPropertyDescriptor&&Qt?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,at=Qt&&bt&&typeof bt.get=="function"?bt.get:null,yr=Qt&&Map.prototype.forEach,Yt=typeof Set=="function"&&Set.prototype,$t=Object.getOwnPropertyDescriptor&&Yt?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,st=Yt&&$t&&typeof $t.get=="function"?$t.get:null,mr=Yt&&Set.prototype.forEach,mo=typeof WeakMap=="function"&&WeakMap.prototype,Ue=mo?WeakMap.prototype.has:null,go=typeof WeakSet=="function"&&WeakSet.prototype,Fe=go?WeakSet.prototype.has:null,bo=typeof WeakRef=="function"&&WeakRef.prototype,gr=bo?WeakRef.prototype.deref:null,$o=Boolean.prototype.valueOf,vo=Object.prototype.toString,wo=Function.prototype.toString,So=String.prototype.match,Xt=String.prototype.slice,he=String.prototype.replace,Oo=String.prototype.toUpperCase,br=String.prototype.toLowerCase,Qr=RegExp.prototype.test,$r=Array.prototype.concat,ae=Array.prototype.join,To=Array.prototype.slice,vr=Math.floor,Ut=typeof BigInt=="function"?BigInt.prototype.valueOf:null,vt=Object.getOwnPropertySymbols,Ft=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,qe=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Me=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===qe||!0)?Symbol.toStringTag:null,Yr=Object.prototype.propertyIsEnumerable,wr=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function Sr(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||Qr.call(/e/,e))return e;var r=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var n=t<0?-vr(-t):vr(t);if(n!==t){var s=String(n),o=Xt.call(e,s.length+1);return he.call(s,r,"$&_")+"."+he.call(he.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return he.call(e,r,"$&_")}var Mt=yo,Or=Mt.custom,Tr=en(Or)?Or:null,Xr={__proto__:null,double:'"',single:"'"},xo={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},ft=function t(e,r,n,s){var o=r||{};if(ue(o,"quoteStyle")&&!ue(Xr,o.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ue(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=ue(o,"customInspect")?o.customInspect:!0;if(typeof a!="boolean"&&a!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ue(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ue(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var i=o.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return rn(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var c=String(e);return i?Sr(e,c):c}if(typeof e=="bigint"){var l=String(e)+"n";return i?Sr(e,l):l}var f=typeof o.depth>"u"?5:o.depth;if(typeof n>"u"&&(n=0),n>=f&&f>0&&typeof e=="object")return Ht(e)?"[Array]":"[Object]";var u=Wo(o,n);if(typeof s>"u")s=[];else if(tn(s,e)>=0)return"[Circular]";function d(_,J,B){if(J&&(s=To.call(s),s.push(J)),B){var V={depth:o.depth};return ue(o,"quoteStyle")&&(V.quoteStyle=o.quoteStyle),t(_,V,n+1,s)}return t(_,o,n+1,s)}if(typeof e=="function"&&!xr(e)){var p=No(e),h=Ke(e,d);return"[Function"+(p?": "+p:" (anonymous)")+"]"+(h.length>0?" { "+ae.call(h,", ")+" }":"")}if(en(e)){var y=qe?he.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Ft.call(e);return typeof e=="object"&&!qe?Le(y):y}if(Mo(e)){for(var g="<"+br.call(String(e.nodeName)),$=e.attributes||[],m=0;m<$.length;m++)g+=" "+$[m].name+"="+Zr(jo($[m].value),"double",o);return g+=">",e.childNodes&&e.childNodes.length&&(g+="..."),g+="</"+br.call(String(e.nodeName))+">",g}if(Ht(e)){if(e.length===0)return"[]";var b=Ke(e,d);return u&&!Bo(b)?"["+Bt(b,u)+"]":"[ "+ae.call(b,", ")+" ]"}if(Po(e)){var S=Ke(e,d);return!("cause"in Error.prototype)&&"cause"in e&&!Yr.call(e,"cause")?"{ ["+String(e)+"] "+ae.call($r.call("[cause]: "+d(e.cause),S),", ")+" }":S.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+ae.call(S,", ")+" }"}if(typeof e=="object"&&a){if(Tr&&typeof e[Tr]=="function"&&Mt)return Mt(e,{depth:f-n});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(_o(e)){var O=[];return yr&&yr.call(e,function(_,J){O.push(d(J,e,!0)+" => "+d(_,e))}),jr("Map",at.call(e),O,u)}if(Uo(e)){var v=[];return mr&&mr.call(e,function(_){v.push(d(_,e))}),jr("Set",st.call(e),v,u)}if(Lo(e))return wt("WeakMap");if(Fo(e))return wt("WeakSet");if(Io(e))return wt("WeakRef");if(ko(e))return Le(d(Number(e)));if(Ro(e))return Le(d(Ut.call(e)));if(Ao(e))return Le($o.call(e));if(Co(e))return Le(d(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof ce.commonjsGlobal<"u"&&e===ce.commonjsGlobal)return"{ [object globalThis] }";if(!Eo(e)&&!xr(e)){var T=Ke(e,d),P=wr?wr(e)===Object.prototype:e instanceof Object||e.constructor===Object,A=e instanceof Object?"":"null prototype",U=!P&&Me&&Object(e)===e&&Me in e?Xt.call(ye(e),8,-1):A?"Object":"",Q=P||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",Y=Q+(U||A?"["+ae.call($r.call([],U||[],A||[]),": ")+"] ":"");return T.length===0?Y+"{}":u?Y+"{"+Bt(T,u)+"}":Y+"{ "+ae.call(T,", ")+" }"}return String(e)};function Zr(t,e,r){var n=r.quoteStyle||e,s=Xr[n];return s+t+s}function jo(t){return he.call(String(t),/"/g,"&quot;")}function Se(t){return!Me||!(typeof t=="object"&&(Me in t||typeof t[Me]<"u"))}function Ht(t){return ye(t)==="[object Array]"&&Se(t)}function Eo(t){return ye(t)==="[object Date]"&&Se(t)}function xr(t){return ye(t)==="[object RegExp]"&&Se(t)}function Po(t){return ye(t)==="[object Error]"&&Se(t)}function Co(t){return ye(t)==="[object String]"&&Se(t)}function ko(t){return ye(t)==="[object Number]"&&Se(t)}function Ao(t){return ye(t)==="[object Boolean]"&&Se(t)}function en(t){if(qe)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!Ft)return!1;try{return Ft.call(t),!0}catch{}return!1}function Ro(t){if(!t||typeof t!="object"||!Ut)return!1;try{return Ut.call(t),!0}catch{}return!1}var qo=Object.prototype.hasOwnProperty||function(t){return t in this};function ue(t,e){return qo.call(t,e)}function ye(t){return vo.call(t)}function No(t){if(t.name)return t.name;var e=So.call(wo.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function tn(t,e){if(t.indexOf)return t.indexOf(e);for(var r=0,n=t.length;r<n;r++)if(t[r]===e)return r;return-1}function _o(t){if(!at||!t||typeof t!="object")return!1;try{at.call(t);try{st.call(t)}catch{return!0}return t instanceof Map}catch{}return!1}function Lo(t){if(!Ue||!t||typeof t!="object")return!1;try{Ue.call(t,Ue);try{Fe.call(t,Fe)}catch{return!0}return t instanceof WeakMap}catch{}return!1}function Io(t){if(!gr||!t||typeof t!="object")return!1;try{return gr.call(t),!0}catch{}return!1}function Uo(t){if(!st||!t||typeof t!="object")return!1;try{st.call(t);try{at.call(t)}catch{return!0}return t instanceof Set}catch{}return!1}function Fo(t){if(!Fe||!t||typeof t!="object")return!1;try{Fe.call(t,Fe);try{Ue.call(t,Ue)}catch{return!0}return t instanceof WeakSet}catch{}return!1}function Mo(t){return!t||typeof t!="object"?!1:typeof HTMLElement<"u"&&t instanceof HTMLElement?!0:typeof t.nodeName=="string"&&typeof t.getAttribute=="function"}function rn(t,e){if(t.length>e.maxStringLength){var r=t.length-e.maxStringLength,n="... "+r+" more character"+(r>1?"s":"");return rn(Xt.call(t,0,e.maxStringLength),e)+n}var s=xo[e.quoteStyle||"single"];s.lastIndex=0;var o=he.call(he.call(t,s,"\\$1"),/[\x00-\x1f]/g,Ho);return Zr(o,"single",e)}function Ho(t){var e=t.charCodeAt(0),r={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return r?"\\"+r:"\\x"+(e<16?"0":"")+Oo.call(e.toString(16))}function Le(t){return"Object("+t+")"}function wt(t){return t+" { ? }"}function jr(t,e,r,n){var s=n?Bt(r,n):ae.call(r,", ");return t+" ("+e+") {"+s+"}"}function Bo(t){for(var e=0;e<t.length;e++)if(tn(t[e],`
45
+ `)>=0)return!1;return!0}function Wo(t,e){var r;if(t.indent===" ")r=" ";else if(typeof t.indent=="number"&&t.indent>0)r=ae.call(Array(t.indent+1)," ");else return null;return{base:r,prev:ae.call(Array(e+1),r)}}function Bt(t,e){if(t.length===0)return"";var r=`
46
46
  `+e.prev+e.base;return r+ae.call(t,","+r)+`
47
- `+e.prev}function Ke(t,e){var r=Gt(t),n=[];if(r){n.length=t.length;for(var s=0;s<t.length;s++)n[s]=ue(t,s)?e(t[s],t):""}var o=typeof $t=="function"?$t(t):[],a;if(qe){a={};for(var i=0;i<o.length;i++)a["$"+o[i]]=o[i]}for(var c in t)ue(t,c)&&(r&&String(Number(c))===c&&c<t.length||qe&&a["$"+c]instanceof Symbol||(tn.call(/[^\w$]/,c)?n.push(e(c,t)+": "+e(t[c],t)):n.push(c+": "+e(t[c],t))));if(typeof $t=="function")for(var l=0;l<o.length;l++)rn.call(t,o[l])&&n.push("["+e(o[l])+"]: "+e(t[o[l]],t));return n}var Do=ft,Qo=_e,ut=function(t,e,r){for(var n=t,s;(s=n.next)!=null;n=s)if(s.key===e)return n.next=s.next,r||(s.next=t.next,t.next=s),s},Yo=function(t,e){if(t){var r=ut(t,e);return r&&r.value}},Xo=function(t,e,r){var n=ut(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},Zo=function(t,e){return t?!!ut(t,e):!1},ei=function(t,e){if(t)return ut(t,e,!0)},ti=function(){var e,r={assert:function(n){if(!r.has(n))throw new Qo("Side channel does not contain "+Do(n))},delete:function(n){var s=ei(e,n);return s&&e&&!e.next&&(e=void 0),!!s},get:function(n){return Yo(e,n)},has:function(n){return Zo(e,n)},set:function(n,s){e||(e={next:void 0}),Xo(e,n,s)}};return r},ln=Object,ri=Error,ni=EvalError,oi=RangeError,ii=ReferenceError,ai=SyntaxError,si=URIError,ci=Math.abs,li=Math.floor,fi=Math.max,ui=Math.min,pi=Math.pow,di=Math.round,hi=Number.isNaN||function(e){return e!==e},yi=hi,mi=function(e){return yi(e)||e===0?e:e<0?-1:1},gi=Object.getOwnPropertyDescriptor,Xe=gi;if(Xe)try{Xe([],"length")}catch{Xe=null}var fn=Xe,Ze=Object.defineProperty||!1;if(Ze)try{Ze({},"a",{value:1})}catch{Ze=!1}var un=Ze,St,kr;function bi(){return kr||(kr=1,St=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var s=42;e[r]=s;for(var o in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var i=Object.getOwnPropertyDescriptor(e,r);if(i.value!==s||i.enumerable!==!0)return!1}return!0}),St}var Ot,Ar;function vi(){if(Ar)return Ot;Ar=1;var t=typeof Symbol<"u"&&Symbol,e=bi();return Ot=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},Ot}var Tt,Rr;function pn(){return Rr||(Rr=1,Tt=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Tt}var xt,qr;function dn(){if(qr)return xt;qr=1;var t=ln;return xt=t.getPrototypeOf||null,xt}var jt,Nr;function $i(){if(Nr)return jt;Nr=1;var t="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,r=Math.max,n="[object Function]",s=function(c,l){for(var f=[],u=0;u<c.length;u+=1)f[u]=c[u];for(var p=0;p<l.length;p+=1)f[p+c.length]=l[p];return f},o=function(c,l){for(var f=[],u=l,p=0;u<c.length;u+=1,p+=1)f[p]=c[u];return f},a=function(i,c){for(var l="",f=0;f<i.length;f+=1)l+=i[f],f+1<i.length&&(l+=c);return l};return jt=function(c){var l=this;if(typeof l!="function"||e.apply(l)!==n)throw new TypeError(t+l);for(var f=o(arguments,1),u,p=function(){if(this instanceof u){var v=l.apply(this,s(f,arguments));return Object(v)===v?v:this}return l.apply(c,s(f,arguments))},d=r(0,l.length-f.length),h=[],y=0;y<d;y++)h[y]="$"+y;if(u=Function("binder","return function ("+a(h,",")+"){ return binder.apply(this,arguments); }")(p),l.prototype){var g=function(){};g.prototype=l.prototype,u.prototype=new g,g.prototype=null}return u},jt}var Et,_r;function pt(){if(_r)return Et;_r=1;var t=$i();return Et=Function.prototype.bind||t,Et}var Pt,Lr;function rr(){return Lr||(Lr=1,Pt=Function.prototype.call),Pt}var Ct,Ir;function hn(){return Ir||(Ir=1,Ct=Function.prototype.apply),Ct}var wi=typeof Reflect<"u"&&Reflect&&Reflect.apply,Si=pt(),Oi=hn(),Ti=rr(),xi=wi,ji=xi||Si.call(Ti,Oi),Ei=pt(),Pi=_e,Ci=rr(),ki=ji,yn=function(e){if(e.length<1||typeof e[0]!="function")throw new Pi("a function is required");return ki(Ei,Ci,e)},kt,Ur;function Ai(){if(Ur)return kt;Ur=1;var t=yn,e=fn,r;try{r=[].__proto__===Array.prototype}catch(a){if(!a||typeof a!="object"||!("code"in a)||a.code!=="ERR_PROTO_ACCESS")throw a}var n=!!r&&e&&e(Object.prototype,"__proto__"),s=Object,o=s.getPrototypeOf;return kt=n&&typeof n.get=="function"?t([n.get]):typeof o=="function"?function(i){return o(i==null?i:s(i))}:!1,kt}var At,Fr;function Ri(){if(Fr)return At;Fr=1;var t=pn(),e=dn(),r=Ai();return At=t?function(s){return t(s)}:e?function(s){if(!s||typeof s!="object"&&typeof s!="function")throw new TypeError("getProto: not an object");return e(s)}:r?function(s){return r(s)}:null,At}var Rt,Mr;function qi(){if(Mr)return Rt;Mr=1;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,r=pt();return Rt=r.call(t,e),Rt}var E,Ni=ln,_i=ri,Li=ni,Ii=oi,Ui=ii,Ne=ai,ke=_e,Fi=si,Mi=ci,Hi=li,Bi=fi,Wi=ui,Gi=pi,Ji=di,zi=mi,mn=Function,qt=function(t){try{return mn('"use strict"; return ('+t+").constructor;")()}catch{}},We=fn,Vi=un,Nt=function(){throw new ke},Ki=We?(function(){try{return arguments.callee,Nt}catch{try{return We(arguments,"callee").get}catch{return Nt}}})():Nt,Oe=vi()(),F=Ri(),Di=dn(),Qi=pn(),gn=hn(),Ge=rr(),xe={},Yi=typeof Uint8Array>"u"||!F?E:F(Uint8Array),we={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?E:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?E:ArrayBuffer,"%ArrayIteratorPrototype%":Oe&&F?F([][Symbol.iterator]()):E,"%AsyncFromSyncIteratorPrototype%":E,"%AsyncFunction%":xe,"%AsyncGenerator%":xe,"%AsyncGeneratorFunction%":xe,"%AsyncIteratorPrototype%":xe,"%Atomics%":typeof Atomics>"u"?E:Atomics,"%BigInt%":typeof BigInt>"u"?E:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?E:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?E:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?E:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":_i,"%eval%":eval,"%EvalError%":Li,"%Float16Array%":typeof Float16Array>"u"?E:Float16Array,"%Float32Array%":typeof Float32Array>"u"?E:Float32Array,"%Float64Array%":typeof Float64Array>"u"?E:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?E:FinalizationRegistry,"%Function%":mn,"%GeneratorFunction%":xe,"%Int8Array%":typeof Int8Array>"u"?E:Int8Array,"%Int16Array%":typeof Int16Array>"u"?E:Int16Array,"%Int32Array%":typeof Int32Array>"u"?E:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Oe&&F?F(F([][Symbol.iterator]())):E,"%JSON%":typeof JSON=="object"?JSON:E,"%Map%":typeof Map>"u"?E:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Oe||!F?E:F(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Ni,"%Object.getOwnPropertyDescriptor%":We,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?E:Promise,"%Proxy%":typeof Proxy>"u"?E:Proxy,"%RangeError%":Ii,"%ReferenceError%":Ui,"%Reflect%":typeof Reflect>"u"?E:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?E:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Oe||!F?E:F(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?E:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Oe&&F?F(""[Symbol.iterator]()):E,"%Symbol%":Oe?Symbol:E,"%SyntaxError%":Ne,"%ThrowTypeError%":Ki,"%TypedArray%":Yi,"%TypeError%":ke,"%Uint8Array%":typeof Uint8Array>"u"?E:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?E:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?E:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?E:Uint32Array,"%URIError%":Fi,"%WeakMap%":typeof WeakMap>"u"?E:WeakMap,"%WeakRef%":typeof WeakRef>"u"?E:WeakRef,"%WeakSet%":typeof WeakSet>"u"?E:WeakSet,"%Function.prototype.call%":Ge,"%Function.prototype.apply%":gn,"%Object.defineProperty%":Vi,"%Object.getPrototypeOf%":Di,"%Math.abs%":Mi,"%Math.floor%":Hi,"%Math.max%":Bi,"%Math.min%":Wi,"%Math.pow%":Gi,"%Math.round%":Ji,"%Math.sign%":zi,"%Reflect.getPrototypeOf%":Qi};if(F)try{null.error}catch(t){var Xi=F(F(t));we["%Error.prototype%"]=Xi}var Zi=function t(e){var r;if(e==="%AsyncFunction%")r=qt("async function () {}");else if(e==="%GeneratorFunction%")r=qt("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=qt("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var s=t("%AsyncGenerator%");s&&F&&(r=F(s.prototype))}return we[e]=r,r},Hr={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Je=pt(),ct=qi(),ea=Je.call(Ge,Array.prototype.concat),ta=Je.call(gn,Array.prototype.splice),Br=Je.call(Ge,String.prototype.replace),lt=Je.call(Ge,String.prototype.slice),ra=Je.call(Ge,RegExp.prototype.exec),na=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,oa=/\\(\\)?/g,ia=function(e){var r=lt(e,0,1),n=lt(e,-1);if(r==="%"&&n!=="%")throw new Ne("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Ne("invalid intrinsic syntax, expected opening `%`");var s=[];return Br(e,na,function(o,a,i,c){s[s.length]=i?Br(c,oa,"$1"):a||o}),s},aa=function(e,r){var n=e,s;if(ct(Hr,n)&&(s=Hr[n],n="%"+s[0]+"%"),ct(we,n)){var o=we[n];if(o===xe&&(o=Zi(n)),typeof o>"u"&&!r)throw new ke("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:s,name:n,value:o}}throw new Ne("intrinsic "+e+" does not exist!")},nr=function(e,r){if(typeof e!="string"||e.length===0)throw new ke("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new ke('"allowMissing" argument must be a boolean');if(ra(/^%?[^%]*%?$/,e)===null)throw new Ne("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=ia(e),s=n.length>0?n[0]:"",o=aa("%"+s+"%",r),a=o.name,i=o.value,c=!1,l=o.alias;l&&(s=l[0],ta(n,ea([0,1],l)));for(var f=1,u=!0;f<n.length;f+=1){var p=n[f],d=lt(p,0,1),h=lt(p,-1);if((d==='"'||d==="'"||d==="`"||h==='"'||h==="'"||h==="`")&&d!==h)throw new Ne("property names with quotes must have matching quotes");if((p==="constructor"||!u)&&(c=!0),s+="."+p,a="%"+s+"%",ct(we,a))i=we[a];else if(i!=null){if(!(p in i)){if(!r)throw new ke("base intrinsic for "+e+" exists, but the property is not available.");return}if(We&&f+1>=n.length){var y=We(i,p);u=!!y,u&&"get"in y&&!("originalValue"in y.get)?i=y.get:i=i[p]}else u=ct(i,p),i=i[p];u&&!c&&(we[a]=i)}}return i},bn=nr,vn=yn,sa=vn([bn("%String.prototype.indexOf%")]),$n=function(e,r){var n=bn(e,!!r);return typeof n=="function"&&sa(e,".prototype.")>-1?vn([n]):n},ca=nr,ze=$n,la=ft,fa=_e,Wr=ca("%Map%",!0),ua=ze("Map.prototype.get",!0),pa=ze("Map.prototype.set",!0),da=ze("Map.prototype.has",!0),ha=ze("Map.prototype.delete",!0),ya=ze("Map.prototype.size",!0),wn=!!Wr&&function(){var e,r={assert:function(n){if(!r.has(n))throw new fa("Side channel does not contain "+la(n))},delete:function(n){if(e){var s=ha(e,n);return ya(e)===0&&(e=void 0),s}return!1},get:function(n){if(e)return ua(e,n)},has:function(n){return e?da(e,n):!1},set:function(n,s){e||(e=new Wr),pa(e,n,s)}};return r},ma=nr,dt=$n,ga=ft,De=wn,ba=_e,Te=ma("%WeakMap%",!0),va=dt("WeakMap.prototype.get",!0),$a=dt("WeakMap.prototype.set",!0),wa=dt("WeakMap.prototype.has",!0),Sa=dt("WeakMap.prototype.delete",!0),Oa=Te?function(){var e,r,n={assert:function(s){if(!n.has(s))throw new ba("Side channel does not contain "+ga(s))},delete:function(s){if(Te&&s&&(typeof s=="object"||typeof s=="function")){if(e)return Sa(e,s)}else if(De&&r)return r.delete(s);return!1},get:function(s){return Te&&s&&(typeof s=="object"||typeof s=="function")&&e?va(e,s):r&&r.get(s)},has:function(s){return Te&&s&&(typeof s=="object"||typeof s=="function")&&e?wa(e,s):!!r&&r.has(s)},set:function(s,o){Te&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new Te),$a(e,s,o)):De&&(r||(r=De()),r.set(s,o))}};return n}:De,Ta=_e,xa=ft,ja=ti,Ea=wn,Pa=Oa,Ca=Pa||Ea||ja,Sn=function(){var e,r={assert:function(n){if(!r.has(n)){var s=n&&Object(n)===n?"the given object key":xa(n);throw new Ta("Side channel does not contain "+s)}},delete:function(n){return!!e&&e.delete(n)},get:function(n){return e&&e.get(n)},has:function(n){return!!e&&e.has(n)},set:function(n,s){e||(e=Ca()),e.set(n,s)}};return r},ka=String.prototype.replace,Aa=/%20/g,_t={RFC1738:"RFC1738",RFC3986:"RFC3986"},or={default:_t.RFC3986,formatters:{RFC1738:function(t){return ka.call(t,Aa,"+")},RFC3986:function(t){return String(t)}},RFC1738:_t.RFC1738,RFC3986:_t.RFC3986},Ra=or,On=Sn,Gr=un,Lt=Object.prototype.hasOwnProperty,be=Array.isArray,ht=On(),ve=function(e,r){return ht.set(e,r),e},$e=function(e){return ht.has(e)},Ie=function(e){return ht.get(e)},zt=function(e,r){ht.set(e,r)},ne=(function(){for(var t=[],e=0;e<256;++e)t[t.length]="%"+((e<16?"0":"")+e.toString(16)).toUpperCase();return t})(),qa=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(be(n)){for(var s=[],o=0;o<n.length;++o)typeof n[o]<"u"&&(s[s.length]=n[o]);r.obj[r.prop]=s}}},Ce=function(e,r){for(var n=r&&r.plainObjects?{__proto__:null}:{},s=0;s<e.length;++s)typeof e[s]<"u"&&(n[s]=e[s]);return n},Vt=function(e,r,n){r==="__proto__"&&Gr?Gr(e,r,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[r]=n},Na=function t(e,r,n){if(!r)return e;if(typeof r!="object"&&typeof r!="function"){if(be(e)){var s=e.length;if(n&&typeof n.arrayLimit=="number"&&s>=n.arrayLimit){if(n.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+n.arrayLimit+" element"+(n.arrayLimit===1?"":"s")+" allowed in an array.");return ve(Ce(e.concat(r),n),s)}e[s]=r}else if(e&&typeof e=="object")if($e(e)){var o=Ie(e)+1;e[o]=r,zt(e,o)}else{if(n&&n.strictMerge)return[e,r];(n&&(n.plainObjects||n.allowPrototypes)||!Lt.call(Object.prototype,r))&&(e[r]=!0)}else return[e,r];return e}if(!e||typeof e!="object"){if($e(r)){for(var a=Object.keys(r),i=n&&n.plainObjects?{__proto__:null,0:e}:{0:e},c=0;c<a.length;c++){var l=parseInt(a[c],10);i[l+1]=r[a[c]]}return ve(i,Ie(r)+1)}var f=[e].concat(r);if(n&&typeof n.arrayLimit=="number"&&f.length>n.arrayLimit){if(n.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+n.arrayLimit+" element"+(n.arrayLimit===1?"":"s")+" allowed in an array.");return ve(Ce(f,n),f.length-1)}return f}var u=e;if(be(e)&&!be(r)&&(u=Ce(e,n)),be(e)&&be(r)){if(r.forEach(function(p,d){if(Lt.call(e,d)){var h=e[d];h&&typeof h=="object"&&p&&typeof p=="object"?e[d]=t(h,p,n):e[e.length]=p}else e[d]=p}),n&&typeof n.arrayLimit=="number"&&e.length>n.arrayLimit){if(n.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+n.arrayLimit+" element"+(n.arrayLimit===1?"":"s")+" allowed in an array.");return ve(Ce(e,n),e.length-1)}return e}return Object.keys(r).reduce(function(p,d){var h=r[d];if(Lt.call(p,d)?Vt(p,d,t(p[d],h,n)):Vt(p,d,h),$e(r)&&!$e(p)&&ve(p,Ie(r)),$e(p)){var y=parseInt(d,10);String(y)===d&&y>=0&&y>Ie(p)&&zt(p,y)}return p},u)},_a=function(e,r){return Object.keys(r).reduce(function(n,s){return Vt(n,s,r[s]),n},e)},La=function(t,e,r){var n=t.replace(/\+/g," ");if(r==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},Qe=1024,Ia=function(e,r,n,s,o){if(e.length===0)return e;var a=e;if(typeof e=="symbol"?a=Symbol.prototype.toString.call(e):typeof e!="string"&&(a=String(e)),n==="iso-8859-1")return escape(a).replace(/%u[0-9a-f]{4}/gi,function(h){return"%26%23"+parseInt(h.slice(2),16)+"%3B"});for(var i="",c=0;c<a.length;c+=Qe){var l=a.length>=Qe?a.slice(c,c+Qe):a;if(c+Qe<a.length){var f=l.charCodeAt(l.length-1);f>=55296&&f<=56319&&(l=l.slice(0,-1),c-=1)}for(var u=[],p=0;p<l.length;++p){var d=l.charCodeAt(p);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||o===Ra.RFC1738&&(d===40||d===41)){u[u.length]=l.charAt(p);continue}if(d<128){u[u.length]=ne[d];continue}if(d<2048){u[u.length]=ne[192|d>>6]+ne[128|d&63];continue}if(d<55296||d>=57344){u[u.length]=ne[224|d>>12]+ne[128|d>>6&63]+ne[128|d&63];continue}p+=1,d=65536+((d&1023)<<10|l.charCodeAt(p)&1023),u[u.length]=ne[240|d>>18]+ne[128|d>>12&63]+ne[128|d>>6&63]+ne[128|d&63]}i+=u.join("")}return i},Ua=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=On(),s=0;s<r.length;++s)for(var o=r[s],a=o.obj[o.prop],i=Object.keys(a),c=0;c<i.length;++c){var l=i[c],f=a[l];typeof f=="object"&&f!==null&&!n.has(f)&&(r[r.length]={obj:a,prop:l},n.set(f,!0))}return qa(r),e},Fa=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Ma=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Ha=function(e,r,n,s,o){if($e(e)){if(o)throw new RangeError("Array limit exceeded. Only "+n+" element"+(n===1?"":"s")+" allowed in an array.");var a=Ie(e)+1;return e[a]=r,zt(e,a),e}var i=[].concat(e,r);if(i.length>n){if(o)throw new RangeError("Array limit exceeded. Only "+n+" element"+(n===1?"":"s")+" allowed in an array.");return ve(Ce(i,{plainObjects:s}),i.length-1)}return i},Ba=function(e,r){if(be(e)){for(var n=[],s=0;s<e.length;s+=1)n[n.length]=r(e[s]);return n}return r(e)},Tn={arrayToObject:Ce,assign:_a,combine:Ha,compact:Ua,decode:La,encode:Ia,isBuffer:Ma,isOverflow:$e,isRegExp:Fa,markOverflow:ve,maybeMap:Ba,merge:Na},xn=Sn,et=Tn,He=or,Wa=Object.prototype.hasOwnProperty,jn={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},oe=Array.isArray,Ga=Array.prototype.push,En=function(t,e){Ga.apply(t,oe(e)?e:[e])},Ja=Date.prototype.toISOString,Jr=He.default,L={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:et.encode,encodeValuesOnly:!1,filter:void 0,format:Jr,formatter:He.formatters[Jr],indices:!1,serializeDate:function(e){return Ja.call(e)},skipNulls:!1,strictNullHandling:!1},za=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},It={},Va=function t(e,r,n,s,o,a,i,c,l,f,u,p,d,h,y,g,v,m){for(var b=e,S=m,O=0,$=!1;(S=S.get(It))!==void 0&&!$;){var T=S.get(e);if(O+=1,typeof T<"u"){if(T===O)throw new RangeError("Cyclic object value");$=!0}typeof S.get(It)>"u"&&(O=0)}if(typeof f=="function"?b=f(r,b):b instanceof Date?b=d(b):n==="comma"&&oe(b)&&(b=et.maybeMap(b,function(w){return w instanceof Date?d(w):w})),b===null){if(a)return y(l&&!g?l(r,L.encoder,v,"key",h):r);b=""}if(za(b)||et.isBuffer(b)){if(l){var P=g?r:l(r,L.encoder,v,"key",h);return[y(P)+"="+y(l(b,L.encoder,v,"value",h))]}return[y(r)+"="+y(String(b))]}var A=[];if(typeof b>"u")return A;var U;if(n==="comma"&&oe(b))g&&l&&(b=et.maybeMap(b,function(w){return w==null?w:l(w)})),U=[{value:b.length>0?b.join(",")||null:void 0}];else if(oe(f))U=f;else{var Q=Object.keys(b);U=u?Q.sort(u):Q}var Y=c?String(r).replace(/\./g,"%2E"):String(r),_=s&&oe(b)&&b.length===1?Y+"[]":Y;if(o&&oe(b)&&b.length===0)return _+"[]";for(var J=0;J<U.length;++J){var B=U[J],V=typeof B=="object"&&B&&typeof B.value<"u"?B.value:b[B];if(!(i&&V===null)){var pe=p&&c?String(B).replace(/\./g,"%2E"):String(B),yt=oe(b)?typeof n=="function"?n(_,pe):_:_+(p?"."+pe:"["+pe+"]");m.set(e,O);var Ve=xn();Ve.set(It,m),En(A,t(V,yt,n,s,o,a,i,c,n==="comma"&&g&&oe(b)?null:l,f,u,p,d,h,y,g,v,Ve))}}return A},Ka=function(e){if(!e)return L;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var r=e.charset||L.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=He.default;if(typeof e.format<"u"){if(!Wa.call(He.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var s=He.formatters[n],o=L.filter;(typeof e.filter=="function"||oe(e.filter))&&(o=e.filter);var a;if(e.arrayFormat in jn?a=e.arrayFormat:"indices"in e?a=e.indices?"indices":"repeat":a=L.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var i=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:L.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:L.addQueryPrefix,allowDots:i,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:L.allowEmptyArrays,arrayFormat:a,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:L.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?L.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:L.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:L.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:L.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:L.encodeValuesOnly,filter:o,format:n,formatter:s,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:L.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:L.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:L.strictNullHandling}},Da=function(t,e){var r=t,n=Ka(e),s,o;typeof n.filter=="function"?(o=n.filter,r=o("",r)):oe(n.filter)&&(o=n.filter,s=o);var a=[];if(typeof r!="object"||r===null)return"";var i=jn[n.arrayFormat],c=i==="comma"&&n.commaRoundTrip;s||(s=Object.keys(r)),n.sort&&s.sort(n.sort);for(var l=xn(),f=0;f<s.length;++f){var u=s[f];if(!(typeof u>"u"||u===null)){var p=r[u];n.skipNulls&&p===null||En(a,Va(p,u,i,c,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,l))}}var d=a.join(n.delimiter),h=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?h+="utf8=%26%2310003%3B"+n.delimiter:h+="utf8=%E2%9C%93"+n.delimiter),d.length>0?h+d:""},se=Tn,tt=Object.prototype.hasOwnProperty,Ut=Array.isArray,q={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:se.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictMerge:!0,strictNullHandling:!1,throwOnLimitExceeded:!1},Qa=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},Pn=function(t,e,r,n){if(t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1){if(n&&e.throwOnLimitExceeded)for(var s=0,o=t.indexOf(",");o>-1;){if(s+=1,s>=e.arrayLimit)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(e.arrayLimit===1?"":"s")+" allowed in an array.");o=t.indexOf(",",o+1)}return t.split(",")}if(e.throwOnLimitExceeded&&r>=e.arrayLimit)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(e.arrayLimit===1?"":"s")+" allowed in an array.");return t},Ya="utf8=%26%2310003%3B",Xa="utf8=%E2%9C%93",Za=function(e,r){var n={__proto__:null},s=r.ignoreQueryPrefix?e.replace(/^\?/,""):e;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=r.parameterLimit===1/0?void 0:r.parameterLimit,a=s.split(r.delimiter,r.throwOnLimitExceeded&&typeof o<"u"?o+1:o);if(r.throwOnLimitExceeded&&typeof o<"u"&&a.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var i=-1,c,l=r.charset;if(r.charsetSentinel)for(c=0;c<a.length;++c)a[c].indexOf("utf8=")===0&&(a[c]===Xa?l="utf-8":a[c]===Ya&&(l="iso-8859-1"),i=c,c=a.length);for(c=0;c<a.length;++c)if(c!==i){var f=a[c],u=f.indexOf("]="),p=u===-1?f.indexOf("="):u+1,d,h;if(p===-1?(d=r.decoder(f,q.decoder,l,"key"),h=r.strictNullHandling?null:""):(d=r.decoder(f.slice(0,p),q.decoder,l,"key"),d!==null&&(h=se.maybeMap(Pn(f.slice(p+1),r,Ut(n[d])?n[d].length:0,f.indexOf("[]=")===-1),function(g){return r.decoder(g,q.decoder,l,"value")}))),h&&r.interpretNumericEntities&&l==="iso-8859-1"&&(h=Qa(String(h))),f.indexOf("[]=")>-1&&(h=Ut(h)?[h]:h),r.comma&&Ut(h)&&h.length>r.arrayLimit&&(h=se.combine([],h,r.arrayLimit,r.plainObjects,r.throwOnLimitExceeded)),d!==null){var y=tt.call(n,d);y&&(r.duplicates==="combine"||f.indexOf("[]=")>-1)?n[d]=se.combine(n[d],h,r.arrayLimit,r.plainObjects,r.throwOnLimitExceeded):(!y||r.duplicates==="last")&&(n[d]=h)}}return n},es=function(t,e,r,n){var s=0;if(t.length>0&&t[t.length-1]==="[]"){var o=t.slice(0,-1).join("");s=Array.isArray(e)&&e[o]?e[o].length:0}for(var a=n?e:Pn(e,r,s),i=t.length-1;i>=0;--i){var c,l=t[i];if(l==="[]"&&r.parseArrays)se.isOverflow(a)?c=a:c=r.allowEmptyArrays&&(a===""||r.strictNullHandling&&a===null)?[]:se.combine([],a,r.arrayLimit,r.plainObjects,r.throwOnLimitExceeded);else{c=r.plainObjects?{__proto__:null}:{};var f=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,u=r.decodeDotInKeys?f.replace(/%2E/g,"."):f,p=parseInt(u,10),d=!isNaN(p)&&l!==u&&String(p)===u&&p>=0&&r.parseArrays;if(!r.parseArrays&&u==="")c={0:a};else if(d&&p<r.arrayLimit)c=[],c[p]=a;else{if(d&&r.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+r.arrayLimit+" element"+(r.arrayLimit===1?"":"s")+" allowed in an array.");d?(c[p]=a,se.markOverflow(c,p)):u!=="__proto__"&&(c[u]=a)}}a=c}return a},ts=function(e,r){var n=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e;if(r.depth<=0)return!r.plainObjects&&tt.call(Object.prototype,n)&&!r.allowPrototypes?void 0:[n];var s=[],o=n.indexOf("["),a=o>=0?n.slice(0,o):n;if(a){if(!r.plainObjects&&tt.call(Object.prototype,a)&&!r.allowPrototypes)return;s[s.length]=a}for(var i=n.length,c=o,l=0;c>=0&&l<r.depth;){for(var f=1,u=c+1,p=-1;u<i&&p<0;){var d=n.charCodeAt(u);d===91?f+=1:d===93&&(f-=1,f===0&&(p=u)),u+=1}if(p<0)return s[s.length]="["+n.slice(c)+"]",s;var h=n.slice(c,p+1),y=h.slice(1,-1);if(!r.plainObjects&&tt.call(Object.prototype,y)&&!r.allowPrototypes)return;s[s.length]=h,l+=1,c=n.indexOf("[",p+1)}if(c>=0){if(r.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+r.depth+" and strictDepth is true");s[s.length]="["+n.slice(c)+"]"}return s},rs=function(e,r,n,s){if(e){var o=ts(e,n);if(o)return es(o,r,n,s)}},ns=function(e){if(!e)return q;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.decodeDotInKeys<"u"&&typeof e.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(e.decoder!==null&&typeof e.decoder<"u"&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof e.throwOnLimitExceeded<"u"&&typeof e.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var r=typeof e.charset>"u"?q.charset:e.charset,n=typeof e.duplicates>"u"?q.duplicates:e.duplicates;if(n!=="combine"&&n!=="first"&&n!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof e.allowDots>"u"?e.decodeDotInKeys===!0?!0:q.allowDots:!!e.allowDots;return{allowDots:s,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:q.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:q.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:q.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:q.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:q.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:q.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:q.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:q.decoder,delimiter:typeof e.delimiter=="string"||se.isRegExp(e.delimiter)?e.delimiter:q.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:q.depth,duplicates:n,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:q.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:q.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:q.plainObjects,strictDepth:typeof e.strictDepth=="boolean"?!!e.strictDepth:q.strictDepth,strictMerge:typeof e.strictMerge=="boolean"?!!e.strictMerge:q.strictMerge,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:q.strictNullHandling,throwOnLimitExceeded:typeof e.throwOnLimitExceeded=="boolean"?e.throwOnLimitExceeded:!1}},os=function(t,e){var r=ns(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?{__proto__:null}:{};for(var n=typeof t=="string"?Za(t,r):t,s=r.plainObjects?{__proto__:null}:{},o=Object.keys(n),a=0;a<o.length;++a){var i=o[a],c=rs(i,n[i],r,typeof t=="string");s=se.merge(s,c,r)}return r.allowSparse===!0?s:se.compact(s)},is=Da,as=os,ss=or,rt={formats:ss,parse:as,stringify:is},cs=bo;function ee(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var ls=/^([a-z0-9.+-]+:)/i,fs=/:[0-9]*$/,us=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,ps=["<",">",'"',"`"," ","\r",`
48
- `," "],ds=["{","}","|","\\","^","`"].concat(ps),Kt=["'"].concat(ds),zr=["%","/","?",";","#"].concat(Kt),Vr=["/","?","#"],hs=255,Kr=/^[+a-z0-9A-Z_-]{0,63}$/,ys=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ms={javascript:!0,"javascript:":!0},Dt={javascript:!0,"javascript:":!0},Ae={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Qt=rt;function ir(t,e,r){if(t&&typeof t=="object"&&t instanceof ee)return t;var n=new ee;return n.parse(t,e,r),n}ee.prototype.parse=function(t,e,r){if(typeof t!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var n=t.indexOf("?"),s=n!==-1&&n<t.indexOf("#")?"?":"#",o=t.split(s),a=/\\/g;o[0]=o[0].replace(a,"/"),t=o.join(s);var i=t;if(i=i.trim(),!r&&t.split("#").length===1){var c=us.exec(i);if(c)return this.path=i,this.href=i,this.pathname=c[1],c[2]?(this.search=c[2],e?this.query=Qt.parse(this.search.substr(1)):this.query=this.search.substr(1)):e&&(this.search="",this.query={}),this}var l=ls.exec(i);if(l){l=l[0];var f=l.toLowerCase();this.protocol=f,i=i.substr(l.length)}if(r||l||i.match(/^\/\/[^@/]+@[^@/]+/)){var u=i.substr(0,2)==="//";u&&!(l&&Dt[l])&&(i=i.substr(2),this.slashes=!0)}if(!Dt[l]&&(u||l&&!Ae[l])){for(var p=-1,d=0;d<Vr.length;d++){var h=i.indexOf(Vr[d]);h!==-1&&(p===-1||h<p)&&(p=h)}var y,g;p===-1?g=i.lastIndexOf("@"):g=i.lastIndexOf("@",p),g!==-1&&(y=i.slice(0,g),i=i.slice(g+1),this.auth=decodeURIComponent(y)),p=-1;for(var d=0;d<zr.length;d++){var h=i.indexOf(zr[d]);h!==-1&&(p===-1||h<p)&&(p=h)}p===-1&&(p=i.length),this.host=i.slice(0,p),i=i.slice(p),this.parseHost(),this.hostname=this.hostname||"";var v=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!v)for(var m=this.hostname.split(/\./),d=0,b=m.length;d<b;d++){var S=m[d];if(S&&!S.match(Kr)){for(var O="",$=0,T=S.length;$<T;$++)S.charCodeAt($)>127?O+="x":O+=S[$];if(!O.match(Kr)){var P=m.slice(0,d),A=m.slice(d+1),U=S.match(ys);U&&(P.push(U[1]),A.unshift(U[2])),A.length&&(i="/"+A.join(".")+i),this.hostname=P.join(".");break}}}this.hostname.length>hs?this.hostname="":this.hostname=this.hostname.toLowerCase(),v||(this.hostname=cs.toASCII(this.hostname));var Q=this.port?":"+this.port:"",Y=this.hostname||"";this.host=Y+Q,this.href+=this.host,v&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),i[0]!=="/"&&(i="/"+i))}if(!ms[f])for(var d=0,b=Kt.length;d<b;d++){var _=Kt[d];if(i.indexOf(_)!==-1){var J=encodeURIComponent(_);J===_&&(J=escape(_)),i=i.split(_).join(J)}}var B=i.indexOf("#");B!==-1&&(this.hash=i.substr(B),i=i.slice(0,B));var V=i.indexOf("?");if(V!==-1?(this.search=i.substr(V),this.query=i.substr(V+1),e&&(this.query=Qt.parse(this.query)),i=i.slice(0,V)):e&&(this.search="",this.query={}),i&&(this.pathname=i),Ae[f]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var Q=this.pathname||"",pe=this.search||"";this.path=Q+pe}return this.href=this.format(),this};function gs(t){return typeof t=="string"&&(t=ir(t)),t instanceof ee?t.format():ee.prototype.format.call(t)}ee.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",n=this.hash||"",s=!1,o="";this.host?s=t+this.host:this.hostname&&(s=t+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(o=Qt.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var a=this.search||o&&"?"+o||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||Ae[e])&&s!==!1?(s="//"+(s||""),r&&r.charAt(0)!=="/"&&(r="/"+r)):s||(s=""),n&&n.charAt(0)!=="#"&&(n="#"+n),a&&a.charAt(0)!=="?"&&(a="?"+a),r=r.replace(/[?#]/g,function(i){return encodeURIComponent(i)}),a=a.replace("#","%23"),e+s+r+a+n};ee.prototype.resolve=function(t){return this.resolveObject(ir(t,!1,!0)).format()};ee.prototype.resolveObject=function(t){if(typeof t=="string"){var e=new ee;e.parse(t,!1,!0),t=e}for(var r=new ee,n=Object.keys(this),s=0;s<n.length;s++){var o=n[s];r[o]=this[o]}if(r.hash=t.hash,t.href==="")return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var a=Object.keys(t),i=0;i<a.length;i++){var c=a[i];c!=="protocol"&&(r[c]=t[c])}return Ae[r.protocol]&&r.hostname&&!r.pathname&&(r.pathname="/",r.path=r.pathname),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!Ae[t.protocol]){for(var l=Object.keys(t),f=0;f<l.length;f++){var u=l[f];r[u]=t[u]}return r.href=r.format(),r}if(r.protocol=t.protocol,!t.host&&!Dt[t.protocol]){for(var b=(t.pathname||"").split("/");b.length&&!(t.host=b.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),b[0]!==""&&b.unshift(""),b.length<2&&b.unshift(""),r.pathname=b.join("/")}else r.pathname=t.pathname;if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var p=r.pathname||"",d=r.search||"";r.path=p+d}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var h=r.pathname&&r.pathname.charAt(0)==="/",y=t.host||t.pathname&&t.pathname.charAt(0)==="/",g=y||h||r.host&&t.pathname,v=g,m=r.pathname&&r.pathname.split("/")||[],b=t.pathname&&t.pathname.split("/")||[],S=r.protocol&&!Ae[r.protocol];if(S&&(r.hostname="",r.port=null,r.host&&(m[0]===""?m[0]=r.host:m.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(b[0]===""?b[0]=t.host:b.unshift(t.host)),t.host=null),g=g&&(b[0]===""||m[0]==="")),y)r.host=t.host||t.host===""?t.host:r.host,r.hostname=t.hostname||t.hostname===""?t.hostname:r.hostname,r.search=t.search,r.query=t.query,m=b;else if(b.length)m||(m=[]),m.pop(),m=m.concat(b),r.search=t.search,r.query=t.query;else if(t.search!=null){if(S){r.host=m.shift(),r.hostname=r.host;var O=r.host&&r.host.indexOf("@")>0?r.host.split("@"):!1;O&&(r.auth=O.shift(),r.hostname=O.shift(),r.host=r.hostname)}return r.search=t.search,r.query=t.query,(r.pathname!==null||r.search!==null)&&(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!m.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var $=m.slice(-1)[0],T=(r.host||t.host||m.length>1)&&($==="."||$==="..")||$==="",P=0,A=m.length;A>=0;A--)$=m[A],$==="."?m.splice(A,1):$===".."?(m.splice(A,1),P++):P&&(m.splice(A,1),P--);if(!g&&!v)for(;P--;P)m.unshift("..");g&&m[0]!==""&&(!m[0]||m[0].charAt(0)!=="/")&&m.unshift(""),T&&m.join("/").substr(-1)!=="/"&&m.push("");var U=m[0]===""||m[0]&&m[0].charAt(0)==="/";if(S){r.hostname=U?"":m.length?m.shift():"",r.host=r.hostname;var O=r.host&&r.host.indexOf("@")>0?r.host.split("@"):!1;O&&(r.auth=O.shift(),r.hostname=O.shift(),r.host=r.hostname)}return g=g||r.host&&m.length,g&&!U&&m.unshift(""),m.length>0?r.pathname=m.join("/"):(r.pathname=null,r.path=null),(r.pathname!==null||r.search!==null)&&(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r};ee.prototype.parseHost=function(){var t=this.host,e=fs.exec(t);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};var bs=ir,Dr=gs;const vs=()=>Object.keys(Pe).map(t=>({...Pe[t].info,clients:Object.keys(Pe[t].clientsById).map(e=>Pe[t].clientsById[e].info)})),$s=t=>typeof t=="object"&&"log"in t&&typeof t.log=="object"&&"entries"in t.log&&Array.isArray(t.log.entries);var ws=class{constructor(t,e={}){this.initCalled=!1,this.entries=[],this.requests=[],this.options={},this.options={harIsAlreadyEncoded:!1,...e},this.requests=[],$s(t)?this.entries=t.log.entries:this.entries=[{request:t}]}init(){return this.initCalled=!0,this.requests=this.entries.map(({request:t})=>{var r;const e={bodySize:0,headersSize:0,headers:[],cookies:[],httpVersion:"HTTP/1.1",queryString:[],postData:{mimeType:((r=t.postData)==null?void 0:r.mimeType)||"application/octet-stream"},...t};return e.postData&&!e.postData.mimeType&&(e.postData.mimeType="application/octet-stream"),this.prepare(e,this.options)}),this}prepare(t,e){var f,u,p;const r={...t,fullUrl:"",uriObj:{},queryObj:{},headersObj:{},cookiesObj:{},allHeaders:{}};if(r!=null&&r.queryString.length&&(r.queryObj=r.queryString.reduce(gr,{})),r!=null&&r.headers.length){const d=/^HTTP\/2/;r.headersObj=r.headers.reduce((h,{name:y,value:g})=>{const v=d.exec(r.httpVersion)?y.toLocaleLowerCase():y;return{...h,[v]:g}},{})}r!=null&&r.cookies.length&&(r.cookiesObj=r.cookies.reduceRight((d,{name:h,value:y})=>({...d,[h]:y}),{}));const n=(f=r.cookies)==null?void 0:f.map(({name:d,value:h})=>e.harIsAlreadyEncoded?`${d}=${h}`:`${encodeURIComponent(d)}=${encodeURIComponent(h)}`);switch(n!=null&&n.length&&(r.allHeaders.cookie=n.join("; ")),r.postData.mimeType){case"multipart/mixed":case"multipart/related":case"multipart/form-data":case"multipart/alternative":if(r.postData.text="",r.postData.mimeType="multipart/form-data",(u=r.postData)!=null&&u.params){const d="---011000010111000001101001",h=`${d}--`,y=`\r
49
- `;/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */const g=S=>S.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),v=S=>S.replace(/\r?\n|\r/g,`\r
50
- `),m=[`--${d}`];(p=r.postData)==null||p.params.forEach((S,O)=>{const $=S.name,T=S.value||"",P=S.fileName||null,A=S.contentType||"application/octet-stream";P?(m.push(`Content-Disposition: form-data; name="${g(v($))}"; filename="${P}"`),m.push(`Content-Type: ${A}`)):m.push(`Content-Disposition: form-data; name="${escape(v($))}"`),m.push(""),m.push(v(T)),O!==r.postData.params.length-1&&m.push(`--${d}`)}),m.push(`--${h}`),r.postData.boundary=d,r.postData.text=m.join(y);const b=G(r.headersObj,"content-type")||"content-type";r.headersObj[b]=`multipart/form-data; boundary=${d}`}break;case"application/x-www-form-urlencoded":r.postData.params?(r.postData.paramsObj=r.postData.params.reduce(gr,{}),r.postData.text=rt.stringify(r.postData.paramsObj)):r.postData.text="";break;case"text/json":case"text/x-json":case"application/json":case"application/x-json":if(r.postData.mimeType="application/json",r.postData.text)try{r.postData.jsonObj=JSON.parse(r.postData.text)}catch{r.postData.mimeType="text/plain"}break}const s={...r.allHeaders,...r.headersObj},o=bs(r.url,!0,!0);r.queryObj={...r.queryObj,...o.query};let a;e.harIsAlreadyEncoded?a=rt.stringify(r.queryObj,{encode:!1,indices:!1}):a=rt.stringify(r.queryObj,{indices:!1});const i={...o,query:r.queryObj,search:a,path:a?`${o.pathname}?${a}`:o.pathname},c=Dr({...o,query:null,search:null}),l=Dr({...o,...i});return{...r,allHeaders:s,fullUrl:l,url:c,uriObj:i}}convert(t,e,r){this.initCalled||this.init(),!r&&e&&(r={clientId:e});const n=Pe[t];if(!n)return[!1];const{convert:s}=n.clientsById[e||n.info.default];return this.requests.map(o=>s(o,r))}installation(t,e,r){this.initCalled||this.init(),!r&&e&&(r={clientId:e});const n=Pe[t];if(!n)return[!1];const{info:s}=n.clientsById[e||n.info.default];return this.requests.map(o=>s!=null&&s.installation?s.installation(o,r):!1)}};const Ss="agent",Os="prompt";function Ts(){return vs()}function xs(t){var n;const e=t==null?void 0:t[0];if(!e)return"http://localhost";let r=e.url;for(const[s,o]of Object.entries(e.variables??{})){const a=o.default??((n=o.enum)==null?void 0:n[0])??`{${s}}`;r=r.replace(new RegExp(`\\{${s}\\}`,"g"),String(a))}return r}function js(t){if(t.example!==void 0||t.examples&&Object.keys(t.examples).length>0)return!0;const e=t.schema;return!!((e==null?void 0:e.example)!==void 0||e!=null&&e.enum&&e.enum.length>0)}function Cn(t){if(t.example!==void 0)return String(t.example);if(t.examples){for(const r of Object.values(t.examples))if(r&&typeof r=="object"&&"value"in r&&r.value!==void 0)return String(r.value)}const e=t.schema;return(e==null?void 0:e.example)!==void 0?String(e.example):e!=null&&e.enum&&e.enum.length>0?String(e.enum[0]):`{${t.name}}`}function Es(t,e,r){const n=e.replace(/\{([^}]+)\}/g,(s,o)=>{const a=r.find(c=>c.in==="path"&&c.name===o);if(!a)return s;const i=Cn(a);return i===`{${o}}`?i:encodeURIComponent(i)});return`${t.replace(/\/$/,"")}${n}`}function Ps(t,e){var s;const r=t[0];if(!r||!e)return[];const n=[];for(const o of Object.keys(r)){const a=e[o];if(a)if(a.type==="apiKey"){const i=a.in==="query"||a.in==="cookie"?a.in:"header";n.push({location:i,name:a.name,value:"YOUR_API_KEY"})}else if(a.type==="http"){const i=((s=a.scheme)==null?void 0:s.toLowerCase())==="basic";n.push({location:"header",name:"Authorization",value:i?"Basic BASE64_ENCODED_CREDENTIALS":"Bearer YOUR_ACCESS_TOKEN"})}else(a.type==="oauth2"||a.type==="openIdConnect")&&n.push({location:"header",name:"Authorization",value:"Bearer YOUR_ACCESS_TOKEN"})}return n}function Cs(t){const e=t==null?void 0:t.content;if(!e)return null;const r="application/json"in e?"application/json":Object.keys(e)[0];if(!r)return null;const n=e[r];let s=n.example;if(s===void 0&&n.examples){for(const o of Object.values(n.examples))if(o&&typeof o=="object"&&"value"in o&&o.value!==void 0){s=o.value;break}}return{contentType:r,schema:n.schema,authorExample:s}}function ks(t){const e=xs(t.servers),r=Es(e,t.path,t.parameters),n=Ps(t.security,t.securitySchemes),s=[],o=[],a=[];for(const c of n)(c.location==="header"?s:c.location==="query"?o:a).push({name:c.name,value:c.value});for(const c of t.parameters)c.in==="query"&&(c.required||js(c))&&o.push({name:c.name,value:Cn(c)});const i={method:t.method.toUpperCase(),url:r,httpVersion:"HTTP/1.1",headers:s,queryString:o,cookies:a};return t.media&&t.resolvedBodyValue!==void 0&&(s.push({name:"Content-Type",value:t.media.contentType}),i.postData={mimeType:t.media.contentType,text:JSON.stringify(t.resolvedBodyValue,null,2)}),i}function As(t,e,r){try{const n=new ws(t),[s]=n.convert(e,r);return typeof s=="string"?s:""}catch{return""}}const Rs={agent:"plaintext",c:"c",clojure:"clojure",crystal:"crystal",csharp:"csharp",go:"go",http:"http",java:"java",javascript:"javascript",json:"json",kotlin:"kotlin",node:"javascript",objc:"objectivec",ocaml:"ocaml",php:"php",powershell:"powershell",python:"python",r:"r",ruby:"ruby",rust:"rust",shell:"bash",swift:"swift"};function qs(t){return Rs[t]??"plaintext"}const Ns={c:()=>Promise.resolve().then(()=>require("./c-C_Sx7N-F.cjs")),clojure:()=>Promise.resolve().then(()=>require("./clojure-DWYEZwCD.cjs")),crystal:()=>Promise.resolve().then(()=>require("./crystal-BcGgviMR.cjs")),csharp:()=>Promise.resolve().then(()=>require("./csharp-yuAGIuP4.cjs")),go:()=>Promise.resolve().then(()=>require("./go-BpetKc7b.cjs")),http:()=>Promise.resolve().then(()=>require("./http--XH4hLDt.cjs")),java:()=>Promise.resolve().then(()=>require("./java-BIk0G-rH.cjs")),kotlin:()=>Promise.resolve().then(()=>require("./kotlin-kGuORR5a.cjs")),objectivec:()=>Promise.resolve().then(()=>require("./objectivec-CoeV81Tz.cjs")),ocaml:()=>Promise.resolve().then(()=>require("./ocaml-0j7KDjso.cjs")),php:()=>Promise.resolve().then(()=>require("./php-DF4zG2hq.cjs")),powershell:()=>Promise.resolve().then(()=>require("./powershell-CvydS3ek.cjs")),r:()=>Promise.resolve().then(()=>require("./r-CYaZnHkA.cjs")),ruby:()=>Promise.resolve().then(()=>require("./ruby-nPcbuC2a.cjs")),rust:()=>Promise.resolve().then(()=>require("./rust-DKnYCg2f.cjs")),swift:()=>Promise.resolve().then(()=>require("./swift-CAnH__EC.cjs"))};function Yt(t){return t==="plaintext"||!!ce.HighlightJS.getLanguage(t)}async function _s(t){if(Yt(t))return;const e=Ns[t];if(!e)return;const r=await e();ce.HighlightJS.registerLanguage(t,r.default)}const Ls=`${Ss}:${Os}`;function Is({method:t,path:e,parameters:r,requestBody:n,security:s,id:o}){var $;const{document:a,showCodeSamples:i}=ce.useDocumentContext(),c=a,l=re.useId(),f=re.useMemo(()=>Ts(),[]),[u,p]=re.useState(Ls),[d,h]=u.split(":"),y=qs(d),g=re.useMemo(()=>Cs(n),[n]),[v,m]=re.useState(void 0);re.useEffect(()=>{if(m(void 0),!g||g.authorExample!==void 0||!g.schema)return;let T=!1;return kn(g.schema).then(P=>{T||m(P)}),()=>{T=!0}},[g]);const[,b]=re.useState(()=>Yt(y));re.useEffect(()=>{b(Yt(y));let T=!1;return _s(y).then(()=>{T||b(!0)}),()=>{T=!0}},[y]);const S=re.useMemo(()=>{var T;return ks({method:t,path:e,servers:c.servers,parameters:r,security:s,securitySchemes:(T=c.components)==null?void 0:T.securitySchemes,media:g,resolvedBodyValue:(g==null?void 0:g.authorExample)??v})},[t,e,c.servers,r,s,($=c.components)==null?void 0:$.securitySchemes,g,v]),O=re.useMemo(()=>As(S,d,h),[S,d,h]);return i?ge.jsxs("div",{id:`endpoint-${o}-code-samples`,children:[ge.jsxs("div",{className:"flex items-center justify-between mb-2",children:[ge.jsx("label",{htmlFor:l,className:"text-xs font-medium text-foreground-muted uppercase tracking-wider",children:"Example Request"}),ge.jsx("select",{id:l,value:u,onChange:T=>p(T.target.value),"aria-label":"Code sample language",className:"text-xs font-medium rounded-md border border-border bg-surface px-2 py-1 text-foreground-secondary focus:border-secondary-500 focus:ring-secondary-500",children:f.map(T=>ge.jsx("optgroup",{label:T.title,children:T.clients.map(P=>ge.jsx("option",{value:`${T.key}:${P.key}`,children:P.title},P.key))},T.key))})]}),ge.jsx(ce.CodeBlock,{code:O,language:y})]}):null}exports.CodeSamples=Is;
47
+ `+e.prev}function Ke(t,e){var r=Ht(t),n=[];if(r){n.length=t.length;for(var s=0;s<t.length;s++)n[s]=ue(t,s)?e(t[s],t):""}var o=typeof vt=="function"?vt(t):[],a;if(qe){a={};for(var i=0;i<o.length;i++)a["$"+o[i]]=o[i]}for(var c in t)ue(t,c)&&(r&&String(Number(c))===c&&c<t.length||qe&&a["$"+c]instanceof Symbol||(Qr.call(/[^\w$]/,c)?n.push(e(c,t)+": "+e(t[c],t)):n.push(c+": "+e(t[c],t))));if(typeof vt=="function")for(var l=0;l<o.length;l++)Yr.call(t,o[l])&&n.push("["+e(o[l])+"]: "+e(t[o[l]],t));return n}var Go=ft,Jo=_e,ut=function(t,e,r){for(var n=t,s;(s=n.next)!=null;n=s)if(s.key===e)return n.next=s.next,r||(s.next=t.next,t.next=s),s},zo=function(t,e){if(t){var r=ut(t,e);return r&&r.value}},Vo=function(t,e,r){var n=ut(t,e);n?n.value=r:t.next={key:e,next:t.next,value:r}},Ko=function(t,e){return t?!!ut(t,e):!1},Do=function(t,e){if(t)return ut(t,e,!0)},Qo=function(){var e,r={assert:function(n){if(!r.has(n))throw new Jo("Side channel does not contain "+Go(n))},delete:function(n){var s=Do(e,n);return s&&e&&!e.next&&(e=void 0),!!s},get:function(n){return zo(e,n)},has:function(n){return Ko(e,n)},set:function(n,s){e||(e={next:void 0}),Vo(e,n,s)}};return r},nn=Object,Yo=Error,Xo=EvalError,Zo=RangeError,ei=ReferenceError,ti=SyntaxError,ri=URIError,ni=Math.abs,oi=Math.floor,ii=Math.max,ai=Math.min,si=Math.pow,ci=Math.round,li=Number.isNaN||function(e){return e!==e},fi=li,ui=function(e){return fi(e)||e===0?e:e<0?-1:1},pi=Object.getOwnPropertyDescriptor,Xe=pi;if(Xe)try{Xe([],"length")}catch{Xe=null}var on=Xe,Ze=Object.defineProperty||!1;if(Ze)try{Ze({},"a",{value:1})}catch{Ze=!1}var an=Ze,St,Er;function di(){return Er||(Er=1,St=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),n=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var s=42;e[r]=s;for(var o in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var i=Object.getOwnPropertyDescriptor(e,r);if(i.value!==s||i.enumerable!==!0)return!1}return!0}),St}var Ot,Pr;function hi(){if(Pr)return Ot;Pr=1;var t=typeof Symbol<"u"&&Symbol,e=di();return Ot=function(){return typeof t!="function"||typeof Symbol!="function"||typeof t("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},Ot}var Tt,Cr;function sn(){return Cr||(Cr=1,Tt=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Tt}var xt,kr;function cn(){if(kr)return xt;kr=1;var t=nn;return xt=t.getPrototypeOf||null,xt}var yi="Function.prototype.bind called on incompatible ",mi=Object.prototype.toString,gi=Math.max,bi="[object Function]",Ar=function(e,r){for(var n=[],s=0;s<e.length;s+=1)n[s]=e[s];for(var o=0;o<r.length;o+=1)n[o+e.length]=r[o];return n},$i=function(e,r){for(var n=[],s=r,o=0;s<e.length;s+=1,o+=1)n[o]=e[s];return n},vi=function(t,e){for(var r="",n=0;n<t.length;n+=1)r+=t[n],n+1<t.length&&(r+=e);return r},wi=function(e){var r=this;if(typeof r!="function"||mi.apply(r)!==bi)throw new TypeError(yi+r);for(var n=$i(arguments,1),s,o=function(){if(this instanceof s){var f=r.apply(this,Ar(n,arguments));return Object(f)===f?f:this}return r.apply(e,Ar(n,arguments))},a=gi(0,r.length-n.length),i=[],c=0;c<a;c++)i[c]="$"+c;if(s=Function("binder","return function ("+vi(i,",")+"){ return binder.apply(this,arguments); }")(o),r.prototype){var l=function(){};l.prototype=r.prototype,s.prototype=new l,l.prototype=null}return s},Si=wi,pt=Function.prototype.bind||Si,Zt=Function.prototype.call,jt,Rr;function ln(){return Rr||(Rr=1,jt=Function.prototype.apply),jt}var Oi=typeof Reflect<"u"&&Reflect&&Reflect.apply,Ti=pt,xi=ln(),ji=Zt,Ei=Oi,Pi=Ei||Ti.call(ji,xi),Ci=pt,ki=_e,Ai=Zt,Ri=Pi,fn=function(e){if(e.length<1||typeof e[0]!="function")throw new ki("a function is required");return Ri(Ci,Ai,e)},Et,qr;function qi(){if(qr)return Et;qr=1;var t=fn,e=on,r;try{r=[].__proto__===Array.prototype}catch(a){if(!a||typeof a!="object"||!("code"in a)||a.code!=="ERR_PROTO_ACCESS")throw a}var n=!!r&&e&&e(Object.prototype,"__proto__"),s=Object,o=s.getPrototypeOf;return Et=n&&typeof n.get=="function"?t([n.get]):typeof o=="function"?function(i){return o(i==null?i:s(i))}:!1,Et}var Pt,Nr;function Ni(){if(Nr)return Pt;Nr=1;var t=sn(),e=cn(),r=qi();return Pt=t?function(s){return t(s)}:e?function(s){if(!s||typeof s!="object"&&typeof s!="function")throw new TypeError("getProto: not an object");return e(s)}:r?function(s){return r(s)}:null,Pt}var Ct,_r;function _i(){if(_r)return Ct;_r=1;var t=Function.prototype.call,e=Object.prototype.hasOwnProperty,r=pt;return Ct=r.call(t,e),Ct}var E,Li=nn,Ii=Yo,Ui=Xo,Fi=Zo,Mi=ei,Ne=ti,ke=_e,Hi=ri,Bi=ni,Wi=oi,Gi=ii,Ji=ai,zi=si,Vi=ci,Ki=ui,un=Function,kt=function(t){try{return un('"use strict"; return ('+t+").constructor;")()}catch{}},We=on,Di=an,At=function(){throw new ke},Qi=We?(function(){try{return arguments.callee,At}catch{try{return We(arguments,"callee").get}catch{return At}}})():At,Oe=hi()(),F=Ni(),Yi=cn(),Xi=sn(),pn=ln(),Ge=Zt,xe={},Zi=typeof Uint8Array>"u"||!F?E:F(Uint8Array),we={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?E:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?E:ArrayBuffer,"%ArrayIteratorPrototype%":Oe&&F?F([][Symbol.iterator]()):E,"%AsyncFromSyncIteratorPrototype%":E,"%AsyncFunction%":xe,"%AsyncGenerator%":xe,"%AsyncGeneratorFunction%":xe,"%AsyncIteratorPrototype%":xe,"%Atomics%":typeof Atomics>"u"?E:Atomics,"%BigInt%":typeof BigInt>"u"?E:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?E:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?E:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?E:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Ii,"%eval%":eval,"%EvalError%":Ui,"%Float16Array%":typeof Float16Array>"u"?E:Float16Array,"%Float32Array%":typeof Float32Array>"u"?E:Float32Array,"%Float64Array%":typeof Float64Array>"u"?E:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?E:FinalizationRegistry,"%Function%":un,"%GeneratorFunction%":xe,"%Int8Array%":typeof Int8Array>"u"?E:Int8Array,"%Int16Array%":typeof Int16Array>"u"?E:Int16Array,"%Int32Array%":typeof Int32Array>"u"?E:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Oe&&F?F(F([][Symbol.iterator]())):E,"%JSON%":typeof JSON=="object"?JSON:E,"%Map%":typeof Map>"u"?E:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Oe||!F?E:F(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Li,"%Object.getOwnPropertyDescriptor%":We,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?E:Promise,"%Proxy%":typeof Proxy>"u"?E:Proxy,"%RangeError%":Fi,"%ReferenceError%":Mi,"%Reflect%":typeof Reflect>"u"?E:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?E:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Oe||!F?E:F(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?E:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Oe&&F?F(""[Symbol.iterator]()):E,"%Symbol%":Oe?Symbol:E,"%SyntaxError%":Ne,"%ThrowTypeError%":Qi,"%TypedArray%":Zi,"%TypeError%":ke,"%Uint8Array%":typeof Uint8Array>"u"?E:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?E:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?E:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?E:Uint32Array,"%URIError%":Hi,"%WeakMap%":typeof WeakMap>"u"?E:WeakMap,"%WeakRef%":typeof WeakRef>"u"?E:WeakRef,"%WeakSet%":typeof WeakSet>"u"?E:WeakSet,"%Function.prototype.call%":Ge,"%Function.prototype.apply%":pn,"%Object.defineProperty%":Di,"%Object.getPrototypeOf%":Yi,"%Math.abs%":Bi,"%Math.floor%":Wi,"%Math.max%":Gi,"%Math.min%":Ji,"%Math.pow%":zi,"%Math.round%":Vi,"%Math.sign%":Ki,"%Reflect.getPrototypeOf%":Xi};if(F)try{null.error}catch(t){var ea=F(F(t));we["%Error.prototype%"]=ea}var ta=function t(e){var r;if(e==="%AsyncFunction%")r=kt("async function () {}");else if(e==="%GeneratorFunction%")r=kt("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=kt("async function* () {}");else if(e==="%AsyncGenerator%"){var n=t("%AsyncGeneratorFunction%");n&&(r=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var s=t("%AsyncGenerator%");s&&F&&(r=F(s.prototype))}return we[e]=r,r},Lr={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Je=pt,ct=_i(),ra=Je.call(Ge,Array.prototype.concat),na=Je.call(pn,Array.prototype.splice),Ir=Je.call(Ge,String.prototype.replace),lt=Je.call(Ge,String.prototype.slice),oa=Je.call(Ge,RegExp.prototype.exec),ia=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,aa=/\\(\\)?/g,sa=function(e){var r=lt(e,0,1),n=lt(e,-1);if(r==="%"&&n!=="%")throw new Ne("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&r!=="%")throw new Ne("invalid intrinsic syntax, expected opening `%`");var s=[];return Ir(e,ia,function(o,a,i,c){s[s.length]=i?Ir(c,aa,"$1"):a||o}),s},ca=function(e,r){var n=e,s;if(ct(Lr,n)&&(s=Lr[n],n="%"+s[0]+"%"),ct(we,n)){var o=we[n];if(o===xe&&(o=ta(n)),typeof o>"u"&&!r)throw new ke("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:s,name:n,value:o}}throw new Ne("intrinsic "+e+" does not exist!")},er=function(e,r){if(typeof e!="string"||e.length===0)throw new ke("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new ke('"allowMissing" argument must be a boolean');if(oa(/^%?[^%]*%?$/,e)===null)throw new Ne("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=sa(e),s=n.length>0?n[0]:"",o=ca("%"+s+"%",r),a=o.name,i=o.value,c=!1,l=o.alias;l&&(s=l[0],na(n,ra([0,1],l)));for(var f=1,u=!0;f<n.length;f+=1){var d=n[f],p=lt(d,0,1),h=lt(d,-1);if((p==='"'||p==="'"||p==="`"||h==='"'||h==="'"||h==="`")&&p!==h)throw new Ne("property names with quotes must have matching quotes");if((d==="constructor"||!u)&&(c=!0),s+="."+d,a="%"+s+"%",ct(we,a))i=we[a];else if(i!=null){if(!(d in i)){if(!r)throw new ke("base intrinsic for "+e+" exists, but the property is not available.");return}if(We&&f+1>=n.length){var y=We(i,d);u=!!y,u&&"get"in y&&!("originalValue"in y.get)?i=y.get:i=i[d]}else u=ct(i,d),i=i[d];u&&!c&&(we[a]=i)}}return i},dn=er,hn=fn,la=hn([dn("%String.prototype.indexOf%")]),yn=function(e,r){var n=dn(e,!!r);return typeof n=="function"&&la(e,".prototype.")>-1?hn([n]):n},fa=er,ze=yn,ua=ft,pa=_e,Ur=fa("%Map%",!0),da=ze("Map.prototype.get",!0),ha=ze("Map.prototype.set",!0),ya=ze("Map.prototype.has",!0),ma=ze("Map.prototype.delete",!0),ga=ze("Map.prototype.size",!0),mn=!!Ur&&function(){var e,r={assert:function(n){if(!r.has(n))throw new pa("Side channel does not contain "+ua(n))},delete:function(n){if(e){var s=ma(e,n);return ga(e)===0&&(e=void 0),s}return!1},get:function(n){if(e)return da(e,n)},has:function(n){return e?ya(e,n):!1},set:function(n,s){e||(e=new Ur),ha(e,n,s)}};return r},ba=er,dt=yn,$a=ft,De=mn,va=_e,Te=ba("%WeakMap%",!0),wa=dt("WeakMap.prototype.get",!0),Sa=dt("WeakMap.prototype.set",!0),Oa=dt("WeakMap.prototype.has",!0),Ta=dt("WeakMap.prototype.delete",!0),xa=Te?function(){var e,r,n={assert:function(s){if(!n.has(s))throw new va("Side channel does not contain "+$a(s))},delete:function(s){if(Te&&s&&(typeof s=="object"||typeof s=="function")){if(e)return Ta(e,s)}else if(De&&r)return r.delete(s);return!1},get:function(s){return Te&&s&&(typeof s=="object"||typeof s=="function")&&e?wa(e,s):r&&r.get(s)},has:function(s){return Te&&s&&(typeof s=="object"||typeof s=="function")&&e?Oa(e,s):!!r&&r.has(s)},set:function(s,o){Te&&s&&(typeof s=="object"||typeof s=="function")?(e||(e=new Te),Sa(e,s,o)):De&&(r||(r=De()),r.set(s,o))}};return n}:De,ja=_e,Ea=ft,Pa=Qo,Ca=mn,ka=xa,Aa=ka||Ca||Pa,gn=function(){var e,r={assert:function(n){if(!r.has(n)){var s=n&&Object(n)===n?"the given object key":Ea(n);throw new ja("Side channel does not contain "+s)}},delete:function(n){return!!e&&e.delete(n)},get:function(n){return e&&e.get(n)},has:function(n){return!!e&&e.has(n)},set:function(n,s){e||(e=Aa()),e.set(n,s)}};return r},Ra=String.prototype.replace,qa=/%20/g,Rt={RFC1738:"RFC1738",RFC3986:"RFC3986"},tr={default:Rt.RFC3986,formatters:{RFC1738:function(t){return Ra.call(t,qa,"+")},RFC3986:function(t){return String(t)}},RFC1738:Rt.RFC1738,RFC3986:Rt.RFC3986},Na=tr,bn=gn,Fr=an,qt=Object.prototype.hasOwnProperty,be=Array.isArray,ht=bn(),$e=function(e,r){return ht.set(e,r),e},ve=function(e){return ht.has(e)},Ie=function(e){return ht.get(e)},Wt=function(e,r){ht.set(e,r)},ne=(function(){for(var t=[],e=0;e<256;++e)t[t.length]="%"+((e<16?"0":"")+e.toString(16)).toUpperCase();return t})(),_a=function(e){for(;e.length>1;){var r=e.pop(),n=r.obj[r.prop];if(be(n)){for(var s=[],o=0;o<n.length;++o)typeof n[o]<"u"&&(s[s.length]=n[o]);r.obj[r.prop]=s}}},Ce=function(e,r){for(var n=r&&r.plainObjects?{__proto__:null}:{},s=0;s<e.length;++s)typeof e[s]<"u"&&(n[s]=e[s]);return n},Gt=function(e,r,n){r==="__proto__"&&Fr?Fr(e,r,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[r]=n},La=function t(e,r,n){if(!r)return e;if(typeof r!="object"&&typeof r!="function"){if(be(e)){var s=e.length;if(n&&typeof n.arrayLimit=="number"&&s>=n.arrayLimit){if(n.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+n.arrayLimit+" element"+(n.arrayLimit===1?"":"s")+" allowed in an array.");return $e(Ce(e.concat(r),n),s)}e[s]=r}else if(e&&typeof e=="object")if(ve(e)){var o=Ie(e)+1;e[o]=r,Wt(e,o)}else{if(n&&n.strictMerge)return[e,r];(n&&(n.plainObjects||n.allowPrototypes)||!qt.call(Object.prototype,r))&&(e[r]=!0)}else return[e,r];return e}if(!e||typeof e!="object"){if(ve(r)){for(var a=Object.keys(r),i=n&&n.plainObjects?{__proto__:null,0:e}:{0:e},c=0;c<a.length;c++){var l=parseInt(a[c],10);i[l+1]=r[a[c]]}return $e(i,Ie(r)+1)}var f=[e].concat(r);if(n&&typeof n.arrayLimit=="number"&&f.length>n.arrayLimit){if(n.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+n.arrayLimit+" element"+(n.arrayLimit===1?"":"s")+" allowed in an array.");return $e(Ce(f,n),f.length-1)}return f}var u=e;if(be(e)&&!be(r)&&(u=Ce(e,n)),be(e)&&be(r)){if(r.forEach(function(d,p){if(qt.call(e,p)){var h=e[p];h&&typeof h=="object"&&d&&typeof d=="object"?e[p]=t(h,d,n):e[e.length]=d}else e[p]=d}),n&&typeof n.arrayLimit=="number"&&e.length>n.arrayLimit){if(n.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+n.arrayLimit+" element"+(n.arrayLimit===1?"":"s")+" allowed in an array.");return $e(Ce(e,n),e.length-1)}return e}return Object.keys(r).reduce(function(d,p){var h=r[p];if(qt.call(d,p)?Gt(d,p,t(d[p],h,n)):Gt(d,p,h),ve(r)&&!ve(d)&&$e(d,Ie(r)),ve(d)){var y=parseInt(p,10);String(y)===p&&y>=0&&y>Ie(d)&&Wt(d,y)}return d},u)},Ia=function(e,r){return Object.keys(r).reduce(function(n,s){return Gt(n,s,r[s]),n},e)},Ua=function(t,e,r){var n=t.replace(/\+/g," ");if(r==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},Qe=1024,Fa=function(e,r,n,s,o){if(e.length===0)return e;var a=e;if(typeof e=="symbol"?a=Symbol.prototype.toString.call(e):typeof e!="string"&&(a=String(e)),n==="iso-8859-1")return escape(a).replace(/%u[0-9a-f]{4}/gi,function(h){return"%26%23"+parseInt(h.slice(2),16)+"%3B"});for(var i="",c=0;c<a.length;c+=Qe){var l=a.length>=Qe?a.slice(c,c+Qe):a;if(c+Qe<a.length){var f=l.charCodeAt(l.length-1);f>=55296&&f<=56319&&(l=l.slice(0,-1),c-=1)}for(var u=[],d=0;d<l.length;++d){var p=l.charCodeAt(d);if(p===45||p===46||p===95||p===126||p>=48&&p<=57||p>=65&&p<=90||p>=97&&p<=122||o===Na.RFC1738&&(p===40||p===41)){u[u.length]=l.charAt(d);continue}if(p<128){u[u.length]=ne[p];continue}if(p<2048){u[u.length]=ne[192|p>>6]+ne[128|p&63];continue}if(p<55296||p>=57344){u[u.length]=ne[224|p>>12]+ne[128|p>>6&63]+ne[128|p&63];continue}d+=1,p=65536+((p&1023)<<10|l.charCodeAt(d)&1023),u[u.length]=ne[240|p>>18]+ne[128|p>>12&63]+ne[128|p>>6&63]+ne[128|p&63]}i+=u.join("")}return i},Ma=function(e){for(var r=[{obj:{o:e},prop:"o"}],n=bn(),s=0;s<r.length;++s)for(var o=r[s],a=o.obj[o.prop],i=Object.keys(a),c=0;c<i.length;++c){var l=i[c],f=a[l];typeof f=="object"&&f!==null&&!n.has(f)&&(r[r.length]={obj:a,prop:l},n.set(f,!0))}return _a(r),e},Ha=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Ba=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Wa=function(e,r,n,s,o){if(ve(e)){if(o)throw new RangeError("Array limit exceeded. Only "+n+" element"+(n===1?"":"s")+" allowed in an array.");var a=Ie(e)+1;return e[a]=r,Wt(e,a),e}var i=[].concat(e,r);if(i.length>n){if(o)throw new RangeError("Array limit exceeded. Only "+n+" element"+(n===1?"":"s")+" allowed in an array.");return $e(Ce(i,{plainObjects:s}),i.length-1)}return i},Ga=function(e,r){if(be(e)){for(var n=[],s=0;s<e.length;s+=1)n[n.length]=r(e[s]);return n}return r(e)},$n={arrayToObject:Ce,assign:Ia,combine:Wa,compact:Ma,decode:Ua,encode:Fa,isBuffer:Ba,isOverflow:ve,isRegExp:Ha,markOverflow:$e,maybeMap:Ga,merge:La},vn=gn,et=$n,He=tr,Ja=Object.prototype.hasOwnProperty,wn={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,r){return e+"["+r+"]"},repeat:function(e){return e}},oe=Array.isArray,za=Array.prototype.push,Sn=function(t,e){za.apply(t,oe(e)?e:[e])},Va=Date.prototype.toISOString,Mr=He.default,L={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:et.encode,encodeValuesOnly:!1,filter:void 0,format:Mr,formatter:He.formatters[Mr],indices:!1,serializeDate:function(e){return Va.call(e)},skipNulls:!1,strictNullHandling:!1},Ka=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},Nt={},Da=function t(e,r,n,s,o,a,i,c,l,f,u,d,p,h,y,g,$,m){for(var b=e,S=m,O=0,v=!1;(S=S.get(Nt))!==void 0&&!v;){var T=S.get(e);if(O+=1,typeof T<"u"){if(T===O)throw new RangeError("Cyclic object value");v=!0}typeof S.get(Nt)>"u"&&(O=0)}if(typeof f=="function"?b=f(r,b):b instanceof Date?b=p(b):n==="comma"&&oe(b)&&(b=et.maybeMap(b,function(w){return w instanceof Date?p(w):w})),b===null){if(a)return y(l&&!g?l(r,L.encoder,$,"key",h):r);b=""}if(Ka(b)||et.isBuffer(b)){if(l){var P=g?r:l(r,L.encoder,$,"key",h);return[y(P)+"="+y(l(b,L.encoder,$,"value",h))]}return[y(r)+"="+y(String(b))]}var A=[];if(typeof b>"u")return A;var U;if(n==="comma"&&oe(b))g&&l&&(b=et.maybeMap(b,function(w){return w==null?w:l(w)})),U=[{value:b.length>0?b.join(",")||null:void 0}];else if(oe(f))U=f;else{var Q=Object.keys(b);U=u?Q.sort(u):Q}var Y=c?String(r).replace(/\./g,"%2E"):String(r),_=s&&oe(b)&&b.length===1?Y+"[]":Y;if(o&&oe(b)&&b.length===0)return _+"[]";for(var J=0;J<U.length;++J){var B=U[J],V=typeof B=="object"&&B&&typeof B.value<"u"?B.value:b[B];if(!(i&&V===null)){var pe=d&&c?String(B).replace(/\./g,"%2E"):String(B),yt=oe(b)?typeof n=="function"?n(_,pe):_:_+(d?"."+pe:"["+pe+"]");m.set(e,O);var Ve=vn();Ve.set(Nt,m),Sn(A,t(V,yt,n,s,o,a,i,c,n==="comma"&&g&&oe(b)?null:l,f,u,d,p,h,y,g,$,Ve))}}return A},Qa=function(e){if(!e)return L;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var r=e.charset||L.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=He.default;if(typeof e.format<"u"){if(!Ja.call(He.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var s=He.formatters[n],o=L.filter;(typeof e.filter=="function"||oe(e.filter))&&(o=e.filter);var a;if(e.arrayFormat in wn?a=e.arrayFormat:"indices"in e?a=e.indices?"indices":"repeat":a=L.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var i=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:L.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:L.addQueryPrefix,allowDots:i,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:L.allowEmptyArrays,arrayFormat:a,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:L.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?L.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:L.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:L.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:L.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:L.encodeValuesOnly,filter:o,format:n,formatter:s,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:L.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:L.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:L.strictNullHandling}},Ya=function(t,e){var r=t,n=Qa(e),s,o;typeof n.filter=="function"?(o=n.filter,r=o("",r)):oe(n.filter)&&(o=n.filter,s=o);var a=[];if(typeof r!="object"||r===null)return"";var i=wn[n.arrayFormat],c=i==="comma"&&n.commaRoundTrip;s||(s=Object.keys(r)),n.sort&&s.sort(n.sort);for(var l=vn(),f=0;f<s.length;++f){var u=s[f];if(!(typeof u>"u"||u===null)){var d=r[u];n.skipNulls&&d===null||Sn(a,Da(d,u,i,c,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,l))}}var p=a.join(n.delimiter),h=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?h+="utf8=%26%2310003%3B"+n.delimiter:h+="utf8=%E2%9C%93"+n.delimiter),p.length>0?h+p:""},se=$n,tt=Object.prototype.hasOwnProperty,_t=Array.isArray,q={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:se.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictMerge:!0,strictNullHandling:!1,throwOnLimitExceeded:!1},Xa=function(t){return t.replace(/&#(\d+);/g,function(e,r){return String.fromCharCode(parseInt(r,10))})},On=function(t,e,r,n){if(t&&typeof t=="string"&&e.comma&&t.indexOf(",")>-1){if(n&&e.throwOnLimitExceeded)for(var s=0,o=t.indexOf(",");o>-1;){if(s+=1,s>=e.arrayLimit)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(e.arrayLimit===1?"":"s")+" allowed in an array.");o=t.indexOf(",",o+1)}return t.split(",")}if(e.throwOnLimitExceeded&&r>=e.arrayLimit)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(e.arrayLimit===1?"":"s")+" allowed in an array.");return t},Za="utf8=%26%2310003%3B",es="utf8=%E2%9C%93",ts=function(e,r){var n={__proto__:null},s=r.ignoreQueryPrefix?e.replace(/^\?/,""):e;s=s.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=r.parameterLimit===1/0?void 0:r.parameterLimit,a=s.split(r.delimiter,r.throwOnLimitExceeded&&typeof o<"u"?o+1:o);if(r.throwOnLimitExceeded&&typeof o<"u"&&a.length>o)throw new RangeError("Parameter limit exceeded. Only "+o+" parameter"+(o===1?"":"s")+" allowed.");var i=-1,c,l=r.charset;if(r.charsetSentinel)for(c=0;c<a.length;++c)a[c].indexOf("utf8=")===0&&(a[c]===es?l="utf-8":a[c]===Za&&(l="iso-8859-1"),i=c,c=a.length);for(c=0;c<a.length;++c)if(c!==i){var f=a[c],u=f.indexOf("]="),d=u===-1?f.indexOf("="):u+1,p,h;if(d===-1?(p=r.decoder(f,q.decoder,l,"key"),h=r.strictNullHandling?null:""):(p=r.decoder(f.slice(0,d),q.decoder,l,"key"),p!==null&&(h=se.maybeMap(On(f.slice(d+1),r,_t(n[p])?n[p].length:0,f.indexOf("[]=")===-1),function(g){return r.decoder(g,q.decoder,l,"value")}))),h&&r.interpretNumericEntities&&l==="iso-8859-1"&&(h=Xa(String(h))),f.indexOf("[]=")>-1&&(h=_t(h)?[h]:h),r.comma&&_t(h)&&h.length>r.arrayLimit&&(h=se.combine([],h,r.arrayLimit,r.plainObjects,r.throwOnLimitExceeded)),p!==null){var y=tt.call(n,p);y&&(r.duplicates==="combine"||f.indexOf("[]=")>-1)?n[p]=se.combine(n[p],h,r.arrayLimit,r.plainObjects,r.throwOnLimitExceeded):(!y||r.duplicates==="last")&&(n[p]=h)}}return n},rs=function(t,e,r,n){var s=0;if(t.length>0&&t[t.length-1]==="[]"){var o=t.slice(0,-1).join("");s=Array.isArray(e)&&e[o]?e[o].length:0}for(var a=n?e:On(e,r,s),i=t.length-1;i>=0;--i){var c,l=t[i];if(l==="[]"&&r.parseArrays)se.isOverflow(a)?c=a:c=r.allowEmptyArrays&&(a===""||r.strictNullHandling&&a===null)?[]:se.combine([],a,r.arrayLimit,r.plainObjects,r.throwOnLimitExceeded);else{c=r.plainObjects?{__proto__:null}:{};var f=l.charAt(0)==="["&&l.charAt(l.length-1)==="]"?l.slice(1,-1):l,u=r.decodeDotInKeys?f.replace(/%2E/g,"."):f,d=parseInt(u,10),p=!isNaN(d)&&l!==u&&String(d)===u&&d>=0&&r.parseArrays;if(!r.parseArrays&&u==="")c={0:a};else if(p&&d<r.arrayLimit)c=[],c[d]=a;else{if(p&&r.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+r.arrayLimit+" element"+(r.arrayLimit===1?"":"s")+" allowed in an array.");p?(c[d]=a,se.markOverflow(c,d)):u!=="__proto__"&&(c[u]=a)}}a=c}return a},ns=function(e,r){var n=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e;if(r.depth<=0)return!r.plainObjects&&tt.call(Object.prototype,n)&&!r.allowPrototypes?void 0:[n];var s=[],o=n.indexOf("["),a=o>=0?n.slice(0,o):n;if(a){if(!r.plainObjects&&tt.call(Object.prototype,a)&&!r.allowPrototypes)return;s[s.length]=a}for(var i=n.length,c=o,l=0;c>=0&&l<r.depth;){for(var f=1,u=c+1,d=-1;u<i&&d<0;){var p=n.charCodeAt(u);p===91?f+=1:p===93&&(f-=1,f===0&&(d=u)),u+=1}if(d<0)return s[s.length]="["+n.slice(c)+"]",s;var h=n.slice(c,d+1),y=h.slice(1,-1);if(!r.plainObjects&&tt.call(Object.prototype,y)&&!r.allowPrototypes)return;s[s.length]=h,l+=1,c=n.indexOf("[",d+1)}if(c>=0){if(r.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+r.depth+" and strictDepth is true");s[s.length]="["+n.slice(c)+"]"}return s},os=function(e,r,n,s){if(e){var o=ns(e,n);if(o)return rs(o,r,n,s)}},is=function(e){if(!e)return q;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.decodeDotInKeys<"u"&&typeof e.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(e.decoder!==null&&typeof e.decoder<"u"&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof e.throwOnLimitExceeded<"u"&&typeof e.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var r=typeof e.charset>"u"?q.charset:e.charset,n=typeof e.duplicates>"u"?q.duplicates:e.duplicates;if(n!=="combine"&&n!=="first"&&n!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var s=typeof e.allowDots>"u"?e.decodeDotInKeys===!0?!0:q.allowDots:!!e.allowDots;return{allowDots:s,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:q.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:q.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:q.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:q.arrayLimit,charset:r,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:q.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:q.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:q.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:q.decoder,delimiter:typeof e.delimiter=="string"||se.isRegExp(e.delimiter)?e.delimiter:q.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:q.depth,duplicates:n,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:q.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:q.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:q.plainObjects,strictDepth:typeof e.strictDepth=="boolean"?!!e.strictDepth:q.strictDepth,strictMerge:typeof e.strictMerge=="boolean"?!!e.strictMerge:q.strictMerge,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:q.strictNullHandling,throwOnLimitExceeded:typeof e.throwOnLimitExceeded=="boolean"?e.throwOnLimitExceeded:!1}},as=function(t,e){var r=is(e);if(t===""||t===null||typeof t>"u")return r.plainObjects?{__proto__:null}:{};for(var n=typeof t=="string"?ts(t,r):t,s=r.plainObjects?{__proto__:null}:{},o=Object.keys(n),a=0;a<o.length;++a){var i=o[a],c=os(i,n[i],r,typeof t=="string");s=se.merge(s,c,r)}return r.allowSparse===!0?s:se.compact(s)},ss=Ya,cs=as,ls=tr,rt={formats:ls,parse:cs,stringify:ss},fs=po;function ee(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var us=/^([a-z0-9.+-]+:)/i,ps=/:[0-9]*$/,ds=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,hs=["<",">",'"',"`"," ","\r",`
48
+ `," "],ys=["{","}","|","\\","^","`"].concat(hs),Jt=["'"].concat(ys),Hr=["%","/","?",";","#"].concat(Jt),Br=["/","?","#"],ms=255,Wr=/^[+a-z0-9A-Z_-]{0,63}$/,gs=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,bs={javascript:!0,"javascript:":!0},zt={javascript:!0,"javascript:":!0},Ae={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Vt=rt;function rr(t,e,r){if(t&&typeof t=="object"&&t instanceof ee)return t;var n=new ee;return n.parse(t,e,r),n}ee.prototype.parse=function(t,e,r){if(typeof t!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var n=t.indexOf("?"),s=n!==-1&&n<t.indexOf("#")?"?":"#",o=t.split(s),a=/\\/g;o[0]=o[0].replace(a,"/"),t=o.join(s);var i=t;if(i=i.trim(),!r&&t.split("#").length===1){var c=ds.exec(i);if(c)return this.path=i,this.href=i,this.pathname=c[1],c[2]?(this.search=c[2],e?this.query=Vt.parse(this.search.substr(1)):this.query=this.search.substr(1)):e&&(this.search="",this.query={}),this}var l=us.exec(i);if(l){l=l[0];var f=l.toLowerCase();this.protocol=f,i=i.substr(l.length)}if(r||l||i.match(/^\/\/[^@/]+@[^@/]+/)){var u=i.substr(0,2)==="//";u&&!(l&&zt[l])&&(i=i.substr(2),this.slashes=!0)}if(!zt[l]&&(u||l&&!Ae[l])){for(var d=-1,p=0;p<Br.length;p++){var h=i.indexOf(Br[p]);h!==-1&&(d===-1||h<d)&&(d=h)}var y,g;d===-1?g=i.lastIndexOf("@"):g=i.lastIndexOf("@",d),g!==-1&&(y=i.slice(0,g),i=i.slice(g+1),this.auth=decodeURIComponent(y)),d=-1;for(var p=0;p<Hr.length;p++){var h=i.indexOf(Hr[p]);h!==-1&&(d===-1||h<d)&&(d=h)}d===-1&&(d=i.length),this.host=i.slice(0,d),i=i.slice(d),this.parseHost(),this.hostname=this.hostname||"";var $=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!$)for(var m=this.hostname.split(/\./),p=0,b=m.length;p<b;p++){var S=m[p];if(S&&!S.match(Wr)){for(var O="",v=0,T=S.length;v<T;v++)S.charCodeAt(v)>127?O+="x":O+=S[v];if(!O.match(Wr)){var P=m.slice(0,p),A=m.slice(p+1),U=S.match(gs);U&&(P.push(U[1]),A.unshift(U[2])),A.length&&(i="/"+A.join(".")+i),this.hostname=P.join(".");break}}}this.hostname.length>ms?this.hostname="":this.hostname=this.hostname.toLowerCase(),$||(this.hostname=fs.toASCII(this.hostname));var Q=this.port?":"+this.port:"",Y=this.hostname||"";this.host=Y+Q,this.href+=this.host,$&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),i[0]!=="/"&&(i="/"+i))}if(!bs[f])for(var p=0,b=Jt.length;p<b;p++){var _=Jt[p];if(i.indexOf(_)!==-1){var J=encodeURIComponent(_);J===_&&(J=escape(_)),i=i.split(_).join(J)}}var B=i.indexOf("#");B!==-1&&(this.hash=i.substr(B),i=i.slice(0,B));var V=i.indexOf("?");if(V!==-1?(this.search=i.substr(V),this.query=i.substr(V+1),e&&(this.query=Vt.parse(this.query)),i=i.slice(0,V)):e&&(this.search="",this.query={}),i&&(this.pathname=i),Ae[f]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var Q=this.pathname||"",pe=this.search||"";this.path=Q+pe}return this.href=this.format(),this};function $s(t){return typeof t=="string"&&(t=rr(t)),t instanceof ee?t.format():ee.prototype.format.call(t)}ee.prototype.format=function(){var t=this.auth||"";t&&(t=encodeURIComponent(t),t=t.replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",n=this.hash||"",s=!1,o="";this.host?s=t+this.host:this.hostname&&(s=t+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(o=Vt.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var a=this.search||o&&"?"+o||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||Ae[e])&&s!==!1?(s="//"+(s||""),r&&r.charAt(0)!=="/"&&(r="/"+r)):s||(s=""),n&&n.charAt(0)!=="#"&&(n="#"+n),a&&a.charAt(0)!=="?"&&(a="?"+a),r=r.replace(/[?#]/g,function(i){return encodeURIComponent(i)}),a=a.replace("#","%23"),e+s+r+a+n};ee.prototype.resolve=function(t){return this.resolveObject(rr(t,!1,!0)).format()};ee.prototype.resolveObject=function(t){if(typeof t=="string"){var e=new ee;e.parse(t,!1,!0),t=e}for(var r=new ee,n=Object.keys(this),s=0;s<n.length;s++){var o=n[s];r[o]=this[o]}if(r.hash=t.hash,t.href==="")return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var a=Object.keys(t),i=0;i<a.length;i++){var c=a[i];c!=="protocol"&&(r[c]=t[c])}return Ae[r.protocol]&&r.hostname&&!r.pathname&&(r.pathname="/",r.path=r.pathname),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!Ae[t.protocol]){for(var l=Object.keys(t),f=0;f<l.length;f++){var u=l[f];r[u]=t[u]}return r.href=r.format(),r}if(r.protocol=t.protocol,!t.host&&!zt[t.protocol]){for(var b=(t.pathname||"").split("/");b.length&&!(t.host=b.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),b[0]!==""&&b.unshift(""),b.length<2&&b.unshift(""),r.pathname=b.join("/")}else r.pathname=t.pathname;if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var d=r.pathname||"",p=r.search||"";r.path=d+p}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var h=r.pathname&&r.pathname.charAt(0)==="/",y=t.host||t.pathname&&t.pathname.charAt(0)==="/",g=y||h||r.host&&t.pathname,$=g,m=r.pathname&&r.pathname.split("/")||[],b=t.pathname&&t.pathname.split("/")||[],S=r.protocol&&!Ae[r.protocol];if(S&&(r.hostname="",r.port=null,r.host&&(m[0]===""?m[0]=r.host:m.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(b[0]===""?b[0]=t.host:b.unshift(t.host)),t.host=null),g=g&&(b[0]===""||m[0]==="")),y)r.host=t.host||t.host===""?t.host:r.host,r.hostname=t.hostname||t.hostname===""?t.hostname:r.hostname,r.search=t.search,r.query=t.query,m=b;else if(b.length)m||(m=[]),m.pop(),m=m.concat(b),r.search=t.search,r.query=t.query;else if(t.search!=null){if(S){r.host=m.shift(),r.hostname=r.host;var O=r.host&&r.host.indexOf("@")>0?r.host.split("@"):!1;O&&(r.auth=O.shift(),r.hostname=O.shift(),r.host=r.hostname)}return r.search=t.search,r.query=t.query,(r.pathname!==null||r.search!==null)&&(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!m.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var v=m.slice(-1)[0],T=(r.host||t.host||m.length>1)&&(v==="."||v==="..")||v==="",P=0,A=m.length;A>=0;A--)v=m[A],v==="."?m.splice(A,1):v===".."?(m.splice(A,1),P++):P&&(m.splice(A,1),P--);if(!g&&!$)for(;P--;P)m.unshift("..");g&&m[0]!==""&&(!m[0]||m[0].charAt(0)!=="/")&&m.unshift(""),T&&m.join("/").substr(-1)!=="/"&&m.push("");var U=m[0]===""||m[0]&&m[0].charAt(0)==="/";if(S){r.hostname=U?"":m.length?m.shift():"",r.host=r.hostname;var O=r.host&&r.host.indexOf("@")>0?r.host.split("@"):!1;O&&(r.auth=O.shift(),r.hostname=O.shift(),r.host=r.hostname)}return g=g||r.host&&m.length,g&&!U&&m.unshift(""),m.length>0?r.pathname=m.join("/"):(r.pathname=null,r.path=null),(r.pathname!==null||r.search!==null)&&(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r};ee.prototype.parseHost=function(){var t=this.host,e=ps.exec(t);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};var vs=rr,Gr=$s;const ws=()=>Object.keys(Pe).map(t=>({...Pe[t].info,clients:Object.keys(Pe[t].clientsById).map(e=>Pe[t].clientsById[e].info)})),Ss=t=>typeof t=="object"&&"log"in t&&typeof t.log=="object"&&"entries"in t.log&&Array.isArray(t.log.entries);var Os=class{constructor(t,e={}){this.initCalled=!1,this.entries=[],this.requests=[],this.options={},this.options={harIsAlreadyEncoded:!1,...e},this.requests=[],Ss(t)?this.entries=t.log.entries:this.entries=[{request:t}]}init(){return this.initCalled=!0,this.requests=this.entries.map(({request:t})=>{var r;const e={bodySize:0,headersSize:0,headers:[],cookies:[],httpVersion:"HTTP/1.1",queryString:[],postData:{mimeType:((r=t.postData)==null?void 0:r.mimeType)||"application/octet-stream"},...t};return e.postData&&!e.postData.mimeType&&(e.postData.mimeType="application/octet-stream"),this.prepare(e,this.options)}),this}prepare(t,e){var f,u,d;const r={...t,fullUrl:"",uriObj:{},queryObj:{},headersObj:{},cookiesObj:{},allHeaders:{}};if(r!=null&&r.queryString.length&&(r.queryObj=r.queryString.reduce(hr,{})),r!=null&&r.headers.length){const p=/^HTTP\/2/;r.headersObj=r.headers.reduce((h,{name:y,value:g})=>{const $=p.exec(r.httpVersion)?y.toLocaleLowerCase():y;return{...h,[$]:g}},{})}r!=null&&r.cookies.length&&(r.cookiesObj=r.cookies.reduceRight((p,{name:h,value:y})=>({...p,[h]:y}),{}));const n=(f=r.cookies)==null?void 0:f.map(({name:p,value:h})=>e.harIsAlreadyEncoded?`${p}=${h}`:`${encodeURIComponent(p)}=${encodeURIComponent(h)}`);switch(n!=null&&n.length&&(r.allHeaders.cookie=n.join("; ")),r.postData.mimeType){case"multipart/mixed":case"multipart/related":case"multipart/form-data":case"multipart/alternative":if(r.postData.text="",r.postData.mimeType="multipart/form-data",(u=r.postData)!=null&&u.params){const p="---011000010111000001101001",h=`${p}--`,y=`\r
49
+ `;/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */const g=S=>S.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),$=S=>S.replace(/\r?\n|\r/g,`\r
50
+ `),m=[`--${p}`];(d=r.postData)==null||d.params.forEach((S,O)=>{const v=S.name,T=S.value||"",P=S.fileName||null,A=S.contentType||"application/octet-stream";P?(m.push(`Content-Disposition: form-data; name="${g($(v))}"; filename="${P}"`),m.push(`Content-Type: ${A}`)):m.push(`Content-Disposition: form-data; name="${escape($(v))}"`),m.push(""),m.push($(T)),O!==r.postData.params.length-1&&m.push(`--${p}`)}),m.push(`--${h}`),r.postData.boundary=p,r.postData.text=m.join(y);const b=G(r.headersObj,"content-type")||"content-type";r.headersObj[b]=`multipart/form-data; boundary=${p}`}break;case"application/x-www-form-urlencoded":r.postData.params?(r.postData.paramsObj=r.postData.params.reduce(hr,{}),r.postData.text=rt.stringify(r.postData.paramsObj)):r.postData.text="";break;case"text/json":case"text/x-json":case"application/json":case"application/x-json":if(r.postData.mimeType="application/json",r.postData.text)try{r.postData.jsonObj=JSON.parse(r.postData.text)}catch{r.postData.mimeType="text/plain"}break}const s={...r.allHeaders,...r.headersObj},o=vs(r.url,!0,!0);r.queryObj={...r.queryObj,...o.query};let a;e.harIsAlreadyEncoded?a=rt.stringify(r.queryObj,{encode:!1,indices:!1}):a=rt.stringify(r.queryObj,{indices:!1});const i={...o,query:r.queryObj,search:a,path:a?`${o.pathname}?${a}`:o.pathname},c=Gr({...o,query:null,search:null}),l=Gr({...o,...i});return{...r,allHeaders:s,fullUrl:l,url:c,uriObj:i}}convert(t,e,r){this.initCalled||this.init(),!r&&e&&(r={clientId:e});const n=Pe[t];if(!n)return[!1];const{convert:s}=n.clientsById[e||n.info.default];return this.requests.map(o=>s(o,r))}installation(t,e,r){this.initCalled||this.init(),!r&&e&&(r={clientId:e});const n=Pe[t];if(!n)return[!1];const{info:s}=n.clientsById[e||n.info.default];return this.requests.map(o=>s!=null&&s.installation?s.installation(o,r):!1)}};const Ts="agent",xs="prompt";function js(){return ws()}function Es(t){var n;const e=t==null?void 0:t[0];if(!e)return"http://localhost";let r=e.url;for(const[s,o]of Object.entries(e.variables??{})){const a=o.default??((n=o.enum)==null?void 0:n[0])??`{${s}}`;r=r.replace(new RegExp(`\\{${s}\\}`,"g"),String(a))}return r}function Ps(t){if(t.example!==void 0||t.examples&&Object.keys(t.examples).length>0)return!0;const e=t.schema;return!!((e==null?void 0:e.example)!==void 0||e!=null&&e.enum&&e.enum.length>0)}function Tn(t){if(t.example!==void 0)return String(t.example);if(t.examples){for(const r of Object.values(t.examples))if(r&&typeof r=="object"&&"value"in r&&r.value!==void 0)return String(r.value)}const e=t.schema;return(e==null?void 0:e.example)!==void 0?String(e.example):e!=null&&e.enum&&e.enum.length>0?String(e.enum[0]):`{${t.name}}`}function Cs(t,e,r){const n=e.replace(/\{([^}]+)\}/g,(s,o)=>{const a=r.find(c=>c.in==="path"&&c.name===o);if(!a)return s;const i=Tn(a);return i===`{${o}}`?i:encodeURIComponent(i)});return`${t.replace(/\/$/,"")}${n}`}function ks(t,e){var s;const r=t[0];if(!r||!e)return[];const n=[];for(const o of Object.keys(r)){const a=e[o];if(a)if(a.type==="apiKey"){const i=a.in==="query"||a.in==="cookie"?a.in:"header";n.push({location:i,name:a.name,value:"YOUR_API_KEY"})}else if(a.type==="http"){const i=((s=a.scheme)==null?void 0:s.toLowerCase())==="basic";n.push({location:"header",name:"Authorization",value:i?"Basic BASE64_ENCODED_CREDENTIALS":"Bearer YOUR_ACCESS_TOKEN"})}else(a.type==="oauth2"||a.type==="openIdConnect")&&n.push({location:"header",name:"Authorization",value:"Bearer YOUR_ACCESS_TOKEN"})}return n}function As(t){const e=t==null?void 0:t.content;if(!e)return null;const r="application/json"in e?"application/json":Object.keys(e)[0];if(!r)return null;const n=e[r];let s=n.example;if(s===void 0&&n.examples){for(const o of Object.values(n.examples))if(o&&typeof o=="object"&&"value"in o&&o.value!==void 0){s=o.value;break}}return{contentType:r,schema:n.schema,authorExample:s}}function Rs(t){const e=Es(t.servers),r=Cs(e,t.path,t.parameters),n=ks(t.security,t.securitySchemes),s=[],o=[],a=[];for(const c of n)(c.location==="header"?s:c.location==="query"?o:a).push({name:c.name,value:c.value});for(const c of t.parameters)c.in==="query"&&(c.required||Ps(c))&&o.push({name:c.name,value:Tn(c)});const i={method:t.method.toUpperCase(),url:r,httpVersion:"HTTP/1.1",headers:s,queryString:o,cookies:a};return t.media&&t.resolvedBodyValue!==void 0&&(s.push({name:"Content-Type",value:t.media.contentType}),i.postData={mimeType:t.media.contentType,text:JSON.stringify(t.resolvedBodyValue,null,2)}),i}function qs(t,e,r){try{const n=new Os(t),[s]=n.convert(e,r);return typeof s=="string"?s:""}catch{return""}}const Ns={agent:"plaintext",c:"c",clojure:"clojure",crystal:"crystal",csharp:"csharp",go:"go",http:"http",java:"java",javascript:"javascript",json:"json",kotlin:"kotlin",node:"javascript",objc:"objectivec",ocaml:"ocaml",php:"php",powershell:"powershell",python:"python",r:"r",ruby:"ruby",rust:"rust",shell:"bash",swift:"swift"};function _s(t){return Ns[t]??"plaintext"}const Ls={c:()=>Promise.resolve().then(()=>require("./c-C_Sx7N-F.cjs")),clojure:()=>Promise.resolve().then(()=>require("./clojure-DWYEZwCD.cjs")),crystal:()=>Promise.resolve().then(()=>require("./crystal-BcGgviMR.cjs")),csharp:()=>Promise.resolve().then(()=>require("./csharp-yuAGIuP4.cjs")),go:()=>Promise.resolve().then(()=>require("./go-BpetKc7b.cjs")),http:()=>Promise.resolve().then(()=>require("./http--XH4hLDt.cjs")),java:()=>Promise.resolve().then(()=>require("./java-BIk0G-rH.cjs")),kotlin:()=>Promise.resolve().then(()=>require("./kotlin-kGuORR5a.cjs")),objectivec:()=>Promise.resolve().then(()=>require("./objectivec-CoeV81Tz.cjs")),ocaml:()=>Promise.resolve().then(()=>require("./ocaml-0j7KDjso.cjs")),php:()=>Promise.resolve().then(()=>require("./php-DF4zG2hq.cjs")),powershell:()=>Promise.resolve().then(()=>require("./powershell-CvydS3ek.cjs")),r:()=>Promise.resolve().then(()=>require("./r-CYaZnHkA.cjs")),ruby:()=>Promise.resolve().then(()=>require("./ruby-nPcbuC2a.cjs")),rust:()=>Promise.resolve().then(()=>require("./rust-DKnYCg2f.cjs")),swift:()=>Promise.resolve().then(()=>require("./swift-CAnH__EC.cjs"))};function Kt(t){return t==="plaintext"||!!ce.HighlightJS.getLanguage(t)}async function Is(t){if(Kt(t))return;const e=Ls[t];if(!e)return;const r=await e();ce.HighlightJS.registerLanguage(t,r.default)}const Us=`${Ts}:${xs}`;function Fs({method:t,path:e,parameters:r,requestBody:n,security:s,id:o}){var v;const{document:a,showCodeSamples:i}=ce.useDocumentContext(),c=a,l=re.useId(),f=re.useMemo(()=>js(),[]),[u,d]=re.useState(Us),[p,h]=u.split(":"),y=_s(p),g=re.useMemo(()=>As(n),[n]),[$,m]=re.useState(void 0);re.useEffect(()=>{if(m(void 0),!g||g.authorExample!==void 0||!g.schema)return;let T=!1;return xn(g.schema).then(P=>{T||m(P)}),()=>{T=!0}},[g]);const[,b]=re.useState(()=>Kt(y));re.useEffect(()=>{b(Kt(y));let T=!1;return Is(y).then(()=>{T||b(!0)}),()=>{T=!0}},[y]);const S=re.useMemo(()=>{var T;return Rs({method:t,path:e,servers:c.servers,parameters:r,security:s,securitySchemes:(T=c.components)==null?void 0:T.securitySchemes,media:g,resolvedBodyValue:(g==null?void 0:g.authorExample)??$})},[t,e,c.servers,r,s,(v=c.components)==null?void 0:v.securitySchemes,g,$]),O=re.useMemo(()=>qs(S,p,h),[S,p,h]);return i?ge.jsxs("div",{id:`endpoint-${o}-code-samples`,children:[ge.jsxs("div",{className:"flex items-center justify-between mb-2",children:[ge.jsx("label",{htmlFor:l,className:"text-xs font-medium text-foreground-muted uppercase tracking-wider",children:"Example Request"}),ge.jsx("select",{id:l,value:u,onChange:T=>d(T.target.value),"aria-label":"Code sample language",className:"text-xs font-medium rounded-md border border-border bg-surface px-2 py-1 text-foreground-secondary focus:border-secondary-500 focus:ring-secondary-500",children:f.map(T=>ge.jsx("optgroup",{label:T.title,children:T.clients.map(P=>ge.jsx("option",{value:`${T.key}:${P.key}`,children:P.title},P.key))},T.key))})]}),ge.jsx(ce.CodeBlock,{code:O,language:y})]}):null}exports.CodeSamples=Fs;