@nice2dev/ui-api 1.4.23 → 1.4.25

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.
package/dist/core.cjs CHANGED
@@ -1,12 +1,12 @@
1
- "use strict";var Un=Object.defineProperty;var qn=(e,t,n)=>t in e?Un(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var xe=(e,t,n)=>qn(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const In=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"],Pn=["inherit","none","apiKey","bearer","basic","digest","oauth2","awsSigV4","hmac","mtls","custom"];let Fe=0;function ke(e="r"){return Fe=(Fe+1)%1e6,`${e}${Date.now().toString(36)}${Fe.toString(36)}${Math.random().toString(36).slice(2,6)}`}function he(e={}){return{...e,kind:"request",id:e.id??ke("r"),name:e.name??"New request",method:e.method??"GET",url:e.url??"",params:e.params??[],body:e.body??{kind:"none"}}}function ge(e={}){return{...e,kind:"folder",id:e.id??ke("f"),name:e.name??"New folder",items:e.items??[]}}function ye(e={}){return{...e,id:e.id??ke("c"),name:e.name??"New API",items:e.items??[],variables:e.variables??[]}}function $e(e,t=[]){const n=[];for(const s of e)s.kind==="folder"?n.push(...$e(s.items,[...t,s])):n.push({request:s,folders:[...t]});return n}function Rt(e,t){for(const n of e){if(n.id===t)return n;if(n.kind==="folder"){const s=Rt(n.items,t);if(s)return s}}}function Ht(e,t,n){const s=[];for(const r of e)if(r.id===t){const o=n(r);o&&s.push(o)}else r.kind==="folder"?s.push({...r,items:Ht(r.items,t,n)}):s.push(r);return s}function I(e){return e.enabled!==!1}function Ln(e){const t={};for(const n of e)I(n)&&(t[n.key]=n.value);return t}function Dt(e,t){return e.params.filter(n=>n.in===t&&I(n))}function Rn(e,t){var s;const n=t.toLowerCase();return(s=Dt(e,"header").find(r=>r.key.toLowerCase()===n))==null?void 0:s.value}function Mt(e,t=[],n){const s=[e.auth,...[...t].reverse().map(r=>r.auth),n==null?void 0:n.auth];for(const r of s)if(r&&r.type!=="inherit")return r;return{type:"none"}}function we(e){switch(e.kind){case"json":case"graphql":return"application/json";case"xml":return"application/xml";case"text":return e.contentType??"text/plain";case"form":return"application/x-www-form-urlencoded";case"multipart":return"multipart/form-data";case"binary":return e.contentType??"application/octet-stream";case"soap":return e.version==="1.2"?`application/soap+xml; charset=utf-8${e.action?`; action="${e.action}"`:""}`:"text/xml; charset=utf-8";default:return}}function re(e){var t;switch(e.kind){case"json":case"xml":case"text":return e.text;case"form":return e.fields.filter(I).map(n=>`${encodeURIComponent(n.key)}=${encodeURIComponent(n.value)}`).join("&");case"graphql":{const n={query:e.query};if((t=e.variables)!=null&&t.trim())try{n.variables=JSON.parse(e.variables)}catch{n.variables=e.variables}return e.operationName&&(n.operationName=e.operationName),JSON.stringify(n)}case"soap":return e.envelope;default:return}}function ut(e,t){const n=(t??"").toLowerCase();return n.includes("x-www-form-urlencoded")?{kind:"form",fields:ft(e)}:n.includes("soap+xml")?{kind:"soap",envelope:e,version:"1.2"}:n.includes("xml")?/<(\w+:)?Envelope[\s>]/.test(e)?{kind:"soap",envelope:e,version:"1.1"}:{kind:"xml",text:e}:n.includes("json")||!n&&/^\s*[[{]/.test(e)?Hn(e)??{kind:"json",text:e}:{kind:"text",text:e,contentType:t||void 0}}function ft(e){return e?e.split("&").map(t=>{const n=t.indexOf("="),s=r=>{try{return decodeURIComponent(r.replace(/\+/g," "))}catch{return r}};return n<0?{key:s(t),value:""}:{key:s(t.slice(0,n)),value:s(t.slice(n+1))}}):[]}function Hn(e){try{const t=JSON.parse(e);if(t&&typeof t=="object"&&typeof t.query=="string"&&/^\s*(query|mutation|subscription|\{|fragment)/.test(t.query))return{kind:"graphql",query:t.query,variables:t.variables===void 0?void 0:JSON.stringify(t.variables,null,2),operationName:typeof t.operationName=="string"?t.operationName:void 0}}catch{}return null}const zt=/\{\{\s*([^{}]+?)\s*\}\}/g;function dt(e){const t=new Set;for(const n of e.matchAll(zt))t.add(n[1]);return[...t]}function Dn(e){const t=s=>Array.from({length:s},()=>Math.floor(e()*16).toString(16)).join(""),n=(8+Math.floor(e()*4)).toString(16);return`${t(8)}-${t(4)}-4${t(3)}-${n}${t(3)}-${t(12)}`}function mt(e,t,n={}){const s=typeof t=="function"?t:c=>t[c],r=n.random??Math.random,o=n.now??(()=>new Date),i=c=>{var p;if(c.startsWith("secret:"))return(p=n.resolveSecret)==null?void 0:p.call(n,c.slice(7).trim());switch(c){case"$guid":case"$randomUUID":return Dn(r);case"$timestamp":return String(Math.floor(o().getTime()/1e3));case"$isoTimestamp":return o().toISOString();case"$randomInt":return String(Math.floor(r()*1001));default:return s(c)}};let a=e;for(let c=0;c<5&&a.includes("{{");c++){const p=a.replace(zt,(u,f)=>i(f)??u);if(p===a)break;a=p}return a}function Mn(e,t,n={}){return dt(mt(e,t,n))}function zn(e,t,n){const s={},r=o=>{for(const i of o??[])I(i)&&i.key&&(s[i.key]=i.value)};return r(e==null?void 0:e.variables),r(t==null?void 0:t.values),{...s,...n}}function ce(e){let t=e.trim(),n="";const s=t.indexOf("#");s>=0&&(n=t.slice(s),t=t.slice(0,s));const r=t.indexOf("?");return r<0?{base:t,query:[],hash:n}:{base:t.slice(0,r),query:ft(t.slice(r+1)),hash:n}}function Wt(e){const t=ce(e).base,n=[],s=t.replace(/^[a-z][\w+.-]*:\/\/[^/]*/i,"").replace(/^\{\{[^}]+\}\}/,"");for(const r of s.matchAll(new RegExp("(?<!\\{)\\{([A-Za-z_][\\w.-]*)\\}(?!\\})|(?:^|\\/):([A-Za-z_][\\w-]*)","g"))){const o=r[1]??r[2];n.includes(o)||n.push(o)}return n}function Bt(e){const t=Wt(e.url),n=e.params.filter(r=>r.in!=="path");return[...t.map(r=>e.params.find(o=>o.in==="path"&&o.key===r)??{key:r,value:"",in:"path",required:!0}),...n]}function Ft(e,t){const{base:n,query:s,hash:r}=ce(t),o={...e,url:n+r,params:[...e.params.filter(i=>i.in!=="query"),...s.map(i=>({...i,in:"query"}))]};return{...o,params:Bt(o)}}function Wn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Nt(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function ve(e,t=n=>n){const{base:n,query:s,hash:r}=ce(e.url);let o=t(n);for(const a of e.params){if(a.in!=="path"||!I(a))continue;const c=encodeURIComponent(t(a.value)),p=new RegExp(`(^|/):${Wn(a.key)}(?=/|$)`);o=o.split(`{${a.key}}`).join(c).replace(p,(u,f)=>f+c)}const i=[...s,...e.params.filter(a=>a.in==="query"&&I(a))].map(a=>{const c=Nt(t(a.key)),p=t(a.value);return p===""&&!("in"in a)?c:`${c}=${Nt(p)}`});return o+(i.length?`?${i.join("&")}`:"")+t(r)}function Bn(e,t){return e?t?`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`:e:t}function Vt(e){return/^\s*(?:\$\s*)?curl(?:\.exe)?(?:\s|$)/i.test(e)}function Fn(e){return/\^\r?\n/.test(e)||/\^"/.test(e)?"cmd":/`\r?\n/.test(e)||/^\s*curl\.exe\b/i.test(e)?"powershell":"bash"}function Kt(e,t=Fn(e)){var c;let n=e.replace(/\r\n?/g,`
1
+ "use strict";var In=Object.defineProperty;var Pn=(e,t,n)=>t in e?In(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var xe=(e,t,n)=>Pn(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ln=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"],Rn=["inherit","none","apiKey","bearer","basic","digest","oauth2","awsSigV4","hmac","mtls","custom"];let Fe=0;function $e(e="r"){return Fe=(Fe+1)%1e6,`${e}${Date.now().toString(36)}${Fe.toString(36)}${Math.random().toString(36).slice(2,6)}`}function he(e={}){return{...e,kind:"request",id:e.id??$e("r"),name:e.name??"New request",method:e.method??"GET",url:e.url??"",params:e.params??[],body:e.body??{kind:"none"}}}function be(e={}){return{...e,kind:"folder",id:e.id??$e("f"),name:e.name??"New folder",items:e.items??[]}}function ye(e={}){return{...e,id:e.id??$e("c"),name:e.name??"New API",items:e.items??[],variables:e.variables??[]}}function ge(e,t=[]){const n=[];for(const s of e)s.kind==="folder"?n.push(...ge(s.items,[...t,s])):n.push({request:s,folders:[...t]});return n}const Nt="#/components/schemas/";function Dn(e,t,n){var a;if(!n||t===n||!((a=e.schemas)!=null&&a[t])||e.schemas[n])return e;const s=Nt+t,r=Nt+n,o=c=>Array.isArray(c)?c.map(o):c&&typeof c=="object"?Object.fromEntries(Object.entries(c).map(([p,u])=>[p,p==="$ref"&&u===s?r:o(u)])):c,i=Object.fromEntries(Object.entries(e.schemas).map(([c,p])=>[c===t?n:c,p]));return o({...e,schemas:i})}function Dt(e,t){for(const n of e){if(n.id===t)return n;if(n.kind==="folder"){const s=Dt(n.items,t);if(s)return s}}}function Ht(e,t,n){const s=[];for(const r of e)if(r.id===t){const o=n(r);o&&s.push(o)}else r.kind==="folder"?s.push({...r,items:Ht(r.items,t,n)}):s.push(r);return s}function I(e){return e.enabled!==!1}function Hn(e){const t={};for(const n of e)I(n)&&(t[n.key]=n.value);return t}function Mt(e,t){return e.params.filter(n=>n.in===t&&I(n))}function Mn(e,t){var s;const n=t.toLowerCase();return(s=Mt(e,"header").find(r=>r.key.toLowerCase()===n))==null?void 0:s.value}function zt(e,t=[],n){const s=[e.auth,...[...t].reverse().map(r=>r.auth),n==null?void 0:n.auth];for(const r of s)if(r&&r.type!=="inherit")return r;return{type:"none"}}function we(e){switch(e.kind){case"json":case"graphql":return"application/json";case"xml":return"application/xml";case"text":return e.contentType??"text/plain";case"form":return"application/x-www-form-urlencoded";case"multipart":return"multipart/form-data";case"binary":return e.contentType??"application/octet-stream";case"soap":return e.version==="1.2"?`application/soap+xml; charset=utf-8${e.action?`; action="${e.action}"`:""}`:"text/xml; charset=utf-8";default:return}}function re(e){var t;switch(e.kind){case"json":case"xml":case"text":return e.text;case"form":return e.fields.filter(I).map(n=>`${encodeURIComponent(n.key)}=${encodeURIComponent(n.value)}`).join("&");case"graphql":{const n={query:e.query};if((t=e.variables)!=null&&t.trim())try{n.variables=JSON.parse(e.variables)}catch{n.variables=e.variables}return e.operationName&&(n.operationName=e.operationName),JSON.stringify(n)}case"soap":return e.envelope;default:return}}function ut(e,t){const n=(t??"").toLowerCase();return n.includes("x-www-form-urlencoded")?{kind:"form",fields:ft(e)}:n.includes("soap+xml")?{kind:"soap",envelope:e,version:"1.2"}:n.includes("xml")?/<(\w+:)?Envelope[\s>]/.test(e)?{kind:"soap",envelope:e,version:"1.1"}:{kind:"xml",text:e}:n.includes("json")||!n&&/^\s*[[{]/.test(e)?zn(e)??{kind:"json",text:e}:{kind:"text",text:e,contentType:t||void 0}}function ft(e){return e?e.split("&").map(t=>{const n=t.indexOf("="),s=r=>{try{return decodeURIComponent(r.replace(/\+/g," "))}catch{return r}};return n<0?{key:s(t),value:""}:{key:s(t.slice(0,n)),value:s(t.slice(n+1))}}):[]}function zn(e){try{const t=JSON.parse(e);if(t&&typeof t=="object"&&typeof t.query=="string"&&/^\s*(query|mutation|subscription|\{|fragment)/.test(t.query))return{kind:"graphql",query:t.query,variables:t.variables===void 0?void 0:JSON.stringify(t.variables,null,2),operationName:typeof t.operationName=="string"?t.operationName:void 0}}catch{}return null}const Wt=/\{\{\s*([^{}]+?)\s*\}\}/g;function dt(e){const t=new Set;for(const n of e.matchAll(Wt))t.add(n[1]);return[...t]}function Wn(e){const t=s=>Array.from({length:s},()=>Math.floor(e()*16).toString(16)).join(""),n=(8+Math.floor(e()*4)).toString(16);return`${t(8)}-${t(4)}-4${t(3)}-${n}${t(3)}-${t(12)}`}function mt(e,t,n={}){const s=typeof t=="function"?t:c=>t[c],r=n.random??Math.random,o=n.now??(()=>new Date),i=c=>{var p;if(c.startsWith("secret:"))return(p=n.resolveSecret)==null?void 0:p.call(n,c.slice(7).trim());switch(c){case"$guid":case"$randomUUID":return Wn(r);case"$timestamp":return String(Math.floor(o().getTime()/1e3));case"$isoTimestamp":return o().toISOString();case"$randomInt":return String(Math.floor(r()*1001));default:return s(c)}};let a=e;for(let c=0;c<5&&a.includes("{{");c++){const p=a.replace(Wt,(u,f)=>i(f)??u);if(p===a)break;a=p}return a}function Bn(e,t,n={}){return dt(mt(e,t,n))}function Fn(e,t,n){const s={},r=o=>{for(const i of o??[])I(i)&&i.key&&(s[i.key]=i.value)};return r(e==null?void 0:e.variables),r(t==null?void 0:t.values),{...s,...n}}function ce(e){let t=e.trim(),n="";const s=t.indexOf("#");s>=0&&(n=t.slice(s),t=t.slice(0,s));const r=t.indexOf("?");return r<0?{base:t,query:[],hash:n}:{base:t.slice(0,r),query:ft(t.slice(r+1)),hash:n}}function Bt(e){const t=ce(e).base,n=[],s=t.replace(/^[a-z][\w+.-]*:\/\/[^/]*/i,"").replace(/^\{\{[^}]+\}\}/,"");for(const r of s.matchAll(new RegExp("(?<!\\{)\\{([A-Za-z_][\\w.-]*)\\}(?!\\})|(?:^|\\/):([A-Za-z_][\\w-]*)","g"))){const o=r[1]??r[2];n.includes(o)||n.push(o)}return n}function Ft(e){const t=Bt(e.url),n=e.params.filter(r=>r.in!=="path");return[...t.map(r=>e.params.find(o=>o.in==="path"&&o.key===r)??{key:r,value:"",in:"path",required:!0}),...n]}function Vt(e,t){const{base:n,query:s,hash:r}=ce(t),o={...e,url:n+r,params:[...e.params.filter(i=>i.in!=="query"),...s.map(i=>({...i,in:"query"}))]};return{...o,params:Ft(o)}}function Vn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ct(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function ve(e,t=n=>n){const{base:n,query:s,hash:r}=ce(e.url);let o=t(n);for(const a of e.params){if(a.in!=="path"||!I(a))continue;const c=encodeURIComponent(t(a.value)),p=new RegExp(`(^|/):${Vn(a.key)}(?=/|$)`);o=o.split(`{${a.key}}`).join(c).replace(p,(u,f)=>f+c)}const i=[...s,...e.params.filter(a=>a.in==="query"&&I(a))].map(a=>{const c=Ct(t(a.key)),p=t(a.value);return p===""&&!("in"in a)?c:`${c}=${Ct(p)}`});return o+(i.length?`?${i.join("&")}`:"")+t(r)}function Kn(e,t){return e?t?`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`:e:t}function Kt(e){return/^\s*(?:\$\s*)?curl(?:\.exe)?(?:\s|$)/i.test(e)}function Jn(e){return/\^\r?\n/.test(e)||/\^"/.test(e)?"cmd":/`\r?\n/.test(e)||/^\s*curl\.exe\b/i.test(e)?"powershell":"bash"}function Jt(e,t=Jn(e)){var c;let n=e.replace(/\r\n?/g,`
2
2
  `);t==="cmd"?n=n.replace(/\^\n/g," ").replace(/\^([\s\S])/g,"$1"):t==="powershell"?n=n.replace(/`\n/g," "):n=n.replace(/\\\n/g," ");const s=[];let r="",o=!1,i=0;const a=()=>{o&&s.push(r),r="",o=!1};for(;i<n.length;){const p=n[i];if(p===" "||p===" "||p===`
3
3
  `){a(),i++;continue}if(p==="#"&&!o&&t==="bash"){for(;i<n.length&&n[i]!==`
4
4
  `;)i++;continue}if(o=!0,p==="'"&&t!=="cmd"){for(i++;i<n.length;){if(n[i]==="'"){if(t==="powershell"&&n[i+1]==="'"){r+="'",i+=2;continue}break}r+=n[i++]}i++;continue}if(p==="$"&&n[i+1]==="'"&&t==="bash"){for(i+=2;i<n.length&&n[i]!=="'";){if(n[i]==="\\"&&i+1<n.length){const u=n[i+1],f={n:`
5
- `,t:" ",r:"\r","\\":"\\","'":"'",'"':'"',0:"\0"};if(u==="x"){const d=((c=/^[0-9a-fA-F]{1,2}/.exec(n.slice(i+2)))==null?void 0:c[0])??"";r+=String.fromCharCode(parseInt(d||"0",16)),i+=2+d.length;continue}r+=f[u]??`\\${u}`,i+=2;continue}r+=n[i++]}i++;continue}if(p==='"'){for(i++;i<n.length;){const u=n[i];if(u==='"'){if(t==="powershell"&&n[i+1]==='"'){r+='"',i+=2;continue}break}if(t==="powershell"){if(u==="`"&&i+1<n.length){r+=n[i+1],i+=2;continue}}else if(u==="\\"&&i+1<n.length&&'"\\$`'.includes(n[i+1])){r+=n[i+1],i+=2;continue}r+=u,i++}i++;continue}if(p==="\\"&&t==="bash"&&i+1<n.length){r+=n[i+1],i+=2;continue}r+=p,i++}return a(),s}const Vn=new Set("XHdFubAemoxwTEKrUzCcDYyQt".split("")),Kn=new Set(["request","header","data","data-ascii","data-raw","data-binary","data-urlencode","json","form","form-string","user","cookie","user-agent","referer","max-time","url","url-query","oauth2-bearer","aws-sigv4","output","proxy","proxy-user","write-out","connect-timeout","retry","retry-delay","retry-max-time","cacert","capath","cert","cert-type","key","key-type","pass","resolve","connect-to","interface","limit-rate","upload-file","range","cookie-jar","dump-header","config","max-redirs","unix-socket","request-target","expect100-timeout","keepalive-time","local-port","dns-servers","socks4","socks5","socks5-hostname","preproxy","netrc-file","trace","trace-ascii","stderr","variable","ciphers","speed-limit","speed-time","time-cond","quote","hostpubmd5","pubkey","login-options","sasl-authzid","tls-max"]),Ct={X:"request",H:"header",d:"data",F:"form",u:"user",b:"cookie",A:"user-agent",e:"referer",m:"max-time",G:"get",k:"insecure",L:"location",I:"head",T:"upload-file",E:"cert"};function ht(e){try{const t=Uint8Array.from(atob(e.trim()),n=>n.charCodeAt(0));return new TextDecoder().decode(t)}catch{return""}}function We(e){const t=new TextEncoder().encode(e);let n="";for(const s of t)n+=String.fromCharCode(s);return btoa(n)}function Jn(e){const t=e.indexOf("@"),n=e.indexOf("=");if(t>=0&&(n<0||t<n))return e;if(n<0)return encodeURIComponent(e);const s=e.slice(0,n),r=encodeURIComponent(e.slice(n+1));return s?`${s}=${r}`:r}function Gn(e,t){const n=e.indexOf("="),s=n<0?e:e.slice(0,n);let r=n<0?"":e.slice(n+1);if(!t&&(r.startsWith("@")||r.startsWith("<"))){const[o,...i]=r.slice(1).split(";"),a={key:s,value:"",type:"file",fileName:o};for(const c of i){const[p,u]=c.split("=");p==="type"&&(a.contentType=u),p==="filename"&&(a.fileName=u)}return a}if(!t){const o=r.indexOf(";type=");if(o>=0){const i={key:s,value:r.slice(0,o),type:"text"};return i.contentType=r.slice(o+6),i}}return r=r.replace(/^"(.*)"$/,"$1"),{key:s,value:r,type:"text"}}function Jt(e){const t=Kt(e.trim());if(t[0]==="$"&&t.shift(),!t.length||!/^curl(\.exe)?$/i.test(t[0]))throw new Error("Not a curl command");let n,s="";const r=[],o=[],i=[],a=[];let c;const p=[];let u,f=!1,d,l,m=!1,k=!1,y=!1;const v={},$=(O,x)=>{switch(O){case"request":n=x==null?void 0:x.toUpperCase();break;case"url":s=x??s;break;case"url-query":x&&i.push(...jt(x));break;case"header":{if(!x)break;const U=x.indexOf(":");U>0?r.push({key:x.slice(0,U).trim(),value:x.slice(U+1).trim()}):x.endsWith(";")&&r.push({key:x.slice(0,-1).trim(),value:""});break}case"user-agent":r.push({key:"User-Agent",value:x??""});break;case"referer":r.push({key:"Referer",value:x??""});break;case"cookie":if(x!=null&&x.includes("="))for(const U of x.split(";")){const H=U.indexOf("=");H>0&&o.push({key:U.slice(0,H).trim(),value:U.slice(H+1).trim()})}break;case"data":case"data-ascii":case"data-binary":case"data-raw":case"json":if(x===void 0)break;O==="json"&&(y=!0),O!=="data-raw"&&x.startsWith("@")?c=x.slice(1):a.push(O==="data"||O==="data-ascii"?x.replace(/[\r\n]/g,""):x);break;case"data-urlencode":x!==void 0&&a.push(Jn(x));break;case"form":case"form-string":x!==void 0&&p.push(Gn(x,O==="form-string"));break;case"user":u=x;break;case"oauth2-bearer":d=x;break;case"aws-sigv4":l=x;break;case"digest":f=!0;break;case"get":m=!0;break;case"head":k=!0;break;case"insecure":v.insecure=!0;break;case"location":v.followRedirects=!0;break;case"max-time":x&&Number.isFinite(Number(x))&&(v.timeoutMs=Number(x)*1e3);break;case"upload-file":x&&(c=x),n??(n="PUT");break}};for(let O=1;O<t.length;O++){const x=t[O];if(x.startsWith("--")&&x.length>2){const U=x.slice(2),H=Kn.has(U)?t[++O]:void 0;$(U,H)}else if(x.startsWith("-")&&x.length>1)for(let U=1;U<x.length;U++){const H=x[U];if(Vn.has(H)){const g=x.slice(U+1)||t[++O];$(Ct[H]??H,g);break}$(Ct[H]??H,void 0)}else s||(s=x)}let T;const b=r.findIndex(O=>O.key.toLowerCase()==="authorization");if(b>=0){const O=r[b].value,x=/^Bearer\s+(.+)$/i.exec(O),U=/^Basic\s+(.+)$/i.exec(O);if(x)T={type:"bearer",token:x[1].trim()},r.splice(b,1);else if(U){const H=ht(U[1]),h=H.indexOf(":");h>=0&&(T={type:"basic",username:H.slice(0,h),password:H.slice(h+1)},r.splice(b,1))}}if(u!==void 0){const O=u.indexOf(":"),x=O<0?u:u.slice(0,O),U=O<0?"":u.slice(O+1);if(l){const[,,H="",h=""]=l.split(":");T={type:"awsSigV4",accessKeyId:x,secretAccessKey:U,region:H,service:h}}else T=f?{type:"digest",username:x,password:U}:{type:"basic",username:x,password:U}}d!==void 0&&(T={type:"bearer",token:d});const S=r.findIndex(O=>O.key.toLowerCase()==="content-type"),w=S>=0?r[S].value:void 0;y&&(S<0&&r.push({key:"Content-Type",value:"application/json"}),r.some(O=>O.key.toLowerCase()==="accept")||r.push({key:"Accept",value:"application/json"}));let N={kind:"none"};if(m&&a.length)i.push(...jt(a.join("&")));else if(p.length)N={kind:"multipart",parts:p};else if(a.length){const O=a.join(y?"":"&"),x=/^\s*[[{]/.test(O);N=ut(O,w??(y||x?"application/json":"application/x-www-form-urlencoded"))}else c!==void 0&&(N={kind:"binary",fileName:c,contentType:w});const L=n??(k?"HEAD":m?"GET":N.kind!=="none"?"POST":"GET"),R=[...r.map(O=>({...O,in:"header"})),...o.map(O=>({...O,in:"cookie"}))];let M=he({name:yt(L,s),method:L,params:R,body:N,auth:T,settings:Object.keys(v).length?v:void 0});return M=Ft(M,s),i.length&&(M={...M,params:[...M.params,...i.map(O=>({...O,in:"query"}))]}),M}function jt(e){return e.split("&").filter(Boolean).map(t=>{const n=t.indexOf("="),s=r=>{try{return decodeURIComponent(r.replace(/\+/g," "))}catch{return r}};return n<0?{key:s(t),value:""}:{key:s(t.slice(0,n)),value:s(t.slice(n+1))}})}function yt(e,t){const n=t.replace(/^[a-z][\w+.-]*:\/\/[^/]*/i,"").replace(/^\{\{[^}]+\}\}/,"").split("?")[0];return`${e} ${n||"/"}`}function Qn(e){return e==="powershell"?t=>`'${t.replace(/'/g,"''")}'`:e==="cmd"?t=>`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:t=>/^[\w./:@%+=,-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`}function Yn(e,t){const n=[],s=[],r=[];switch(e==null?void 0:e.type){case"basic":n.push(["-u",`${t(e.username)}:${t(e.password)}`]);break;case"digest":n.push(["--digest"],["-u",`${t(e.username)}:${t(e.password)}`]);break;case"bearer":n.push(["-H",`Authorization: ${e.prefix??"Bearer"} ${t(e.token)}`]);break;case"oauth2":e.accessToken&&n.push(["-H",`Authorization: ${e.tokenType??"Bearer"} ${t(e.accessToken)}`]);break;case"apiKey":e.in==="header"?n.push(["-H",`${t(e.key)}: ${t(e.value)}`]):e.in==="query"?s.push({key:e.key,value:e.value}):r.push({key:e.key,value:e.value});break;case"awsSigV4":n.push(["--aws-sigv4",`aws:amz:${t(e.region)}:${t(e.service)}`],["-u",`${t(e.accessKeyId)}:${t(e.secretAccessKey)}`]),e.sessionToken&&n.push(["-H",`x-amz-security-token: ${t(e.sessionToken)}`]);break;case"custom":for(const o of e.headers.filter(I))n.push(["-H",`${t(o.key)}: ${t(o.value)}`]);break;case"mtls":e.certificate&&n.push(["--cert",t(e.certificate)]),e.key&&n.push(["--key",t(e.key)]);break}return{options:n,query:s,cookies:r}}function Pe(e,t={}){var T,b,S;const n=t.shell??"bash",s=t.transform??(w=>w),r=Qn(n),o=Yn(t.auth??e.auth,s),i={...e,params:[...e.params,...o.query.map(w=>({...w,in:"query"}))]},a=ve(i,s),c=[],p=e.method.toUpperCase(),u=e.body.kind!=="none";p==="HEAD"?c.push(["-I"]):!(p==="GET"&&!u)&&!(p==="POST"&&u)&&c.push(["-X",p]);const f=e.params.filter(w=>w.in==="header"&&I(w));for(const w of f)c.push(["-H",`${s(w.key)}: ${s(w.value)}`]);c.push(...o.options);const d=we(e.body),l=f.some(w=>w.key.toLowerCase()==="content-type"),m=[...e.params.filter(w=>w.in==="cookie"&&I(w)),...o.cookies];m.length&&c.push(["-b",m.map(w=>`${s(w.key)}=${s(w.value)}`).join("; ")]);const k=e.body;switch(k.kind){case"none":break;case"form":for(const w of k.fields.filter(I))c.push(["--data-urlencode",`${s(w.key)}=${s(w.value)}`]);break;case"multipart":for(const w of k.parts.filter(I))w.type==="file"?c.push(["-F",`${s(w.key)}=@${w.fileName??w.value}${w.contentType?`;type=${w.contentType}`:""}`]):c.push(["-F",`${s(w.key)}=${s(w.value)}${w.contentType?`;type=${w.contentType}`:""}`]);break;case"binary":!l&&d&&c.push(["-H",`Content-Type: ${d}`]),c.push(["--data-binary",`@${k.fileName??"file"}`]);break;default:{!l&&d&&c.push(["-H",`Content-Type: ${d}`]),k.kind==="soap"&&k.version==="1.1"&&k.action!==void 0&&(f.some(w=>w.key.toLowerCase()==="soapaction")||c.push(["-H",`SOAPAction: "${s(k.action)}"`])),c.push(["--data-raw",s(re(k)??"")]);break}}(T=e.settings)!=null&&T.followRedirects&&c.push(["-L"]),(b=e.settings)!=null&&b.insecure&&c.push(["-k"]),(S=e.settings)!=null&&S.timeoutMs&&c.push(["-m",String(e.settings.timeoutMs/1e3)]);const v=[`${n==="powershell"?"curl.exe":"curl"} ${r(a)}`,...c.map(([w,N])=>N===void 0?w:`${w} ${r(N)}`)];if(t.multiline===!1)return v.join(" ");const $=n==="cmd"?` ^
5
+ `,t:" ",r:"\r","\\":"\\","'":"'",'"':'"',0:"\0"};if(u==="x"){const d=((c=/^[0-9a-fA-F]{1,2}/.exec(n.slice(i+2)))==null?void 0:c[0])??"";r+=String.fromCharCode(parseInt(d||"0",16)),i+=2+d.length;continue}r+=f[u]??`\\${u}`,i+=2;continue}r+=n[i++]}i++;continue}if(p==='"'){for(i++;i<n.length;){const u=n[i];if(u==='"'){if(t==="powershell"&&n[i+1]==='"'){r+='"',i+=2;continue}break}if(t==="powershell"){if(u==="`"&&i+1<n.length){r+=n[i+1],i+=2;continue}}else if(u==="\\"&&i+1<n.length&&'"\\$`'.includes(n[i+1])){r+=n[i+1],i+=2;continue}r+=u,i++}i++;continue}if(p==="\\"&&t==="bash"&&i+1<n.length){r+=n[i+1],i+=2;continue}r+=p,i++}return a(),s}const Gn=new Set("XHdFubAemoxwTEKrUzCcDYyQt".split("")),Qn=new Set(["request","header","data","data-ascii","data-raw","data-binary","data-urlencode","json","form","form-string","user","cookie","user-agent","referer","max-time","url","url-query","oauth2-bearer","aws-sigv4","output","proxy","proxy-user","write-out","connect-timeout","retry","retry-delay","retry-max-time","cacert","capath","cert","cert-type","key","key-type","pass","resolve","connect-to","interface","limit-rate","upload-file","range","cookie-jar","dump-header","config","max-redirs","unix-socket","request-target","expect100-timeout","keepalive-time","local-port","dns-servers","socks4","socks5","socks5-hostname","preproxy","netrc-file","trace","trace-ascii","stderr","variable","ciphers","speed-limit","speed-time","time-cond","quote","hostpubmd5","pubkey","login-options","sasl-authzid","tls-max"]),jt={X:"request",H:"header",d:"data",F:"form",u:"user",b:"cookie",A:"user-agent",e:"referer",m:"max-time",G:"get",k:"insecure",L:"location",I:"head",T:"upload-file",E:"cert"};function ht(e){try{const t=Uint8Array.from(atob(e.trim()),n=>n.charCodeAt(0));return new TextDecoder().decode(t)}catch{return""}}function We(e){const t=new TextEncoder().encode(e);let n="";for(const s of t)n+=String.fromCharCode(s);return btoa(n)}function Yn(e){const t=e.indexOf("@"),n=e.indexOf("=");if(t>=0&&(n<0||t<n))return e;if(n<0)return encodeURIComponent(e);const s=e.slice(0,n),r=encodeURIComponent(e.slice(n+1));return s?`${s}=${r}`:r}function Xn(e,t){const n=e.indexOf("="),s=n<0?e:e.slice(0,n);let r=n<0?"":e.slice(n+1);if(!t&&(r.startsWith("@")||r.startsWith("<"))){const[o,...i]=r.slice(1).split(";"),a={key:s,value:"",type:"file",fileName:o};for(const c of i){const[p,u]=c.split("=");p==="type"&&(a.contentType=u),p==="filename"&&(a.fileName=u)}return a}if(!t){const o=r.indexOf(";type=");if(o>=0){const i={key:s,value:r.slice(0,o),type:"text"};return i.contentType=r.slice(o+6),i}}return r=r.replace(/^"(.*)"$/,"$1"),{key:s,value:r,type:"text"}}function Gt(e){const t=Jt(e.trim());if(t[0]==="$"&&t.shift(),!t.length||!/^curl(\.exe)?$/i.test(t[0]))throw new Error("Not a curl command");let n,s="";const r=[],o=[],i=[],a=[];let c;const p=[];let u,f=!1,d,l,m=!1,k=!1,y=!1;const v={},$=(O,x)=>{switch(O){case"request":n=x==null?void 0:x.toUpperCase();break;case"url":s=x??s;break;case"url-query":x&&i.push(...Et(x));break;case"header":{if(!x)break;const U=x.indexOf(":");U>0?r.push({key:x.slice(0,U).trim(),value:x.slice(U+1).trim()}):x.endsWith(";")&&r.push({key:x.slice(0,-1).trim(),value:""});break}case"user-agent":r.push({key:"User-Agent",value:x??""});break;case"referer":r.push({key:"Referer",value:x??""});break;case"cookie":if(x!=null&&x.includes("="))for(const U of x.split(";")){const D=U.indexOf("=");D>0&&o.push({key:U.slice(0,D).trim(),value:U.slice(D+1).trim()})}break;case"data":case"data-ascii":case"data-binary":case"data-raw":case"json":if(x===void 0)break;O==="json"&&(y=!0),O!=="data-raw"&&x.startsWith("@")?c=x.slice(1):a.push(O==="data"||O==="data-ascii"?x.replace(/[\r\n]/g,""):x);break;case"data-urlencode":x!==void 0&&a.push(Yn(x));break;case"form":case"form-string":x!==void 0&&p.push(Xn(x,O==="form-string"));break;case"user":u=x;break;case"oauth2-bearer":d=x;break;case"aws-sigv4":l=x;break;case"digest":f=!0;break;case"get":m=!0;break;case"head":k=!0;break;case"insecure":v.insecure=!0;break;case"location":v.followRedirects=!0;break;case"max-time":x&&Number.isFinite(Number(x))&&(v.timeoutMs=Number(x)*1e3);break;case"upload-file":x&&(c=x),n??(n="PUT");break}};for(let O=1;O<t.length;O++){const x=t[O];if(x.startsWith("--")&&x.length>2){const U=x.slice(2),D=Qn.has(U)?t[++O]:void 0;$(U,D)}else if(x.startsWith("-")&&x.length>1)for(let U=1;U<x.length;U++){const D=x[U];if(Gn.has(D)){const g=x.slice(U+1)||t[++O];$(jt[D]??D,g);break}$(jt[D]??D,void 0)}else s||(s=x)}let T;const b=r.findIndex(O=>O.key.toLowerCase()==="authorization");if(b>=0){const O=r[b].value,x=/^Bearer\s+(.+)$/i.exec(O),U=/^Basic\s+(.+)$/i.exec(O);if(x)T={type:"bearer",token:x[1].trim()},r.splice(b,1);else if(U){const D=ht(U[1]),h=D.indexOf(":");h>=0&&(T={type:"basic",username:D.slice(0,h),password:D.slice(h+1)},r.splice(b,1))}}if(u!==void 0){const O=u.indexOf(":"),x=O<0?u:u.slice(0,O),U=O<0?"":u.slice(O+1);if(l){const[,,D="",h=""]=l.split(":");T={type:"awsSigV4",accessKeyId:x,secretAccessKey:U,region:D,service:h}}else T=f?{type:"digest",username:x,password:U}:{type:"basic",username:x,password:U}}d!==void 0&&(T={type:"bearer",token:d});const S=r.findIndex(O=>O.key.toLowerCase()==="content-type"),w=S>=0?r[S].value:void 0;y&&(S<0&&r.push({key:"Content-Type",value:"application/json"}),r.some(O=>O.key.toLowerCase()==="accept")||r.push({key:"Accept",value:"application/json"}));let N={kind:"none"};if(m&&a.length)i.push(...Et(a.join("&")));else if(p.length)N={kind:"multipart",parts:p};else if(a.length){const O=a.join(y?"":"&"),x=/^\s*[[{]/.test(O);N=ut(O,w??(y||x?"application/json":"application/x-www-form-urlencoded"))}else c!==void 0&&(N={kind:"binary",fileName:c,contentType:w});const L=n??(k?"HEAD":m?"GET":N.kind!=="none"?"POST":"GET"),R=[...r.map(O=>({...O,in:"header"})),...o.map(O=>({...O,in:"cookie"}))];let M=he({name:yt(L,s),method:L,params:R,body:N,auth:T,settings:Object.keys(v).length?v:void 0});return M=Vt(M,s),i.length&&(M={...M,params:[...M.params,...i.map(O=>({...O,in:"query"}))]}),M}function Et(e){return e.split("&").filter(Boolean).map(t=>{const n=t.indexOf("="),s=r=>{try{return decodeURIComponent(r.replace(/\+/g," "))}catch{return r}};return n<0?{key:s(t),value:""}:{key:s(t.slice(0,n)),value:s(t.slice(n+1))}})}function yt(e,t){const n=t.replace(/^[a-z][\w+.-]*:\/\/[^/]*/i,"").replace(/^\{\{[^}]+\}\}/,"").split("?")[0];return`${e} ${n||"/"}`}function Zn(e){return e==="powershell"?t=>`'${t.replace(/'/g,"''")}'`:e==="cmd"?t=>`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`:t=>/^[\w./:@%+=,-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`}function es(e,t){const n=[],s=[],r=[];switch(e==null?void 0:e.type){case"basic":n.push(["-u",`${t(e.username)}:${t(e.password)}`]);break;case"digest":n.push(["--digest"],["-u",`${t(e.username)}:${t(e.password)}`]);break;case"bearer":n.push(["-H",`Authorization: ${e.prefix??"Bearer"} ${t(e.token)}`]);break;case"oauth2":e.accessToken&&n.push(["-H",`Authorization: ${e.tokenType??"Bearer"} ${t(e.accessToken)}`]);break;case"apiKey":e.in==="header"?n.push(["-H",`${t(e.key)}: ${t(e.value)}`]):e.in==="query"?s.push({key:e.key,value:e.value}):r.push({key:e.key,value:e.value});break;case"awsSigV4":n.push(["--aws-sigv4",`aws:amz:${t(e.region)}:${t(e.service)}`],["-u",`${t(e.accessKeyId)}:${t(e.secretAccessKey)}`]),e.sessionToken&&n.push(["-H",`x-amz-security-token: ${t(e.sessionToken)}`]);break;case"custom":for(const o of e.headers.filter(I))n.push(["-H",`${t(o.key)}: ${t(o.value)}`]);break;case"mtls":e.certificate&&n.push(["--cert",t(e.certificate)]),e.key&&n.push(["--key",t(e.key)]);break}return{options:n,query:s,cookies:r}}function Pe(e,t={}){var T,b,S;const n=t.shell??"bash",s=t.transform??(w=>w),r=Zn(n),o=es(t.auth??e.auth,s),i={...e,params:[...e.params,...o.query.map(w=>({...w,in:"query"}))]},a=ve(i,s),c=[],p=e.method.toUpperCase(),u=e.body.kind!=="none";p==="HEAD"?c.push(["-I"]):!(p==="GET"&&!u)&&!(p==="POST"&&u)&&c.push(["-X",p]);const f=e.params.filter(w=>w.in==="header"&&I(w));for(const w of f)c.push(["-H",`${s(w.key)}: ${s(w.value)}`]);c.push(...o.options);const d=we(e.body),l=f.some(w=>w.key.toLowerCase()==="content-type"),m=[...e.params.filter(w=>w.in==="cookie"&&I(w)),...o.cookies];m.length&&c.push(["-b",m.map(w=>`${s(w.key)}=${s(w.value)}`).join("; ")]);const k=e.body;switch(k.kind){case"none":break;case"form":for(const w of k.fields.filter(I))c.push(["--data-urlencode",`${s(w.key)}=${s(w.value)}`]);break;case"multipart":for(const w of k.parts.filter(I))w.type==="file"?c.push(["-F",`${s(w.key)}=@${w.fileName??w.value}${w.contentType?`;type=${w.contentType}`:""}`]):c.push(["-F",`${s(w.key)}=${s(w.value)}${w.contentType?`;type=${w.contentType}`:""}`]);break;case"binary":!l&&d&&c.push(["-H",`Content-Type: ${d}`]),c.push(["--data-binary",`@${k.fileName??"file"}`]);break;default:{!l&&d&&c.push(["-H",`Content-Type: ${d}`]),k.kind==="soap"&&k.version==="1.1"&&k.action!==void 0&&(f.some(w=>w.key.toLowerCase()==="soapaction")||c.push(["-H",`SOAPAction: "${s(k.action)}"`])),c.push(["--data-raw",s(re(k)??"")]);break}}(T=e.settings)!=null&&T.followRedirects&&c.push(["-L"]),(b=e.settings)!=null&&b.insecure&&c.push(["-k"]),(S=e.settings)!=null&&S.timeoutMs&&c.push(["-m",String(e.settings.timeoutMs/1e3)]);const v=[`${n==="powershell"?"curl.exe":"curl"} ${r(a)}`,...c.map(([w,N])=>N===void 0?w:`${w} ${r(N)}`)];if(t.multiline===!1)return v.join(" ");const $=n==="cmd"?` ^
6
6
  `:n==="powershell"?" `\n ":` \\
7
- `;return v.join($)}const Gt=[{id:"curl",label:"cURL (bash)",syntax:"shell"},{id:"curl-cmd",label:"cURL (cmd)",syntax:"bat"},{id:"curl-powershell",label:"cURL (PowerShell)",syntax:"powershell"},{id:"fetch",label:"JavaScript fetch",syntax:"javascript"},{id:"csharp",label:"C# HttpClient",syntax:"csharp"},{id:"powershell",label:"PowerShell",syntax:"powershell"},{id:"python",label:"Python requests",syntax:"python"}];function Ie(e,t){var d;const n=t.transform??(l=>l),s=t.auth??e.auth,r=e.params.filter(l=>l.in==="header"&&I(l)).map(l=>[n(l.key),n(l.value)]),o=[],i=e.params.filter(l=>l.in==="cookie"&&I(l)).map(l=>`${n(l.key)}=${n(l.value)}`);let a;switch(s==null?void 0:s.type){case"basic":r.push(["Authorization",`Basic ${We(`${n(s.username)}:${n(s.password)}`)}`]);break;case"bearer":r.push(["Authorization",`${s.prefix??"Bearer"} ${n(s.token)}`]);break;case"oauth2":s.accessToken?r.push(["Authorization",`${s.tokenType??"Bearer"} ${n(s.accessToken)}`]):a="OAuth 2: obtain a token first and send it as Authorization: Bearer <token>.";break;case"apiKey":s.in==="header"?r.push([n(s.key),n(s.value)]):s.in==="query"?o.push({key:s.key,value:s.value,in:"query"}):i.push(`${n(s.key)}=${n(s.value)}`);break;case"custom":for(const l of s.headers.filter(I))r.push([n(l.key),n(l.value)]);break;case"digest":a="Digest auth: the signature is computed per call from the server challenge.";break;case"awsSigV4":a="AWS Signature V4: sign each call (an AWS SDK or a SigV4 signer).";break;case"hmac":a=`HMAC: compute the ${s.header} header per call.`;break;case"mtls":a="Mutual TLS: attach the client certificate in the HTTP client.";break}i.length&&r.push(["Cookie",i.join("; ")]);const c=ve({...e,params:[...e.params,...o]},n),p=e.body,u=((d=r.find(([l])=>l.toLowerCase()==="content-type"))==null?void 0:d[1])??we(p);p.kind==="soap"&&p.version==="1.1"&&p.action!==void 0&&(r.some(([l])=>l.toLowerCase()==="soapaction")||r.push(["SOAPAction",`"${n(p.action)}"`]));const f=Xn(p,n);return{method:e.method.toUpperCase(),url:c,headers:r,body:f,contentType:u,note:a}}function Xn(e,t){switch(e.kind){case"json":case"xml":return{...e,text:t(e.text)};case"text":return{...e,text:t(e.text)};case"form":return{...e,fields:e.fields.filter(I).map(n=>({...n,key:t(n.key),value:t(n.value)}))};case"multipart":return{...e,parts:e.parts.filter(I).map(n=>({...n,key:t(n.key),value:t(n.value)}))};case"graphql":return{...e,query:t(e.query),variables:e.variables===void 0?void 0:t(e.variables)};case"soap":return{...e,envelope:t(e.envelope)};default:return e}}const se=e=>JSON.stringify(e),F=e=>`@"${e.replace(/"/g,'""')}"`,te=e=>`'${e.replace(/'/g,"''")}'`,X=e=>JSON.stringify(e);function Qt(e,t){return e.split(`
7
+ `;return v.join($)}const Qt=[{id:"curl",label:"cURL (bash)",syntax:"shell"},{id:"curl-cmd",label:"cURL (cmd)",syntax:"bat"},{id:"curl-powershell",label:"cURL (PowerShell)",syntax:"powershell"},{id:"fetch",label:"JavaScript fetch",syntax:"javascript"},{id:"csharp",label:"C# HttpClient",syntax:"csharp"},{id:"powershell",label:"PowerShell",syntax:"powershell"},{id:"python",label:"Python requests",syntax:"python"}];function Ie(e,t){var d;const n=t.transform??(l=>l),s=t.auth??e.auth,r=e.params.filter(l=>l.in==="header"&&I(l)).map(l=>[n(l.key),n(l.value)]),o=[],i=e.params.filter(l=>l.in==="cookie"&&I(l)).map(l=>`${n(l.key)}=${n(l.value)}`);let a;switch(s==null?void 0:s.type){case"basic":r.push(["Authorization",`Basic ${We(`${n(s.username)}:${n(s.password)}`)}`]);break;case"bearer":r.push(["Authorization",`${s.prefix??"Bearer"} ${n(s.token)}`]);break;case"oauth2":s.accessToken?r.push(["Authorization",`${s.tokenType??"Bearer"} ${n(s.accessToken)}`]):a="OAuth 2: obtain a token first and send it as Authorization: Bearer <token>.";break;case"apiKey":s.in==="header"?r.push([n(s.key),n(s.value)]):s.in==="query"?o.push({key:s.key,value:s.value,in:"query"}):i.push(`${n(s.key)}=${n(s.value)}`);break;case"custom":for(const l of s.headers.filter(I))r.push([n(l.key),n(l.value)]);break;case"digest":a="Digest auth: the signature is computed per call from the server challenge.";break;case"awsSigV4":a="AWS Signature V4: sign each call (an AWS SDK or a SigV4 signer).";break;case"hmac":a=`HMAC: compute the ${s.header} header per call.`;break;case"mtls":a="Mutual TLS: attach the client certificate in the HTTP client.";break}i.length&&r.push(["Cookie",i.join("; ")]);const c=ve({...e,params:[...e.params,...o]},n),p=e.body,u=((d=r.find(([l])=>l.toLowerCase()==="content-type"))==null?void 0:d[1])??we(p);p.kind==="soap"&&p.version==="1.1"&&p.action!==void 0&&(r.some(([l])=>l.toLowerCase()==="soapaction")||r.push(["SOAPAction",`"${n(p.action)}"`]));const f=ts(p,n);return{method:e.method.toUpperCase(),url:c,headers:r,body:f,contentType:u,note:a}}function ts(e,t){switch(e.kind){case"json":case"xml":return{...e,text:t(e.text)};case"text":return{...e,text:t(e.text)};case"form":return{...e,fields:e.fields.filter(I).map(n=>({...n,key:t(n.key),value:t(n.value)}))};case"multipart":return{...e,parts:e.parts.filter(I).map(n=>({...n,key:t(n.key),value:t(n.value)}))};case"graphql":return{...e,query:t(e.query),variables:e.variables===void 0?void 0:t(e.variables)};case"soap":return{...e,envelope:t(e.envelope)};default:return e}}const se=e=>JSON.stringify(e),F=e=>`@"${e.replace(/"/g,'""')}"`,te=e=>`'${e.replace(/'/g,"''")}'`,X=e=>JSON.stringify(e);function Yt(e,t){return e.split(`
8
8
  `).map((n,s)=>s===0?n:t+n).join(`
9
- `)}function Yt(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return}}function Zn(e){const t=[];e.note&&t.push(`// ${e.note}`);let n="",s;const r=[...e.headers],o=r.some(([a])=>a.toLowerCase()==="content-type");switch(e.body.kind){case"json":{const a=Yt(e.body.text);s=a?`JSON.stringify(${Qt(a," ")})`:se(e.body.text),o||r.push(["Content-Type","application/json"]);break}case"form":n=`const body = new URLSearchParams();
9
+ `)}function Xt(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return}}function ns(e){const t=[];e.note&&t.push(`// ${e.note}`);let n="",s;const r=[...e.headers],o=r.some(([a])=>a.toLowerCase()==="content-type");switch(e.body.kind){case"json":{const a=Xt(e.body.text);s=a?`JSON.stringify(${Yt(a," ")})`:se(e.body.text),o||r.push(["Content-Type","application/json"]);break}case"form":n=`const body = new URLSearchParams();
10
10
  ${e.body.fields.map(a=>`body.append(${se(a.key)}, ${se(a.value)});`).join(`
11
11
  `)}
12
12
 
@@ -21,40 +21,40 @@ ${r.map(([a,c])=>` ${se(a)}: ${se(c)},`).join(`
21
21
  ${i.join(`
22
22
  `)}
23
23
  });`),t.push("const data = await response.text();"),t.join(`
24
- `)}const es=new Set(["content-type","content-length","content-encoding","content-language","content-disposition"]);function ts(e){const t=[];e.note&&t.push(`// ${e.note}`),t.push("using System.Net.Http;","using System.Text;",""),t.push("using var client = new HttpClient();");const s=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"].includes(e.method)?`HttpMethod.${e.method[0]}${e.method.slice(1).toLowerCase()}`:`new HttpMethod(${F(e.method)})`;t.push(`using var request = new HttpRequestMessage(${s}, ${F(e.url)});`);for(const[o,i]of e.headers)es.has(o.toLowerCase())||t.push(`request.Headers.TryAddWithoutValidation(${F(o)}, ${F(i)});`);const r=(e.contentType??"text/plain").split(";")[0].trim();switch(e.body.kind){case"none":break;case"form":t.push("request.Content = new FormUrlEncodedContent(new Dictionary<string, string>","{",...e.body.fields.map(o=>` [${F(o.key)}] = ${F(o.value)},`),"});");break;case"multipart":t.push("var form = new MultipartFormDataContent();");for(const o of e.body.parts)t.push(o.type==="file"?`form.Add(new StreamContent(File.OpenRead(${F(o.fileName??"file")})), ${F(o.key)}, ${F(o.fileName??"file")});`:`form.Add(new StringContent(${F(o.value)}), ${F(o.key)});`);t.push("request.Content = form;");break;case"binary":t.push(`request.Content = new StreamContent(File.OpenRead(${F(e.body.fileName??"file")}));`),t.push(`request.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(${F(r)});`);break;default:t.push(`request.Content = new StringContent(${F(re(e.body)??"")}, Encoding.UTF8, ${F(r)});`)}return t.push("","using var response = await client.SendAsync(request);","response.EnsureSuccessStatusCode();","var body = await response.Content.ReadAsStringAsync();"),t.join(`
25
- `)}function ns(e){const t=[];e.note&&t.push(`# ${e.note}`);const n=e.headers.filter(([r])=>r.toLowerCase()!=="content-type");n.length&&t.push("$headers = @{",...n.map(([r,o])=>` ${te(r)} = ${te(o)}`),"}");const s=[`-Uri ${te(e.url)}`,`-Method ${e.method[0]}${e.method.slice(1).toLowerCase()}`];switch(n.length&&s.push("-Headers $headers"),e.body.kind){case"none":break;case"form":t.push("$body = @{",...e.body.fields.map(r=>` ${te(r.key)} = ${te(r.value)}`),"}"),s.push("-Body $body");break;case"multipart":t.push("$form = @{",...e.body.parts.map(r=>r.type==="file"?` ${te(r.key)} = Get-Item ${te(r.fileName??"file")}`:` ${te(r.key)} = ${te(r.value)}`),"}"),s.push("-Form $form");break;case"binary":s.push(`-InFile ${te(e.body.fileName??"file")}`),e.contentType&&s.push(`-ContentType ${te(e.contentType)}`);break;default:t.push(`$body = @'
24
+ `)}const ss=new Set(["content-type","content-length","content-encoding","content-language","content-disposition"]);function rs(e){const t=[];e.note&&t.push(`// ${e.note}`),t.push("using System.Net.Http;","using System.Text;",""),t.push("using var client = new HttpClient();");const s=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"].includes(e.method)?`HttpMethod.${e.method[0]}${e.method.slice(1).toLowerCase()}`:`new HttpMethod(${F(e.method)})`;t.push(`using var request = new HttpRequestMessage(${s}, ${F(e.url)});`);for(const[o,i]of e.headers)ss.has(o.toLowerCase())||t.push(`request.Headers.TryAddWithoutValidation(${F(o)}, ${F(i)});`);const r=(e.contentType??"text/plain").split(";")[0].trim();switch(e.body.kind){case"none":break;case"form":t.push("request.Content = new FormUrlEncodedContent(new Dictionary<string, string>","{",...e.body.fields.map(o=>` [${F(o.key)}] = ${F(o.value)},`),"});");break;case"multipart":t.push("var form = new MultipartFormDataContent();");for(const o of e.body.parts)t.push(o.type==="file"?`form.Add(new StreamContent(File.OpenRead(${F(o.fileName??"file")})), ${F(o.key)}, ${F(o.fileName??"file")});`:`form.Add(new StringContent(${F(o.value)}), ${F(o.key)});`);t.push("request.Content = form;");break;case"binary":t.push(`request.Content = new StreamContent(File.OpenRead(${F(e.body.fileName??"file")}));`),t.push(`request.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(${F(r)});`);break;default:t.push(`request.Content = new StringContent(${F(re(e.body)??"")}, Encoding.UTF8, ${F(r)});`)}return t.push("","using var response = await client.SendAsync(request);","response.EnsureSuccessStatusCode();","var body = await response.Content.ReadAsStringAsync();"),t.join(`
25
+ `)}function is(e){const t=[];e.note&&t.push(`# ${e.note}`);const n=e.headers.filter(([r])=>r.toLowerCase()!=="content-type");n.length&&t.push("$headers = @{",...n.map(([r,o])=>` ${te(r)} = ${te(o)}`),"}");const s=[`-Uri ${te(e.url)}`,`-Method ${e.method[0]}${e.method.slice(1).toLowerCase()}`];switch(n.length&&s.push("-Headers $headers"),e.body.kind){case"none":break;case"form":t.push("$body = @{",...e.body.fields.map(r=>` ${te(r.key)} = ${te(r.value)}`),"}"),s.push("-Body $body");break;case"multipart":t.push("$form = @{",...e.body.parts.map(r=>r.type==="file"?` ${te(r.key)} = Get-Item ${te(r.fileName??"file")}`:` ${te(r.key)} = ${te(r.value)}`),"}"),s.push("-Form $form");break;case"binary":s.push(`-InFile ${te(e.body.fileName??"file")}`),e.contentType&&s.push(`-ContentType ${te(e.contentType)}`);break;default:t.push(`$body = @'
26
26
  ${re(e.body)??""}
27
27
  '@`),s.push("-Body $body"),e.contentType&&s.push(`-ContentType ${te(e.contentType)}`)}return t.push(`$response = Invoke-RestMethod ${s.join(" ")}`),t.join(`
28
- `)}function ss(e){const t=[];e.note&&t.push(`# ${e.note}`),t.push("import requests","");const n=[` ${X(e.method)},`,` ${X(e.url)},`],s=[...e.headers];switch(e.body.kind){case"none":break;case"json":{const r=Yt(e.body.text);if(r){const o=r.replace(/\btrue\b/g,"True").replace(/\bfalse\b/g,"False").replace(/\bnull\b/g,"None");n.push(` json=${Qt(o," ")},`);for(let i=s.length-1;i>=0;i--)s[i][0].toLowerCase()==="content-type"&&s.splice(i,1)}else n.push(` data=${X(e.body.text)},`);break}case"form":n.push(` data={${e.body.fields.map(r=>`${X(r.key)}: ${X(r.value)}`).join(", ")}},`);break;case"multipart":{const r=e.body.parts.filter(i=>i.type==="file"),o=e.body.parts.filter(i=>i.type!=="file");o.length&&n.push(` data={${o.map(i=>`${X(i.key)}: ${X(i.value)}`).join(", ")}},`),r.length&&n.push(` files={${r.map(i=>`${X(i.key)}: open(${X(i.fileName??"file")}, "rb")`).join(", ")}},`);for(let i=s.length-1;i>=0;i--)s[i][0].toLowerCase()==="content-type"&&s.splice(i,1);break}case"binary":n.push(` data=open(${X(e.body.fileName??"file")}, "rb"),`);break;default:n.push(` data=${X(re(e.body)??"")},`),e.contentType&&!s.some(([r])=>r.toLowerCase()==="content-type")&&s.push(["Content-Type",e.contentType])}return s.length&&n.splice(2,0,` headers={
28
+ `)}function os(e){const t=[];e.note&&t.push(`# ${e.note}`),t.push("import requests","");const n=[` ${X(e.method)},`,` ${X(e.url)},`],s=[...e.headers];switch(e.body.kind){case"none":break;case"json":{const r=Xt(e.body.text);if(r){const o=r.replace(/\btrue\b/g,"True").replace(/\bfalse\b/g,"False").replace(/\bnull\b/g,"None");n.push(` json=${Yt(o," ")},`);for(let i=s.length-1;i>=0;i--)s[i][0].toLowerCase()==="content-type"&&s.splice(i,1)}else n.push(` data=${X(e.body.text)},`);break}case"form":n.push(` data={${e.body.fields.map(r=>`${X(r.key)}: ${X(r.value)}`).join(", ")}},`);break;case"multipart":{const r=e.body.parts.filter(i=>i.type==="file"),o=e.body.parts.filter(i=>i.type!=="file");o.length&&n.push(` data={${o.map(i=>`${X(i.key)}: ${X(i.value)}`).join(", ")}},`),r.length&&n.push(` files={${r.map(i=>`${X(i.key)}: open(${X(i.fileName??"file")}, "rb")`).join(", ")}},`);for(let i=s.length-1;i>=0;i--)s[i][0].toLowerCase()==="content-type"&&s.splice(i,1);break}case"binary":n.push(` data=open(${X(e.body.fileName??"file")}, "rb"),`);break;default:n.push(` data=${X(re(e.body)??"")},`),e.contentType&&!s.some(([r])=>r.toLowerCase()==="content-type")&&s.push(["Content-Type",e.contentType])}return s.length&&n.splice(2,0,` headers={
29
29
  ${s.map(([r,o])=>` ${X(r)}: ${X(o)},`).join(`
30
30
  `)}
31
31
  },`),t.push(`response = requests.request(
32
32
  ${n.join(`
33
33
  `)}
34
34
  )`,"print(response.status_code, response.text)"),t.join(`
35
- `)}function Xt(e,t,n={}){switch(t){case"curl":return Pe(e,{...n,shell:"bash"});case"curl-cmd":return Pe(e,{...n,shell:"cmd"});case"curl-powershell":return Pe(e,{...n,shell:"powershell"});case"fetch":return Zn(Ie(e,n));case"csharp":return ts(Ie(e,n));case"powershell":return ns(Ie(e,n));case"python":return ss(Ie(e,n));default:return""}}class Q extends Error{constructor(t,n){super(`${t} (line ${n})`),this.line=n,this.name="NiceYamlError"}}function Et(e){let t=null;for(let n=0;n<e.length;n++){const s=e[n];if(t){if(s===t){if(t==="'"&&e[n+1]==="'"){n++;continue}t=null}else s==="\\"&&t==='"'&&n++;continue}if((s==='"'||s==="'")&&(n===0||/[\s:[{,-]/.test(e[n-1])))t=s;else if(s==="#"&&(n===0||/\s/.test(e[n-1])))return e.slice(0,n).trimEnd()}return e.trimEnd()}const rs=new Set(["","~","null","Null","NULL"]);function Be(e){if(rs.has(e))return null;if(/^(true|True|TRUE)$/.test(e))return!0;if(/^(false|False|FALSE)$/.test(e))return!1;if(/^[-+]?[0-9]+$/.test(e)){const t=Number(e);return Number.isSafeInteger(t)?t:e}return/^0x[0-9a-fA-F]+$/.test(e)?parseInt(e.slice(2),16):/^0o[0-7]+$/.test(e)?parseInt(e.slice(2),8):/^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$/.test(e)?Number(e):/^[-+]?\.(inf|Inf|INF)$/.test(e)?e.startsWith("-")?-1/0:1/0:/^\.(nan|NaN|NAN)$/.test(e)?NaN:e}function Ze(e,t){let n="";for(let s=0;s<e.length;s++){const r=e[s];if(r!=="\\"){n+=r;continue}const o=e[++s],i={n:`
35
+ `)}function Zt(e,t,n={}){switch(t){case"curl":return Pe(e,{...n,shell:"bash"});case"curl-cmd":return Pe(e,{...n,shell:"cmd"});case"curl-powershell":return Pe(e,{...n,shell:"powershell"});case"fetch":return ns(Ie(e,n));case"csharp":return rs(Ie(e,n));case"powershell":return is(Ie(e,n));case"python":return os(Ie(e,n));default:return""}}class Q extends Error{constructor(t,n){super(`${t} (line ${n})`),this.line=n,this.name="NiceYamlError"}}function _t(e){let t=null;for(let n=0;n<e.length;n++){const s=e[n];if(t){if(s===t){if(t==="'"&&e[n+1]==="'"){n++;continue}t=null}else s==="\\"&&t==='"'&&n++;continue}if((s==='"'||s==="'")&&(n===0||/[\s:[{,-]/.test(e[n-1])))t=s;else if(s==="#"&&(n===0||/\s/.test(e[n-1])))return e.slice(0,n).trimEnd()}return e.trimEnd()}const as=new Set(["","~","null","Null","NULL"]);function Be(e){if(as.has(e))return null;if(/^(true|True|TRUE)$/.test(e))return!0;if(/^(false|False|FALSE)$/.test(e))return!1;if(/^[-+]?[0-9]+$/.test(e)){const t=Number(e);return Number.isSafeInteger(t)?t:e}return/^0x[0-9a-fA-F]+$/.test(e)?parseInt(e.slice(2),16):/^0o[0-7]+$/.test(e)?parseInt(e.slice(2),8):/^[-+]?(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$/.test(e)?Number(e):/^[-+]?\.(inf|Inf|INF)$/.test(e)?e.startsWith("-")?-1/0:1/0:/^\.(nan|NaN|NAN)$/.test(e)?NaN:e}function Ze(e,t){let n="";for(let s=0;s<e.length;s++){const r=e[s];if(r!=="\\"){n+=r;continue}const o=e[++s],i={n:`
36
36
  `,t:" ",r:"\r",0:"\0",'"':'"',"\\":"\\","/":"/"," ":" ",b:"\b",f:"\f",e:"\x1B",a:"\x07",v:"\v",N:"…",_:" "};if(o in i)n+=i[o];else if(o==="x"||o==="u"||o==="U"){const a=o==="x"?2:o==="u"?4:8,c=e.slice(s+1,s+1+a);if(!/^[0-9a-fA-F]+$/.test(c)||c.length!==a)throw new Q("Bad escape",t);n+=String.fromCodePoint(parseInt(c,16)),s+=a}else if(o!==`
37
37
  `)throw new Q(`Unknown escape \\${o}`,t)}return n}function Ve(e){let t="",n=0;return e.forEach((s,r)=>{const o=r===0?s.trimEnd():r===e.length-1?s.trimStart():s.trim();if(r>0&&o===""&&r<e.length-1){n++;return}r>0&&(t+=n?`
38
- `.repeat(n):" "),n=0,t+=o}),t}class is{constructor(t){xe(this,"lines");xe(this,"i",0);xe(this,"anchors",new Map);this.lines=t.replace(/^\uFEFF/,"").replace(/\r\n?/g,`
38
+ `.repeat(n):" "),n=0,t+=o}),t}class cs{constructor(t){xe(this,"lines");xe(this,"i",0);xe(this,"anchors",new Map);this.lines=t.replace(/^\uFEFF/,"").replace(/\r\n?/g,`
39
39
  `).split(`
40
- `).map((n,s)=>{const r=n.length-n.replace(/^ +/,"").length,o=n.slice(r);if(o.startsWith(" "))throw new Q("Tabs cannot indent YAML",s+1);return{indent:r,raw:o,text:Et(o),num:s+1}})}skipBlank(){for(;this.i<this.lines.length&&this.lines[this.i].text==="";)this.i++}current(){return this.skipBlank(),this.lines[this.i]}parseDocument(){let t=this.current();for(;t&&(t.text.startsWith("%")||t.text==="---"||t.text.startsWith("--- "));){if(t.text.startsWith("--- ")){this.lines[this.i]={...t,raw:t.raw.slice(4),text:t.text.slice(4),indent:t.indent+4};break}this.i++,t=this.current()}if(!t||t.text==="...")return null;const n=this.parseBlock(-1),s=this.current();if(s&&s.text!=="..."&&s.text!=="---")throw new Q(`Unexpected text: ${s.text.slice(0,40)}`,s.num);return n}parseBlock(t){const n=this.current();return!n||n.indent<=t?null:n.text==="-"||n.text.startsWith("- ")?this.parseSequence(n.indent):this.splitKey(n.text)?this.parseMapping(n.indent):(this.i++,this.parseValue(n.text,t,n))}splitKey(t){if(t.startsWith('"')||t.startsWith("'")){const r=t[0];let o=1;for(;o<t.length;){if(t[o]==="\\"&&r==='"'){o+=2;continue}if(t[o]===r){if(r==="'"&&t[o+1]==="'"){o+=2;continue}break}o++}const i=t.slice(o+1),a=/^\s*:(\s|$)/.exec(i);if(!a)return null;const c=t.slice(1,o);return{key:r==='"'?Ze(c,0):c.replace(/''/g,"'"),rest:i.slice(a[0].length).trim()}}if(/^[[{]/.test(t)||/^\?\s+(.*)$/.exec(t))return null;const s=/^(.*?)\s*:(?:\s+|$)/.exec(t);return!s||s[1]===""||s[1].includes(" #")?null:{key:s[1],rest:t.slice(s[0].length).trim()}}parseMapping(t){const n={};for(let r=this.current();r&&r.indent===t;r=this.current()){const o=this.splitKey(r.text);if(!o){if(r.text==="-"||r.text.startsWith("- "))break;throw new Q(`Expected "key: value": ${r.text.slice(0,40)}`,r.num)}this.i++;const i=this.parseValue(o.rest,t,r,!0);if(o.key==="<<"){const a=Array.isArray(i)?i:[i];for(const c of a)if(c&&typeof c=="object"&&!Array.isArray(c))for(const[p,u]of Object.entries(c))p in n||(n[p]=u)}else n[o.key]=i}const s=this.current();if(s&&s.indent>t)throw new Q("Bad indentation",s.num);return n}parseSequence(t){const n=[];for(let s=this.current();s&&s.indent===t&&(s.text==="-"||s.text.startsWith("- "));s=this.current()){const r=s.text==="-"?"":s.text.slice(2).trimStart(),o=t+(s.text.length-r.length);if(r===""){this.i++,n.push(this.parseNested(t));continue}if(!this.takeAnchor(r).anchor&&(r==="-"||r.startsWith("- ")||this.splitKey(r))){this.lines[this.i]={...s,indent:o,raw:s.raw.slice(o-s.indent),text:r},n.push(r==="-"||r.startsWith("- ")?this.parseSequence(o):this.parseMapping(o));continue}this.i++,n.push(this.parseValue(r,t,s))}return n}takeAnchor(t){let n=t,s;for(;;){const r=/^&([^\s[\]{},]+)\s*/.exec(n);if(r){s=r[1],n=n.slice(r[0].length);continue}const o=/^!!?[^\s]*\s*/.exec(n);if(o&&n.startsWith("!")){n=n.slice(o[0].length);continue}return{anchor:s,rest:n}}}parseNested(t,n=!1){const s=this.current();return s?s.indent>t?this.parseBlock(t):n&&s.indent===t&&(s.text==="-"||s.text.startsWith("- "))?this.parseSequence(t):null:null}parseValue(t,n,s,r=!1){const{anchor:o,rest:i}=this.takeAnchor(t);let a;if(i==="")a=this.parseNested(n,r);else if(i.startsWith("*")){const c=i.slice(1).trim();if(!this.anchors.has(c))throw new Q(`Unknown alias *${c}`,s.num);a=this.anchors.get(c)}else/^[|>]/.test(i)?a=this.parseBlockScalar(i,n,s):i.startsWith("[")||i.startsWith("{")?a=this.parseFlowLines(i,s):i.startsWith('"')||i.startsWith("'")?a=this.parseQuotedLines(i,s):a=this.parsePlainLines(i,n);return o&&this.anchors.set(o,a),a}parseBlockScalar(t,n,s){const r=/^([|>])([1-9])?([-+])?([1-9])?\s*$/.exec(t);if(!r)throw new Q(`Bad block scalar header ${t}`,s.num);const o=r[1]===">",i=r[3]??"",a=Number(r[2]??r[4]??0),c=[];let p=a?n+a:-1;for(;this.i<this.lines.length;){const d=this.lines[this.i],l=d.raw.trim()==="";if(!l){if(p<0){if(d.indent<=n)break;p=d.indent}if(d.indent<p)break}c.push(l?"":" ".repeat(d.indent-p)+d.raw),this.i++}let u=0;for(;c.length&&c[c.length-1]==="";)c.pop(),u++;let f;return o?(f="",c.forEach((d,l)=>{if(l===0){f=d;return}const m=c[l-1],k=d.startsWith(" ")||m.startsWith(" ");d===""?f+=`
40
+ `).map((n,s)=>{const r=n.length-n.replace(/^ +/,"").length,o=n.slice(r);if(o.startsWith(" "))throw new Q("Tabs cannot indent YAML",s+1);return{indent:r,raw:o,text:_t(o),num:s+1}})}skipBlank(){for(;this.i<this.lines.length&&this.lines[this.i].text==="";)this.i++}current(){return this.skipBlank(),this.lines[this.i]}parseDocument(){let t=this.current();for(;t&&(t.text.startsWith("%")||t.text==="---"||t.text.startsWith("--- "));){if(t.text.startsWith("--- ")){this.lines[this.i]={...t,raw:t.raw.slice(4),text:t.text.slice(4),indent:t.indent+4};break}this.i++,t=this.current()}if(!t||t.text==="...")return null;const n=this.parseBlock(-1),s=this.current();if(s&&s.text!=="..."&&s.text!=="---")throw new Q(`Unexpected text: ${s.text.slice(0,40)}`,s.num);return n}parseBlock(t){const n=this.current();return!n||n.indent<=t?null:n.text==="-"||n.text.startsWith("- ")?this.parseSequence(n.indent):this.splitKey(n.text)?this.parseMapping(n.indent):(this.i++,this.parseValue(n.text,t,n))}splitKey(t){if(t.startsWith('"')||t.startsWith("'")){const r=t[0];let o=1;for(;o<t.length;){if(t[o]==="\\"&&r==='"'){o+=2;continue}if(t[o]===r){if(r==="'"&&t[o+1]==="'"){o+=2;continue}break}o++}const i=t.slice(o+1),a=/^\s*:(\s|$)/.exec(i);if(!a)return null;const c=t.slice(1,o);return{key:r==='"'?Ze(c,0):c.replace(/''/g,"'"),rest:i.slice(a[0].length).trim()}}if(/^[[{]/.test(t)||/^\?\s+(.*)$/.exec(t))return null;const s=/^(.*?)\s*:(?:\s+|$)/.exec(t);return!s||s[1]===""||s[1].includes(" #")?null:{key:s[1],rest:t.slice(s[0].length).trim()}}parseMapping(t){const n={};for(let r=this.current();r&&r.indent===t;r=this.current()){const o=this.splitKey(r.text);if(!o){if(r.text==="-"||r.text.startsWith("- "))break;throw new Q(`Expected "key: value": ${r.text.slice(0,40)}`,r.num)}this.i++;const i=this.parseValue(o.rest,t,r,!0);if(o.key==="<<"){const a=Array.isArray(i)?i:[i];for(const c of a)if(c&&typeof c=="object"&&!Array.isArray(c))for(const[p,u]of Object.entries(c))p in n||(n[p]=u)}else n[o.key]=i}const s=this.current();if(s&&s.indent>t)throw new Q("Bad indentation",s.num);return n}parseSequence(t){const n=[];for(let s=this.current();s&&s.indent===t&&(s.text==="-"||s.text.startsWith("- "));s=this.current()){const r=s.text==="-"?"":s.text.slice(2).trimStart(),o=t+(s.text.length-r.length);if(r===""){this.i++,n.push(this.parseNested(t));continue}if(!this.takeAnchor(r).anchor&&(r==="-"||r.startsWith("- ")||this.splitKey(r))){this.lines[this.i]={...s,indent:o,raw:s.raw.slice(o-s.indent),text:r},n.push(r==="-"||r.startsWith("- ")?this.parseSequence(o):this.parseMapping(o));continue}this.i++,n.push(this.parseValue(r,t,s))}return n}takeAnchor(t){let n=t,s;for(;;){const r=/^&([^\s[\]{},]+)\s*/.exec(n);if(r){s=r[1],n=n.slice(r[0].length);continue}const o=/^!!?[^\s]*\s*/.exec(n);if(o&&n.startsWith("!")){n=n.slice(o[0].length);continue}return{anchor:s,rest:n}}}parseNested(t,n=!1){const s=this.current();return s?s.indent>t?this.parseBlock(t):n&&s.indent===t&&(s.text==="-"||s.text.startsWith("- "))?this.parseSequence(t):null:null}parseValue(t,n,s,r=!1){const{anchor:o,rest:i}=this.takeAnchor(t);let a;if(i==="")a=this.parseNested(n,r);else if(i.startsWith("*")){const c=i.slice(1).trim();if(!this.anchors.has(c))throw new Q(`Unknown alias *${c}`,s.num);a=this.anchors.get(c)}else/^[|>]/.test(i)?a=this.parseBlockScalar(i,n,s):i.startsWith("[")||i.startsWith("{")?a=this.parseFlowLines(i,s):i.startsWith('"')||i.startsWith("'")?a=this.parseQuotedLines(i,s):a=this.parsePlainLines(i,n);return o&&this.anchors.set(o,a),a}parseBlockScalar(t,n,s){const r=/^([|>])([1-9])?([-+])?([1-9])?\s*$/.exec(t);if(!r)throw new Q(`Bad block scalar header ${t}`,s.num);const o=r[1]===">",i=r[3]??"",a=Number(r[2]??r[4]??0),c=[];let p=a?n+a:-1;for(;this.i<this.lines.length;){const d=this.lines[this.i],l=d.raw.trim()==="";if(!l){if(p<0){if(d.indent<=n)break;p=d.indent}if(d.indent<p)break}c.push(l?"":" ".repeat(d.indent-p)+d.raw),this.i++}let u=0;for(;c.length&&c[c.length-1]==="";)c.pop(),u++;let f;return o?(f="",c.forEach((d,l)=>{if(l===0){f=d;return}const m=c[l-1],k=d.startsWith(" ")||m.startsWith(" ");d===""?f+=`
41
41
  `:m===""||k?f+=(m===""?"":`
42
42
  `)+d:f+=` ${d}`})):f=c.join(`
43
43
  `),c.length?i==="-"?f:i==="+"?`${f}
44
44
  ${`
45
45
  `.repeat(u)}`:`${f}
46
46
  `:i==="+"?`
47
- `.repeat(u):""}parseQuotedLines(t,n){const s=t[0],r=[];let o=t.slice(1),i=n.num;for(;;){const a=this.findClosingQuote(o,s);if(a>=0){r.push(o.slice(0,a));const p=Et(o.slice(a+1)).trim();if(p)throw new Q(`Text after a quoted scalar: ${p.slice(0,20)}`,i);break}if(r.push(o),this.i>=this.lines.length)throw new Q("Unclosed quote",n.num);const c=this.lines[this.i++];o=c.raw,i=c.num}if(s==='"'){const a=[];for(const c of r)a.length&&a[a.length-1].endsWith("\\")&&!a[a.length-1].endsWith("\\\\")?a[a.length-1]=a[a.length-1].slice(0,-1)+c.trimStart():a.push(c);return Ze(Ve(a),n.num)}return Ve(r).replace(/''/g,"'")}findClosingQuote(t,n){for(let s=0;s<t.length;s++){if(n==='"'&&t[s]==="\\"){s++;continue}if(t[s]===n){if(n==="'"&&t[s+1]==="'"){s++;continue}return s}}return-1}parsePlainLines(t,n){const s=[t];for(;this.i<this.lines.length;){const r=this.lines[this.i];if(r.text===""){let o=this.i;for(;o<this.lines.length&&this.lines[o].text==="";)o++;const i=this.lines[o];if(i&&i.indent>n&&!this.splitKey(i.text)&&!i.text.startsWith("- ")){s.push(...Array.from({length:o-this.i},()=>"")),this.i=o;continue}break}if(r.indent<=n||this.splitKey(r.text)||r.text.startsWith("- "))break;s.push(r.text),this.i++}return s.length===1?Be(t):Ve(s)}parseFlowLines(t,n){let s=t;for(;!os(s);){if(this.i>=this.lines.length)throw new Q("Unclosed flow collection",n.num);s+=` ${this.lines[this.i++].text}`}const r=new as(s,n.num,this.anchors),o=r.parseValue();if(r.skipSpace(),!r.atEnd())throw new Q("Text after a flow collection",n.num);return o}}function os(e){let t=0,n=null;for(let s=0;s<e.length;s++){const r=e[s];if(n){r==="\\"&&n==='"'?s++:r===n&&(n=null);continue}r==='"'||r==="'"?n=r:r==="["||r==="{"?t++:(r==="]"||r==="}")&&t--}return t<=0&&!n}class as{constructor(t,n,s){xe(this,"pos",0);this.text=t,this.line=n,this.anchors=s}atEnd(){return this.pos>=this.text.length}skipSpace(){for(;this.pos<this.text.length&&/\s/.test(this.text[this.pos]);)this.pos++}fail(t){throw new Q(t,this.line)}parseValue(){this.skipSpace();const t=this.text[this.pos];if(t==="[")return this.parseSeq();if(t==="{")return this.parseMap();if(t==='"'||t==="'")return this.parseQuoted();if(t==="*"){this.pos++;const n=/^[^\s,\]}]+/.exec(this.text.slice(this.pos));return this.pos+=(n==null?void 0:n[0].length)??0,this.anchors.get((n==null?void 0:n[0])??"")}return Be(this.parsePlain(!1))}parseQuoted(){const t=this.text[this.pos++];let n="";for(;this.pos<this.text.length;){const s=this.text[this.pos];if(t==='"'&&s==="\\"){n+=s+this.text[this.pos+1],this.pos+=2;continue}if(s===t){if(t==="'"&&this.text[this.pos+1]==="'"){n+="'",this.pos+=2;continue}return this.pos++,t==='"'?Ze(n,this.line):n}n+=s,this.pos++}return this.fail("Unclosed quote")}parsePlain(t){const n=this.pos;for(;this.pos<this.text.length;){const s=this.text[this.pos];if(s===","||s==="]"||s==="}"||s===":"&&(t||/[\s,\]}]/.test(this.text[this.pos+1]??" ")))break;this.pos++}return this.text.slice(n,this.pos).trim()}parseSeq(){this.pos++;const t=[];for(;;){if(this.skipSpace(),this.text[this.pos]==="]")return this.pos++,t;t.push(this.parseValue()),this.skipSpace(),this.text[this.pos]===","?this.pos++:this.text[this.pos]!=="]"&&this.fail("Expected , or ]")}}parseMap(){this.pos++;const t={};for(;;){if(this.skipSpace(),this.text[this.pos]==="}")return this.pos++,t;const n=this.text[this.pos],s=n==='"'||n==="'"?this.parseQuoted():this.parsePlain(!0);this.skipSpace();let r=null;this.text[this.pos]===":"&&(this.pos++,this.skipSpace(),r=this.text[this.pos]===","||this.text[this.pos]==="}"?null:this.parseValue()),t[String(s)]=r,this.skipSpace(),this.text[this.pos]===","?this.pos++:this.text[this.pos]!=="}"&&this.fail("Expected , or }")}}}function Zt(e){return new is(e).parseDocument()}function en(e){for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<32&&n!==9&&n!==10&&n!==13)return!0}return!1}const cs=/^[-?:,[\]{}#&*!|>'"%@`]/;function tn(e){return e===""||e!==e.trim()||cs.test(e)||/: |:$| #|[\t\n\r]/.test(e)||en(e)||typeof Be(e)!="string"}function ps(e){if(e==null)return"null";if(typeof e=="number")return Number.isNaN(e)?".nan":Number.isFinite(e)?String(e):e>0?".inf":"-.inf";if(typeof e=="boolean")return String(e);const t=String(e);return tn(t)?JSON.stringify(t):t}function ls(e){return tn(e)?JSON.stringify(e):e}function _t(e){return Array.isArray(e)?e.length>0:!!e&&typeof e=="object"&&Object.keys(e).length>0}function et(e,t,n,s){const r=" ".repeat(t);if(Array.isArray(e)){if(!e.length){n.push(`${s}[]`);return}s&&n.push(s.trimEnd());for(const o of e)if(_t(o)){const i=[];et(o,t+2,i,""),n.push(`${r}- ${i[0].trimStart()}`,...i.slice(1))}else Ke(o,t,n,`${r}- `);return}if(e&&typeof e=="object"){const o=Object.entries(e).filter(([,i])=>i!==void 0);if(!o.length){n.push(`${s}{}`);return}s&&n.push(s.trimEnd());for(const[i,a]of o){const c=`${r}${ls(i)}:`;_t(a)?et(a,Array.isArray(a)?t:t+2,n,c):Ke(a,t,n,`${c} `)}return}Ke(e,t,n,s)}function Ke(e,t,n,s){if(Array.isArray(e)){n.push(`${s}[]`);return}if(e&&typeof e=="object"){n.push(`${s}{}`);return}if(typeof e=="string"&&e.includes(`
48
- `)&&!en(e)){const r=e.endsWith(`
47
+ `.repeat(u):""}parseQuotedLines(t,n){const s=t[0],r=[];let o=t.slice(1),i=n.num;for(;;){const a=this.findClosingQuote(o,s);if(a>=0){r.push(o.slice(0,a));const p=_t(o.slice(a+1)).trim();if(p)throw new Q(`Text after a quoted scalar: ${p.slice(0,20)}`,i);break}if(r.push(o),this.i>=this.lines.length)throw new Q("Unclosed quote",n.num);const c=this.lines[this.i++];o=c.raw,i=c.num}if(s==='"'){const a=[];for(const c of r)a.length&&a[a.length-1].endsWith("\\")&&!a[a.length-1].endsWith("\\\\")?a[a.length-1]=a[a.length-1].slice(0,-1)+c.trimStart():a.push(c);return Ze(Ve(a),n.num)}return Ve(r).replace(/''/g,"'")}findClosingQuote(t,n){for(let s=0;s<t.length;s++){if(n==='"'&&t[s]==="\\"){s++;continue}if(t[s]===n){if(n==="'"&&t[s+1]==="'"){s++;continue}return s}}return-1}parsePlainLines(t,n){const s=[t];for(;this.i<this.lines.length;){const r=this.lines[this.i];if(r.text===""){let o=this.i;for(;o<this.lines.length&&this.lines[o].text==="";)o++;const i=this.lines[o];if(i&&i.indent>n&&!this.splitKey(i.text)&&!i.text.startsWith("- ")){s.push(...Array.from({length:o-this.i},()=>"")),this.i=o;continue}break}if(r.indent<=n||this.splitKey(r.text)||r.text.startsWith("- "))break;s.push(r.text),this.i++}return s.length===1?Be(t):Ve(s)}parseFlowLines(t,n){let s=t;for(;!ps(s);){if(this.i>=this.lines.length)throw new Q("Unclosed flow collection",n.num);s+=` ${this.lines[this.i++].text}`}const r=new ls(s,n.num,this.anchors),o=r.parseValue();if(r.skipSpace(),!r.atEnd())throw new Q("Text after a flow collection",n.num);return o}}function ps(e){let t=0,n=null;for(let s=0;s<e.length;s++){const r=e[s];if(n){r==="\\"&&n==='"'?s++:r===n&&(n=null);continue}r==='"'||r==="'"?n=r:r==="["||r==="{"?t++:(r==="]"||r==="}")&&t--}return t<=0&&!n}class ls{constructor(t,n,s){xe(this,"pos",0);this.text=t,this.line=n,this.anchors=s}atEnd(){return this.pos>=this.text.length}skipSpace(){for(;this.pos<this.text.length&&/\s/.test(this.text[this.pos]);)this.pos++}fail(t){throw new Q(t,this.line)}parseValue(){this.skipSpace();const t=this.text[this.pos];if(t==="[")return this.parseSeq();if(t==="{")return this.parseMap();if(t==='"'||t==="'")return this.parseQuoted();if(t==="*"){this.pos++;const n=/^[^\s,\]}]+/.exec(this.text.slice(this.pos));return this.pos+=(n==null?void 0:n[0].length)??0,this.anchors.get((n==null?void 0:n[0])??"")}return Be(this.parsePlain(!1))}parseQuoted(){const t=this.text[this.pos++];let n="";for(;this.pos<this.text.length;){const s=this.text[this.pos];if(t==='"'&&s==="\\"){n+=s+this.text[this.pos+1],this.pos+=2;continue}if(s===t){if(t==="'"&&this.text[this.pos+1]==="'"){n+="'",this.pos+=2;continue}return this.pos++,t==='"'?Ze(n,this.line):n}n+=s,this.pos++}return this.fail("Unclosed quote")}parsePlain(t){const n=this.pos;for(;this.pos<this.text.length;){const s=this.text[this.pos];if(s===","||s==="]"||s==="}"||s===":"&&(t||/[\s,\]}]/.test(this.text[this.pos+1]??" ")))break;this.pos++}return this.text.slice(n,this.pos).trim()}parseSeq(){this.pos++;const t=[];for(;;){if(this.skipSpace(),this.text[this.pos]==="]")return this.pos++,t;t.push(this.parseValue()),this.skipSpace(),this.text[this.pos]===","?this.pos++:this.text[this.pos]!=="]"&&this.fail("Expected , or ]")}}parseMap(){this.pos++;const t={};for(;;){if(this.skipSpace(),this.text[this.pos]==="}")return this.pos++,t;const n=this.text[this.pos],s=n==='"'||n==="'"?this.parseQuoted():this.parsePlain(!0);this.skipSpace();let r=null;this.text[this.pos]===":"&&(this.pos++,this.skipSpace(),r=this.text[this.pos]===","||this.text[this.pos]==="}"?null:this.parseValue()),t[String(s)]=r,this.skipSpace(),this.text[this.pos]===","?this.pos++:this.text[this.pos]!=="}"&&this.fail("Expected , or }")}}}function en(e){return new cs(e).parseDocument()}function tn(e){for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<32&&n!==9&&n!==10&&n!==13)return!0}return!1}const us=/^[-?:,[\]{}#&*!|>'"%@`]/;function nn(e){return e===""||e!==e.trim()||us.test(e)||/: |:$| #|[\t\n\r]/.test(e)||tn(e)||typeof Be(e)!="string"}function fs(e){if(e==null)return"null";if(typeof e=="number")return Number.isNaN(e)?".nan":Number.isFinite(e)?String(e):e>0?".inf":"-.inf";if(typeof e=="boolean")return String(e);const t=String(e);return nn(t)?JSON.stringify(t):t}function ds(e){return nn(e)?JSON.stringify(e):e}function Ut(e){return Array.isArray(e)?e.length>0:!!e&&typeof e=="object"&&Object.keys(e).length>0}function et(e,t,n,s){const r=" ".repeat(t);if(Array.isArray(e)){if(!e.length){n.push(`${s}[]`);return}s&&n.push(s.trimEnd());for(const o of e)if(Ut(o)){const i=[];et(o,t+2,i,""),n.push(`${r}- ${i[0].trimStart()}`,...i.slice(1))}else Ke(o,t,n,`${r}- `);return}if(e&&typeof e=="object"){const o=Object.entries(e).filter(([,i])=>i!==void 0);if(!o.length){n.push(`${s}{}`);return}s&&n.push(s.trimEnd());for(const[i,a]of o){const c=`${r}${ds(i)}:`;Ut(a)?et(a,Array.isArray(a)?t:t+2,n,c):Ke(a,t,n,`${c} `)}return}Ke(e,t,n,s)}function Ke(e,t,n,s){if(Array.isArray(e)){n.push(`${s}[]`);return}if(e&&typeof e=="object"){n.push(`${s}{}`);return}if(typeof e=="string"&&e.includes(`
48
+ `)&&!tn(e)){const r=e.endsWith(`
49
49
  `),o=(r?e.slice(0,-1):e).split(`
50
50
  `),i=o[0].startsWith(" "),a=" ".repeat(t+2),c=r?e.endsWith(`
51
51
 
52
- `)?"+":"":"-";n.push(`${s}|${i?"2":""}${c}`);for(const p of o)n.push(p?a+p:"");return}n.push(s+ps(e))}function nn(e){const t=[];return et(e,0,t,""),`${t.join(`
52
+ `)?"+":"":"-";n.push(`${s}|${i?"2":""}${c}`);for(const p of o)n.push(p?a+p:"");return}n.push(s+fs(e))}function sn(e){const t=[];return et(e,0,t,""),`${t.join(`
53
53
  `)}
54
- `}function He(e,t=Zt){const n=e.trimStart();if(n.startsWith("{")||n.startsWith("["))try{return JSON.parse(n)}catch{}return t(e)}function gt(e){return t=>{var s;const n=(s=/^#\/(?:components\/schemas|definitions)\/(.+)$/.exec(t))==null?void 0:s[1];return n?e==null?void 0:e[decodeURIComponent(n.replace(/~1/g,"/").replace(/~0/g,"~"))]:void 0}}function us(e){if(Array.isArray(e.type))return e.type.find(t=>t!=="null")??e.type[0];if(e.type)return e.type;if(e.properties||e.additionalProperties)return"object";if(e.items)return"array"}function fs(e,t){switch(e.format){case"email":return"user@example.com";case"date":return t().toISOString().slice(0,10);case"date-time":return t().toISOString();case"time":return t().toISOString().slice(11,19);case"uuid":return"3fa85f64-5717-4562-b3fc-2c963f66afa6";case"uri":case"url":return"https://example.com";case"hostname":return"example.com";case"ipv4":return"192.168.0.1";case"ipv6":return"::1";case"byte":return"U3dhZ2dlciByb2Nrcw==";case"binary":return"";case"password":return"********";default:{const n=e.title??"string";return e.minLength&&n.length<e.minLength?n.padEnd(e.minLength,"x"):e.maxLength&&n.length>e.maxLength?n.slice(0,e.maxLength):n}}}function bt(e,t={}){const n=t.maxDepth??6,s=t.arrayItems??1,r=t.now??(()=>new Date),o=(i,a,c)=>{var u,f,d,l,m,k;if(!i)return null;if(i.$ref){if(c.has(i.$ref)||a>n)return null;const y=(u=t.resolveRef)==null?void 0:u.call(t,i.$ref);return y?o(y,a,new Set([...c,i.$ref])):null}if(i.example!==void 0)return i.example;if((f=i.examples)!=null&&f.length)return i.examples[0];if(i.const!==void 0)return i.const;if(i.default!==void 0)return i.default;if((d=i.enum)!=null&&d.length)return i.enum[0];if((l=i.allOf)!=null&&l.length){const y={};let v;for(const $ of i.allOf){const T=o($,a,c);T&&typeof T=="object"&&!Array.isArray(T)?Object.assign(y,T):T!=null&&(v=T)}return i.properties&&Object.assign(y,o({...i,allOf:void 0},a,c)),Object.keys(y).length?y:v??null}const p=((m=i.oneOf)==null?void 0:m[0])??((k=i.anyOf)==null?void 0:k[0]);if(p)return o(p,a,c);switch(us(i)){case"string":return fs(i,r);case"integer":return i.minimum??0;case"number":return i.minimum??0;case"boolean":return!0;case"array":return a>=n?[]:Array.from({length:s},()=>o(i.items,a+1,c));case"object":{if(a>=n)return{};const y={};for(const[v,$]of Object.entries(i.properties??{}))t.usage==="request"&&$.readOnly||t.usage==="response"&&$.writeOnly||(y[v]=o($,a+1,c));return!i.properties&&i.additionalProperties&&typeof i.additionalProperties=="object"&&(y.key=o(i.additionalProperties,a+1,c)),y}case"null":return null;default:return null}};return o(e,0,new Set)}function De(e){if(e===null)return{type:"null"};if(Array.isArray(e))return e.length?{type:"array",items:De(e[0])}:{type:"array"};switch(typeof e){case"string":return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(e)?{type:"string",format:"date-time"}:/^\d{4}-\d{2}-\d{2}$/.test(e)?{type:"string",format:"date"}:/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)?{type:"string",format:"uuid"}:/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(e)?{type:"string",format:"email"}:{type:"string"};case"number":return{type:Number.isInteger(e)?"integer":"number"};case"boolean":return{type:"boolean"};case"object":{const t={};for(const[n,s]of Object.entries(e))t[n]=De(s);return{type:"object",properties:t}}default:return{}}}function ds(e,t){var p;const n=(p=e.examples)==null?void 0:p[0];if(n){const u={};for(const f of n.headers??[])u[f.key]=f.value;return{status:n.status,headers:u,body:n.body??""}}const s=Object.entries(e.responses??{}),[r,o]=s.find(([u])=>/^2\d\d$/.test(u))??s.find(([u])=>u==="default")??["200",void 0],i=/^\d{3}$/.test(r)?Number(r):200;if(!o)return{status:i,headers:{},body:""};const a=o.contentType??"application/json";let c=o.example??"";if(!c&&o.schema){const u=bt(o.schema,{resolveRef:gt(t==null?void 0:t.schemas),usage:"response"});c=typeof u=="string"?u:JSON.stringify(u,null,2)}return{status:i,headers:{"Content-Type":a},body:c}}const C=e=>!!e&&typeof e=="object"&&!Array.isArray(e),z=e=>typeof e=="string"?e:void 0,sn=["get","put","post","delete","options","head","patch","trace"],ms=["query","path","header","cookie"];function tt(e,t){const n=t.indexOf("#"),s=n>=0?t.slice(n+1):"";if(!s||s==="/")return e;let r=e;for(const o of s.split("/").slice(1)){const i=decodeURIComponent(o).replace(/~1/g,"/").replace(/~0/g,"~");if(C(r))r=r[i];else if(Array.isArray(r))r=r[Number(i)];else return}return r}function ue(e){return e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):JSON.stringify(e)}function Je(e){const t=Object.keys(e),n=[s=>s==="application/json",s=>/\+json$|\/json/.test(s),s=>s==="application/x-www-form-urlencoded",s=>s==="multipart/form-data",s=>/xml/.test(s),s=>s.startsWith("text/"),()=>!0];for(const s of n){const r=t.find(s);if(r)return[r,C(e[r])?e[r]:{}]}}function rn(e,t={}){var x,U,H;let n=typeof e=="string"?He(e,t.parseYaml):e;if(!C(n))throw new Error("Not an OpenAPI document");if(typeof n.swagger=="string")n=on(n);else if(typeof n.openapi!="string")throw new Error('Not an OpenAPI document: no "openapi" or "swagger" version');const s=n,r=t.baseUrlVariable??"baseUrl",o=new Map,i=h=>{var A;if(h.startsWith("#"))return tt(s,h);const g=h.split("#")[0];if(!o.has(g)){const E=(A=t.resolveRef)==null?void 0:A.call(t,g);o.set(g,typeof E=="string"?He(E,t.parseYaml):E)}return tt(o.get(g),h)},a=h=>{let g=h;for(let A=0;A<20&&C(g)&&typeof g.$ref=="string";A++)g=i(g.$ref);return g},c=(h,g=0)=>{if(!C(h))return;if(typeof h.$ref=="string")return/^#\/components\/schemas\//.test(h.$ref)?{$ref:h.$ref}:g>12?{}:c(i(h.$ref),g+1);const A={...h};if(C(h.properties)){A.properties={};for(const[E,j]of Object.entries(h.properties))A.properties[E]=c(j,g+1)??{}}h.items!==void 0&&(A.items=c(h.items,g+1)),C(h.additionalProperties)&&(A.additionalProperties=c(h.additionalProperties,g+1));for(const E of["allOf","oneOf","anyOf"]){const j=h[E];Array.isArray(j)&&(A[E]=j.map(q=>c(q,g+1)??{}))}return A},p=C(s.components)?s.components:{},u={};if(C(p.schemas))for(const[h,g]of Object.entries(p.schemas))u[h]=c(g)??{};const f=gt(u),d=h=>{if(!C(h))return;const g=Object.values(h)[0],A=a(g);return C(A)?A.value:void 0},l=new Map,m=(h,g=!1)=>(l.has(h)||l.set(h,{key:h,value:"",secret:g||void 0}),`{{${h}}}`),k=C(p.securitySchemes)?p.securitySchemes:{},y=(h,g)=>{const A=a(k[h]);if(!C(A))return;const E=h.replace(/[^\w.-]/g,"_");switch(A.type){case"apiKey":{const j=A.in==="query"||A.in==="cookie"?A.in:"header";return{type:"apiKey",key:z(A.name)??"X-API-Key",value:m(E,!0),in:j}}case"http":{const j=(z(A.scheme)??"").toLowerCase();return j==="basic"?{type:"basic",username:m("username"),password:m("password",!0)}:j==="digest"?{type:"digest",username:m("username"),password:m("password",!0)}:j==="bearer"?{type:"bearer",token:m(E,!0)}:{type:"custom",headers:[{key:"Authorization",value:`${z(A.scheme)??""} ${m(E,!0)}`}]}}case"oauth2":{const j=C(A.flows)?A.flows:{},P=["authorizationCode","clientCredentials","password","implicit"].find(ie=>C(j[ie]))??"clientCredentials",D=j[P]??{},B=Array.isArray(g)&&g.length?g.join(" "):void 0;return{type:"oauth2",grant:P,tokenUrl:z(D.tokenUrl),authUrl:z(D.authorizationUrl),clientId:m("clientId"),clientSecret:P==="implicit"?void 0:m("clientSecret",!0),scope:B,usePkce:P==="authorizationCode"||void 0,username:P==="password"?m("username"):void 0,password:P==="password"?m("password",!0):void 0}}case"openIdConnect":return{type:"oauth2",grant:"authorizationCode",authUrl:z(A.openIdConnectUrl),clientId:m("clientId"),usePkce:!0,scope:Array.isArray(g)&&g.length?g.join(" "):"openid"};case"mutualTLS":return{type:"mtls"};default:return}},v=h=>{if(Array.isArray(h)){if(!h.length)return{type:"none"};for(const g of h){if(!C(g))continue;const A=Object.keys(g);if(!A.length)return{type:"none"};const E=y(A[0],g[A[0]]);if(E)return E}}},$=h=>{var B,ie;const g=a(h);if(!C(g)||typeof g.name!="string")return null;const A=ms.find(oe=>oe===g.in);if(!A||A==="header"&&/^(accept|content-type|authorization)$/i.test(g.name))return null;const E=c(g.schema)??(C(g.content)?c((B=Je(g.content))==null?void 0:B[1].schema):void 0),j=E!=null&&E.$ref?f(E.$ref):E,q=g.example??d(g.examples)??(j==null?void 0:j.example)??(j==null?void 0:j.default)??((ie=j==null?void 0:j.enum)==null?void 0:ie[0]),P=A==="path"||g.required===!0,D={key:g.name,value:ue(q),in:A};return P&&(D.required=!0),!P&&q===void 0&&(D.enabled=!1),typeof g.description=="string"&&(D.description=g.description),E&&(D.schema=E),typeof g.style=="string"&&(D.style=g.style),typeof g.explode=="boolean"&&(D.explode=g.explode),D},T=(h,g)=>{const A=c(g.schema),E=g.example??d(g.examples),j=E!==void 0?E:bt(A,{resolveRef:f,usage:"request"}),q=P=>{const D=P!=null&&P.$ref?f(P.$ref):P;return(D==null?void 0:D.properties)??{}};if(h==="application/x-www-form-urlencoded"){const P=C(j)?j:{};return{kind:"form",fields:(Object.keys(P).length?Object.keys(P):Object.keys(q(A))).map(B=>({key:B,value:ue(P[B])}))}}if(h.startsWith("multipart/")){const P=C(j)?j:{};return{kind:"multipart",parts:Object.entries(q(A)).map(([D,B])=>{var oe;return B.format==="binary"||B.format==="base64"||B.contentMediaType!==void 0||B.type==="array"&&((oe=B.items)==null?void 0:oe.format)==="binary"?{key:D,value:"",type:"file"}:{key:D,value:ue(P[D]),type:"text"}})}}return/json/.test(h)?{kind:"json",text:typeof j=="string"?j:JSON.stringify(j??{},null,2)}:h==="application/graphql"?{kind:"graphql",query:ue(j)}:/xml/.test(h)?{kind:"xml",text:typeof j=="string"?j:""}:h.startsWith("text/")?{kind:"text",text:ue(j),contentType:h==="text/plain"?void 0:h}:{kind:"binary",contentType:h}},b=h=>{const g=a(h);if(!C(g))return{};const A={};typeof g.description=="string"&&(A.description=g.description);const E=C(g.content)?Je(g.content):void 0;if(E){const[j,q]=E;A.contentType=j;const P=c(q.schema);P&&(A.schema=P);const D=q.example??d(q.examples);D!==void 0&&(A.example=typeof D=="string"?D:JSON.stringify(D,null,2))}return C(g.headers)&&(A.headers=Object.entries(g.headers).map(([j,q])=>{const P=a(q);return{key:j,value:"",description:C(P)?z(P.description):void 0}})),A},S=v(s.security),w=[],N=C(s.paths)?s.paths:{};for(const[h,g]of Object.entries(N)){const A=a(g);if(!C(A))continue;const E=Array.isArray(A.parameters)?A.parameters:[];for(const j of sn){const q=A[j];if(!C(q))continue;const P=[];for(const Y of[...E,...Array.isArray(q.parameters)?q.parameters:[]]){const pe=$(Y);if(!pe)continue;const St=P.findIndex(Ot=>Ot.key===pe.key&&Ot.in===pe.in);St>=0?P[St]=pe:P.push(pe)}let D={kind:"none"};const B=a(q.requestBody);if(C(B)&&C(B.content)){const Y=Je(B.content);Y&&(D=T(Y[0],Y[1]),((x=we(D))==null?void 0:x.split(";")[0])!==Y[0]&&D.kind!=="multipart"&&P.push({key:"Content-Type",value:Y[0],in:"header"}))}const ie={};if(C(q.responses))for(const[Y,pe]of Object.entries(q.responses))ie[Y]=b(pe);const oe=(U=Object.entries(ie).find(([Y])=>/^2/.test(Y)))==null?void 0:U[1];oe!=null&&oe.contentType&&oe.contentType!=="*/*"&&P.push({key:"Accept",value:oe.contentType,in:"header"});let qe=v(q.security);qe&&S&&JSON.stringify(qe)===JSON.stringify(S)&&(qe=void 0);const le=Array.isArray(q.tags)?q.tags.filter(Y=>typeof Y=="string"):void 0,_n=he({name:z(q.summary)??z(q.operationId)??`${j.toUpperCase()} ${h}`,method:j.toUpperCase(),url:`{{${r}}}${h}`,params:P,body:D,auth:qe,description:z(q.description),operationId:z(q.operationId),tags:le!=null&&le.length?le:void 0,deprecated:q.deprecated===!0||void 0,responses:Object.keys(ie).length?ie:void 0});w.push({request:_n,tag:le==null?void 0:le[0],segment:h.split("/").filter(Boolean)[0]})}}const L=[],R=t.groupBy??"tag";if(R==="none")L.push(...w.map(h=>h.request));else{const h=new Map,g=Array.isArray(s.tags)?s.tags.filter(C):[];if(R==="tag")for(const A of g)typeof A.name=="string"&&h.set(A.name,ge({name:A.name,description:z(A.description)}));for(const{request:A,tag:E,segment:j}of w){const q=R==="tag"?E:j;if(!q){L.push(A);continue}h.has(q)||h.set(q,ge({name:q})),h.get(q).items.push(A)}L.unshift(...[...h.values()].filter(A=>A.items.length))}const M=(Array.isArray(s.servers)?s.servers.filter(C):[]).map(h=>{let g=z(h.url)??"";if(C(h.variables))for(const[A,E]of Object.entries(h.variables))C(E)&&(g=g.split(`{${A}}`).join(ue(E.default)));return{url:g,description:z(h.description)}}),O=C(s.info)?s.info:{};return ye({name:z(O.title)??"API",description:z(O.description),version:O.version===void 0?void 0:ue(O.version),items:L,variables:[{key:r,value:((H=M[0])==null?void 0:H.url)??""},...l.values()],auth:S,servers:M.length?M:void 0,schemas:Object.keys(u).length?u:void 0})}function on(e){const t=y=>{if(Array.isArray(y))return y.map(t);if(!C(y))return y;const v={};for(const[$,T]of Object.entries(y))v[$]=$==="$ref"&&typeof T=="string"?T.replace("#/definitions/","#/components/schemas/").replace("#/responses/","#/components/responses/"):t(T);return v},n=t(e),s=Array.isArray(n.consumes)?n.consumes:["application/json"],r=Array.isArray(n.produces)?n.produces:["application/json"],o=C(n.parameters)?n.parameters:{},i=y=>{if(C(y)){if(typeof y.$ref=="string"&&y.$ref.startsWith("#/parameters/")){const v=o[y.$ref.slice(13)];return C(v)?v:void 0}return y}},a=y=>{const v={};for(const $ of["type","format","items","enum","default","minimum","maximum","pattern","minLength","maxLength"])y[$]!==void 0&&(v[$]=y[$]);return v.type==="file"&&(v.type="string",v.format="binary"),v},c=(y,v)=>{if(!C(y)||typeof y.$ref=="string")return y;const $={description:y.description??""};if(y.schema!==void 0){const T=C(y.examples)?y.examples:{};$.content=Object.fromEntries(v.map(b=>[b,T[b]!==void 0?{schema:y.schema,example:T[b]}:{schema:y.schema}]))}return C(y.headers)&&($.headers=Object.fromEntries(Object.entries(y.headers).map(([T,b])=>[T,C(b)?{description:b.description,schema:a(b)}:b]))),$},p=(y,v)=>{const $=Array.isArray(y.consumes)?y.consumes:s,T={...y};delete T.consumes,delete T.produces,delete T.schemes;const b=[],S=[];for(const w of[...v,...Array.isArray(y.parameters)?y.parameters:[]]){const N=i(w);if(N)if(N.in==="body")T.requestBody={description:N.description,required:N.required,content:Object.fromEntries($.map(L=>[L,{schema:N.schema}]))};else if(N.in==="formData")S.push(N);else{const L={name:N.name,in:N.in,description:N.description,required:N.required,schema:a(N)};N["x-example"]!==void 0&&(L.example=N["x-example"]),b.push(L)}}if(S.length){const N=$.includes("multipart/form-data")||S.some(R=>R.type==="file")?"multipart/form-data":"application/x-www-form-urlencoded",L=S.filter(R=>R.required).map(R=>String(R.name));T.requestBody={content:{[N]:{schema:{type:"object",properties:Object.fromEntries(S.map(R=>[String(R.name),{...a(R),description:R.description}])),...L.length?{required:L}:{}}}}}}if(T.parameters=b,C(y.responses)){const w=Array.isArray(y.produces)?y.produces:r;T.responses=Object.fromEntries(Object.entries(y.responses).map(([N,L])=>[N,c(L,w)]))}return T},u={};if(C(n.paths))for(const[y,v]of Object.entries(n.paths)){if(!C(v))continue;const $=Array.isArray(v.parameters)?v.parameters:[],T={};for(const[b,S]of Object.entries(v))sn.includes(b)&&C(S)?T[b]=p(S,$):b!=="parameters"&&(T[b]=S);u[y]=T}const f={};if(C(n.securityDefinitions)){const y={implicit:"implicit",password:"password",application:"clientCredentials",accessCode:"authorizationCode"};for(const[v,$]of Object.entries(n.securityDefinitions))C($)&&($.type==="basic"?f[v]={type:"http",scheme:"basic",description:$.description}:$.type==="apiKey"?f[v]={type:"apiKey",name:$.name,in:$.in,description:$.description}:$.type==="oauth2"&&(f[v]={type:"oauth2",description:$.description,flows:{[y[String($.flow)]??"clientCredentials"]:{authorizationUrl:$.authorizationUrl,tokenUrl:$.tokenUrl,scopes:$.scopes??{}}}}))}const d={};if(C(n.responses))for(const[y,v]of Object.entries(n.responses))d[y]=c(v,r);const l=z(n.host),m=z(n.basePath)??"",k=Array.isArray(n.schemes)&&typeof n.schemes[0]=="string"?n.schemes[0]:"https";return{openapi:"3.0.3",info:n.info,servers:l?[{url:`${k}://${l}${m}`}]:m?[{url:m}]:void 0,tags:n.tags,security:n.security,paths:u,components:{schemas:n.definitions,responses:d,securitySchemes:f}}}function hs(e){switch(e.type){case"bearer":return{name:"bearerAuth",scheme:{type:"http",scheme:"bearer"},scopes:[]};case"basic":return{name:"basicAuth",scheme:{type:"http",scheme:"basic"},scopes:[]};case"digest":return{name:"digestAuth",scheme:{type:"http",scheme:"digest"},scopes:[]};case"apiKey":return{name:`${e.key.replace(/[^\w.-]/g,"_")}Auth`,scheme:{type:"apiKey",in:e.in,name:e.key},scopes:[]};case"oauth2":{const t=(e.scope??"").split(/\s+/).filter(Boolean),n=e.grant==="deviceCode"?"clientCredentials":e.grant,s={scopes:Object.fromEntries(t.map(r=>[r,""]))};return e.tokenUrl&&(s.tokenUrl=e.tokenUrl),e.authUrl&&(s.authorizationUrl=e.authUrl),{name:"oauth2",scheme:{type:"oauth2",flows:{[n]:s}},scopes:t}}case"mtls":return{name:"mutualTLS",scheme:{type:"mutualTLS"},scopes:[]};case"awsSigV4":return{name:"awsSigV4",scheme:{type:"apiKey",in:"header",name:"Authorization","x-amazon-apigateway-authtype":"awsSigv4"},scopes:[]};case"hmac":return{name:"hmacAuth",scheme:{type:"apiKey",in:"header",name:e.header},scopes:[]};case"custom":{const t=e.headers.find(I);return t?{name:`${t.key.replace(/[^\w.-]/g,"_")}Auth`,scheme:{type:"apiKey",in:"header",name:t.key},scopes:[]}:void 0}default:return}}function Me(e){if(e!==void 0)try{return JSON.parse(e)}catch{return e}}function ys(e,t){let n=e.split("?")[0].split("#")[0];for(const s of t)if(s&&n.startsWith(s)){n=n.slice(s.length);break}return n=n.replace(/^[a-z][\w+.-]*:\/\/[^/]*/i,"").replace(/^\{\{[^}]+\}\}/,""),n=n.replace(/(^|\/):([A-Za-z_][\w-]*)/g,"$1{$2}"),n.startsWith("/")?n:`/${n}`}function gs(e,t){const n=t==null?void 0:t.split(";")[0].trim();switch(e.kind){case"none":return;case"json":{const s=Me(e.text);return{content:{[n??"application/json"]:{schema:De(s),example:s}}}}case"xml":return{content:{[n??"application/xml"]:{schema:{type:"string"},example:e.text}}};case"text":return{content:{[n??e.contentType??"text/plain"]:{schema:{type:"string"},example:e.text}}};case"form":return{content:{"application/x-www-form-urlencoded":{schema:{type:"object",properties:Object.fromEntries(e.fields.filter(I).map(s=>[s.key,{type:"string",example:s.value||void 0}]))}}}};case"multipart":return{content:{"multipart/form-data":{schema:{type:"object",properties:Object.fromEntries(e.parts.filter(I).map(s=>[s.key,s.type==="file"?{type:"string",format:"binary"}:{type:"string",example:s.value||void 0}]))}}}};case"binary":return{content:{[n??e.contentType??"application/octet-stream"]:{schema:{type:"string",format:"binary"}}}};case"graphql":return{content:{"application/json":{schema:{type:"object",properties:{query:{type:"string"},variables:{type:"object"},operationName:{type:"string"}},required:["query"]},example:Me(re(e))}}};case"soap":return{content:{[n??"text/xml"]:{schema:{type:"string"},example:e.envelope}}};default:return}}function an(e,t={}){var l,m,k,y,v,$,T;const n=t.baseUrlVariable??"baseUrl",s=(l=e.variables.find(b=>b.key===n))==null?void 0:l.value,r=(m=e.servers)!=null&&m.length?e.servers:s?[{url:s}]:void 0,o=[`{{${n}}}`,...(r??[]).map(b=>b.url)],i={},a=b=>{if(!b||b.type==="inherit")return;if(b.type==="none")return e.auth&&e.auth.type!=="none"?[]:void 0;const S=hs(b);if(S)return i[S.name]=S.scheme,[{[S.name]:S.scopes}]},c=a(e.auth),p={},u=new Map;for(const{request:b,folders:S}of $e(e.items)){const w=ys(b.url,o),N=b.method.toLowerCase();if(p[w]??(p[w]={}),p[w][N])continue;for(const h of S)u.set(h.name,h.description);const L=(k=b.tags)!=null&&k.length?b.tags:S.length?[S[S.length-1].name]:void 0,R=b.params.filter(h=>!(h.in==="header"&&/^(accept|content-type|authorization)$/i.test(h.key))).map(h=>{const g={name:h.key,in:h.in};return h.description&&(g.description=h.description),(h.in==="path"||h.required)&&(g.required=!0),g.schema=h.schema??{type:"string"},h.value&&(g.example=h.value),h.style&&(g.style=h.style),h.explode!==void 0&&(g.explode=h.explode),g}),M=(y=b.params.find(h=>h.in==="header"&&/^content-type$/i.test(h.key)))==null?void 0:y.value,O={summary:b.name};b.operationId&&(O.operationId=b.operationId),b.description&&(O.description=b.description),L&&(O.tags=L),b.deprecated&&(O.deprecated=!0),R.length&&(O.parameters=R);const x=gs(b.body,M);x&&(O.requestBody=x);const U={};for(const[h,g]of Object.entries(b.responses??{})){const A={description:g.description??""};if(g.contentType){const E={};g.schema&&(E.schema=g.schema),g.example!==void 0&&(E.example=/json/.test(g.contentType)?Me(g.example):g.example),A.content={[g.contentType]:E}}U[h]=A}for(const h of b.examples??[]){const g=String(h.status);if(U[g])continue;const A=((T=($=(v=h.headers)==null?void 0:v.find(E=>/^content-type$/i.test(E.key)))==null?void 0:$.value)==null?void 0:T.split(";")[0])??"application/json";U[g]={description:h.name,content:{[A]:{example:/json/.test(A)?Me(h.body):h.body}}}}O.responses=Object.keys(U).length?U:{200:{description:"OK"}};const H=a(b.auth);H&&(O.security=H),p[w][N]=O}const f={openapi:"3.1.0",info:{title:e.name,version:e.version??"1.0.0",...e.description?{description:e.description}:{}}};r&&(f.servers=r.map(b=>b.description?b:{url:b.url})),u.size&&(f.tags=[...u].map(([b,S])=>S?{name:b,description:S}:{name:b})),c&&(f.security=c),f.paths=p;const d={};return e.schemas&&Object.keys(e.schemas).length&&(d.schemas=e.schemas),Object.keys(i).length&&(d.securitySchemes=i),Object.keys(d).length&&(f.components=d),f}function bs(e,t={}){return nn(an(e,t))}const W=e=>!!e&&typeof e=="object"&&!Array.isArray(e),_=e=>typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):void 0,Ae=e=>Array.isArray(e)?e.filter(W):[],cn="https://schema.getpostman.com/json/collection/v2.1.0/collection.json";function kt(e){return W(e)&&W(e.info)&&Array.isArray(e.item)}function be(e){if(typeof e=="string")return e||void 0;if(W(e))return _(e.content)}function je(e){return Ae(e).map(t=>{const n={key:_(t.key)??"",value:_(t.value)??""};t.disabled===!0&&(n.enabled=!1);const s=be(t.description);return s&&(n.description=s),n})}function $t(e){if(!W(e)||typeof e.type!="string")return;const t=e[e.type],n=s=>{var r;if(Array.isArray(t))return _((r=t.filter(W).find(o=>o.key===s))==null?void 0:r.value);if(W(t))return _(t[s])};switch(e.type){case"noauth":return{type:"none"};case"bearer":return{type:"bearer",token:n("token")??""};case"basic":return{type:"basic",username:n("username")??"",password:n("password")??""};case"digest":return{type:"digest",username:n("username")??"",password:n("password")??"",realm:n("realm"),nonce:n("nonce"),qop:n("qop"),algorithm:n("algorithm"),opaque:n("opaque")};case"apikey":{const s=n("in");return{type:"apiKey",key:n("key")??"X-API-Key",value:n("value")??"",in:s==="query"?"query":"header"}}case"oauth2":{const s=n("grant_type")??"authorization_code";return{type:"oauth2",grant:s==="client_credentials"?"clientCredentials":s==="password_credentials"||s==="password"?"password":s==="implicit"?"implicit":"authorizationCode",tokenUrl:n("accessTokenUrl"),authUrl:n("authUrl"),clientId:n("clientId")??"",clientSecret:n("clientSecret"),scope:n("scope"),username:n("username"),password:n("password"),redirectUri:n("redirect_uri"),usePkce:s==="authorization_code_with_pkce"||void 0,clientAuth:n("client_authentication")==="body"?"body":void 0,accessToken:n("accessToken"),tokenType:n("tokenType")}}case"awsv4":return{type:"awsSigV4",accessKeyId:n("accessKey")??"",secretAccessKey:n("secretKey")??"",region:n("region")??"",service:n("service")??"",sessionToken:n("sessionToken")};default:return}}function ks(e){if(typeof e=="string"){const{base:o,query:i,hash:a}=ce(e);return{url:o+a,params:i.map(c=>({...c,in:"query"}))}}if(!W(e))return{url:"",params:[]};const t=_(e.raw);let n;if(t!==void 0)n=ce(t).base;else{const o=_(e.protocol),i=Array.isArray(e.host)?e.host.join("."):_(e.host)??"",a=_(e.port),c=Array.isArray(e.path)?e.path.map(p=>(W(p)?_(p.value):_(p))??"").join("/"):_(e.path)??"";n=`${o?`${o}://`:""}${i}${a?`:${a}`:""}${c?`/${c.replace(/^\//,"")}`:""}`}const s=Array.isArray(e.query)?je(e.query).map(o=>({...o,in:"query"})):t!==void 0?ce(t).query.map(o=>({...o,in:"query"})):[],r=je(e.variable).map(o=>({...o,in:"path",required:!0}));return{url:n,params:[...r,...s]}}function $s(e){if(!W(e))return{kind:"none"};switch(e.mode){case"raw":{const t=_(e.raw)??"",n=W(e.options)&&W(e.options.raw)?_(e.options.raw.language):void 0;return n==="json"?{kind:"json",text:t}:n==="xml"?/<(\w+:)?Envelope[\s>]/.test(t)?{kind:"soap",envelope:t,version:"1.1"}:{kind:"xml",text:t}:n==="html"?{kind:"text",text:t,contentType:"text/html"}:n==="javascript"?{kind:"text",text:t,contentType:"application/javascript"}:!n&&/^\s*[[{]/.test(t)?{kind:"json",text:t}:{kind:"text",text:t}}case"urlencoded":return{kind:"form",fields:je(e.urlencoded)};case"formdata":return{kind:"multipart",parts:Ae(e.formdata).map(t=>{const n=t.type==="file",s=Array.isArray(t.src)?_(t.src[0]):_(t.src),r={key:_(t.key)??"",value:n?"":_(t.value)??"",type:n?"file":"text",...n&&s?{fileName:s}:{},..._(t.contentType)?{contentType:_(t.contentType)}:{}};return t.disabled===!0?{...r,enabled:!1}:r})};case"file":return{kind:"binary",fileName:W(e.file)?_(e.file.src):void 0};case"graphql":{const t=W(e.graphql)?e.graphql:{};return{kind:"graphql",query:_(t.query)??"",variables:_(t.variables)}}default:return{kind:"none"}}}function pn(e){const t={};for(const n of Ae(e)){const s=W(n.script)?n.script:{},r=Array.isArray(s.exec)?s.exec.map(o=>_(o)??"").join(`
55
- `):_(s.exec)??"";r.trim()&&(n.listen==="prerequest"&&(t.preRequest=r),n.listen==="test"&&(t.test=r))}return t.preRequest||t.test?t:void 0}function ws(e){const t=W(e.request)?e.request:typeof e.request=="string"?{url:e.request}:{},{url:n,params:s}=ks(t.url),r=je(t.header).map(i=>({...i,in:"header"})),o=Ae(e.response).map(i=>({name:_(i.name)??"Example",status:Number(i.code??200)||200,headers:je(i.header),body:_(i.body)}));return he({id:_(e.id)??void 0,name:_(e.name)??"Request",method:(_(t.method)??"GET").toUpperCase(),url:n,params:[...s,...r],body:$s(t.body),auth:$t(t.auth),description:be(t.description)??be(e.description),scripts:pn(e.event),examples:o.length?o:void 0})}function ln(e){return Ae(e).map(t=>Array.isArray(t.item)?ge({id:_(t.id)??void 0,name:_(t.name)??"Folder",description:be(t.description),items:ln(t.item),auth:$t(t.auth)}):ws(t))}function un(e){return Ae(e).map(t=>{const n={key:_(t.key)??"",value:_(t.value)??""};t.type==="secret"&&(n.secret=!0),(t.disabled===!0||t.enabled===!1)&&(n.enabled=!1);const s=be(t.description);return s&&(n.description=s),n})}function fn(e){const t=typeof e=="string"?JSON.parse(e):e;if(!kt(t))throw new Error("Not a Postman collection");const n=t,s=n.info,r=pn(n.event),o=ye({id:_(s._postman_id)??void 0,name:_(s.name)??"Postman collection",description:be(s.description),version:W(s.version)?_(s.version.raw):_(s.version),items:ln(n.item),variables:un(n.variable),auth:$t(n.auth)});if(r){const i=a=>a.map(c=>c.kind==="folder"?{...c,items:i(c.items)}:c.scripts?c:{...c,scripts:r});o.items=i(o.items)}return o}function dn(e){const t=typeof e=="string"?JSON.parse(e):e;if(!W(t)||!Array.isArray(t.values))throw new Error("Not a Postman environment");return{id:_(t.id)??ke("e"),name:_(t.name)??"Environment",values:un(t.values)}}const V=(e,t)=>({key:e,value:t??"",type:"string"});function nt(e){switch(e==null?void 0:e.type){case void 0:case"inherit":return;case"none":return{type:"noauth"};case"bearer":return{type:"bearer",bearer:[V("token",e.token)]};case"basic":return{type:"basic",basic:[V("username",e.username),V("password",e.password)]};case"digest":return{type:"digest",digest:[V("username",e.username),V("password",e.password),...["realm","nonce","qop","algorithm","opaque"].filter(t=>e[t]).map(t=>V(t,e[t]))]};case"apiKey":return{type:"apikey",apikey:[V("key",e.key),V("value",e.value),V("in",e.in==="query"?"query":"header")]};case"oauth2":return{type:"oauth2",oauth2:[["grant_type",e.grant==="clientCredentials"?"client_credentials":e.grant==="password"?"password_credentials":e.grant==="implicit"?"implicit":e.usePkce?"authorization_code_with_pkce":"authorization_code"],["accessTokenUrl",e.tokenUrl],["authUrl",e.authUrl],["clientId",e.clientId],["clientSecret",e.clientSecret],["scope",e.scope],["username",e.username],["password",e.password],["redirect_uri",e.redirectUri],["client_authentication",e.clientAuth],["accessToken",e.accessToken],["tokenType",e.tokenType]].filter(([,s])=>s!==void 0).map(([s,r])=>V(s,r))};case"awsSigV4":return{type:"awsv4",awsv4:[V("accessKey",e.accessKeyId),V("secretKey",e.secretAccessKey),V("region",e.region),V("service",e.service),...e.sessionToken?[V("sessionToken",e.sessionToken)]:[]]};default:return}}const Ee=e=>{const t={key:e.key,value:e.value};return I(e)||(t.disabled=!0),e.description&&(t.description=e.description),t};function vs(e){const t=e.params.filter(f=>f.in==="query"),n=ve({...e,params:e.params.filter(f=>f.in==="query"&&I(f))}).replace(/%7B%7B(.*?)%7D%7D/g,"{{$1}}").replace(new RegExp("(?<!\\{)\\{([A-Za-z_][\\w.-]*)\\}(?!\\})","g"),":$1"),s=ce(e.url).base,r=/^([a-z][\w+.-]*):\/\//i.exec(s),o=r?s.slice(r[0].length):s,i=o.indexOf("/"),a=i<0?o:o.slice(0,i),c=i<0?[]:o.slice(i+1).split("/"),p={raw:n,host:a?a.startsWith("{{")?[a]:a.split("."):[],path:c.map(f=>f.replace(/^\{([A-Za-z_][\w.-]*)\}$/,":$1"))};r&&(p.protocol=r[1]),t.length&&(p.query=t.map(Ee));const u=e.params.filter(f=>f.in==="path");return u.length&&(p.variable=u.map(Ee)),p}function As(e){switch(e.kind){case"none":return;case"json":return{mode:"raw",raw:e.text,options:{raw:{language:"json"}}};case"xml":return{mode:"raw",raw:e.text,options:{raw:{language:"xml"}}};case"soap":return{mode:"raw",raw:e.envelope,options:{raw:{language:"xml"}}};case"text":return{mode:"raw",raw:e.text,options:{raw:{language:e.contentType==="text/html"?"html":"text"}}};case"form":return{mode:"urlencoded",urlencoded:e.fields.map(Ee)};case"multipart":return{mode:"formdata",formdata:e.parts.map(t=>{const n=t.type==="file"?{key:t.key,type:"file",src:t.fileName??""}:{key:t.key,value:t.value,type:"text"};return t.contentType&&(n.contentType=t.contentType),I(t)||(n.disabled=!0),n})};case"binary":return{mode:"file",file:{src:e.fileName??""}};case"graphql":return{mode:"graphql",graphql:{query:e.query,variables:e.variables??""}};default:return}}function xs(e){const t=[];return e!=null&&e.preRequest&&t.push({listen:"prerequest",script:{type:"text/javascript",exec:e.preRequest.split(`
54
+ `}function De(e,t=en){const n=e.trimStart();if(n.startsWith("{")||n.startsWith("["))try{return JSON.parse(n)}catch{}return t(e)}function gt(e){return t=>{var s;const n=(s=/^#\/(?:components\/schemas|definitions)\/(.+)$/.exec(t))==null?void 0:s[1];return n?e==null?void 0:e[decodeURIComponent(n.replace(/~1/g,"/").replace(/~0/g,"~"))]:void 0}}function ms(e){if(Array.isArray(e.type))return e.type.find(t=>t!=="null")??e.type[0];if(e.type)return e.type;if(e.properties||e.additionalProperties)return"object";if(e.items)return"array"}function hs(e,t){switch(e.format){case"email":return"user@example.com";case"date":return t().toISOString().slice(0,10);case"date-time":return t().toISOString();case"time":return t().toISOString().slice(11,19);case"uuid":return"3fa85f64-5717-4562-b3fc-2c963f66afa6";case"uri":case"url":return"https://example.com";case"hostname":return"example.com";case"ipv4":return"192.168.0.1";case"ipv6":return"::1";case"byte":return"U3dhZ2dlciByb2Nrcw==";case"binary":return"";case"password":return"********";default:{const n=e.title??"string";return e.minLength&&n.length<e.minLength?n.padEnd(e.minLength,"x"):e.maxLength&&n.length>e.maxLength?n.slice(0,e.maxLength):n}}}function bt(e,t={}){const n=t.maxDepth??6,s=t.arrayItems??1,r=t.now??(()=>new Date),o=(i,a,c)=>{var u,f,d,l,m,k;if(!i)return null;if(i.$ref){if(c.has(i.$ref)||a>n)return null;const y=(u=t.resolveRef)==null?void 0:u.call(t,i.$ref);return y?o(y,a,new Set([...c,i.$ref])):null}if(i.example!==void 0)return i.example;if((f=i.examples)!=null&&f.length)return i.examples[0];if(i.const!==void 0)return i.const;if(i.default!==void 0)return i.default;if((d=i.enum)!=null&&d.length)return i.enum[0];if((l=i.allOf)!=null&&l.length){const y={};let v;for(const $ of i.allOf){const T=o($,a,c);T&&typeof T=="object"&&!Array.isArray(T)?Object.assign(y,T):T!=null&&(v=T)}return i.properties&&Object.assign(y,o({...i,allOf:void 0},a,c)),Object.keys(y).length?y:v??null}const p=((m=i.oneOf)==null?void 0:m[0])??((k=i.anyOf)==null?void 0:k[0]);if(p)return o(p,a,c);switch(ms(i)){case"string":return hs(i,r);case"integer":return i.minimum??0;case"number":return i.minimum??0;case"boolean":return!0;case"array":return a>=n?[]:Array.from({length:s},()=>o(i.items,a+1,c));case"object":{if(a>=n)return{};const y={};for(const[v,$]of Object.entries(i.properties??{}))t.usage==="request"&&$.readOnly||t.usage==="response"&&$.writeOnly||(y[v]=o($,a+1,c));return!i.properties&&i.additionalProperties&&typeof i.additionalProperties=="object"&&(y.key=o(i.additionalProperties,a+1,c)),y}case"null":return null;default:return null}};return o(e,0,new Set)}function He(e){if(e===null)return{type:"null"};if(Array.isArray(e))return e.length?{type:"array",items:He(e[0])}:{type:"array"};switch(typeof e){case"string":return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(e)?{type:"string",format:"date-time"}:/^\d{4}-\d{2}-\d{2}$/.test(e)?{type:"string",format:"date"}:/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e)?{type:"string",format:"uuid"}:/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(e)?{type:"string",format:"email"}:{type:"string"};case"number":return{type:Number.isInteger(e)?"integer":"number"};case"boolean":return{type:"boolean"};case"object":{const t={};for(const[n,s]of Object.entries(e))t[n]=He(s);return{type:"object",properties:t}}default:return{}}}function ys(e,t){var p;const n=(p=e.examples)==null?void 0:p[0];if(n){const u={};for(const f of n.headers??[])u[f.key]=f.value;return{status:n.status,headers:u,body:n.body??""}}const s=Object.entries(e.responses??{}),[r,o]=s.find(([u])=>/^2\d\d$/.test(u))??s.find(([u])=>u==="default")??["200",void 0],i=/^\d{3}$/.test(r)?Number(r):200;if(!o)return{status:i,headers:{},body:""};const a=o.contentType??"application/json";let c=o.example??"";if(!c&&o.schema){const u=bt(o.schema,{resolveRef:gt(t==null?void 0:t.schemas),usage:"response"});c=typeof u=="string"?u:JSON.stringify(u,null,2)}return{status:i,headers:{"Content-Type":a},body:c}}const C=e=>!!e&&typeof e=="object"&&!Array.isArray(e),z=e=>typeof e=="string"?e:void 0,rn=["get","put","post","delete","options","head","patch","trace"],gs=["query","path","header","cookie"];function tt(e,t){const n=t.indexOf("#"),s=n>=0?t.slice(n+1):"";if(!s||s==="/")return e;let r=e;for(const o of s.split("/").slice(1)){const i=decodeURIComponent(o).replace(/~1/g,"/").replace(/~0/g,"~");if(C(r))r=r[i];else if(Array.isArray(r))r=r[Number(i)];else return}return r}function ue(e){return e==null?"":typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):JSON.stringify(e)}function Je(e){const t=Object.keys(e),n=[s=>s==="application/json",s=>/\+json$|\/json/.test(s),s=>s==="application/x-www-form-urlencoded",s=>s==="multipart/form-data",s=>/xml/.test(s),s=>s.startsWith("text/"),()=>!0];for(const s of n){const r=t.find(s);if(r)return[r,C(e[r])?e[r]:{}]}}function on(e,t={}){var x,U,D;let n=typeof e=="string"?De(e,t.parseYaml):e;if(!C(n))throw new Error("Not an OpenAPI document");if(typeof n.swagger=="string")n=an(n);else if(typeof n.openapi!="string")throw new Error('Not an OpenAPI document: no "openapi" or "swagger" version');const s=n,r=t.baseUrlVariable??"baseUrl",o=new Map,i=h=>{var A;if(h.startsWith("#"))return tt(s,h);const g=h.split("#")[0];if(!o.has(g)){const E=(A=t.resolveRef)==null?void 0:A.call(t,g);o.set(g,typeof E=="string"?De(E,t.parseYaml):E)}return tt(o.get(g),h)},a=h=>{let g=h;for(let A=0;A<20&&C(g)&&typeof g.$ref=="string";A++)g=i(g.$ref);return g},c=(h,g=0)=>{if(!C(h))return;if(typeof h.$ref=="string")return/^#\/components\/schemas\//.test(h.$ref)?{$ref:h.$ref}:g>12?{}:c(i(h.$ref),g+1);const A={...h};if(C(h.properties)){A.properties={};for(const[E,j]of Object.entries(h.properties))A.properties[E]=c(j,g+1)??{}}h.items!==void 0&&(A.items=c(h.items,g+1)),C(h.additionalProperties)&&(A.additionalProperties=c(h.additionalProperties,g+1));for(const E of["allOf","oneOf","anyOf"]){const j=h[E];Array.isArray(j)&&(A[E]=j.map(q=>c(q,g+1)??{}))}return A},p=C(s.components)?s.components:{},u={};if(C(p.schemas))for(const[h,g]of Object.entries(p.schemas))u[h]=c(g)??{};const f=gt(u),d=h=>{if(!C(h))return;const g=Object.values(h)[0],A=a(g);return C(A)?A.value:void 0},l=new Map,m=(h,g=!1)=>(l.has(h)||l.set(h,{key:h,value:"",secret:g||void 0}),`{{${h}}}`),k=C(p.securitySchemes)?p.securitySchemes:{},y=(h,g)=>{const A=a(k[h]);if(!C(A))return;const E=h.replace(/[^\w.-]/g,"_");switch(A.type){case"apiKey":{const j=A.in==="query"||A.in==="cookie"?A.in:"header";return{type:"apiKey",key:z(A.name)??"X-API-Key",value:m(E,!0),in:j}}case"http":{const j=(z(A.scheme)??"").toLowerCase();return j==="basic"?{type:"basic",username:m("username"),password:m("password",!0)}:j==="digest"?{type:"digest",username:m("username"),password:m("password",!0)}:j==="bearer"?{type:"bearer",token:m(E,!0)}:{type:"custom",headers:[{key:"Authorization",value:`${z(A.scheme)??""} ${m(E,!0)}`}]}}case"oauth2":{const j=C(A.flows)?A.flows:{},P=["authorizationCode","clientCredentials","password","implicit"].find(ie=>C(j[ie]))??"clientCredentials",H=j[P]??{},B=Array.isArray(g)&&g.length?g.join(" "):void 0;return{type:"oauth2",grant:P,tokenUrl:z(H.tokenUrl),authUrl:z(H.authorizationUrl),clientId:m("clientId"),clientSecret:P==="implicit"?void 0:m("clientSecret",!0),scope:B,usePkce:P==="authorizationCode"||void 0,username:P==="password"?m("username"):void 0,password:P==="password"?m("password",!0):void 0}}case"openIdConnect":return{type:"oauth2",grant:"authorizationCode",authUrl:z(A.openIdConnectUrl),clientId:m("clientId"),usePkce:!0,scope:Array.isArray(g)&&g.length?g.join(" "):"openid"};case"mutualTLS":return{type:"mtls"};default:return}},v=h=>{if(Array.isArray(h)){if(!h.length)return{type:"none"};for(const g of h){if(!C(g))continue;const A=Object.keys(g);if(!A.length)return{type:"none"};const E=y(A[0],g[A[0]]);if(E)return E}}},$=h=>{var B,ie;const g=a(h);if(!C(g)||typeof g.name!="string")return null;const A=gs.find(oe=>oe===g.in);if(!A||A==="header"&&/^(accept|content-type|authorization)$/i.test(g.name))return null;const E=c(g.schema)??(C(g.content)?c((B=Je(g.content))==null?void 0:B[1].schema):void 0),j=E!=null&&E.$ref?f(E.$ref):E,q=g.example??d(g.examples)??(j==null?void 0:j.example)??(j==null?void 0:j.default)??((ie=j==null?void 0:j.enum)==null?void 0:ie[0]),P=A==="path"||g.required===!0,H={key:g.name,value:ue(q),in:A};return P&&(H.required=!0),!P&&q===void 0&&(H.enabled=!1),typeof g.description=="string"&&(H.description=g.description),E&&(H.schema=E),typeof g.style=="string"&&(H.style=g.style),typeof g.explode=="boolean"&&(H.explode=g.explode),H},T=(h,g)=>{const A=c(g.schema),E=g.example??d(g.examples),j=E!==void 0?E:bt(A,{resolveRef:f,usage:"request"}),q=P=>{const H=P!=null&&P.$ref?f(P.$ref):P;return(H==null?void 0:H.properties)??{}};if(h==="application/x-www-form-urlencoded"){const P=C(j)?j:{};return{kind:"form",fields:(Object.keys(P).length?Object.keys(P):Object.keys(q(A))).map(B=>({key:B,value:ue(P[B])}))}}if(h.startsWith("multipart/")){const P=C(j)?j:{};return{kind:"multipart",parts:Object.entries(q(A)).map(([H,B])=>{var oe;return B.format==="binary"||B.format==="base64"||B.contentMediaType!==void 0||B.type==="array"&&((oe=B.items)==null?void 0:oe.format)==="binary"?{key:H,value:"",type:"file"}:{key:H,value:ue(P[H]),type:"text"}})}}return/json/.test(h)?{kind:"json",text:typeof j=="string"?j:JSON.stringify(j??{},null,2)}:h==="application/graphql"?{kind:"graphql",query:ue(j)}:/xml/.test(h)?{kind:"xml",text:typeof j=="string"?j:""}:h.startsWith("text/")?{kind:"text",text:ue(j),contentType:h==="text/plain"?void 0:h}:{kind:"binary",contentType:h}},b=h=>{const g=a(h);if(!C(g))return{};const A={};typeof g.description=="string"&&(A.description=g.description);const E=C(g.content)?Je(g.content):void 0;if(E){const[j,q]=E;A.contentType=j;const P=c(q.schema);P&&(A.schema=P);const H=q.example??d(q.examples);H!==void 0&&(A.example=typeof H=="string"?H:JSON.stringify(H,null,2))}return C(g.headers)&&(A.headers=Object.entries(g.headers).map(([j,q])=>{const P=a(q);return{key:j,value:"",description:C(P)?z(P.description):void 0}})),A},S=v(s.security),w=[],N=C(s.paths)?s.paths:{};for(const[h,g]of Object.entries(N)){const A=a(g);if(!C(A))continue;const E=Array.isArray(A.parameters)?A.parameters:[];for(const j of rn){const q=A[j];if(!C(q))continue;const P=[];for(const Y of[...E,...Array.isArray(q.parameters)?q.parameters:[]]){const pe=$(Y);if(!pe)continue;const St=P.findIndex(Ot=>Ot.key===pe.key&&Ot.in===pe.in);St>=0?P[St]=pe:P.push(pe)}let H={kind:"none"};const B=a(q.requestBody);if(C(B)&&C(B.content)){const Y=Je(B.content);Y&&(H=T(Y[0],Y[1]),((x=we(H))==null?void 0:x.split(";")[0])!==Y[0]&&H.kind!=="multipart"&&P.push({key:"Content-Type",value:Y[0],in:"header"}))}const ie={};if(C(q.responses))for(const[Y,pe]of Object.entries(q.responses))ie[Y]=b(pe);const oe=(U=Object.entries(ie).find(([Y])=>/^2/.test(Y)))==null?void 0:U[1];oe!=null&&oe.contentType&&oe.contentType!=="*/*"&&P.push({key:"Accept",value:oe.contentType,in:"header"});let qe=v(q.security);qe&&S&&JSON.stringify(qe)===JSON.stringify(S)&&(qe=void 0);const le=Array.isArray(q.tags)?q.tags.filter(Y=>typeof Y=="string"):void 0,qn=he({name:z(q.summary)??z(q.operationId)??`${j.toUpperCase()} ${h}`,method:j.toUpperCase(),url:`{{${r}}}${h}`,params:P,body:H,auth:qe,description:z(q.description),operationId:z(q.operationId),tags:le!=null&&le.length?le:void 0,deprecated:q.deprecated===!0||void 0,responses:Object.keys(ie).length?ie:void 0});w.push({request:qn,tag:le==null?void 0:le[0],segment:h.split("/").filter(Boolean)[0]})}}const L=[],R=t.groupBy??"tag";if(R==="none")L.push(...w.map(h=>h.request));else{const h=new Map,g=Array.isArray(s.tags)?s.tags.filter(C):[];if(R==="tag")for(const A of g)typeof A.name=="string"&&h.set(A.name,be({name:A.name,description:z(A.description)}));for(const{request:A,tag:E,segment:j}of w){const q=R==="tag"?E:j;if(!q){L.push(A);continue}h.has(q)||h.set(q,be({name:q})),h.get(q).items.push(A)}L.unshift(...[...h.values()].filter(A=>A.items.length))}const M=(Array.isArray(s.servers)?s.servers.filter(C):[]).map(h=>{let g=z(h.url)??"";if(C(h.variables))for(const[A,E]of Object.entries(h.variables))C(E)&&(g=g.split(`{${A}}`).join(ue(E.default)));return{url:g,description:z(h.description)}}),O=C(s.info)?s.info:{};return ye({name:z(O.title)??"API",description:z(O.description),version:O.version===void 0?void 0:ue(O.version),items:L,variables:[{key:r,value:((D=M[0])==null?void 0:D.url)??""},...l.values()],auth:S,servers:M.length?M:void 0,schemas:Object.keys(u).length?u:void 0})}function an(e){const t=y=>{if(Array.isArray(y))return y.map(t);if(!C(y))return y;const v={};for(const[$,T]of Object.entries(y))v[$]=$==="$ref"&&typeof T=="string"?T.replace("#/definitions/","#/components/schemas/").replace("#/responses/","#/components/responses/"):t(T);return v},n=t(e),s=Array.isArray(n.consumes)?n.consumes:["application/json"],r=Array.isArray(n.produces)?n.produces:["application/json"],o=C(n.parameters)?n.parameters:{},i=y=>{if(C(y)){if(typeof y.$ref=="string"&&y.$ref.startsWith("#/parameters/")){const v=o[y.$ref.slice(13)];return C(v)?v:void 0}return y}},a=y=>{const v={};for(const $ of["type","format","items","enum","default","minimum","maximum","pattern","minLength","maxLength"])y[$]!==void 0&&(v[$]=y[$]);return v.type==="file"&&(v.type="string",v.format="binary"),v},c=(y,v)=>{if(!C(y)||typeof y.$ref=="string")return y;const $={description:y.description??""};if(y.schema!==void 0){const T=C(y.examples)?y.examples:{};$.content=Object.fromEntries(v.map(b=>[b,T[b]!==void 0?{schema:y.schema,example:T[b]}:{schema:y.schema}]))}return C(y.headers)&&($.headers=Object.fromEntries(Object.entries(y.headers).map(([T,b])=>[T,C(b)?{description:b.description,schema:a(b)}:b]))),$},p=(y,v)=>{const $=Array.isArray(y.consumes)?y.consumes:s,T={...y};delete T.consumes,delete T.produces,delete T.schemes;const b=[],S=[];for(const w of[...v,...Array.isArray(y.parameters)?y.parameters:[]]){const N=i(w);if(N)if(N.in==="body")T.requestBody={description:N.description,required:N.required,content:Object.fromEntries($.map(L=>[L,{schema:N.schema}]))};else if(N.in==="formData")S.push(N);else{const L={name:N.name,in:N.in,description:N.description,required:N.required,schema:a(N)};N["x-example"]!==void 0&&(L.example=N["x-example"]),b.push(L)}}if(S.length){const N=$.includes("multipart/form-data")||S.some(R=>R.type==="file")?"multipart/form-data":"application/x-www-form-urlencoded",L=S.filter(R=>R.required).map(R=>String(R.name));T.requestBody={content:{[N]:{schema:{type:"object",properties:Object.fromEntries(S.map(R=>[String(R.name),{...a(R),description:R.description}])),...L.length?{required:L}:{}}}}}}if(T.parameters=b,C(y.responses)){const w=Array.isArray(y.produces)?y.produces:r;T.responses=Object.fromEntries(Object.entries(y.responses).map(([N,L])=>[N,c(L,w)]))}return T},u={};if(C(n.paths))for(const[y,v]of Object.entries(n.paths)){if(!C(v))continue;const $=Array.isArray(v.parameters)?v.parameters:[],T={};for(const[b,S]of Object.entries(v))rn.includes(b)&&C(S)?T[b]=p(S,$):b!=="parameters"&&(T[b]=S);u[y]=T}const f={};if(C(n.securityDefinitions)){const y={implicit:"implicit",password:"password",application:"clientCredentials",accessCode:"authorizationCode"};for(const[v,$]of Object.entries(n.securityDefinitions))C($)&&($.type==="basic"?f[v]={type:"http",scheme:"basic",description:$.description}:$.type==="apiKey"?f[v]={type:"apiKey",name:$.name,in:$.in,description:$.description}:$.type==="oauth2"&&(f[v]={type:"oauth2",description:$.description,flows:{[y[String($.flow)]??"clientCredentials"]:{authorizationUrl:$.authorizationUrl,tokenUrl:$.tokenUrl,scopes:$.scopes??{}}}}))}const d={};if(C(n.responses))for(const[y,v]of Object.entries(n.responses))d[y]=c(v,r);const l=z(n.host),m=z(n.basePath)??"",k=Array.isArray(n.schemes)&&typeof n.schemes[0]=="string"?n.schemes[0]:"https";return{openapi:"3.0.3",info:n.info,servers:l?[{url:`${k}://${l}${m}`}]:m?[{url:m}]:void 0,tags:n.tags,security:n.security,paths:u,components:{schemas:n.definitions,responses:d,securitySchemes:f}}}function bs(e){const t=new Map,n=(s,r)=>{if(!s||s.type==="none"||s.type==="inherit")return;const o=cn(s);if(!o)return;const i=t.get(o.name)??{name:o.name,scheme:o.scheme,scopes:o.scopes,collectionDefault:!1,requestIds:[]};r?i.requestIds.push(r):i.collectionDefault=!0,t.set(o.name,i)};n(e.auth);for(const{request:s,folders:r}of ge(e.items)){let o=s.auth;for(let i=r.length-1;(!o||o.type==="inherit")&&i>=0;i--)o=r[i].auth;n(!o||o.type==="inherit"?e.auth:o,s.id)}return[...t.values()]}function cn(e){switch(e.type){case"bearer":return{name:"bearerAuth",scheme:{type:"http",scheme:"bearer"},scopes:[]};case"basic":return{name:"basicAuth",scheme:{type:"http",scheme:"basic"},scopes:[]};case"digest":return{name:"digestAuth",scheme:{type:"http",scheme:"digest"},scopes:[]};case"apiKey":return{name:`${e.key.replace(/[^\w.-]/g,"_")}Auth`,scheme:{type:"apiKey",in:e.in,name:e.key},scopes:[]};case"oauth2":{const t=(e.scope??"").split(/\s+/).filter(Boolean),n=e.grant==="deviceCode"?"clientCredentials":e.grant,s={scopes:Object.fromEntries(t.map(r=>[r,""]))};return e.tokenUrl&&(s.tokenUrl=e.tokenUrl),e.authUrl&&(s.authorizationUrl=e.authUrl),{name:"oauth2",scheme:{type:"oauth2",flows:{[n]:s}},scopes:t}}case"mtls":return{name:"mutualTLS",scheme:{type:"mutualTLS"},scopes:[]};case"awsSigV4":return{name:"awsSigV4",scheme:{type:"apiKey",in:"header",name:"Authorization","x-amazon-apigateway-authtype":"awsSigv4"},scopes:[]};case"hmac":return{name:"hmacAuth",scheme:{type:"apiKey",in:"header",name:e.header},scopes:[]};case"custom":{const t=e.headers.find(I);return t?{name:`${t.key.replace(/[^\w.-]/g,"_")}Auth`,scheme:{type:"apiKey",in:"header",name:t.key},scopes:[]}:void 0}default:return}}function Me(e){if(e!==void 0)try{return JSON.parse(e)}catch{return e}}function ks(e,t){let n=e.split("?")[0].split("#")[0];for(const s of t)if(s&&n.startsWith(s)){n=n.slice(s.length);break}return n=n.replace(/^[a-z][\w+.-]*:\/\/[^/]*/i,"").replace(/^\{\{[^}]+\}\}/,""),n=n.replace(/(^|\/):([A-Za-z_][\w-]*)/g,"$1{$2}"),n.startsWith("/")?n:`/${n}`}function $s(e,t){const n=t==null?void 0:t.split(";")[0].trim();switch(e.kind){case"none":return;case"json":{const s=Me(e.text);return{content:{[n??"application/json"]:{schema:He(s),example:s}}}}case"xml":return{content:{[n??"application/xml"]:{schema:{type:"string"},example:e.text}}};case"text":return{content:{[n??e.contentType??"text/plain"]:{schema:{type:"string"},example:e.text}}};case"form":return{content:{"application/x-www-form-urlencoded":{schema:{type:"object",properties:Object.fromEntries(e.fields.filter(I).map(s=>[s.key,{type:"string",example:s.value||void 0}]))}}}};case"multipart":return{content:{"multipart/form-data":{schema:{type:"object",properties:Object.fromEntries(e.parts.filter(I).map(s=>[s.key,s.type==="file"?{type:"string",format:"binary"}:{type:"string",example:s.value||void 0}]))}}}};case"binary":return{content:{[n??e.contentType??"application/octet-stream"]:{schema:{type:"string",format:"binary"}}}};case"graphql":return{content:{"application/json":{schema:{type:"object",properties:{query:{type:"string"},variables:{type:"object"},operationName:{type:"string"}},required:["query"]},example:Me(re(e))}}};case"soap":return{content:{[n??"text/xml"]:{schema:{type:"string"},example:e.envelope}}};default:return}}function pn(e,t={}){var l,m,k,y,v,$,T;const n=t.baseUrlVariable??"baseUrl",s=(l=e.variables.find(b=>b.key===n))==null?void 0:l.value,r=(m=e.servers)!=null&&m.length?e.servers:s?[{url:s}]:void 0,o=[`{{${n}}}`,...(r??[]).map(b=>b.url)],i={},a=b=>{if(!b||b.type==="inherit")return;if(b.type==="none")return e.auth&&e.auth.type!=="none"?[]:void 0;const S=cn(b);if(S)return i[S.name]=S.scheme,[{[S.name]:S.scopes}]},c=a(e.auth),p={},u=new Map;for(const{request:b,folders:S}of ge(e.items)){const w=ks(b.url,o),N=b.method.toLowerCase();if(p[w]??(p[w]={}),p[w][N])continue;for(const h of S)u.set(h.name,h.description);const L=(k=b.tags)!=null&&k.length?b.tags:S.length?[S[S.length-1].name]:void 0,R=b.params.filter(h=>!(h.in==="header"&&/^(accept|content-type|authorization)$/i.test(h.key))).map(h=>{const g={name:h.key,in:h.in};return h.description&&(g.description=h.description),(h.in==="path"||h.required)&&(g.required=!0),g.schema=h.schema??{type:"string"},h.value&&(g.example=h.value),h.style&&(g.style=h.style),h.explode!==void 0&&(g.explode=h.explode),g}),M=(y=b.params.find(h=>h.in==="header"&&/^content-type$/i.test(h.key)))==null?void 0:y.value,O={summary:b.name};b.operationId&&(O.operationId=b.operationId),b.description&&(O.description=b.description),L&&(O.tags=L),b.deprecated&&(O.deprecated=!0),R.length&&(O.parameters=R);const x=$s(b.body,M);x&&(O.requestBody=x);const U={};for(const[h,g]of Object.entries(b.responses??{})){const A={description:g.description??""};if(g.contentType){const E={};g.schema&&(E.schema=g.schema),g.example!==void 0&&(E.example=/json/.test(g.contentType)?Me(g.example):g.example),A.content={[g.contentType]:E}}U[h]=A}for(const h of b.examples??[]){const g=String(h.status);if(U[g])continue;const A=((T=($=(v=h.headers)==null?void 0:v.find(E=>/^content-type$/i.test(E.key)))==null?void 0:$.value)==null?void 0:T.split(";")[0])??"application/json";U[g]={description:h.name,content:{[A]:{example:/json/.test(A)?Me(h.body):h.body}}}}O.responses=Object.keys(U).length?U:{200:{description:"OK"}};const D=a(b.auth);D&&(O.security=D),p[w][N]=O}const f={openapi:"3.1.0",info:{title:e.name,version:e.version??"1.0.0",...e.description?{description:e.description}:{}}};r&&(f.servers=r.map(b=>b.description?b:{url:b.url})),u.size&&(f.tags=[...u].map(([b,S])=>S?{name:b,description:S}:{name:b})),c&&(f.security=c),f.paths=p;const d={};return e.schemas&&Object.keys(e.schemas).length&&(d.schemas=e.schemas),Object.keys(i).length&&(d.securitySchemes=i),Object.keys(d).length&&(f.components=d),f}function ws(e,t={}){return sn(pn(e,t))}const W=e=>!!e&&typeof e=="object"&&!Array.isArray(e),_=e=>typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):void 0,Ae=e=>Array.isArray(e)?e.filter(W):[],ln="https://schema.getpostman.com/json/collection/v2.1.0/collection.json";function kt(e){return W(e)&&W(e.info)&&Array.isArray(e.item)}function ke(e){if(typeof e=="string")return e||void 0;if(W(e))return _(e.content)}function je(e){return Ae(e).map(t=>{const n={key:_(t.key)??"",value:_(t.value)??""};t.disabled===!0&&(n.enabled=!1);const s=ke(t.description);return s&&(n.description=s),n})}function $t(e){if(!W(e)||typeof e.type!="string")return;const t=e[e.type],n=s=>{var r;if(Array.isArray(t))return _((r=t.filter(W).find(o=>o.key===s))==null?void 0:r.value);if(W(t))return _(t[s])};switch(e.type){case"noauth":return{type:"none"};case"bearer":return{type:"bearer",token:n("token")??""};case"basic":return{type:"basic",username:n("username")??"",password:n("password")??""};case"digest":return{type:"digest",username:n("username")??"",password:n("password")??"",realm:n("realm"),nonce:n("nonce"),qop:n("qop"),algorithm:n("algorithm"),opaque:n("opaque")};case"apikey":{const s=n("in");return{type:"apiKey",key:n("key")??"X-API-Key",value:n("value")??"",in:s==="query"?"query":"header"}}case"oauth2":{const s=n("grant_type")??"authorization_code";return{type:"oauth2",grant:s==="client_credentials"?"clientCredentials":s==="password_credentials"||s==="password"?"password":s==="implicit"?"implicit":"authorizationCode",tokenUrl:n("accessTokenUrl"),authUrl:n("authUrl"),clientId:n("clientId")??"",clientSecret:n("clientSecret"),scope:n("scope"),username:n("username"),password:n("password"),redirectUri:n("redirect_uri"),usePkce:s==="authorization_code_with_pkce"||void 0,clientAuth:n("client_authentication")==="body"?"body":void 0,accessToken:n("accessToken"),tokenType:n("tokenType")}}case"awsv4":return{type:"awsSigV4",accessKeyId:n("accessKey")??"",secretAccessKey:n("secretKey")??"",region:n("region")??"",service:n("service")??"",sessionToken:n("sessionToken")};default:return}}function vs(e){if(typeof e=="string"){const{base:o,query:i,hash:a}=ce(e);return{url:o+a,params:i.map(c=>({...c,in:"query"}))}}if(!W(e))return{url:"",params:[]};const t=_(e.raw);let n;if(t!==void 0)n=ce(t).base;else{const o=_(e.protocol),i=Array.isArray(e.host)?e.host.join("."):_(e.host)??"",a=_(e.port),c=Array.isArray(e.path)?e.path.map(p=>(W(p)?_(p.value):_(p))??"").join("/"):_(e.path)??"";n=`${o?`${o}://`:""}${i}${a?`:${a}`:""}${c?`/${c.replace(/^\//,"")}`:""}`}const s=Array.isArray(e.query)?je(e.query).map(o=>({...o,in:"query"})):t!==void 0?ce(t).query.map(o=>({...o,in:"query"})):[],r=je(e.variable).map(o=>({...o,in:"path",required:!0}));return{url:n,params:[...r,...s]}}function As(e){if(!W(e))return{kind:"none"};switch(e.mode){case"raw":{const t=_(e.raw)??"",n=W(e.options)&&W(e.options.raw)?_(e.options.raw.language):void 0;return n==="json"?{kind:"json",text:t}:n==="xml"?/<(\w+:)?Envelope[\s>]/.test(t)?{kind:"soap",envelope:t,version:"1.1"}:{kind:"xml",text:t}:n==="html"?{kind:"text",text:t,contentType:"text/html"}:n==="javascript"?{kind:"text",text:t,contentType:"application/javascript"}:!n&&/^\s*[[{]/.test(t)?{kind:"json",text:t}:{kind:"text",text:t}}case"urlencoded":return{kind:"form",fields:je(e.urlencoded)};case"formdata":return{kind:"multipart",parts:Ae(e.formdata).map(t=>{const n=t.type==="file",s=Array.isArray(t.src)?_(t.src[0]):_(t.src),r={key:_(t.key)??"",value:n?"":_(t.value)??"",type:n?"file":"text",...n&&s?{fileName:s}:{},..._(t.contentType)?{contentType:_(t.contentType)}:{}};return t.disabled===!0?{...r,enabled:!1}:r})};case"file":return{kind:"binary",fileName:W(e.file)?_(e.file.src):void 0};case"graphql":{const t=W(e.graphql)?e.graphql:{};return{kind:"graphql",query:_(t.query)??"",variables:_(t.variables)}}default:return{kind:"none"}}}function un(e){const t={};for(const n of Ae(e)){const s=W(n.script)?n.script:{},r=Array.isArray(s.exec)?s.exec.map(o=>_(o)??"").join(`
55
+ `):_(s.exec)??"";r.trim()&&(n.listen==="prerequest"&&(t.preRequest=r),n.listen==="test"&&(t.test=r))}return t.preRequest||t.test?t:void 0}function xs(e){const t=W(e.request)?e.request:typeof e.request=="string"?{url:e.request}:{},{url:n,params:s}=vs(t.url),r=je(t.header).map(i=>({...i,in:"header"})),o=Ae(e.response).map(i=>({name:_(i.name)??"Example",status:Number(i.code??200)||200,headers:je(i.header),body:_(i.body)}));return he({id:_(e.id)??void 0,name:_(e.name)??"Request",method:(_(t.method)??"GET").toUpperCase(),url:n,params:[...s,...r],body:As(t.body),auth:$t(t.auth),description:ke(t.description)??ke(e.description),scripts:un(e.event),examples:o.length?o:void 0})}function fn(e){return Ae(e).map(t=>Array.isArray(t.item)?be({id:_(t.id)??void 0,name:_(t.name)??"Folder",description:ke(t.description),items:fn(t.item),auth:$t(t.auth)}):xs(t))}function dn(e){return Ae(e).map(t=>{const n={key:_(t.key)??"",value:_(t.value)??""};t.type==="secret"&&(n.secret=!0),(t.disabled===!0||t.enabled===!1)&&(n.enabled=!1);const s=ke(t.description);return s&&(n.description=s),n})}function mn(e){const t=typeof e=="string"?JSON.parse(e):e;if(!kt(t))throw new Error("Not a Postman collection");const n=t,s=n.info,r=un(n.event),o=ye({id:_(s._postman_id)??void 0,name:_(s.name)??"Postman collection",description:ke(s.description),version:W(s.version)?_(s.version.raw):_(s.version),items:fn(n.item),variables:dn(n.variable),auth:$t(n.auth)});if(r){const i=a=>a.map(c=>c.kind==="folder"?{...c,items:i(c.items)}:c.scripts?c:{...c,scripts:r});o.items=i(o.items)}return o}function hn(e){const t=typeof e=="string"?JSON.parse(e):e;if(!W(t)||!Array.isArray(t.values))throw new Error("Not a Postman environment");return{id:_(t.id)??$e("e"),name:_(t.name)??"Environment",values:dn(t.values)}}const V=(e,t)=>({key:e,value:t??"",type:"string"});function nt(e){switch(e==null?void 0:e.type){case void 0:case"inherit":return;case"none":return{type:"noauth"};case"bearer":return{type:"bearer",bearer:[V("token",e.token)]};case"basic":return{type:"basic",basic:[V("username",e.username),V("password",e.password)]};case"digest":return{type:"digest",digest:[V("username",e.username),V("password",e.password),...["realm","nonce","qop","algorithm","opaque"].filter(t=>e[t]).map(t=>V(t,e[t]))]};case"apiKey":return{type:"apikey",apikey:[V("key",e.key),V("value",e.value),V("in",e.in==="query"?"query":"header")]};case"oauth2":return{type:"oauth2",oauth2:[["grant_type",e.grant==="clientCredentials"?"client_credentials":e.grant==="password"?"password_credentials":e.grant==="implicit"?"implicit":e.usePkce?"authorization_code_with_pkce":"authorization_code"],["accessTokenUrl",e.tokenUrl],["authUrl",e.authUrl],["clientId",e.clientId],["clientSecret",e.clientSecret],["scope",e.scope],["username",e.username],["password",e.password],["redirect_uri",e.redirectUri],["client_authentication",e.clientAuth],["accessToken",e.accessToken],["tokenType",e.tokenType]].filter(([,s])=>s!==void 0).map(([s,r])=>V(s,r))};case"awsSigV4":return{type:"awsv4",awsv4:[V("accessKey",e.accessKeyId),V("secretKey",e.secretAccessKey),V("region",e.region),V("service",e.service),...e.sessionToken?[V("sessionToken",e.sessionToken)]:[]]};default:return}}const Ee=e=>{const t={key:e.key,value:e.value};return I(e)||(t.disabled=!0),e.description&&(t.description=e.description),t};function Ts(e){const t=e.params.filter(f=>f.in==="query"),n=ve({...e,params:e.params.filter(f=>f.in==="query"&&I(f))}).replace(/%7B%7B(.*?)%7D%7D/g,"{{$1}}").replace(new RegExp("(?<!\\{)\\{([A-Za-z_][\\w.-]*)\\}(?!\\})","g"),":$1"),s=ce(e.url).base,r=/^([a-z][\w+.-]*):\/\//i.exec(s),o=r?s.slice(r[0].length):s,i=o.indexOf("/"),a=i<0?o:o.slice(0,i),c=i<0?[]:o.slice(i+1).split("/"),p={raw:n,host:a?a.startsWith("{{")?[a]:a.split("."):[],path:c.map(f=>f.replace(/^\{([A-Za-z_][\w.-]*)\}$/,":$1"))};r&&(p.protocol=r[1]),t.length&&(p.query=t.map(Ee));const u=e.params.filter(f=>f.in==="path");return u.length&&(p.variable=u.map(Ee)),p}function Ss(e){switch(e.kind){case"none":return;case"json":return{mode:"raw",raw:e.text,options:{raw:{language:"json"}}};case"xml":return{mode:"raw",raw:e.text,options:{raw:{language:"xml"}}};case"soap":return{mode:"raw",raw:e.envelope,options:{raw:{language:"xml"}}};case"text":return{mode:"raw",raw:e.text,options:{raw:{language:e.contentType==="text/html"?"html":"text"}}};case"form":return{mode:"urlencoded",urlencoded:e.fields.map(Ee)};case"multipart":return{mode:"formdata",formdata:e.parts.map(t=>{const n=t.type==="file"?{key:t.key,type:"file",src:t.fileName??""}:{key:t.key,value:t.value,type:"text"};return t.contentType&&(n.contentType=t.contentType),I(t)||(n.disabled=!0),n})};case"binary":return{mode:"file",file:{src:e.fileName??""}};case"graphql":return{mode:"graphql",graphql:{query:e.query,variables:e.variables??""}};default:return}}function Os(e){const t=[];return e!=null&&e.preRequest&&t.push({listen:"prerequest",script:{type:"text/javascript",exec:e.preRequest.split(`
56
56
  `)}}),e!=null&&e.test&&t.push({listen:"test",script:{type:"text/javascript",exec:e.test.split(`
57
- `)}}),t.length?t:void 0}function mn(e){if(e.kind==="folder"){const a={name:e.name,item:e.items.map(mn)};e.description&&(a.description=e.description);const c=nt(e.auth);return c&&(a.auth=c),a}const t={method:e.method,header:e.params.filter(a=>a.in==="header").map(Ee),url:vs(e)},n=As(e.body);n&&(t.body=n);const s=nt(e.auth);s&&(t.auth=s),e.description&&(t.description=e.description);const r=e.params.filter(a=>a.in==="cookie"&&I(a));r.length&&t.header.push({key:"Cookie",value:r.map(a=>`${a.key}=${a.value}`).join("; ")});const o={name:e.name,request:t},i=xs(e.scripts);return i&&(o.event=i),o.response=(e.examples??[]).map(a=>({name:a.name,code:a.status,header:(a.headers??[]).map(Ee),body:a.body??""})),o}function Ts(e){const t={info:{_postman_id:e.id,name:e.name,...e.description?{description:e.description}:{},schema:cn},item:e.items.map(mn)};e.variables.length&&(t.variable=e.variables.map(s=>{const r={key:s.key,value:s.value,type:s.secret?"secret":"string"};return s.enabled===!1&&(r.disabled=!0),r}));const n=nt(e.auth);return n&&(t.auth=n),t}function Ss(e){return{id:e.id,name:e.name,values:e.values.map(t=>({key:t.key,value:t.value,type:t.secret?"secret":"default",enabled:t.enabled!==!1})),_postman_variable_scope:"environment"}}const de=e=>!!e&&typeof e=="object"&&!Array.isArray(e),K=e=>typeof e=="string"?e:void 0,st=e=>Array.isArray(e)?e.filter(de):[],Os=/^(image|font|audio|video)\/|^text\/css|javascript|^application\/(x-)?font|wasm/;function Te(e){return st(e).map(t=>({key:K(t.name)??"",value:K(t.value)??""}))}function wt(e){return de(e)&&de(e.log)&&Array.isArray(e.log.entries)}function hn(e,t={}){const n=typeof e=="string"?JSON.parse(e):e;if(!wt(n))throw new Error("Not a HAR log");const s=st(n.log.entries),r=t.skipStatic??!0,o=[];for(const i of s){if(t.filter&&!t.filter(i))continue;const a=de(i.request)?i.request:{},c=de(i.response)?i.response:{},p=de(c.content)?c.content:{},u=(K(p.mimeType)??"").toLowerCase();if(r&&Os.test(u))continue;const{base:f,query:d}=ce(K(a.url)??""),l=Array.isArray(a.queryString)?Te(a.queryString):d,m=Te(a.cookies),k=Te(a.headers).filter(w=>!w.key.startsWith(":")&&!/^(content-length|host|connection)$/i.test(w.key)&&!(m.length&&/^cookie$/i.test(w.key))),y=[...l.map(w=>({...w,in:"query"})),...k.map(w=>({...w,in:"header"})),...m.map(w=>({...w,in:"cookie"}))];let v={kind:"none"};const $=de(a.postData)?a.postData:void 0;if($){const w=K($.mimeType)??"",N=st($.params);N.length&&w.includes("multipart")?v={kind:"multipart",parts:N.map(L=>L.fileName!==void 0?{key:K(L.name)??"",value:"",type:"file",fileName:K(L.fileName),contentType:K(L.contentType)}:{key:K(L.name)??"",value:K(L.value)??"",type:"text"})}:N.length?v={kind:"form",fields:Te(N)}:K($.text)!==void 0&&(v=ut(K($.text)??"",w||void 0))}const T=(K(a.method)??"GET").toUpperCase(),b=[],S=Number(c.status);if(Number.isFinite(S)&&S>0){let w=K(p.text);w!==void 0&&p.encoding==="base64"&&/json|xml|text|javascript/.test(u)&&(w=ht(w)),b.push({name:`${S} ${K(c.statusText)??""}`.trim(),status:S,headers:Te(c.headers).filter(N=>!N.key.startsWith(":")),body:w})}o.push(he({name:yt(T,f),method:T,url:f,params:y,body:v,examples:b.length?b:void 0}))}return ye({name:t.name??"HAR import",items:o})}const Ge=e=>({name:e.key,value:e.value});function Ns(e,t={}){const n=Array.isArray(e)?e:$e(e.items).map(i=>i.request),s=t.transform??(i=>i),r=(t.now??(()=>new Date))().toISOString(),o=n.map(i=>{var k,y,v,$,T;const a=ve(i,s),c=i.params.filter(b=>b.in==="header"&&I(b)).map(b=>({key:s(b.key),value:s(b.value)})),p=i.params.filter(b=>b.in==="cookie"&&I(b)).map(b=>({key:s(b.key),value:s(b.value)})),u=((k=c.find(b=>/^content-type$/i.test(b.key)))==null?void 0:k.value)??we(i.body),f={method:i.method.toUpperCase(),url:a,httpVersion:"HTTP/1.1",headers:c.map(Ge),queryString:i.params.filter(b=>b.in==="query"&&I(b)).map(b=>({name:s(b.key),value:s(b.value)})),cookies:p.map(Ge),headersSize:-1,bodySize:-1},d=i.body;d.kind==="form"?f.postData={mimeType:u,params:d.fields.filter(I).map(b=>({name:s(b.key),value:s(b.value)})),text:s(re(d)??"")}:d.kind==="multipart"?f.postData={mimeType:u,params:d.parts.filter(I).map(b=>b.type==="file"?{name:s(b.key),fileName:b.fileName??"",contentType:b.contentType}:{name:s(b.key),value:s(b.value)})}:d.kind!=="none"&&d.kind!=="binary"&&(f.postData={mimeType:u,text:s(re(d)??"")});const l=(y=i.examples)==null?void 0:y[0],m=(($=(v=l==null?void 0:l.headers)==null?void 0:v.find(b=>/^content-type$/i.test(b.key)))==null?void 0:$.value)??"";return{startedDateTime:r,time:0,request:f,response:{status:(l==null?void 0:l.status)??0,statusText:l?l.name.replace(new RegExp(`^${l.status}\\s*`),""):"",httpVersion:"HTTP/1.1",headers:((l==null?void 0:l.headers)??[]).map(Ge),cookies:[],content:{size:((T=l==null?void 0:l.body)==null?void 0:T.length)??0,mimeType:m,...(l==null?void 0:l.body)!==void 0?{text:l.body}:{}},redirectURL:"",headersSize:-1,bodySize:-1},cache:{},timings:{send:0,wait:0,receive:0}}});return{log:{version:"1.2",creator:{name:t.creator??"Nice2Dev",version:"1"},entries:o}}}const Cs=`query IntrospectionQuery {
57
+ `)}}),t.length?t:void 0}function yn(e){if(e.kind==="folder"){const a={name:e.name,item:e.items.map(yn)};e.description&&(a.description=e.description);const c=nt(e.auth);return c&&(a.auth=c),a}const t={method:e.method,header:e.params.filter(a=>a.in==="header").map(Ee),url:Ts(e)},n=Ss(e.body);n&&(t.body=n);const s=nt(e.auth);s&&(t.auth=s),e.description&&(t.description=e.description);const r=e.params.filter(a=>a.in==="cookie"&&I(a));r.length&&t.header.push({key:"Cookie",value:r.map(a=>`${a.key}=${a.value}`).join("; ")});const o={name:e.name,request:t},i=Os(e.scripts);return i&&(o.event=i),o.response=(e.examples??[]).map(a=>({name:a.name,code:a.status,header:(a.headers??[]).map(Ee),body:a.body??""})),o}function Ns(e){const t={info:{_postman_id:e.id,name:e.name,...e.description?{description:e.description}:{},schema:ln},item:e.items.map(yn)};e.variables.length&&(t.variable=e.variables.map(s=>{const r={key:s.key,value:s.value,type:s.secret?"secret":"string"};return s.enabled===!1&&(r.disabled=!0),r}));const n=nt(e.auth);return n&&(t.auth=n),t}function Cs(e){return{id:e.id,name:e.name,values:e.values.map(t=>({key:t.key,value:t.value,type:t.secret?"secret":"default",enabled:t.enabled!==!1})),_postman_variable_scope:"environment"}}const de=e=>!!e&&typeof e=="object"&&!Array.isArray(e),K=e=>typeof e=="string"?e:void 0,st=e=>Array.isArray(e)?e.filter(de):[],js=/^(image|font|audio|video)\/|^text\/css|javascript|^application\/(x-)?font|wasm/;function Te(e){return st(e).map(t=>({key:K(t.name)??"",value:K(t.value)??""}))}function wt(e){return de(e)&&de(e.log)&&Array.isArray(e.log.entries)}function gn(e,t={}){const n=typeof e=="string"?JSON.parse(e):e;if(!wt(n))throw new Error("Not a HAR log");const s=st(n.log.entries),r=t.skipStatic??!0,o=[];for(const i of s){if(t.filter&&!t.filter(i))continue;const a=de(i.request)?i.request:{},c=de(i.response)?i.response:{},p=de(c.content)?c.content:{},u=(K(p.mimeType)??"").toLowerCase();if(r&&js.test(u))continue;const{base:f,query:d}=ce(K(a.url)??""),l=Array.isArray(a.queryString)?Te(a.queryString):d,m=Te(a.cookies),k=Te(a.headers).filter(w=>!w.key.startsWith(":")&&!/^(content-length|host|connection)$/i.test(w.key)&&!(m.length&&/^cookie$/i.test(w.key))),y=[...l.map(w=>({...w,in:"query"})),...k.map(w=>({...w,in:"header"})),...m.map(w=>({...w,in:"cookie"}))];let v={kind:"none"};const $=de(a.postData)?a.postData:void 0;if($){const w=K($.mimeType)??"",N=st($.params);N.length&&w.includes("multipart")?v={kind:"multipart",parts:N.map(L=>L.fileName!==void 0?{key:K(L.name)??"",value:"",type:"file",fileName:K(L.fileName),contentType:K(L.contentType)}:{key:K(L.name)??"",value:K(L.value)??"",type:"text"})}:N.length?v={kind:"form",fields:Te(N)}:K($.text)!==void 0&&(v=ut(K($.text)??"",w||void 0))}const T=(K(a.method)??"GET").toUpperCase(),b=[],S=Number(c.status);if(Number.isFinite(S)&&S>0){let w=K(p.text);w!==void 0&&p.encoding==="base64"&&/json|xml|text|javascript/.test(u)&&(w=ht(w)),b.push({name:`${S} ${K(c.statusText)??""}`.trim(),status:S,headers:Te(c.headers).filter(N=>!N.key.startsWith(":")),body:w})}o.push(he({name:yt(T,f),method:T,url:f,params:y,body:v,examples:b.length?b:void 0}))}return ye({name:t.name??"HAR import",items:o})}const Ge=e=>({name:e.key,value:e.value});function Es(e,t={}){const n=Array.isArray(e)?e:ge(e.items).map(i=>i.request),s=t.transform??(i=>i),r=(t.now??(()=>new Date))().toISOString(),o=n.map(i=>{var k,y,v,$,T;const a=ve(i,s),c=i.params.filter(b=>b.in==="header"&&I(b)).map(b=>({key:s(b.key),value:s(b.value)})),p=i.params.filter(b=>b.in==="cookie"&&I(b)).map(b=>({key:s(b.key),value:s(b.value)})),u=((k=c.find(b=>/^content-type$/i.test(b.key)))==null?void 0:k.value)??we(i.body),f={method:i.method.toUpperCase(),url:a,httpVersion:"HTTP/1.1",headers:c.map(Ge),queryString:i.params.filter(b=>b.in==="query"&&I(b)).map(b=>({name:s(b.key),value:s(b.value)})),cookies:p.map(Ge),headersSize:-1,bodySize:-1},d=i.body;d.kind==="form"?f.postData={mimeType:u,params:d.fields.filter(I).map(b=>({name:s(b.key),value:s(b.value)})),text:s(re(d)??"")}:d.kind==="multipart"?f.postData={mimeType:u,params:d.parts.filter(I).map(b=>b.type==="file"?{name:s(b.key),fileName:b.fileName??"",contentType:b.contentType}:{name:s(b.key),value:s(b.value)})}:d.kind!=="none"&&d.kind!=="binary"&&(f.postData={mimeType:u,text:s(re(d)??"")});const l=(y=i.examples)==null?void 0:y[0],m=(($=(v=l==null?void 0:l.headers)==null?void 0:v.find(b=>/^content-type$/i.test(b.key)))==null?void 0:$.value)??"";return{startedDateTime:r,time:0,request:f,response:{status:(l==null?void 0:l.status)??0,statusText:l?l.name.replace(new RegExp(`^${l.status}\\s*`),""):"",httpVersion:"HTTP/1.1",headers:((l==null?void 0:l.headers)??[]).map(Ge),cookies:[],content:{size:((T=l==null?void 0:l.body)==null?void 0:T.length)??0,mimeType:m,...(l==null?void 0:l.body)!==void 0?{text:l.body}:{}},redirectURL:"",headersSize:-1,bodySize:-1},cache:{},timings:{send:0,wait:0,receive:0}}});return{log:{version:"1.2",creator:{name:t.creator??"Nice2Dev",version:"1"},entries:o}}}const _s=`query IntrospectionQuery {
58
58
  __schema {
59
59
  queryType { name }
60
60
  mutationType { name }
@@ -89,33 +89,33 @@ fragment TypeRef on __Type {
89
89
  kind
90
90
  name
91
91
  ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name ofType { kind name } } } } } }
92
- }`;function yn(e){var o,i,a,c;const n=typeof e=="string"?JSON.parse(e):e,s=((o=n==null?void 0:n.data)==null?void 0:o.__schema)??(n==null?void 0:n.__schema)??(Array.isArray(n==null?void 0:n.types)?n:void 0);if(!s||!Array.isArray(s.types))throw new Error("Not a GraphQL introspection result");const r={};for(const p of s.types)p!=null&&p.name&&(r[p.name]=p);return{queryType:((i=s.queryType)==null?void 0:i.name)??void 0,mutationType:((a=s.mutationType)==null?void 0:a.name)??void 0,subscriptionType:((c=s.subscriptionType)==null?void 0:c.name)??void 0,types:r}}function ze(e){return e?e.kind==="NON_NULL"?`${ze(e.ofType)}!`:e.kind==="LIST"?`[${ze(e.ofType)}]`:e.name??"":""}function vt(e){let t=e;for(;t&&(t.kind==="NON_NULL"||t.kind==="LIST");)t=t.ofType;return(t==null?void 0:t.name)??void 0}function gn(e){const t=[],n=[["query",e.queryType],["mutation",e.mutationType],["subscription",e.subscriptionType]];for(const[s,r]of n){const o=r?e.types[r]:void 0;for(const i of(o==null?void 0:o.fields)??[])i.name.startsWith("__")||t.push({kind:s,field:i})}return t}function bn(e,t){var s;const n=(s=e.types[vt(t)??""])==null?void 0:s.kind;return n==="SCALAR"||n==="ENUM"||n===void 0}function js(e){var t;return((t=e.args)==null?void 0:t.some(n=>n.type.kind==="NON_NULL"&&n.defaultValue==null))??!1}function rt(e,t,n,s){const r=e.types[vt(t)??""];if(!r||r.kind==="SCALAR"||r.kind==="ENUM")return"";const o=[];if(r.kind==="UNION"||r.kind==="INTERFACE"&&!(r.fields??[]).length){o.push(`${s} __typename`);for(const i of r.possibleTypes??[]){const a=rt(e,i,Math.max(n-1,0),`${s} `);a&&o.push(`${s} ... on ${i.name} ${a}`)}return`{
92
+ }`;function bn(e){var o,i,a,c;const n=typeof e=="string"?JSON.parse(e):e,s=((o=n==null?void 0:n.data)==null?void 0:o.__schema)??(n==null?void 0:n.__schema)??(Array.isArray(n==null?void 0:n.types)?n:void 0);if(!s||!Array.isArray(s.types))throw new Error("Not a GraphQL introspection result");const r={};for(const p of s.types)p!=null&&p.name&&(r[p.name]=p);return{queryType:((i=s.queryType)==null?void 0:i.name)??void 0,mutationType:((a=s.mutationType)==null?void 0:a.name)??void 0,subscriptionType:((c=s.subscriptionType)==null?void 0:c.name)??void 0,types:r}}function ze(e){return e?e.kind==="NON_NULL"?`${ze(e.ofType)}!`:e.kind==="LIST"?`[${ze(e.ofType)}]`:e.name??"":""}function vt(e){let t=e;for(;t&&(t.kind==="NON_NULL"||t.kind==="LIST");)t=t.ofType;return(t==null?void 0:t.name)??void 0}function kn(e){const t=[],n=[["query",e.queryType],["mutation",e.mutationType],["subscription",e.subscriptionType]];for(const[s,r]of n){const o=r?e.types[r]:void 0;for(const i of(o==null?void 0:o.fields)??[])i.name.startsWith("__")||t.push({kind:s,field:i})}return t}function $n(e,t){var s;const n=(s=e.types[vt(t)??""])==null?void 0:s.kind;return n==="SCALAR"||n==="ENUM"||n===void 0}function Us(e){var t;return((t=e.args)==null?void 0:t.some(n=>n.type.kind==="NON_NULL"&&n.defaultValue==null))??!1}function rt(e,t,n,s){const r=e.types[vt(t)??""];if(!r||r.kind==="SCALAR"||r.kind==="ENUM")return"";const o=[];if(r.kind==="UNION"||r.kind==="INTERFACE"&&!(r.fields??[]).length){o.push(`${s} __typename`);for(const i of r.possibleTypes??[]){const a=rt(e,i,Math.max(n-1,0),`${s} `);a&&o.push(`${s} ... on ${i.name} ${a}`)}return`{
93
93
  ${o.join(`
94
94
  `)}
95
- ${s}}`}for(const i of r.fields??[])if(!(i.isDeprecated||js(i))){if(bn(e,i.type))o.push(`${s} ${i.name}`);else if(n>0){const a=rt(e,i.type,n-1,`${s} `);a&&o.push(`${s} ${i.name} ${a}`)}}return o.length||o.push(`${s} __typename`),`{
95
+ ${s}}`}for(const i of r.fields??[])if(!(i.isDeprecated||Us(i))){if($n(e,i.type))o.push(`${s} ${i.name}`);else if(n>0){const a=rt(e,i.type,n-1,`${s} `);a&&o.push(`${s} ${i.name} ${a}`)}}return o.length||o.push(`${s} __typename`),`{
96
96
  ${o.join(`
97
97
  `)}
98
- ${s}}`}function Ne(e,t,n=0){var r,o;if(t.kind==="NON_NULL"&&t.ofType)return Ne(e,t.ofType,n);if(t.kind==="LIST"&&t.ofType)return[Ne(e,t.ofType,n)];const s=e.types[t.name??""];switch((s==null?void 0:s.kind)??"SCALAR"){case"ENUM":return((o=(r=s==null?void 0:s.enumValues)==null?void 0:r[0])==null?void 0:o.name)??"";case"INPUT_OBJECT":{if(n>4)return{};const i={};for(const a of(s==null?void 0:s.inputFields)??[])(a.type.kind==="NON_NULL"||n===0)&&(i[a.name]=Ne(e,a.type,n+1));return i}default:switch(t.name){case"Int":case"Float":return 0;case"Boolean":return!1;default:return""}}}function Es(e){return e.charAt(0).toUpperCase()+e.slice(1)}function kn(e,t,n={}){const{kind:s,field:r}=t,o=n.depth??2,i=Es(r.name),a=r.args??[],c=a.length?`(${a.map(l=>`$${l.name}: ${ze(l.type)}`).join(", ")})`:"",p=a.length?`(${a.map(l=>`${l.name}: $${l.name}`).join(", ")})`:"",u=bn(e,r.type)?"":` ${rt(e,r.type,o-1," ")}`,f=`${s} ${i}${c} {
98
+ ${s}}`}function Ne(e,t,n=0){var r,o;if(t.kind==="NON_NULL"&&t.ofType)return Ne(e,t.ofType,n);if(t.kind==="LIST"&&t.ofType)return[Ne(e,t.ofType,n)];const s=e.types[t.name??""];switch((s==null?void 0:s.kind)??"SCALAR"){case"ENUM":return((o=(r=s==null?void 0:s.enumValues)==null?void 0:r[0])==null?void 0:o.name)??"";case"INPUT_OBJECT":{if(n>4)return{};const i={};for(const a of(s==null?void 0:s.inputFields)??[])(a.type.kind==="NON_NULL"||n===0)&&(i[a.name]=Ne(e,a.type,n+1));return i}default:switch(t.name){case"Int":case"Float":return 0;case"Boolean":return!1;default:return""}}}function qs(e){return e.charAt(0).toUpperCase()+e.slice(1)}function wn(e,t,n={}){const{kind:s,field:r}=t,o=n.depth??2,i=qs(r.name),a=r.args??[],c=a.length?`(${a.map(l=>`$${l.name}: ${ze(l.type)}`).join(", ")})`:"",p=a.length?`(${a.map(l=>`${l.name}: $${l.name}`).join(", ")})`:"",u=$n(e,r.type)?"":` ${rt(e,r.type,o-1," ")}`,f=`${s} ${i}${c} {
99
99
  ${r.name}${p}${u}
100
- }`,d={};for(const l of a)l.defaultValue==null&&(d[l.name]=Ne(e,l.type));return{query:f,variables:d,operationName:i}}function $n(e,t={}){const n=typeof e=="object"&&e&&"types"in e&&!Array.isArray(e.types)?e:yn(e),s={query:"Queries",mutation:"Mutations",subscription:"Subscriptions",...t.folderNames},r=new Map;for(const o of gn(n)){const i=kn(n,o,{depth:t.depth}),a=he({name:o.field.name,method:"POST",url:"{{graphqlUrl}}",body:{kind:"graphql",query:i.query,variables:Object.keys(i.variables).length?JSON.stringify(i.variables,null,2):void 0,operationName:i.operationName},description:o.field.description??void 0,deprecated:o.field.isDeprecated||void 0});r.has(o.kind)||r.set(o.kind,[]),r.get(o.kind).push(a)}return ye({name:t.name??"GraphQL API",items:[...r].map(([o,i])=>ge({name:s[o],items:i})),variables:[{key:"graphqlUrl",value:t.endpoint??""}]})}const G="http://schemas.xmlsoap.org/wsdl/",Qe="http://schemas.xmlsoap.org/wsdl/soap/",Ye="http://schemas.xmlsoap.org/wsdl/soap12/",me="http://www.w3.org/2001/XMLSchema",_s="http://schemas.xmlsoap.org/soap/envelope/",Us="http://www.w3.org/2003/05/soap-envelope",ee=(e,t)=>`{${e??""}}${t}`;function Z(e,t,n){return Array.from(e.childNodes).filter(s=>s.nodeType===1&&s.localName===n&&(t===null||s.namespaceURI===t))}function ne(e,t,n){return Z(e,t,n)[0]}function ae(e,t){if(!t)return;const n=t.indexOf(":"),s=n<0?null:t.slice(0,n),r=n<0?t:t.slice(n+1);return{namespace:e.lookupNamespaceURI(s)??void 0,name:r}}function Ut(e){var s;const t=ne(e,G,"documentation");return((s=t==null?void 0:t.textContent)==null?void 0:s.trim())||void 0}function qs(){const e=globalThis.DOMParser;if(!e)throw new Error("No DOMParser: pass one (xmldom, jsdom) in Node");return new e}function wn(e,t=qs()){const s=t.parseFromString(e,"text/xml").documentElement;if(!s||s.localName!=="definitions"||s.namespaceURI!==G)throw new Error("Not a WSDL 1.1 document");const r=s.getAttribute("targetNamespace")??void 0,o={elements:new Map,types:new Map,qualified:new Map},i=ne(s,G,"types");for(const f of i?Z(i,me,"schema"):[]){const d=f.getAttribute("targetNamespace")??void 0;o.qualified.set(d??"",f.getAttribute("elementFormDefault")==="qualified");for(const l of Z(f,me,"element")){const m=l.getAttribute("name");m&&o.elements.set(ee(d,m),l)}for(const l of[...Z(f,me,"complexType"),...Z(f,me,"simpleType")]){const m=l.getAttribute("name");m&&o.types.set(ee(d,m),l)}}const a=new Map;for(const f of Z(s,G,"message")){const d=Z(f,G,"part").map(l=>({name:l.getAttribute("name")??"",element:ae(l,l.getAttribute("element")),type:ae(l,l.getAttribute("type"))}));a.set(ee(r,f.getAttribute("name")??""),d)}const c=new Map;for(const f of Z(s,G,"portType")){const d=new Map;for(const l of Z(f,G,"operation")){const m=ne(l,G,"input"),k=ne(l,G,"output"),y=m?ae(m,m.getAttribute("message")):void 0,v=k?ae(k,k.getAttribute("message")):void 0;d.set(l.getAttribute("name")??"",{doc:Ut(l),input:y?ee(y.namespace,y.name):void 0,output:v?ee(v.namespace,v.name):void 0})}c.set(ee(r,f.getAttribute("name")??""),d)}const p=new Map;for(const f of Z(s,G,"binding")){const d=ne(f,Qe,"binding"),l=ne(f,Ye,"binding"),m=d??l,k=ee(r,f.getAttribute("name")??"");if(!m){p.set(k,null);continue}const y=d?Qe:Ye,v=ae(f,f.getAttribute("type")),$=v?c.get(ee(v.namespace,v.name)):void 0,T=m.getAttribute("style")==="rpc"?"rpc":"document",b=Z(f,G,"operation").map(S=>{const w=S.getAttribute("name")??"",N=ne(S,y,"operation"),L=((N==null?void 0:N.getAttribute("style"))??T)==="rpc"?"rpc":"document",R=$==null?void 0:$.get(w),M=R!=null&&R.input?a.get(R.input):void 0,O=R!=null&&R.output?a.get(R.output):void 0,x=ne(S,G,"input"),U=x?ne(x,y,"body"):void 0,H={name:w,soapAction:(N==null?void 0:N.getAttribute("soapAction"))??void 0,style:L,documentation:R==null?void 0:R.doc};if(L==="rpc")H.inputElement={namespace:(U==null?void 0:U.getAttribute("namespace"))??r,name:w},H.inputParts=(M??[]).map(g=>({name:g.name,type:g.type}));else{const g=(M==null?void 0:M.find(A=>A.element))??(M==null?void 0:M[0]);g!=null&&g.element&&(H.inputElement=g.element)}const h=O==null?void 0:O.find(g=>g.element);return h!=null&&h.element&&(H.outputElement=h.element),H});p.set(k,{version:d?"1.1":"1.2",operations:b})}const u=Z(s,G,"service").map(f=>({name:f.getAttribute("name")??"Service",documentation:Ut(f),ports:Z(f,G,"port").flatMap(d=>{const l=ae(d,d.getAttribute("binding")),m=l?p.get(ee(l.namespace,l.name)):void 0;if(!m)return[];const k=ne(d,Qe,"address")??ne(d,Ye,"address");return[{name:d.getAttribute("name")??"",binding:(l==null?void 0:l.name)??"",version:m.version,address:(k==null?void 0:k.getAttribute("location"))??"",operations:m.operations}]})}));return{targetNamespace:r,services:u,schema:o}}function vn(e,t,n,s,r,o,i){const a=t.getAttribute("name")??t.getAttribute("ref")??"element";let c=t,p=n;if(t.getAttribute("ref")){const $=ae(t,t.getAttribute("ref")),T=$?e.schema.elements.get(ee($.namespace,$.name)):void 0;T&&(c=T,p=$==null?void 0:$.namespace)}const u=c.getAttribute("name")??a.split(":").pop()??a,f=r&&p?it(p,s):"",d=f?`${f}:${u}`:u,m=c.getAttribute("minOccurs")==="0"||t.getAttribute("minOccurs")==="0"?`${o}<!--Optional:-->
101
- `:"";let k=ne(c,me,"complexType");const y=ae(c,c.getAttribute("type"));if(!k&&y&&y.namespace!==me){const $=e.schema.types.get(ee(y.namespace,y.name));($==null?void 0:$.localName)==="complexType"&&(k=$)}if(!k||i>6)return`${m}${o}<${d}>?</${d}>`;const v=Is(e,k,p,s,o,i);return v?`${m}${o}<${d}>
100
+ }`,d={};for(const l of a)l.defaultValue==null&&(d[l.name]=Ne(e,l.type));return{query:f,variables:d,operationName:i}}function vn(e,t={}){const n=typeof e=="object"&&e&&"types"in e&&!Array.isArray(e.types)?e:bn(e),s={query:"Queries",mutation:"Mutations",subscription:"Subscriptions",...t.folderNames},r=new Map;for(const o of kn(n)){const i=wn(n,o,{depth:t.depth}),a=he({name:o.field.name,method:"POST",url:"{{graphqlUrl}}",body:{kind:"graphql",query:i.query,variables:Object.keys(i.variables).length?JSON.stringify(i.variables,null,2):void 0,operationName:i.operationName},description:o.field.description??void 0,deprecated:o.field.isDeprecated||void 0});r.has(o.kind)||r.set(o.kind,[]),r.get(o.kind).push(a)}return ye({name:t.name??"GraphQL API",items:[...r].map(([o,i])=>be({name:s[o],items:i})),variables:[{key:"graphqlUrl",value:t.endpoint??""}]})}const G="http://schemas.xmlsoap.org/wsdl/",Qe="http://schemas.xmlsoap.org/wsdl/soap/",Ye="http://schemas.xmlsoap.org/wsdl/soap12/",me="http://www.w3.org/2001/XMLSchema",Is="http://schemas.xmlsoap.org/soap/envelope/",Ps="http://www.w3.org/2003/05/soap-envelope",ee=(e,t)=>`{${e??""}}${t}`;function Z(e,t,n){return Array.from(e.childNodes).filter(s=>s.nodeType===1&&s.localName===n&&(t===null||s.namespaceURI===t))}function ne(e,t,n){return Z(e,t,n)[0]}function ae(e,t){if(!t)return;const n=t.indexOf(":"),s=n<0?null:t.slice(0,n),r=n<0?t:t.slice(n+1);return{namespace:e.lookupNamespaceURI(s)??void 0,name:r}}function qt(e){var s;const t=ne(e,G,"documentation");return((s=t==null?void 0:t.textContent)==null?void 0:s.trim())||void 0}function Ls(){const e=globalThis.DOMParser;if(!e)throw new Error("No DOMParser: pass one (xmldom, jsdom) in Node");return new e}function An(e,t=Ls()){const s=t.parseFromString(e,"text/xml").documentElement;if(!s||s.localName!=="definitions"||s.namespaceURI!==G)throw new Error("Not a WSDL 1.1 document");const r=s.getAttribute("targetNamespace")??void 0,o={elements:new Map,types:new Map,qualified:new Map},i=ne(s,G,"types");for(const f of i?Z(i,me,"schema"):[]){const d=f.getAttribute("targetNamespace")??void 0;o.qualified.set(d??"",f.getAttribute("elementFormDefault")==="qualified");for(const l of Z(f,me,"element")){const m=l.getAttribute("name");m&&o.elements.set(ee(d,m),l)}for(const l of[...Z(f,me,"complexType"),...Z(f,me,"simpleType")]){const m=l.getAttribute("name");m&&o.types.set(ee(d,m),l)}}const a=new Map;for(const f of Z(s,G,"message")){const d=Z(f,G,"part").map(l=>({name:l.getAttribute("name")??"",element:ae(l,l.getAttribute("element")),type:ae(l,l.getAttribute("type"))}));a.set(ee(r,f.getAttribute("name")??""),d)}const c=new Map;for(const f of Z(s,G,"portType")){const d=new Map;for(const l of Z(f,G,"operation")){const m=ne(l,G,"input"),k=ne(l,G,"output"),y=m?ae(m,m.getAttribute("message")):void 0,v=k?ae(k,k.getAttribute("message")):void 0;d.set(l.getAttribute("name")??"",{doc:qt(l),input:y?ee(y.namespace,y.name):void 0,output:v?ee(v.namespace,v.name):void 0})}c.set(ee(r,f.getAttribute("name")??""),d)}const p=new Map;for(const f of Z(s,G,"binding")){const d=ne(f,Qe,"binding"),l=ne(f,Ye,"binding"),m=d??l,k=ee(r,f.getAttribute("name")??"");if(!m){p.set(k,null);continue}const y=d?Qe:Ye,v=ae(f,f.getAttribute("type")),$=v?c.get(ee(v.namespace,v.name)):void 0,T=m.getAttribute("style")==="rpc"?"rpc":"document",b=Z(f,G,"operation").map(S=>{const w=S.getAttribute("name")??"",N=ne(S,y,"operation"),L=((N==null?void 0:N.getAttribute("style"))??T)==="rpc"?"rpc":"document",R=$==null?void 0:$.get(w),M=R!=null&&R.input?a.get(R.input):void 0,O=R!=null&&R.output?a.get(R.output):void 0,x=ne(S,G,"input"),U=x?ne(x,y,"body"):void 0,D={name:w,soapAction:(N==null?void 0:N.getAttribute("soapAction"))??void 0,style:L,documentation:R==null?void 0:R.doc};if(L==="rpc")D.inputElement={namespace:(U==null?void 0:U.getAttribute("namespace"))??r,name:w},D.inputParts=(M??[]).map(g=>({name:g.name,type:g.type}));else{const g=(M==null?void 0:M.find(A=>A.element))??(M==null?void 0:M[0]);g!=null&&g.element&&(D.inputElement=g.element)}const h=O==null?void 0:O.find(g=>g.element);return h!=null&&h.element&&(D.outputElement=h.element),D});p.set(k,{version:d?"1.1":"1.2",operations:b})}const u=Z(s,G,"service").map(f=>({name:f.getAttribute("name")??"Service",documentation:qt(f),ports:Z(f,G,"port").flatMap(d=>{const l=ae(d,d.getAttribute("binding")),m=l?p.get(ee(l.namespace,l.name)):void 0;if(!m)return[];const k=ne(d,Qe,"address")??ne(d,Ye,"address");return[{name:d.getAttribute("name")??"",binding:(l==null?void 0:l.name)??"",version:m.version,address:(k==null?void 0:k.getAttribute("location"))??"",operations:m.operations}]})}));return{targetNamespace:r,services:u,schema:o}}function xn(e,t,n,s,r,o,i){const a=t.getAttribute("name")??t.getAttribute("ref")??"element";let c=t,p=n;if(t.getAttribute("ref")){const $=ae(t,t.getAttribute("ref")),T=$?e.schema.elements.get(ee($.namespace,$.name)):void 0;T&&(c=T,p=$==null?void 0:$.namespace)}const u=c.getAttribute("name")??a.split(":").pop()??a,f=r&&p?it(p,s):"",d=f?`${f}:${u}`:u,m=c.getAttribute("minOccurs")==="0"||t.getAttribute("minOccurs")==="0"?`${o}<!--Optional:-->
101
+ `:"";let k=ne(c,me,"complexType");const y=ae(c,c.getAttribute("type"));if(!k&&y&&y.namespace!==me){const $=e.schema.types.get(ee(y.namespace,y.name));($==null?void 0:$.localName)==="complexType"&&(k=$)}if(!k||i>6)return`${m}${o}<${d}>?</${d}>`;const v=Rs(e,k,p,s,o,i);return v?`${m}${o}<${d}>
102
102
  ${v}
103
- ${o}</${d}>`:`${m}${o}<${d}/>`}function Is(e,t,n,s,r,o){const i=e.schema.qualified.get(n??"")??!1,a=[],c=p=>{for(const u of Array.from(p.childNodes)){if(u.nodeType!==1)continue;const f=u;if(f.namespaceURI===me){if(f.localName==="element")a.push(vn(e,f,n,s,i,`${r} `,o+1));else if(["sequence","all","choice","complexContent","extension"].includes(f.localName)){if(f.localName==="extension"){const d=ae(f,f.getAttribute("base")),l=d?e.schema.types.get(ee(d.namespace,d.name)):void 0;l&&c(l)}c(f)}}}};return c(t),a.join(`
104
- `)}function it(e,t){return t.has(e)||t.set(e,t.size?`ns${t.size}`:"tns"),t.get(e)}function An(e,t,n="1.1"){const s=new Map,r=n==="1.2"?"soap":"soapenv";let o;const i=t.inputElement;if(t.style==="rpc"){const p=i==null?void 0:i.namespace,u=p?it(p,s):"",f=u?`${u}:${t.name}`:t.name,d=(t.inputParts??[]).map(l=>` <${l.name}>?</${l.name}>`);o=d.length?` <${f}>
103
+ ${o}</${d}>`:`${m}${o}<${d}/>`}function Rs(e,t,n,s,r,o){const i=e.schema.qualified.get(n??"")??!1,a=[],c=p=>{for(const u of Array.from(p.childNodes)){if(u.nodeType!==1)continue;const f=u;if(f.namespaceURI===me){if(f.localName==="element")a.push(xn(e,f,n,s,i,`${r} `,o+1));else if(["sequence","all","choice","complexContent","extension"].includes(f.localName)){if(f.localName==="extension"){const d=ae(f,f.getAttribute("base")),l=d?e.schema.types.get(ee(d.namespace,d.name)):void 0;l&&c(l)}c(f)}}}};return c(t),a.join(`
104
+ `)}function it(e,t){return t.has(e)||t.set(e,t.size?`ns${t.size}`:"tns"),t.get(e)}function Tn(e,t,n="1.1"){const s=new Map,r=n==="1.2"?"soap":"soapenv";let o;const i=t.inputElement;if(t.style==="rpc"){const p=i==null?void 0:i.namespace,u=p?it(p,s):"",f=u?`${u}:${t.name}`:t.name,d=(t.inputParts??[]).map(l=>` <${l.name}>?</${l.name}>`);o=d.length?` <${f}>
105
105
  ${d.join(`
106
106
  `)}
107
- </${f}>`:` <${f}/>`}else if(i){const p=e.schema.elements.get(ee(i.namespace,i.name));if(p)o=vn(e,p,i.namespace,s,!0," ",0);else{const u=i.namespace?it(i.namespace,s):"",f=u?`${u}:${i.name}`:i.name;o=` <${f}>?</${f}>`}}else o="";const c=[`xmlns:${r}="${n==="1.2"?Us:_s}"`,...[...s].map(([p,u])=>`xmlns:${u}="${p}"`)].join(" ");return[`<${r}:Envelope ${c}>`,` <${r}:Header/>`,` <${r}:Body>`,...o?[o]:[],` </${r}:Body>`,`</${r}:Envelope>`].join(`
108
- `)}function xn(e,t={}){var r;const n=wn(e,t.parser),s=n.services.flatMap(o=>o.ports.map(i=>ge({name:n.services.length>1||o.ports.length>1?`${o.name} — ${i.name}`:o.name,description:o.documentation,items:i.operations.map(a=>he({name:a.name,method:"POST",url:i.address,body:{kind:"soap",envelope:An(n,a,i.version),action:a.soapAction??"",version:i.version},description:a.documentation}))})));return ye({name:t.name??((r=n.services[0])==null?void 0:r.name)??"SOAP service",items:s.length===1?s[0].items:s})}const qt=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],Ps=Array.from({length:64},(e,t)=>Math.floor(Math.abs(Math.sin(t+1))*2**32)>>>0);function At(e){const t=typeof e=="string"?new TextEncoder().encode(e):e,n=t.length*8,s=new Uint8Array(((t.length+8>>6)+1)*64);s.set(t),s[t.length]=128;const r=new DataView(s.buffer);r.setUint32(s.length-8,n>>>0,!0),r.setUint32(s.length-4,Math.floor(n/2**32),!0);let o=1732584193,i=4023233417,a=2562383102,c=271733878;const p=new Uint32Array(16);for(let f=0;f<s.length;f+=64){for(let y=0;y<16;y++)p[y]=r.getUint32(f+y*4,!0);let d=o,l=i,m=a,k=c;for(let y=0;y<64;y++){let v,$;y<16?(v=l&m|~l&k,$=y):y<32?(v=k&l|~k&m,$=(5*y+1)%16):y<48?(v=l^m^k,$=(3*y+5)%16):(v=m^(l|~k),$=7*y%16);const T=d+v+Ps[y]+p[$]>>>0;d=k,k=m,m=l,l=l+(T<<qt[y]|T>>>32-qt[y])>>>0}o=o+d>>>0,i=i+l>>>0,a=a+m>>>0,c=c+k>>>0}const u=new DataView(new ArrayBuffer(16));return[o,i,a,c].forEach((f,d)=>u.setUint32(d*4,f,!0)),Array.from(new Uint8Array(u.buffer),f=>f.toString(16).padStart(2,"0")).join("")}function ot(e,t){if(typeof e=="string")return t(e);if(Array.isArray(e))return e.map(n=>ot(n,t));if(e&&typeof e=="object"){const n={};for(const[s,r]of Object.entries(e))n[s]=ot(r,t);return n}return e}const Ls=new TextEncoder;function at(){const e=globalThis.crypto;if(!(e!=null&&e.subtle))throw new Error("Web Crypto is not available");return e.subtle}function Ce(e){return Array.from(new Uint8Array(e),t=>t.toString(16).padStart(2,"0")).join("")}function xt(e){let t="";for(const n of e instanceof Uint8Array?e:new Uint8Array(e))t+=String.fromCharCode(n);return btoa(t)}function Le(e){const t=typeof e=="string"?Ls.encode(e):e;return new Uint8Array(t)}async function _e(e,t){return at().digest(e,Le(t))}async function fe(e,t,n){const s=t instanceof ArrayBuffer?new Uint8Array(t):Le(t),r=await at().importKey("raw",Le(s),{name:"HMAC",hash:e},!1,["sign"]);return at().sign("HMAC",r,Le(n))}function Xe(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function J(e,t,n){const s=t.toLowerCase(),r=e.findIndex(([o])=>o.toLowerCase()===s);r>=0?e[r]=[e[r][0],n]:e.push([t,n])}function Re(e,t){var s;const n=t.toLowerCase();return(s=e.find(([r])=>r.toLowerCase()===n))==null?void 0:s[1]}function Tn(e){const t=/Digest\s+(.*)$/i.exec(e);if(!t)return;const n={};for(const s of t[1].matchAll(/(\w+)=(?:"([^"]*)"|([^\s,]+))/g))n[s[1].toLowerCase()]=s[2]??s[3];return n}async function Se(e,t){return/sha-?256/i.test(e)?Ce(await _e("SHA-256",t)):At(t)}async function Sn(e,t,n,s={}){var l;if(!e.realm||!e.nonce)return;const r=e.algorithm??"MD5",o=n.replace(/^[a-z][\w+.-]*:\/\/[^/]*/i,"")||"/",i=(l=e.qop)!=null&&l.split(",").map(m=>m.trim()).includes("auth")?"auth":e.qop?e.qop.split(",")[0].trim():void 0,a=s.cnonce??At(String(Math.random())).slice(0,16),c=(s.nc??1).toString(16).padStart(8,"0");let p=await Se(r,`${e.username}:${e.realm}:${e.password}`);/-sess$/i.test(r)&&(p=await Se(r,`${p}:${e.nonce}:${a}`));const u=await Se(r,`${t}:${o}`),f=i?await Se(r,`${p}:${e.nonce}:${c}:${a}:${i}:${u}`):await Se(r,`${p}:${e.nonce}:${u}`),d=[`username="${e.username}"`,`realm="${e.realm}"`,`nonce="${e.nonce}"`,`uri="${o}"`,`algorithm=${r}`,`response="${f}"`];return i&&d.push(`qop=${i}`,`nc=${c}`,`cnonce="${a}"`),e.opaque&&d.push(`opaque="${e.opaque}"`),`Digest ${d.join(", ")}`}async function On(e,t,n=new Date){var b;const s=new URL(e.url),r=n.toISOString().replace(/[:-]|\.\d{3}/g,""),o=r.slice(0,8);let i="";typeof e.body=="string"?i=e.body:((b=e.body)==null?void 0:b.kind)==="binary"&&e.body.data&&(i=Uint8Array.from(atob(e.body.data),S=>S.charCodeAt(0)));const a=e.body&&typeof e.body!="string"&&e.body.kind==="multipart"?"UNSIGNED-PAYLOAD":Ce(await _e("SHA-256",i)),c=t.service==="s3";J(e.headers,"X-Amz-Date",r),c&&J(e.headers,"X-Amz-Content-Sha256",a),t.sessionToken&&J(e.headers,"X-Amz-Security-Token",t.sessionToken);const p=s.pathname.split("/").map(S=>c?S:Xe(S)).join("/")||"/",u=[...s.searchParams.entries()].map(([S,w])=>[Xe(S),Xe(w)]).sort(([S,w],[N,L])=>S===N?w<L?-1:w>L?1:0:S<N?-1:1).map(([S,w])=>`${S}=${w}`).join("&"),f=new Map([["host",s.host]]);for(const[S,w]of e.headers){const N=S.toLowerCase();(N.startsWith("x-amz-")||N==="content-type")&&f.set(N,w.trim().replace(/\s+/g," "))}const d=[...f.keys()].sort(),l=d.map(S=>`${S}:${f.get(S)}
107
+ </${f}>`:` <${f}/>`}else if(i){const p=e.schema.elements.get(ee(i.namespace,i.name));if(p)o=xn(e,p,i.namespace,s,!0," ",0);else{const u=i.namespace?it(i.namespace,s):"",f=u?`${u}:${i.name}`:i.name;o=` <${f}>?</${f}>`}}else o="";const c=[`xmlns:${r}="${n==="1.2"?Ps:Is}"`,...[...s].map(([p,u])=>`xmlns:${u}="${p}"`)].join(" ");return[`<${r}:Envelope ${c}>`,` <${r}:Header/>`,` <${r}:Body>`,...o?[o]:[],` </${r}:Body>`,`</${r}:Envelope>`].join(`
108
+ `)}function Sn(e,t={}){var r;const n=An(e,t.parser),s=n.services.flatMap(o=>o.ports.map(i=>be({name:n.services.length>1||o.ports.length>1?`${o.name} — ${i.name}`:o.name,description:o.documentation,items:i.operations.map(a=>he({name:a.name,method:"POST",url:i.address,body:{kind:"soap",envelope:Tn(n,a,i.version),action:a.soapAction??"",version:i.version},description:a.documentation}))})));return ye({name:t.name??((r=n.services[0])==null?void 0:r.name)??"SOAP service",items:s.length===1?s[0].items:s})}const It=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],Ds=Array.from({length:64},(e,t)=>Math.floor(Math.abs(Math.sin(t+1))*2**32)>>>0);function At(e){const t=typeof e=="string"?new TextEncoder().encode(e):e,n=t.length*8,s=new Uint8Array(((t.length+8>>6)+1)*64);s.set(t),s[t.length]=128;const r=new DataView(s.buffer);r.setUint32(s.length-8,n>>>0,!0),r.setUint32(s.length-4,Math.floor(n/2**32),!0);let o=1732584193,i=4023233417,a=2562383102,c=271733878;const p=new Uint32Array(16);for(let f=0;f<s.length;f+=64){for(let y=0;y<16;y++)p[y]=r.getUint32(f+y*4,!0);let d=o,l=i,m=a,k=c;for(let y=0;y<64;y++){let v,$;y<16?(v=l&m|~l&k,$=y):y<32?(v=k&l|~k&m,$=(5*y+1)%16):y<48?(v=l^m^k,$=(3*y+5)%16):(v=m^(l|~k),$=7*y%16);const T=d+v+Ds[y]+p[$]>>>0;d=k,k=m,m=l,l=l+(T<<It[y]|T>>>32-It[y])>>>0}o=o+d>>>0,i=i+l>>>0,a=a+m>>>0,c=c+k>>>0}const u=new DataView(new ArrayBuffer(16));return[o,i,a,c].forEach((f,d)=>u.setUint32(d*4,f,!0)),Array.from(new Uint8Array(u.buffer),f=>f.toString(16).padStart(2,"0")).join("")}function ot(e,t){if(typeof e=="string")return t(e);if(Array.isArray(e))return e.map(n=>ot(n,t));if(e&&typeof e=="object"){const n={};for(const[s,r]of Object.entries(e))n[s]=ot(r,t);return n}return e}const Hs=new TextEncoder;function at(){const e=globalThis.crypto;if(!(e!=null&&e.subtle))throw new Error("Web Crypto is not available");return e.subtle}function Ce(e){return Array.from(new Uint8Array(e),t=>t.toString(16).padStart(2,"0")).join("")}function xt(e){let t="";for(const n of e instanceof Uint8Array?e:new Uint8Array(e))t+=String.fromCharCode(n);return btoa(t)}function Le(e){const t=typeof e=="string"?Hs.encode(e):e;return new Uint8Array(t)}async function _e(e,t){return at().digest(e,Le(t))}async function fe(e,t,n){const s=t instanceof ArrayBuffer?new Uint8Array(t):Le(t),r=await at().importKey("raw",Le(s),{name:"HMAC",hash:e},!1,["sign"]);return at().sign("HMAC",r,Le(n))}function Xe(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function J(e,t,n){const s=t.toLowerCase(),r=e.findIndex(([o])=>o.toLowerCase()===s);r>=0?e[r]=[e[r][0],n]:e.push([t,n])}function Re(e,t){var s;const n=t.toLowerCase();return(s=e.find(([r])=>r.toLowerCase()===n))==null?void 0:s[1]}function On(e){const t=/Digest\s+(.*)$/i.exec(e);if(!t)return;const n={};for(const s of t[1].matchAll(/(\w+)=(?:"([^"]*)"|([^\s,]+))/g))n[s[1].toLowerCase()]=s[2]??s[3];return n}async function Se(e,t){return/sha-?256/i.test(e)?Ce(await _e("SHA-256",t)):At(t)}async function Nn(e,t,n,s={}){var l;if(!e.realm||!e.nonce)return;const r=e.algorithm??"MD5",o=n.replace(/^[a-z][\w+.-]*:\/\/[^/]*/i,"")||"/",i=(l=e.qop)!=null&&l.split(",").map(m=>m.trim()).includes("auth")?"auth":e.qop?e.qop.split(",")[0].trim():void 0,a=s.cnonce??At(String(Math.random())).slice(0,16),c=(s.nc??1).toString(16).padStart(8,"0");let p=await Se(r,`${e.username}:${e.realm}:${e.password}`);/-sess$/i.test(r)&&(p=await Se(r,`${p}:${e.nonce}:${a}`));const u=await Se(r,`${t}:${o}`),f=i?await Se(r,`${p}:${e.nonce}:${c}:${a}:${i}:${u}`):await Se(r,`${p}:${e.nonce}:${u}`),d=[`username="${e.username}"`,`realm="${e.realm}"`,`nonce="${e.nonce}"`,`uri="${o}"`,`algorithm=${r}`,`response="${f}"`];return i&&d.push(`qop=${i}`,`nc=${c}`,`cnonce="${a}"`),e.opaque&&d.push(`opaque="${e.opaque}"`),`Digest ${d.join(", ")}`}async function Cn(e,t,n=new Date){var b;const s=new URL(e.url),r=n.toISOString().replace(/[:-]|\.\d{3}/g,""),o=r.slice(0,8);let i="";typeof e.body=="string"?i=e.body:((b=e.body)==null?void 0:b.kind)==="binary"&&e.body.data&&(i=Uint8Array.from(atob(e.body.data),S=>S.charCodeAt(0)));const a=e.body&&typeof e.body!="string"&&e.body.kind==="multipart"?"UNSIGNED-PAYLOAD":Ce(await _e("SHA-256",i)),c=t.service==="s3";J(e.headers,"X-Amz-Date",r),c&&J(e.headers,"X-Amz-Content-Sha256",a),t.sessionToken&&J(e.headers,"X-Amz-Security-Token",t.sessionToken);const p=s.pathname.split("/").map(S=>c?S:Xe(S)).join("/")||"/",u=[...s.searchParams.entries()].map(([S,w])=>[Xe(S),Xe(w)]).sort(([S,w],[N,L])=>S===N?w<L?-1:w>L?1:0:S<N?-1:1).map(([S,w])=>`${S}=${w}`).join("&"),f=new Map([["host",s.host]]);for(const[S,w]of e.headers){const N=S.toLowerCase();(N.startsWith("x-amz-")||N==="content-type")&&f.set(N,w.trim().replace(/\s+/g," "))}const d=[...f.keys()].sort(),l=d.map(S=>`${S}:${f.get(S)}
109
109
  `).join(""),m=d.join(";"),k=[e.method.toUpperCase(),p,u,l,m,a].join(`
110
110
  `),y=`${o}/${t.region}/${t.service}/aws4_request`,v=["AWS4-HMAC-SHA256",r,y,Ce(await _e("SHA-256",k))].join(`
111
- `);let $=await fe("SHA-256",`AWS4${t.secretAccessKey}`,o);$=await fe("SHA-256",$,t.region),$=await fe("SHA-256",$,t.service),$=await fe("SHA-256",$,"aws4_request");const T=Ce(await fe("SHA-256",$,v));J(e.headers,"Authorization",`AWS4-HMAC-SHA256 Credential=${t.accessKeyId}/${y}, SignedHeaders=${m}, Signature=${T}`)}async function Nn(e,t,n=new Date){const s=/^[a-z][\w+.-]*:\/\//i.test(e.url)?new URL(e.url):new URL(e.url,"http://localhost"),r=t.template??`{method}
111
+ `);let $=await fe("SHA-256",`AWS4${t.secretAccessKey}`,o);$=await fe("SHA-256",$,t.region),$=await fe("SHA-256",$,t.service),$=await fe("SHA-256",$,"aws4_request");const T=Ce(await fe("SHA-256",$,v));J(e.headers,"Authorization",`AWS4-HMAC-SHA256 Credential=${t.accessKeyId}/${y}, SignedHeaders=${m}, Signature=${T}`)}async function jn(e,t,n=new Date){const s=/^[a-z][\w+.-]*:\/\//i.test(e.url)?new URL(e.url):new URL(e.url,"http://localhost"),r=t.template??`{method}
112
112
  {path}
113
113
  {timestamp}
114
114
  {body}`,o=String(Math.floor(n.getTime()/1e3)),i=r.replace(/\\n/g,`
115
- `).replace(/\{method\}/g,e.method.toUpperCase()).replace(/\{path\}/g,s.pathname+s.search).replace(/\{query\}/g,s.search.replace(/^\?/,"")).replace(/\{timestamp\}/g,o).replace(/\{body\}/g,typeof e.body=="string"?e.body:""),a=await fe(t.algorithm,t.secret,i),c=t.encoding==="base64"?xt(a):Ce(a);J(e.headers,t.header,`${t.prefix??""}${c}`),r.includes("{timestamp}")&&J(e.headers,t.timestampHeader??"X-Timestamp",o)}async function ct(e,t={}){var m;const n=k=>mt(k,t.variables??{},t),s=t.auth??e.auth,r=!s||s.type==="inherit"?{type:"none"}:ot(s,n),o=[],i=e.params.filter(k=>k.in==="header"&&I(k)).map(k=>[n(k.key),n(k.value)]),a=e.params.filter(k=>k.in==="cookie"&&I(k)).map(k=>`${n(k.key)}=${n(k.value)}`);switch(r.type){case"basic":J(i,"Authorization",`Basic ${We(`${r.username}:${r.password}`)}`);break;case"bearer":r.token&&J(i,"Authorization",`${r.prefix??"Bearer"} ${r.token}`);break;case"oauth2":r.accessToken&&J(i,"Authorization",`${r.tokenType??"Bearer"} ${r.accessToken}`);break;case"apiKey":r.in==="header"?J(i,r.key,r.value):r.in==="query"?o.push({key:r.key,value:r.value,in:"query"}):a.push(`${r.key}=${r.value}`);break;case"custom":for(const k of r.headers.filter(I))J(i,k.key,k.value);break}a.length&&J(i,"Cookie",[Re(i,"Cookie"),...a].filter(Boolean).join("; "));const c=ve({...e,params:[...e.params,...o]},n);let p;const u=e.body;u.kind==="multipart"?p={kind:"multipart",parts:u.parts.filter(I).map(k=>({...k,key:n(k.key),value:n(k.value)}))}:u.kind==="binary"?p={kind:"binary",fileName:u.fileName,contentType:u.contentType,data:u.data}:u.kind!=="none"&&(p=n(re(u)??""));const f=we(u);f&&u.kind!=="multipart"&&!Re(i,"Content-Type")&&J(i,"Content-Type",f),u.kind==="soap"&&u.version==="1.1"&&u.action!==void 0&&!Re(i,"SOAPAction")&&J(i,"SOAPAction",`"${n(u.action)}"`);const d={method:e.method.toUpperCase(),url:c,headers:i,body:p,settings:{...e.settings}},l=((m=t.now)==null?void 0:m.call(t))??new Date;if(r.type==="digest"){const k=await Sn(r,d.method,c);k&&J(d.headers,"Authorization",k)}else r.type==="awsSigV4"?await On(d,r,l):r.type==="hmac"&&await Nn(d,r,l);return d}async function Rs(e,t,n={},s){let r=await ct(e,n),o=await t(r,s);const i=n.auth??e.auth;if(o.status===401&&(i==null?void 0:i.type)==="digest"&&!i.nonce){const a=Tn(Re(o.headers,"WWW-Authenticate")??"");if(a!=null&&a.nonce){const c={...i,realm:a.realm,nonce:a.nonce,qop:a.qop,algorithm:a.algorithm,opaque:a.opaque};return r=await ct(e,{...n,auth:c}),o=await t(r,s),{response:o,sent:r,auth:c}}}return{response:o,sent:r,auth:i}}const Hs=/^text\/|json|xml|javascript|ecmascript|x-www-form-urlencoded|graphql|yaml|csv|html/i;function It(e,t){const n=Uint8Array.from(atob(e),s=>s.charCodeAt(0));return new Blob([n],t?{type:t}:void 0)}function Ds(e=(...t)=>fetch(...t)){return async(t,n)=>{var p,u,f;const s=new Headers;for(const[d,l]of t.headers)s.append(d,l);let r;if(typeof t.body=="string")r=t.body;else if(((p=t.body)==null?void 0:p.kind)==="multipart"){const d=new FormData;for(const l of t.body.parts)if(l.type==="file"){const m=(u=t.body.files)==null?void 0:u[l.key];d.append(l.key,m?It(m,l.contentType):new Blob([]),l.fileName??l.key)}else d.append(l.key,l.value);r=d,s.delete("Content-Type")}else((f=t.body)==null?void 0:f.kind)==="binary"&&t.body.data&&(r=It(t.body.data,t.body.contentType));const o=new AbortController,i=()=>o.abort();n==null||n.addEventListener("abort",i);const a=t.settings.timeoutMs?setTimeout(i,t.settings.timeoutMs):void 0,c=Date.now();try{const d=await e(t.url,{method:t.method,headers:s,body:t.method==="GET"||t.method==="HEAD"?void 0:r,redirect:t.settings.followRedirects===!1?"manual":"follow",signal:o.signal}),l=await d.arrayBuffer(),m=d.headers.get("content-type")??"",k=!m||Hs.test(m),y=[];return d.headers.forEach((v,$)=>y.push([$,v])),{status:d.status,statusText:d.statusText,headers:y,body:k?new TextDecoder().decode(l):"",bodyBase64:k?void 0:xt(l),timeMs:Date.now()-c,size:l.byteLength,url:d.url||t.url}}finally{a&&clearTimeout(a),n==null||n.removeEventListener("abort",i)}}}function Pt(e){return xt(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Ms(){const e=new Uint8Array(32);globalThis.crypto.getRandomValues(e);const t=Pt(e),n=Pt(await _e("SHA-256",t));return{verifier:t,challenge:n}}function zs(e,t={}){const n=new URLSearchParams;n.set("response_type",e.grant==="implicit"?"token":"code"),n.set("client_id",e.clientId),e.redirectUri&&n.set("redirect_uri",e.redirectUri),e.scope&&n.set("scope",e.scope),e.audience&&n.set("audience",e.audience),t.state&&n.set("state",t.state),t.challenge&&(n.set("code_challenge",t.challenge),n.set("code_challenge_method","S256"));const s=e.authUrl??"";return`${s}${s.includes("?")?"&":"?"}${n.toString()}`}async function Ue(e,t,n){if(!e.tokenUrl)throw new Error("OAuth 2: no token URL");const s=[["Content-Type","application/x-www-form-urlencoded"],["Accept","application/json"]],r=new URLSearchParams(t);e.clientAuth==="body"||!e.clientSecret?(r.set("client_id",e.clientId),e.clientSecret&&r.set("client_secret",e.clientSecret)):s.push(["Authorization",`Basic ${We(`${encodeURIComponent(e.clientId)}:${encodeURIComponent(e.clientSecret)}`)}`]),e.scope&&!r.has("scope")&&t.grant_type!=="authorization_code"&&t.grant_type!=="refresh_token"&&r.set("scope",e.scope),e.audience&&r.set("audience",e.audience);const o=await n({method:"POST",url:e.tokenUrl,headers:s,body:r.toString(),settings:{}});let i={};try{i=JSON.parse(o.body)}catch{i=Object.fromEntries(new URLSearchParams(o.body))}if(o.status>=400||typeof i.access_token!="string"){const c=typeof i.error=="string"?i.error:`HTTP ${o.status}`,p=typeof i.error_description=="string"?`: ${i.error_description}`:"";throw new Error(`OAuth 2 token request failed — ${c}${p}`)}const a=Number(i.expires_in);return{accessToken:i.access_token,tokenType:typeof i.token_type=="string"?i.token_type.replace(/^bearer$/i,"Bearer"):"Bearer",refreshToken:typeof i.refresh_token=="string"?i.refresh_token:void 0,expiresAt:Number.isFinite(a)&&a>0?Date.now()+a*1e3:void 0,scope:typeof i.scope=="string"?i.scope:void 0,idToken:typeof i.id_token=="string"?i.id_token:void 0}}async function Ws(e,t){if(e.grant==="clientCredentials")return Ue(e,{grant_type:"client_credentials"},t);if(e.grant==="password")return Ue(e,{grant_type:"password",username:e.username??"",password:e.password??""},t);throw new Error(`OAuth 2: the ${e.grant} grant needs the user — use buildAuthorizationUrl / startDeviceAuthorization`)}async function Bs(e,t,n,s){const r={grant_type:"authorization_code",code:t};return e.redirectUri&&(r.redirect_uri=e.redirectUri),s&&(r.code_verifier=s),Ue(e,r,n)}async function Fs(e,t,n){return Ue(e,{grant_type:"refresh_token",refresh_token:t},n)}async function Vs(e,t){if(!e.deviceUrl)throw new Error("OAuth 2: no device authorization URL");const n=new URLSearchParams({client_id:e.clientId});e.scope&&n.set("scope",e.scope),e.audience&&n.set("audience",e.audience);const s=await t({method:"POST",url:e.deviceUrl,headers:[["Content-Type","application/x-www-form-urlencoded"],["Accept","application/json"]],body:n.toString(),settings:{}}),r=JSON.parse(s.body);if(typeof r.device_code!="string")throw new Error(`OAuth 2 device authorization failed — HTTP ${s.status}`);return{deviceCode:r.device_code,userCode:String(r.user_code??""),verificationUri:String(r.verification_uri_complete??r.verification_uri??""),interval:Number(r.interval??5),expiresIn:r.expires_in===void 0?void 0:Number(r.expires_in)}}async function Ks(e,t,n){try{return await Ue(e,{grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:t},n)}catch(s){const r=s instanceof Error?s.message:"";if(r.includes("authorization_pending"))return"pending";if(r.includes("slow_down"))return"slow_down";throw s}}const Cn={version:"Version",servers:"Servers",authentication:"Authentication",parameters:"Parameters",name:"Name",location:"In",required:"Required",type:"Type",description:"Description",yes:"Yes",no:"No",requestBody:"Request body",responses:"Responses",status:"Status",example:"Example",deprecated:"Deprecated",noAuth:"None"},Oe=e=>(e??"").replace(/\|/g,"\\|").replace(/\r?\n/g," ");function pt(e){if(!e)return"string";if(e.$ref)return e.$ref.split("/").pop()??"object";const t=Array.isArray(e.type)?e.type.join(" | "):e.type;return t==="array"?`${pt(e.items)}[]`:[t??"object",e.format?`(${e.format})`:""].filter(Boolean).join(" ")}function Js(e,t){switch(e.type){case"none":case"inherit":return t.noAuth;case"apiKey":return`API key \`${e.key}\` (${e.in})`;case"bearer":return"Bearer token";case"basic":return"HTTP Basic";case"digest":return"HTTP Digest";case"oauth2":return`OAuth 2 (${e.grant}${e.scope?`, scope: ${e.scope}`:""})`;case"awsSigV4":return`AWS Signature V4 (${e.service}, ${e.region})`;case"hmac":return`HMAC ${e.algorithm} (\`${e.header}\`)`;case"mtls":return"Mutual TLS";case"custom":return e.headers.map(n=>`\`${n.key}\``).join(", ");default:return""}}function Lt(e,t){const n=e.includes("```")?"````":"```";return`${n}${t}
115
+ `).replace(/\{method\}/g,e.method.toUpperCase()).replace(/\{path\}/g,s.pathname+s.search).replace(/\{query\}/g,s.search.replace(/^\?/,"")).replace(/\{timestamp\}/g,o).replace(/\{body\}/g,typeof e.body=="string"?e.body:""),a=await fe(t.algorithm,t.secret,i),c=t.encoding==="base64"?xt(a):Ce(a);J(e.headers,t.header,`${t.prefix??""}${c}`),r.includes("{timestamp}")&&J(e.headers,t.timestampHeader??"X-Timestamp",o)}async function ct(e,t={}){var m;const n=k=>mt(k,t.variables??{},t),s=t.auth??e.auth,r=!s||s.type==="inherit"?{type:"none"}:ot(s,n),o=[],i=e.params.filter(k=>k.in==="header"&&I(k)).map(k=>[n(k.key),n(k.value)]),a=e.params.filter(k=>k.in==="cookie"&&I(k)).map(k=>`${n(k.key)}=${n(k.value)}`);switch(r.type){case"basic":J(i,"Authorization",`Basic ${We(`${r.username}:${r.password}`)}`);break;case"bearer":r.token&&J(i,"Authorization",`${r.prefix??"Bearer"} ${r.token}`);break;case"oauth2":r.accessToken&&J(i,"Authorization",`${r.tokenType??"Bearer"} ${r.accessToken}`);break;case"apiKey":r.in==="header"?J(i,r.key,r.value):r.in==="query"?o.push({key:r.key,value:r.value,in:"query"}):a.push(`${r.key}=${r.value}`);break;case"custom":for(const k of r.headers.filter(I))J(i,k.key,k.value);break}a.length&&J(i,"Cookie",[Re(i,"Cookie"),...a].filter(Boolean).join("; "));const c=ve({...e,params:[...e.params,...o]},n);let p;const u=e.body;u.kind==="multipart"?p={kind:"multipart",parts:u.parts.filter(I).map(k=>({...k,key:n(k.key),value:n(k.value)}))}:u.kind==="binary"?p={kind:"binary",fileName:u.fileName,contentType:u.contentType,data:u.data}:u.kind!=="none"&&(p=n(re(u)??""));const f=we(u);f&&u.kind!=="multipart"&&!Re(i,"Content-Type")&&J(i,"Content-Type",f),u.kind==="soap"&&u.version==="1.1"&&u.action!==void 0&&!Re(i,"SOAPAction")&&J(i,"SOAPAction",`"${n(u.action)}"`);const d={method:e.method.toUpperCase(),url:c,headers:i,body:p,settings:{...e.settings}},l=((m=t.now)==null?void 0:m.call(t))??new Date;if(r.type==="digest"){const k=await Nn(r,d.method,c);k&&J(d.headers,"Authorization",k)}else r.type==="awsSigV4"?await Cn(d,r,l):r.type==="hmac"&&await jn(d,r,l);return d}async function Ms(e,t,n={},s){let r=await ct(e,n),o=await t(r,s);const i=n.auth??e.auth;if(o.status===401&&(i==null?void 0:i.type)==="digest"&&!i.nonce){const a=On(Re(o.headers,"WWW-Authenticate")??"");if(a!=null&&a.nonce){const c={...i,realm:a.realm,nonce:a.nonce,qop:a.qop,algorithm:a.algorithm,opaque:a.opaque};return r=await ct(e,{...n,auth:c}),o=await t(r,s),{response:o,sent:r,auth:c}}}return{response:o,sent:r,auth:i}}const zs=/^text\/|json|xml|javascript|ecmascript|x-www-form-urlencoded|graphql|yaml|csv|html/i;function Pt(e,t){const n=Uint8Array.from(atob(e),s=>s.charCodeAt(0));return new Blob([n],t?{type:t}:void 0)}function Ws(e=(...t)=>fetch(...t)){return async(t,n)=>{var p,u,f;const s=new Headers;for(const[d,l]of t.headers)s.append(d,l);let r;if(typeof t.body=="string")r=t.body;else if(((p=t.body)==null?void 0:p.kind)==="multipart"){const d=new FormData;for(const l of t.body.parts)if(l.type==="file"){const m=(u=t.body.files)==null?void 0:u[l.key];d.append(l.key,m?Pt(m,l.contentType):new Blob([]),l.fileName??l.key)}else d.append(l.key,l.value);r=d,s.delete("Content-Type")}else((f=t.body)==null?void 0:f.kind)==="binary"&&t.body.data&&(r=Pt(t.body.data,t.body.contentType));const o=new AbortController,i=()=>o.abort();n==null||n.addEventListener("abort",i);const a=t.settings.timeoutMs?setTimeout(i,t.settings.timeoutMs):void 0,c=Date.now();try{const d=await e(t.url,{method:t.method,headers:s,body:t.method==="GET"||t.method==="HEAD"?void 0:r,redirect:t.settings.followRedirects===!1?"manual":"follow",signal:o.signal}),l=await d.arrayBuffer(),m=d.headers.get("content-type")??"",k=!m||zs.test(m),y=[];return d.headers.forEach((v,$)=>y.push([$,v])),{status:d.status,statusText:d.statusText,headers:y,body:k?new TextDecoder().decode(l):"",bodyBase64:k?void 0:xt(l),timeMs:Date.now()-c,size:l.byteLength,url:d.url||t.url}}finally{a&&clearTimeout(a),n==null||n.removeEventListener("abort",i)}}}function Lt(e){return xt(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Bs(){const e=new Uint8Array(32);globalThis.crypto.getRandomValues(e);const t=Lt(e),n=Lt(await _e("SHA-256",t));return{verifier:t,challenge:n}}function Fs(e,t={}){const n=new URLSearchParams;n.set("response_type",e.grant==="implicit"?"token":"code"),n.set("client_id",e.clientId),e.redirectUri&&n.set("redirect_uri",e.redirectUri),e.scope&&n.set("scope",e.scope),e.audience&&n.set("audience",e.audience),t.state&&n.set("state",t.state),t.challenge&&(n.set("code_challenge",t.challenge),n.set("code_challenge_method","S256"));const s=e.authUrl??"";return`${s}${s.includes("?")?"&":"?"}${n.toString()}`}async function Ue(e,t,n){if(!e.tokenUrl)throw new Error("OAuth 2: no token URL");const s=[["Content-Type","application/x-www-form-urlencoded"],["Accept","application/json"]],r=new URLSearchParams(t);e.clientAuth==="body"||!e.clientSecret?(r.set("client_id",e.clientId),e.clientSecret&&r.set("client_secret",e.clientSecret)):s.push(["Authorization",`Basic ${We(`${encodeURIComponent(e.clientId)}:${encodeURIComponent(e.clientSecret)}`)}`]),e.scope&&!r.has("scope")&&t.grant_type!=="authorization_code"&&t.grant_type!=="refresh_token"&&r.set("scope",e.scope),e.audience&&r.set("audience",e.audience);const o=await n({method:"POST",url:e.tokenUrl,headers:s,body:r.toString(),settings:{}});let i={};try{i=JSON.parse(o.body)}catch{i=Object.fromEntries(new URLSearchParams(o.body))}if(o.status>=400||typeof i.access_token!="string"){const c=typeof i.error=="string"?i.error:`HTTP ${o.status}`,p=typeof i.error_description=="string"?`: ${i.error_description}`:"";throw new Error(`OAuth 2 token request failed — ${c}${p}`)}const a=Number(i.expires_in);return{accessToken:i.access_token,tokenType:typeof i.token_type=="string"?i.token_type.replace(/^bearer$/i,"Bearer"):"Bearer",refreshToken:typeof i.refresh_token=="string"?i.refresh_token:void 0,expiresAt:Number.isFinite(a)&&a>0?Date.now()+a*1e3:void 0,scope:typeof i.scope=="string"?i.scope:void 0,idToken:typeof i.id_token=="string"?i.id_token:void 0}}async function Vs(e,t){if(e.grant==="clientCredentials")return Ue(e,{grant_type:"client_credentials"},t);if(e.grant==="password")return Ue(e,{grant_type:"password",username:e.username??"",password:e.password??""},t);throw new Error(`OAuth 2: the ${e.grant} grant needs the user — use buildAuthorizationUrl / startDeviceAuthorization`)}async function Ks(e,t,n,s){const r={grant_type:"authorization_code",code:t};return e.redirectUri&&(r.redirect_uri=e.redirectUri),s&&(r.code_verifier=s),Ue(e,r,n)}async function Js(e,t,n){return Ue(e,{grant_type:"refresh_token",refresh_token:t},n)}async function Gs(e,t){if(!e.deviceUrl)throw new Error("OAuth 2: no device authorization URL");const n=new URLSearchParams({client_id:e.clientId});e.scope&&n.set("scope",e.scope),e.audience&&n.set("audience",e.audience);const s=await t({method:"POST",url:e.deviceUrl,headers:[["Content-Type","application/x-www-form-urlencoded"],["Accept","application/json"]],body:n.toString(),settings:{}}),r=JSON.parse(s.body);if(typeof r.device_code!="string")throw new Error(`OAuth 2 device authorization failed — HTTP ${s.status}`);return{deviceCode:r.device_code,userCode:String(r.user_code??""),verificationUri:String(r.verification_uri_complete??r.verification_uri??""),interval:Number(r.interval??5),expiresIn:r.expires_in===void 0?void 0:Number(r.expires_in)}}async function Qs(e,t,n){try{return await Ue(e,{grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:t},n)}catch(s){const r=s instanceof Error?s.message:"";if(r.includes("authorization_pending"))return"pending";if(r.includes("slow_down"))return"slow_down";throw s}}const En={version:"Version",servers:"Servers",authentication:"Authentication",parameters:"Parameters",name:"Name",location:"In",required:"Required",type:"Type",description:"Description",yes:"Yes",no:"No",requestBody:"Request body",responses:"Responses",status:"Status",example:"Example",deprecated:"Deprecated",noAuth:"None"},Oe=e=>(e??"").replace(/\|/g,"\\|").replace(/\r?\n/g," ");function pt(e){if(!e)return"string";if(e.$ref)return e.$ref.split("/").pop()??"object";const t=Array.isArray(e.type)?e.type.join(" | "):e.type;return t==="array"?`${pt(e.items)}[]`:[t??"object",e.format?`(${e.format})`:""].filter(Boolean).join(" ")}function Ys(e,t){switch(e.type){case"none":case"inherit":return t.noAuth;case"apiKey":return`API key \`${e.key}\` (${e.in})`;case"bearer":return"Bearer token";case"basic":return"HTTP Basic";case"digest":return"HTTP Digest";case"oauth2":return`OAuth 2 (${e.grant}${e.scope?`, scope: ${e.scope}`:""})`;case"awsSigV4":return`AWS Signature V4 (${e.service}, ${e.region})`;case"hmac":return`HMAC ${e.algorithm} (\`${e.header}\`)`;case"mtls":return"Mutual TLS";case"custom":return e.headers.map(n=>`\`${n.key}\``).join(", ");default:return""}}function Rt(e,t){const n=e.includes("```")?"````":"```";return`${n}${t}
116
116
  ${e}
117
- ${n}`}function Gs(e,t,n,s,r,o){var d;const i="#".repeat(o),a=[],c=e.url.replace(/^\{\{[^}]+\}\}/,"")||"/";a.push(`${i} \`${e.method}\` ${c}${e.name&&e.name!==`${e.method} ${c}`?` — ${e.name}`:""}`,""),e.deprecated&&a.push(`> **${s.deprecated}**`,""),e.description&&a.push(e.description,"");const p=e.params.filter(I);p.length&&a.push(`${i}# ${s.parameters}`,"",`| ${s.name} | ${s.location} | ${s.required} | ${s.type} | ${s.description} |`,"|---|---|---|---|---|",...p.map(l=>`| \`${Oe(l.key)}\` | ${l.in} | ${l.required||l.in==="path"?s.yes:s.no} | ${Oe(pt(l.schema))} | ${Oe(l.description)} |`),"");const u=e.body;if(u.kind!=="none")if(a.push(`${i}# ${s.requestBody}`,""),u.kind==="form"||u.kind==="multipart"){const l=u.kind==="form"?u.fields:u.parts;a.push(...l.filter(I).map(m=>`- \`${m.key}\`${"type"in m&&m.type==="file"?" (file)":m.value?`: ${m.value}`:""}`),"")}else if(u.kind==="binary")a.push(`${u.contentType??"application/octet-stream"}${u.fileName?` — ${u.fileName}`:""}`,"");else{const l=u.kind==="json"||u.kind==="graphql"?"json":u.kind==="text"?"":"xml";a.push(Lt(re(u)??"",l),"")}const f=Object.entries(e.responses??{});if(f.length&&a.push(`${i}# ${s.responses}`,"",`| ${s.status} | ${s.description} | ${s.type} |`,"|---|---|---|",...f.map(([l,m])=>`| ${l} | ${Oe(m.description)} | ${Oe(m.schema?pt(m.schema):m.contentType)} |`),""),r.codeLanguage!==!1){const l=n.filter(v=>v.kind==="folder"),m=r.codeLanguage??"curl",k=Xt(e,m,{auth:Mt(e,l,t)}),y=((d=Gt.find(v=>v.id===m))==null?void 0:d.syntax)??"shell";a.push(`${i}# ${s.example}`,"",Lt(k,y),"")}return a}function Qs(e,t={}){var o;const n={...Cn,...t.labels},s=[`# ${e.name}`,""];e.description&&s.push(e.description,""),e.version&&s.push(`**${n.version}:** ${e.version}`,""),(o=e.servers)!=null&&o.length&&s.push(`## ${n.servers}`,"",...e.servers.map(i=>`- \`${i.url}\`${i.description?` — ${i.description}`:""}`),""),e.auth&&e.auth.type!=="none"&&e.auth.type!=="inherit"&&s.push(`## ${n.authentication}`,"",Js(e.auth,n),"");const r=(i,a,c)=>{for(const p of i)p.kind==="folder"?(s.push(`${"#".repeat(Math.min(a,6))} ${p.name}`,""),p.description&&s.push(p.description,""),r(p.items,a+1,[...c,p])):s.push(...Gs(p,e,c,n,t,Math.min(a,5)))};return r(e.items,2,[]),`${s.join(`
117
+ ${n}`}function Xs(e,t,n,s,r,o){var d;const i="#".repeat(o),a=[],c=e.url.replace(/^\{\{[^}]+\}\}/,"")||"/";a.push(`${i} \`${e.method}\` ${c}${e.name&&e.name!==`${e.method} ${c}`?` — ${e.name}`:""}`,""),e.deprecated&&a.push(`> **${s.deprecated}**`,""),e.description&&a.push(e.description,"");const p=e.params.filter(I);p.length&&a.push(`${i}# ${s.parameters}`,"",`| ${s.name} | ${s.location} | ${s.required} | ${s.type} | ${s.description} |`,"|---|---|---|---|---|",...p.map(l=>`| \`${Oe(l.key)}\` | ${l.in} | ${l.required||l.in==="path"?s.yes:s.no} | ${Oe(pt(l.schema))} | ${Oe(l.description)} |`),"");const u=e.body;if(u.kind!=="none")if(a.push(`${i}# ${s.requestBody}`,""),u.kind==="form"||u.kind==="multipart"){const l=u.kind==="form"?u.fields:u.parts;a.push(...l.filter(I).map(m=>`- \`${m.key}\`${"type"in m&&m.type==="file"?" (file)":m.value?`: ${m.value}`:""}`),"")}else if(u.kind==="binary")a.push(`${u.contentType??"application/octet-stream"}${u.fileName?` — ${u.fileName}`:""}`,"");else{const l=u.kind==="json"||u.kind==="graphql"?"json":u.kind==="text"?"":"xml";a.push(Rt(re(u)??"",l),"")}const f=Object.entries(e.responses??{});if(f.length&&a.push(`${i}# ${s.responses}`,"",`| ${s.status} | ${s.description} | ${s.type} |`,"|---|---|---|",...f.map(([l,m])=>`| ${l} | ${Oe(m.description)} | ${Oe(m.schema?pt(m.schema):m.contentType)} |`),""),r.codeLanguage!==!1){const l=n.filter(v=>v.kind==="folder"),m=r.codeLanguage??"curl",k=Zt(e,m,{auth:zt(e,l,t)}),y=((d=Qt.find(v=>v.id===m))==null?void 0:d.syntax)??"shell";a.push(`${i}# ${s.example}`,"",Rt(k,y),"")}return a}function Zs(e,t={}){var o;const n={...En,...t.labels},s=[`# ${e.name}`,""];e.description&&s.push(e.description,""),e.version&&s.push(`**${n.version}:** ${e.version}`,""),(o=e.servers)!=null&&o.length&&s.push(`## ${n.servers}`,"",...e.servers.map(i=>`- \`${i.url}\`${i.description?` — ${i.description}`:""}`),""),e.auth&&e.auth.type!=="none"&&e.auth.type!=="inherit"&&s.push(`## ${n.authentication}`,"",Ys(e.auth,n),"");const r=(i,a,c)=>{for(const p of i)p.kind==="folder"?(s.push(`${"#".repeat(Math.min(a,6))} ${p.name}`,""),p.description&&s.push(p.description,""),r(p.items,a+1,[...c,p])):s.push(...Xs(p,e,c,n,t,Math.min(a,5)))};return r(e.items,2,[]),`${s.join(`
118
118
  `).replace(/\n{3,}/g,`
119
119
 
120
120
  `).trimEnd()}
121
- `}function jn(e,t){try{return He(e,t)}catch{return}}function En(e,t={}){const n=e.trim();if(!n)return;if(Vt(n))return"curl";if(n.startsWith("<"))return/<(\w+:)?definitions[\s>]/.test(n)&&/schemas\.xmlsoap\.org\/wsdl/.test(n)?"wsdl":void 0;const s=jn(n,t.parseYaml);if(!s||typeof s!="object")return;const r=s;if(typeof r.openapi=="string"||typeof r.swagger=="string")return"openapi";if(kt(r))return"postman";if(Array.isArray(r.values)&&(r._postman_variable_scope!==void 0||typeof r.name=="string"))return"postman-environment";if(wt(r))return"har";const o=r.data;if(r.__schema||o!=null&&o.__schema)return"graphql"}function Ys(e,t={}){const n=En(e,t),s=()=>jn(e.trim(),t.parseYaml);switch(n){case"curl":return{kind:n,request:Jt(e)};case"openapi":return{kind:n,collection:rn(s(),t)};case"postman":return{kind:n,collection:fn(s())};case"postman-environment":return{kind:n,environment:dn(s())};case"har":return{kind:n,collection:hn(s())};case"graphql":return{kind:n,collection:$n(s())};case"wsdl":return{kind:n,collection:xn(e,{parser:t.xmlParser})};default:throw new Error("Unknown API document: expected curl, OpenAPI, Swagger, Postman, HAR, GraphQL introspection or WSDL")}}const Xs=["rest","graphql","soap","odata","grpc","websocket","sse","webhook","database","sftp"];function Zs(e={}){return{...e,key:e.key??ke("i"),name:e.name??"New integration",direction:e.direction??"outbound",connection:e.connection??{protocol:"rest",baseUrl:""},endpoints:e.endpoints??ye({name:e.name??"API"})}}function Tt(e,t){const n=[],s=new Set;let r=e.sets.find(i=>i.id===t);for(;r&&!s.has(r.id);)s.add(r.id),n.push(r),r=r.extends?e.sets.find(i=>i.id===r.extends):void 0;const o={};for(const i of e.variables)i.defaultValue!==void 0&&(o[i.key]=i.defaultValue);for(const i of n.reverse())Object.assign(o,i.values);for(const i of e.variables)i.secret&&o[i.key]===void 0&&(o[i.key]=`{{secret:${i.key}}}`);return o}function er(e,t,n){const s=new Set;let r=e.sets.find(a=>a.id===t),o=!0;for(;r&&!s.has(r.id);){if(s.add(r.id),n in r.values)return{value:r.values[n],from:o?"own":"inherited",set:r.id};o=!1,r=r.extends?e.sets.find(a=>a.id===r.extends):void 0}const i=e.variables.find(a=>a.key===n);return(i==null?void 0:i.defaultValue)!==void 0?{value:i.defaultValue,from:"default"}:{from:"none"}}function tr(e){return e.sets.map(t=>({id:t.id,name:t.name,values:Object.entries(Tt(e,t.id)).map(([n,s])=>{var r;return{key:n,value:s,secret:((r=e.variables.find(o=>o.key===n))==null?void 0:r.secret)||void 0}})}))}function nr(e,t){return(t?e.sets.find(n=>{var s;return((s=n.appliesTo)==null?void 0:s.database)===t}):void 0)??e.sets.find(n=>{var s;return!((s=n.appliesTo)!=null&&s.database)})}function lt(e,t=[]){if(typeof e=="string")t.push(e);else if(Array.isArray(e))for(const n of e)lt(n,t);else if(e&&typeof e=="object")for(const n of Object.values(e))lt(n,t);return t}function sr(e,t={variables:[],sets:[]},n={}){var a,c;const s=[],r=new Set(t.variables.map(p=>p.key)),o=new Set;for(const p of e.integrations){const u=p.key;o.has(u)&&s.push({severity:"error",integration:u,code:"keyDuplicate",message:`Duplicate key ${u}`}),o.add(u),!p.connection.baseUrl.trim()&&p.connection.protocol!=="webhook"&&s.push({severity:"warning",integration:u,code:"baseUrlMissing",message:`${u}: no base URL`});const f=new Set(lt([p.connection,p.endpoints]).flatMap(dt).filter(m=>!m.startsWith("$")&&!m.startsWith("secret:")));for(const m of f)!r.has(m)&&!p.endpoints.variables.some(k=>k.key===m)&&s.push({severity:"warning",integration:u,code:"variableUndeclared",message:`${u}: {{${m}}} is not declared in the environment variables`});const d=new Set($e(p.endpoints.items).map(({request:m})=>m.id)),l=new Set((p.expose??[]).map(m=>m.key));for(const m of p.operations??[])m.endpoint&&!d.has(m.endpoint)&&!l.has(m.endpoint)&&s.push({severity:"error",integration:u,code:"endpointMissing",message:`${u}/${m.key}: endpoint ${m.endpoint} does not exist`});for(const m of((a=p.requires)==null?void 0:a.modules)??[])n.modules&&!n.modules.includes(m)&&s.push({severity:"warning",integration:u,code:"requiresMissing",message:`${u}: module ${m} is not installed`});for(const m of((c=p.requires)==null?void 0:c.dataSources)??[])n.dataSources&&!n.dataSources.includes(m)&&s.push({severity:"warning",integration:u,code:"requiresMissing",message:`${u}: data source ${m} does not exist`})}const i=new Set(t.sets.map(p=>p.id));for(const p of t.sets){p.extends&&!i.has(p.extends)&&s.push({severity:"error",code:"extendsMissing",message:`${p.id} extends ${p.extends}, which does not exist`});for(const f of t.variables){const d=p.values[f.key];f.secret&&d!==void 0&&d!==""&&!/^\{\{\s*secret:/.test(d)&&s.push({severity:"error",code:"secretInSeed",message:`${p.id}: ${f.key} is a secret — write {{secret:${f.key}}}, not the value`})}const u=Tt(t,p.id);for(const f of t.variables)f.required&&!u[f.key]&&s.push({severity:"warning",code:"requiredUnset",message:`${p.id}: ${f.key} has no value`})}return s}function rr(e){const t=new Map;for(const s of e){const r=s.package??"";t.has(r)||t.set(r,new Map);const o=t.get(r);o.has(s.direction)||o.set(s.direction,[]),o.get(s.direction).push(s)}const n=["inbound","outbound","bidirectional"];return[...t].sort(([s],[r])=>s.localeCompare(r)).map(([s,r])=>({package:s,directions:n.filter(o=>r.has(o)).map(o=>({direction:o,integrations:r.get(o)}))}))}function ir(e){const t=$e(e.endpoints.items).map(({request:s})=>({id:s.id,label:`${s.method} ${s.name}`,exposed:!1})),n=(e.expose??[]).map(s=>({id:s.key,label:`${s.method} ${s.path}`,exposed:!0}));return[...t,...n]}exports.GRAPHQL_INTROSPECTION_QUERY=Cs;exports.NICE_API_AUTH_TYPES=Pn;exports.NICE_API_CODE_LANGUAGES=Gt;exports.NICE_API_MARKDOWN_LABELS=Cn;exports.NICE_API_METHODS=In;exports.NICE_CONNECTION_PROTOCOLS=Xs;exports.NiceYamlError=Q;exports.POSTMAN_SCHEMA_V21=cn;exports.bodyContentType=we;exports.bodyFromText=ut;exports.bodyText=re;exports.buildAuthorizationUrl=zs;exports.buildGraphqlOperation=kn;exports.buildRequestUrl=ve;exports.buildSoapEnvelope=An;exports.collectionToMarkdown=Qs;exports.createPkcePair=Ms;exports.detectApiDocument=En;exports.digest=_e;exports.digestAuthorization=Sn;exports.effectiveAuth=Mt;exports.environmentSetFor=nr;exports.exchangeAuthorizationCode=Bs;exports.exportHar=Ns;exports.exportOpenApi=an;exports.exportOpenApiYaml=bs;exports.exportPostman=Ts;exports.exportPostmanEnvironment=Ss;exports.fetchOAuth2Token=Ws;exports.fetchTransport=Ds;exports.findApiItem=Rt;exports.findVariables=dt;exports.flattenApiRequests=$e;exports.fromBase64=ht;exports.generateCode=Xt;exports.graphqlExampleValue=Ne;exports.graphqlOperations=gn;exports.graphqlTypeName=ze;exports.groupIntegrations=rr;exports.headerValue=Rn;exports.hmac=fe;exports.importApiDocument=Ys;exports.importGraphqlIntrospection=$n;exports.importHar=hn;exports.importOpenApi=rn;exports.importPostman=fn;exports.importPostmanEnvironment=dn;exports.importWsdl=xn;exports.inferSchema=De;exports.integrationEndpoints=ir;exports.interpolate=mt;exports.isCurlCommand=Vt;exports.isEnabled=I;exports.isHar=wt;exports.isPostmanCollection=kt;exports.joinUrl=Bn;exports.jsonPointer=tt;exports.md5Hex=At;exports.mockFromSchema=bt;exports.mockResponse=ds;exports.namedType=vt;exports.newApiCollection=ye;exports.newApiFolder=ge;exports.newApiId=ke;exports.newApiRequest=he;exports.newIntegration=Zs;exports.paramsIn=Dt;exports.parseCurl=Jt;exports.parseDigestChallenge=Tn;exports.parseFormEncoded=ft;exports.parseGraphqlIntrospection=yn;exports.parseJsonOrYaml=He;exports.parseWsdl=wn;exports.parseYaml=Zt;exports.pathParamNames=Wt;exports.pollDeviceToken=Ks;exports.refreshOAuth2Token=Fs;exports.requestName=yt;exports.resolveEnvironmentSet=Tt;exports.resolvePlainScalar=Be;exports.resolveRequest=ct;exports.rowsToRecord=Ln;exports.schemaResolver=gt;exports.sendApiRequest=Rs;exports.setRequestUrl=Ft;exports.signAwsV4=On;exports.signHmac=Nn;exports.splitUrl=ce;exports.startDeviceAuthorization=Vs;exports.stringifyYaml=nn;exports.swagger2ToOpenApi3=on;exports.syncPathParams=Bt;exports.toApiEnvironments=tr;exports.toBase64=We;exports.toCurl=Pe;exports.tokenizeCommand=Kt;exports.unresolvedVariables=Mn;exports.updateApiItem=Ht;exports.validateIntegrations=sr;exports.valueOrigin=er;exports.variableScope=zn;
121
+ `}function _n(e,t){try{return De(e,t)}catch{return}}function Un(e,t={}){const n=e.trim();if(!n)return;if(Kt(n))return"curl";if(n.startsWith("<"))return/<(\w+:)?definitions[\s>]/.test(n)&&/schemas\.xmlsoap\.org\/wsdl/.test(n)?"wsdl":void 0;const s=_n(n,t.parseYaml);if(!s||typeof s!="object")return;const r=s;if(typeof r.openapi=="string"||typeof r.swagger=="string")return"openapi";if(kt(r))return"postman";if(Array.isArray(r.values)&&(r._postman_variable_scope!==void 0||typeof r.name=="string"))return"postman-environment";if(wt(r))return"har";const o=r.data;if(r.__schema||o!=null&&o.__schema)return"graphql"}function er(e,t={}){const n=Un(e,t),s=()=>_n(e.trim(),t.parseYaml);switch(n){case"curl":return{kind:n,request:Gt(e)};case"openapi":return{kind:n,collection:on(s(),t)};case"postman":return{kind:n,collection:mn(s())};case"postman-environment":return{kind:n,environment:hn(s())};case"har":return{kind:n,collection:gn(s())};case"graphql":return{kind:n,collection:vn(s())};case"wsdl":return{kind:n,collection:Sn(e,{parser:t.xmlParser})};default:throw new Error("Unknown API document: expected curl, OpenAPI, Swagger, Postman, HAR, GraphQL introspection or WSDL")}}const tr=["rest","graphql","soap","odata","grpc","websocket","sse","webhook","database","sftp"];function nr(e={}){return{...e,key:e.key??$e("i"),name:e.name??"New integration",direction:e.direction??"outbound",connection:e.connection??{protocol:"rest",baseUrl:""},endpoints:e.endpoints??ye({name:e.name??"API"})}}function Tt(e,t){const n=[],s=new Set;let r=e.sets.find(i=>i.id===t);for(;r&&!s.has(r.id);)s.add(r.id),n.push(r),r=r.extends?e.sets.find(i=>i.id===r.extends):void 0;const o={};for(const i of e.variables)i.defaultValue!==void 0&&(o[i.key]=i.defaultValue);for(const i of n.reverse())Object.assign(o,i.values);for(const i of e.variables)i.secret&&o[i.key]===void 0&&(o[i.key]=`{{secret:${i.key}}}`);return o}function sr(e,t,n){const s=new Set;let r=e.sets.find(a=>a.id===t),o=!0;for(;r&&!s.has(r.id);){if(s.add(r.id),n in r.values)return{value:r.values[n],from:o?"own":"inherited",set:r.id};o=!1,r=r.extends?e.sets.find(a=>a.id===r.extends):void 0}const i=e.variables.find(a=>a.key===n);return(i==null?void 0:i.defaultValue)!==void 0?{value:i.defaultValue,from:"default"}:{from:"none"}}function rr(e){return e.sets.map(t=>({id:t.id,name:t.name,values:Object.entries(Tt(e,t.id)).map(([n,s])=>{var r;return{key:n,value:s,secret:((r=e.variables.find(o=>o.key===n))==null?void 0:r.secret)||void 0}})}))}function ir(e,t){return(t?e.sets.find(n=>{var s;return((s=n.appliesTo)==null?void 0:s.database)===t}):void 0)??e.sets.find(n=>{var s;return!((s=n.appliesTo)!=null&&s.database)})}function lt(e,t=[]){if(typeof e=="string")t.push(e);else if(Array.isArray(e))for(const n of e)lt(n,t);else if(e&&typeof e=="object")for(const n of Object.values(e))lt(n,t);return t}function or(e,t={variables:[],sets:[]},n={}){var a,c;const s=[],r=new Set(t.variables.map(p=>p.key)),o=new Set;for(const p of e.integrations){const u=p.key;o.has(u)&&s.push({severity:"error",integration:u,code:"keyDuplicate",message:`Duplicate key ${u}`}),o.add(u),!p.connection.baseUrl.trim()&&p.connection.protocol!=="webhook"&&s.push({severity:"warning",integration:u,code:"baseUrlMissing",message:`${u}: no base URL`});const f=new Set(lt([p.connection,p.endpoints]).flatMap(dt).filter(m=>!m.startsWith("$")&&!m.startsWith("secret:")));for(const m of f)!r.has(m)&&!p.endpoints.variables.some(k=>k.key===m)&&s.push({severity:"warning",integration:u,code:"variableUndeclared",message:`${u}: {{${m}}} is not declared in the environment variables`});const d=new Set(ge(p.endpoints.items).map(({request:m})=>m.id)),l=new Set((p.expose??[]).map(m=>m.key));for(const m of p.operations??[])m.endpoint&&!d.has(m.endpoint)&&!l.has(m.endpoint)&&s.push({severity:"error",integration:u,code:"endpointMissing",message:`${u}/${m.key}: endpoint ${m.endpoint} does not exist`});for(const m of((a=p.requires)==null?void 0:a.modules)??[])n.modules&&!n.modules.includes(m)&&s.push({severity:"warning",integration:u,code:"requiresMissing",message:`${u}: module ${m} is not installed`});for(const m of((c=p.requires)==null?void 0:c.dataSources)??[])n.dataSources&&!n.dataSources.includes(m)&&s.push({severity:"warning",integration:u,code:"requiresMissing",message:`${u}: data source ${m} does not exist`})}const i=new Set(t.sets.map(p=>p.id));for(const p of t.sets){p.extends&&!i.has(p.extends)&&s.push({severity:"error",code:"extendsMissing",message:`${p.id} extends ${p.extends}, which does not exist`});for(const f of t.variables){const d=p.values[f.key];f.secret&&d!==void 0&&d!==""&&!/^\{\{\s*secret:/.test(d)&&s.push({severity:"error",code:"secretInSeed",message:`${p.id}: ${f.key} is a secret — write {{secret:${f.key}}}, not the value`})}const u=Tt(t,p.id);for(const f of t.variables)f.required&&!u[f.key]&&s.push({severity:"warning",code:"requiredUnset",message:`${p.id}: ${f.key} has no value`})}return s}function ar(e){const t=new Map;for(const s of e){const r=s.package??"";t.has(r)||t.set(r,new Map);const o=t.get(r);o.has(s.direction)||o.set(s.direction,[]),o.get(s.direction).push(s)}const n=["inbound","outbound","bidirectional"];return[...t].sort(([s],[r])=>s.localeCompare(r)).map(([s,r])=>({package:s,directions:n.filter(o=>r.has(o)).map(o=>({direction:o,integrations:r.get(o)}))}))}function cr(e){const t=ge(e.endpoints.items).map(({request:s})=>({id:s.id,label:`${s.method} ${s.name}`,exposed:!1})),n=(e.expose??[]).map(s=>({id:s.key,label:`${s.method} ${s.path}`,exposed:!0}));return[...t,...n]}exports.GRAPHQL_INTROSPECTION_QUERY=_s;exports.NICE_API_AUTH_TYPES=Rn;exports.NICE_API_CODE_LANGUAGES=Qt;exports.NICE_API_MARKDOWN_LABELS=En;exports.NICE_API_METHODS=Ln;exports.NICE_CONNECTION_PROTOCOLS=tr;exports.NiceYamlError=Q;exports.POSTMAN_SCHEMA_V21=ln;exports.apiSecuritySchemes=bs;exports.bodyContentType=we;exports.bodyFromText=ut;exports.bodyText=re;exports.buildAuthorizationUrl=Fs;exports.buildGraphqlOperation=wn;exports.buildRequestUrl=ve;exports.buildSoapEnvelope=Tn;exports.collectionToMarkdown=Zs;exports.createPkcePair=Bs;exports.detectApiDocument=Un;exports.digest=_e;exports.digestAuthorization=Nn;exports.effectiveAuth=zt;exports.environmentSetFor=ir;exports.exchangeAuthorizationCode=Ks;exports.exportHar=Es;exports.exportOpenApi=pn;exports.exportOpenApiYaml=ws;exports.exportPostman=Ns;exports.exportPostmanEnvironment=Cs;exports.fetchOAuth2Token=Vs;exports.fetchTransport=Ws;exports.findApiItem=Dt;exports.findVariables=dt;exports.flattenApiRequests=ge;exports.fromBase64=ht;exports.generateCode=Zt;exports.graphqlExampleValue=Ne;exports.graphqlOperations=kn;exports.graphqlTypeName=ze;exports.groupIntegrations=ar;exports.headerValue=Mn;exports.hmac=fe;exports.importApiDocument=er;exports.importGraphqlIntrospection=vn;exports.importHar=gn;exports.importOpenApi=on;exports.importPostman=mn;exports.importPostmanEnvironment=hn;exports.importWsdl=Sn;exports.inferSchema=He;exports.integrationEndpoints=cr;exports.interpolate=mt;exports.isCurlCommand=Kt;exports.isEnabled=I;exports.isHar=wt;exports.isPostmanCollection=kt;exports.joinUrl=Kn;exports.jsonPointer=tt;exports.md5Hex=At;exports.mockFromSchema=bt;exports.mockResponse=ys;exports.namedType=vt;exports.newApiCollection=ye;exports.newApiFolder=be;exports.newApiId=$e;exports.newApiRequest=he;exports.newIntegration=nr;exports.paramsIn=Mt;exports.parseCurl=Gt;exports.parseDigestChallenge=On;exports.parseFormEncoded=ft;exports.parseGraphqlIntrospection=bn;exports.parseJsonOrYaml=De;exports.parseWsdl=An;exports.parseYaml=en;exports.pathParamNames=Bt;exports.pollDeviceToken=Qs;exports.refreshOAuth2Token=Js;exports.renameApiSchema=Dn;exports.requestName=yt;exports.resolveEnvironmentSet=Tt;exports.resolvePlainScalar=Be;exports.resolveRequest=ct;exports.rowsToRecord=Hn;exports.schemaResolver=gt;exports.sendApiRequest=Ms;exports.setRequestUrl=Vt;exports.signAwsV4=Cn;exports.signHmac=jn;exports.splitUrl=ce;exports.startDeviceAuthorization=Gs;exports.stringifyYaml=sn;exports.swagger2ToOpenApi3=an;exports.syncPathParams=Ft;exports.toApiEnvironments=rr;exports.toBase64=We;exports.toCurl=Pe;exports.tokenizeCommand=Jt;exports.unresolvedVariables=Bn;exports.updateApiItem=Ht;exports.validateIntegrations=or;exports.valueOrigin=sr;exports.variableScope=Fn;