@nice2dev/ui-api 1.4.10 → 1.4.12

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,60 +1,60 @@
1
- "use strict";var _n=Object.defineProperty;var En=(e,t,n)=>t in e?_n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ae=(e,t,n)=>En(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Un=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"],qn=["inherit","none","apiKey","bearer","basic","digest","oauth2","awsSigV4","hmac","mtls","custom"];let Fe=0;function Ee(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??Ee("r"),name:e.name??"New request",method:e.method??"GET",url:e.url??"",params:e.params??[],body:e.body??{kind:"none"}}}function ye(e={}){return{...e,kind:"folder",id:e.id??Ee("f"),name:e.name??"New folder",items:e.items??[]}}function be(e={}){return{...e,id:e.id??Ee("c"),name:e.name??"New API",items:e.items??[],variables:e.variables??[]}}function ze(e,t=[]){const n=[];for(const r of e)r.kind==="folder"?n.push(...ze(r.items,[...t,r])):n.push({request:r,folders:[...t]});return n}function It(e,t){for(const n of e){if(n.id===t)return n;if(n.kind==="folder"){const r=It(n.items,t);if(r)return r}}}function Pt(e,t,n){const r=[];for(const s of e)if(s.id===t){const o=n(s);o&&r.push(o)}else s.kind==="folder"?r.push({...s,items:Pt(s.items,t,n)}):r.push(s);return r}function I(e){return e.enabled!==!1}function In(e){const t={};for(const n of e)I(n)&&(t[n.key]=n.value);return t}function Lt(e,t){return e.params.filter(n=>n.in===t&&I(n))}function Pn(e,t){var r;const n=t.toLowerCase();return(r=Lt(e,"header").find(s=>s.key.toLowerCase()===n))==null?void 0:r.value}function Rt(e,t=[],n){const r=[e.auth,...[...t].reverse().map(s=>s.auth),n==null?void 0:n.auth];for(const s of r)if(s&&s.type!=="inherit")return s;return{type:"none"}}function ke(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 se(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 lt(e,t){const n=(t??"").toLowerCase();return n.includes("x-www-form-urlencoded")?{kind:"form",fields:ut(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)?Ln(e)??{kind:"json",text:e}:{kind:"text",text:e,contentType:t||void 0}}function ut(e){return e?e.split("&").map(t=>{const n=t.indexOf("="),r=s=>{try{return decodeURIComponent(s.replace(/\+/g," "))}catch{return s}};return n<0?{key:r(t),value:""}:{key:r(t.slice(0,n)),value:r(t.slice(n+1))}}):[]}function Ln(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 Ht=/\{\{\s*([^{}]+?)\s*\}\}/g;function Dt(e){const t=new Set;for(const n of e.matchAll(Ht))t.add(n[1]);return[...t]}function Rn(e){const t=r=>Array.from({length:r},()=>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 ft(e,t,n={}){const r=typeof t=="function"?t:c=>t[c],s=n.random??Math.random,o=n.now??(()=>new Date),i=c=>{var l;if(c.startsWith("secret:"))return(l=n.resolveSecret)==null?void 0:l.call(n,c.slice(7).trim());switch(c){case"$guid":case"$randomUUID":return Rn(s);case"$timestamp":return String(Math.floor(o().getTime()/1e3));case"$isoTimestamp":return o().toISOString();case"$randomInt":return String(Math.floor(s()*1001));default:return r(c)}};let a=e;for(let c=0;c<5&&a.includes("{{");c++){const l=a.replace(Ht,(f,u)=>i(u)??f);if(l===a)break;a=l}return a}function Hn(e,t,n={}){return Dt(ft(e,t,n))}function Dn(e,t,n){const r={},s=o=>{for(const i of o??[])I(i)&&i.key&&(r[i.key]=i.value)};return s(e==null?void 0:e.variables),s(t==null?void 0:t.values),{...r,...n}}function ce(e){let t=e.trim(),n="";const r=t.indexOf("#");r>=0&&(n=t.slice(r),t=t.slice(0,r));const s=t.indexOf("?");return s<0?{base:t,query:[],hash:n}:{base:t.slice(0,s),query:ut(t.slice(s+1)),hash:n}}function Mt(e){const t=ce(e).base,n=[],r=t.replace(/^[a-z][\w+.-]*:\/\/[^/]*/i,"").replace(/^\{\{[^}]+\}\}/,"");for(const s of r.matchAll(new RegExp("(?<!\\{)\\{([A-Za-z_][\\w.-]*)\\}(?!\\})|(?:^|\\/):([A-Za-z_][\\w-]*)","g"))){const o=s[1]??s[2];n.includes(o)||n.push(o)}return n}function zt(e){const t=Mt(e.url),n=e.params.filter(s=>s.in!=="path");return[...t.map(s=>e.params.find(o=>o.in==="path"&&o.key===s)??{key:s,value:"",in:"path",required:!0}),...n]}function Wt(e,t){const{base:n,query:r,hash:s}=ce(t),o={...e,url:n+s,params:[...e.params.filter(i=>i.in!=="query"),...r.map(i=>({...i,in:"query"}))]};return{...o,params:zt(o)}}function Mn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xt(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function $e(e,t=n=>n){const{base:n,query:r,hash:s}=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)),l=new RegExp(`(^|/):${Mn(a.key)}(?=/|$)`);o=o.split(`{${a.key}}`).join(c).replace(l,(f,u)=>u+c)}const i=[...r,...e.params.filter(a=>a.in==="query"&&I(a))].map(a=>{const c=xt(t(a.key)),l=t(a.value);return l===""&&!("in"in a)?c:`${c}=${xt(l)}`});return o+(i.length?`?${i.join("&")}`:"")+t(s)}function zn(e,t){return e?t?`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`:e:t}function Bt(e){return/^\s*(?:\$\s*)?curl(?:\.exe)?(?:\s|$)/i.test(e)}function Wn(e){return/\^\r?\n/.test(e)||/\^"/.test(e)?"cmd":/`\r?\n/.test(e)||/^\s*curl\.exe\b/i.test(e)?"powershell":"bash"}function Ft(e,t=Wn(e)){var c;let n=e.replace(/\r\n?/g,`
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 r=[];let s="",o=!1,i=0;const a=()=>{o&&r.push(s),s="",o=!1};for(;i<n.length;){const l=n[i];if(l===" "||l===" "||l===`
3
- `){a(),i++;continue}if(l==="#"&&!o&&t==="bash"){for(;i<n.length&&n[i]!==`
4
- `;)i++;continue}if(o=!0,l==="'"&&t!=="cmd"){for(i++;i<n.length;){if(n[i]==="'"){if(t==="powershell"&&n[i+1]==="'"){s+="'",i+=2;continue}break}s+=n[i++]}i++;continue}if(l==="$"&&n[i+1]==="'"&&t==="bash"){for(i+=2;i<n.length&&n[i]!=="'";){if(n[i]==="\\"&&i+1<n.length){const f=n[i+1],u={n:`
5
- `,t:" ",r:"\r","\\":"\\","'":"'",'"':'"',0:"\0"};if(f==="x"){const d=((c=/^[0-9a-fA-F]{1,2}/.exec(n.slice(i+2)))==null?void 0:c[0])??"";s+=String.fromCharCode(parseInt(d||"0",16)),i+=2+d.length;continue}s+=u[f]??`\\${f}`,i+=2;continue}s+=n[i++]}i++;continue}if(l==='"'){for(i++;i<n.length;){const f=n[i];if(f==='"'){if(t==="powershell"&&n[i+1]==='"'){s+='"',i+=2;continue}break}if(t==="powershell"){if(f==="`"&&i+1<n.length){s+=n[i+1],i+=2;continue}}else if(f==="\\"&&i+1<n.length&&'"\\$`'.includes(n[i+1])){s+=n[i+1],i+=2;continue}s+=f,i++}i++;continue}if(l==="\\"&&t==="bash"&&i+1<n.length){s+=n[i+1],i+=2;continue}s+=l,i++}return a(),r}const Bn=new Set("XHdFubAemoxwTEKrUzCcDYyQt".split("")),Fn=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"]),St={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 dt(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 r of t)n+=String.fromCharCode(r);return btoa(n)}function Vn(e){const t=e.indexOf("@"),n=e.indexOf("=");if(t>=0&&(n<0||t<n))return e;if(n<0)return encodeURIComponent(e);const r=e.slice(0,n),s=encodeURIComponent(e.slice(n+1));return r?`${r}=${s}`:s}function Kn(e,t){const n=e.indexOf("="),r=n<0?e:e.slice(0,n);let s=n<0?"":e.slice(n+1);if(!t&&(s.startsWith("@")||s.startsWith("<"))){const[o,...i]=s.slice(1).split(";"),a={key:r,value:"",type:"file",fileName:o};for(const c of i){const[l,f]=c.split("=");l==="type"&&(a.contentType=f),l==="filename"&&(a.fileName=f)}return a}if(!t){const o=s.indexOf(";type=");if(o>=0){const i={key:r,value:s.slice(0,o),type:"text"};return i.contentType=s.slice(o+6),i}}return s=s.replace(/^"(.*)"$/,"$1"),{key:r,value:s,type:"text"}}function Vt(e){const t=Ft(e.trim());if(t[0]==="$"&&t.shift(),!t.length||!/^curl(\.exe)?$/i.test(t[0]))throw new Error("Not a curl command");let n,r="";const s=[],o=[],i=[],a=[];let c;const l=[];let f,u=!1,d,p,b=!1,$=!1,h=!1;const A={},k=(N,T)=>{switch(N){case"request":n=T==null?void 0:T.toUpperCase();break;case"url":r=T??r;break;case"url-query":T&&i.push(...Nt(T));break;case"header":{if(!T)break;const U=T.indexOf(":");U>0?s.push({key:T.slice(0,U).trim(),value:T.slice(U+1).trim()}):T.endsWith(";")&&s.push({key:T.slice(0,-1).trim(),value:""});break}case"user-agent":s.push({key:"User-Agent",value:T??""});break;case"referer":s.push({key:"Referer",value:T??""});break;case"cookie":if(T!=null&&T.includes("="))for(const U of T.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(T===void 0)break;N==="json"&&(h=!0),N!=="data-raw"&&T.startsWith("@")?c=T.slice(1):a.push(N==="data"||N==="data-ascii"?T.replace(/[\r\n]/g,""):T);break;case"data-urlencode":T!==void 0&&a.push(Vn(T));break;case"form":case"form-string":T!==void 0&&l.push(Kn(T,N==="form-string"));break;case"user":f=T;break;case"oauth2-bearer":d=T;break;case"aws-sigv4":p=T;break;case"digest":u=!0;break;case"get":b=!0;break;case"head":$=!0;break;case"insecure":A.insecure=!0;break;case"location":A.followRedirects=!0;break;case"max-time":T&&Number.isFinite(Number(T))&&(A.timeoutMs=Number(T)*1e3);break;case"upload-file":T&&(c=T),n??(n="PUT");break}};for(let N=1;N<t.length;N++){const T=t[N];if(T.startsWith("--")&&T.length>2){const U=T.slice(2),H=Fn.has(U)?t[++N]:void 0;k(U,H)}else if(T.startsWith("-")&&T.length>1)for(let U=1;U<T.length;U++){const H=T[U];if(Bn.has(H)){const y=T.slice(U+1)||t[++N];k(St[H]??H,y);break}k(St[H]??H,void 0)}else r||(r=T)}let x;const g=s.findIndex(N=>N.key.toLowerCase()==="authorization");if(g>=0){const N=s[g].value,T=/^Bearer\s+(.+)$/i.exec(N),U=/^Basic\s+(.+)$/i.exec(N);if(T)x={type:"bearer",token:T[1].trim()},s.splice(g,1);else if(U){const H=dt(U[1]),m=H.indexOf(":");m>=0&&(x={type:"basic",username:H.slice(0,m),password:H.slice(m+1)},s.splice(g,1))}}if(f!==void 0){const N=f.indexOf(":"),T=N<0?f:f.slice(0,N),U=N<0?"":f.slice(N+1);if(p){const[,,H="",m=""]=p.split(":");x={type:"awsSigV4",accessKeyId:T,secretAccessKey:U,region:H,service:m}}else x=u?{type:"digest",username:T,password:U}:{type:"basic",username:T,password:U}}d!==void 0&&(x={type:"bearer",token:d});const S=s.findIndex(N=>N.key.toLowerCase()==="content-type"),w=S>=0?s[S].value:void 0;h&&(S<0&&s.push({key:"Content-Type",value:"application/json"}),s.some(N=>N.key.toLowerCase()==="accept")||s.push({key:"Accept",value:"application/json"}));let O={kind:"none"};if(b&&a.length)i.push(...Nt(a.join("&")));else if(l.length)O={kind:"multipart",parts:l};else if(a.length){const N=a.join(h?"":"&"),T=/^\s*[[{]/.test(N);O=lt(N,w??(h||T?"application/json":"application/x-www-form-urlencoded"))}else c!==void 0&&(O={kind:"binary",fileName:c,contentType:w});const L=n??($?"HEAD":b?"GET":O.kind!=="none"?"POST":"GET"),R=[...s.map(N=>({...N,in:"header"})),...o.map(N=>({...N,in:"cookie"}))];let M=he({name:mt(L,r),method:L,params:R,body:O,auth:x,settings:Object.keys(A).length?A:void 0});return M=Wt(M,r),i.length&&(M={...M,params:[...M.params,...i.map(N=>({...N,in:"query"}))]}),M}function Nt(e){return e.split("&").filter(Boolean).map(t=>{const n=t.indexOf("="),r=s=>{try{return decodeURIComponent(s.replace(/\+/g," "))}catch{return s}};return n<0?{key:r(t),value:""}:{key:r(t.slice(0,n)),value:r(t.slice(n+1))}})}function mt(e,t){const n=t.replace(/^[a-z][\w+.-]*:\/\/[^/]*/i,"").replace(/^\{\{[^}]+\}\}/,"").split("?")[0];return`${e} ${n||"/"}`}function Jn(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 Gn(e,t){const n=[],r=[],s=[];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"?r.push({key:e.key,value:e.value}):s.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:r,cookies:s}}function Ie(e,t={}){var x,g,S;const n=t.shell??"bash",r=t.transform??(w=>w),s=Jn(n),o=Gn(t.auth??e.auth,r),i={...e,params:[...e.params,...o.query.map(w=>({...w,in:"query"}))]},a=$e(i,r),c=[],l=e.method.toUpperCase(),f=e.body.kind!=="none";l==="HEAD"?c.push(["-I"]):!(l==="GET"&&!f)&&!(l==="POST"&&f)&&c.push(["-X",l]);const u=e.params.filter(w=>w.in==="header"&&I(w));for(const w of u)c.push(["-H",`${r(w.key)}: ${r(w.value)}`]);c.push(...o.options);const d=ke(e.body),p=u.some(w=>w.key.toLowerCase()==="content-type"),b=[...e.params.filter(w=>w.in==="cookie"&&I(w)),...o.cookies];b.length&&c.push(["-b",b.map(w=>`${r(w.key)}=${r(w.value)}`).join("; ")]);const $=e.body;switch($.kind){case"none":break;case"form":for(const w of $.fields.filter(I))c.push(["--data-urlencode",`${r(w.key)}=${r(w.value)}`]);break;case"multipart":for(const w of $.parts.filter(I))w.type==="file"?c.push(["-F",`${r(w.key)}=@${w.fileName??w.value}${w.contentType?`;type=${w.contentType}`:""}`]):c.push(["-F",`${r(w.key)}=${r(w.value)}${w.contentType?`;type=${w.contentType}`:""}`]);break;case"binary":!p&&d&&c.push(["-H",`Content-Type: ${d}`]),c.push(["--data-binary",`@${$.fileName??"file"}`]);break;default:{!p&&d&&c.push(["-H",`Content-Type: ${d}`]),$.kind==="soap"&&$.version==="1.1"&&$.action!==void 0&&(u.some(w=>w.key.toLowerCase()==="soapaction")||c.push(["-H",`SOAPAction: "${r($.action)}"`])),c.push(["--data-raw",r(se($)??"")]);break}}(x=e.settings)!=null&&x.followRedirects&&c.push(["-L"]),(g=e.settings)!=null&&g.insecure&&c.push(["-k"]),(S=e.settings)!=null&&S.timeoutMs&&c.push(["-m",String(e.settings.timeoutMs/1e3)]);const A=[`${n==="powershell"?"curl.exe":"curl"} ${s(a)}`,...c.map(([w,O])=>O===void 0?w:`${w} ${s(O)}`)];if(t.multiline===!1)return A.join(" ");const k=n==="cmd"?` ^
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,`
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
+ `){a(),i++;continue}if(p==="#"&&!o&&t==="bash"){for(;i<n.length&&n[i]!==`
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"?` ^
6
6
  `:n==="powershell"?" `\n ":` \\
7
- `;return A.join(k)}const Kt=[{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 qe(e,t){var d;const n=t.transform??(p=>p),r=t.auth??e.auth,s=e.params.filter(p=>p.in==="header"&&I(p)).map(p=>[n(p.key),n(p.value)]),o=[],i=e.params.filter(p=>p.in==="cookie"&&I(p)).map(p=>`${n(p.key)}=${n(p.value)}`);let a;switch(r==null?void 0:r.type){case"basic":s.push(["Authorization",`Basic ${We(`${n(r.username)}:${n(r.password)}`)}`]);break;case"bearer":s.push(["Authorization",`${r.prefix??"Bearer"} ${n(r.token)}`]);break;case"oauth2":r.accessToken?s.push(["Authorization",`${r.tokenType??"Bearer"} ${n(r.accessToken)}`]):a="OAuth 2: obtain a token first and send it as Authorization: Bearer <token>.";break;case"apiKey":r.in==="header"?s.push([n(r.key),n(r.value)]):r.in==="query"?o.push({key:r.key,value:r.value,in:"query"}):i.push(`${n(r.key)}=${n(r.value)}`);break;case"custom":for(const p of r.headers.filter(I))s.push([n(p.key),n(p.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 ${r.header} header per call.`;break;case"mtls":a="Mutual TLS: attach the client certificate in the HTTP client.";break}i.length&&s.push(["Cookie",i.join("; ")]);const c=$e({...e,params:[...e.params,...o]},n),l=e.body,f=((d=s.find(([p])=>p.toLowerCase()==="content-type"))==null?void 0:d[1])??ke(l);l.kind==="soap"&&l.version==="1.1"&&l.action!==void 0&&(s.some(([p])=>p.toLowerCase()==="soapaction")||s.push(["SOAPAction",`"${n(l.action)}"`]));const u=Qn(l,n);return{method:e.method.toUpperCase(),url:c,headers:s,body:u,contentType:f,note:a}}function Qn(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 re=e=>JSON.stringify(e),F=e=>`@"${e.replace(/"/g,'""')}"`,te=e=>`'${e.replace(/'/g,"''")}'`,X=e=>JSON.stringify(e);function Jt(e,t){return e.split(`
8
- `).map((n,r)=>r===0?n:t+n).join(`
9
- `)}function Gt(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return}}function Yn(e){const t=[];e.note&&t.push(`// ${e.note}`);let n="",r;const s=[...e.headers],o=s.some(([a])=>a.toLowerCase()==="content-type");switch(e.body.kind){case"json":{const a=Gt(e.body.text);r=a?`JSON.stringify(${Jt(a," ")})`:re(e.body.text),o||s.push(["Content-Type","application/json"]);break}case"form":n=`const body = new URLSearchParams();
10
- ${e.body.fields.map(a=>`body.append(${re(a.key)}, ${re(a.value)});`).join(`
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(`
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();
10
+ ${e.body.fields.map(a=>`body.append(${se(a.key)}, ${se(a.value)});`).join(`
11
11
  `)}
12
12
 
13
- `,r="body";break;case"multipart":n=`const body = new FormData();
14
- ${e.body.parts.map(a=>a.type==="file"?`body.append(${re(a.key)}, fileInput.files[0]); // ${a.fileName??"file"}`:`body.append(${re(a.key)}, ${re(a.value)});`).join(`
13
+ `,s="body";break;case"multipart":n=`const body = new FormData();
14
+ ${e.body.parts.map(a=>a.type==="file"?`body.append(${se(a.key)}, fileInput.files[0]); // ${a.fileName??"file"}`:`body.append(${se(a.key)}, ${se(a.value)});`).join(`
15
15
  `)}
16
16
 
17
- `,r="body";for(let a=s.length-1;a>=0;a--)s[a][0].toLowerCase()==="content-type"&&s.splice(a,1);break;case"binary":r=`file // ${e.body.fileName??"a File or Blob"}`,!o&&e.contentType&&s.push(["Content-Type",e.contentType]);break;case"none":break;default:r=re(se(e.body)??""),!o&&e.contentType&&s.push(["Content-Type",e.contentType])}n&&t.push(n.trimEnd(),"");const i=[` method: ${re(e.method)},`];return s.length&&i.push(` headers: {
18
- ${s.map(([a,c])=>` ${re(a)}: ${re(c)},`).join(`
17
+ `,s="body";for(let a=r.length-1;a>=0;a--)r[a][0].toLowerCase()==="content-type"&&r.splice(a,1);break;case"binary":s=`file // ${e.body.fileName??"a File or Blob"}`,!o&&e.contentType&&r.push(["Content-Type",e.contentType]);break;case"none":break;default:s=se(re(e.body)??""),!o&&e.contentType&&r.push(["Content-Type",e.contentType])}n&&t.push(n.trimEnd(),"");const i=[` method: ${se(e.method)},`];return r.length&&i.push(` headers: {
18
+ ${r.map(([a,c])=>` ${se(a)}: ${se(c)},`).join(`
19
19
  `)}
20
- },`),r&&i.push(` body: ${r},`),t.push(`const response = await fetch(${re(e.url)}, {
20
+ },`),s&&i.push(` body: ${s},`),t.push(`const response = await fetch(${se(e.url)}, {
21
21
  ${i.join(`
22
22
  `)}
23
23
  });`),t.push("const data = await response.text();"),t.join(`
24
- `)}const Xn=new Set(["content-type","content-length","content-encoding","content-language","content-disposition"]);function Zn(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 r=["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(${r}, ${F(e.url)});`);for(const[o,i]of e.headers)Xn.has(o.toLowerCase())||t.push(`request.Headers.TryAddWithoutValidation(${F(o)}, ${F(i)});`);const s=(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(s)});`);break;default:t.push(`request.Content = new StringContent(${F(se(e.body)??"")}, Encoding.UTF8, ${F(s)});`)}return t.push("","using var response = await client.SendAsync(request);","response.EnsureSuccessStatusCode();","var body = await response.Content.ReadAsStringAsync();"),t.join(`
25
- `)}function er(e){const t=[];e.note&&t.push(`# ${e.note}`);const n=e.headers.filter(([s])=>s.toLowerCase()!=="content-type");n.length&&t.push("$headers = @{",...n.map(([s,o])=>` ${te(s)} = ${te(o)}`),"}");const r=[`-Uri ${te(e.url)}`,`-Method ${e.method[0]}${e.method.slice(1).toLowerCase()}`];switch(n.length&&r.push("-Headers $headers"),e.body.kind){case"none":break;case"form":t.push("$body = @{",...e.body.fields.map(s=>` ${te(s.key)} = ${te(s.value)}`),"}"),r.push("-Body $body");break;case"multipart":t.push("$form = @{",...e.body.parts.map(s=>s.type==="file"?` ${te(s.key)} = Get-Item ${te(s.fileName??"file")}`:` ${te(s.key)} = ${te(s.value)}`),"}"),r.push("-Form $form");break;case"binary":r.push(`-InFile ${te(e.body.fileName??"file")}`),e.contentType&&r.push(`-ContentType ${te(e.contentType)}`);break;default:t.push(`$body = @'
26
- ${se(e.body)??""}
27
- '@`),r.push("-Body $body"),e.contentType&&r.push(`-ContentType ${te(e.contentType)}`)}return t.push(`$response = Invoke-RestMethod ${r.join(" ")}`),t.join(`
28
- `)}function tr(e){const t=[];e.note&&t.push(`# ${e.note}`),t.push("import requests","");const n=[` ${X(e.method)},`,` ${X(e.url)},`],r=[...e.headers];switch(e.body.kind){case"none":break;case"json":{const s=Gt(e.body.text);if(s){const o=s.replace(/\btrue\b/g,"True").replace(/\bfalse\b/g,"False").replace(/\bnull\b/g,"None");n.push(` json=${Jt(o," ")},`);for(let i=r.length-1;i>=0;i--)r[i][0].toLowerCase()==="content-type"&&r.splice(i,1)}else n.push(` data=${X(e.body.text)},`);break}case"form":n.push(` data={${e.body.fields.map(s=>`${X(s.key)}: ${X(s.value)}`).join(", ")}},`);break;case"multipart":{const s=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(", ")}},`),s.length&&n.push(` files={${s.map(i=>`${X(i.key)}: open(${X(i.fileName??"file")}, "rb")`).join(", ")}},`);for(let i=r.length-1;i>=0;i--)r[i][0].toLowerCase()==="content-type"&&r.splice(i,1);break}case"binary":n.push(` data=open(${X(e.body.fileName??"file")}, "rb"),`);break;default:n.push(` data=${X(se(e.body)??"")},`),e.contentType&&!r.some(([s])=>s.toLowerCase()==="content-type")&&r.push(["Content-Type",e.contentType])}return r.length&&n.splice(2,0,` headers={
29
- ${r.map(([s,o])=>` ${X(s)}: ${X(o)},`).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 = @'
26
+ ${re(e.body)??""}
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={
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 Qt(e,t,n={}){switch(t){case"curl":return Ie(e,{...n,shell:"bash"});case"curl-cmd":return Ie(e,{...n,shell:"cmd"});case"curl-powershell":return Ie(e,{...n,shell:"powershell"});case"fetch":return Yn(qe(e,n));case"csharp":return Zn(qe(e,n));case"powershell":return er(qe(e,n));case"python":return tr(qe(e,n));default:return""}}class Q extends Error{constructor(t,n){super(`${t} (line ${n})`),this.line=n,this.name="NiceYamlError"}}function Ot(e){let t=null;for(let n=0;n<e.length;n++){const r=e[n];if(t){if(r===t){if(t==="'"&&e[n+1]==="'"){n++;continue}t=null}else r==="\\"&&t==='"'&&n++;continue}if((r==='"'||r==="'")&&(n===0||/[\s:[{,-]/.test(e[n-1])))t=r;else if(r==="#"&&(n===0||/\s/.test(e[n-1])))return e.slice(0,n).trimEnd()}return e.trimEnd()}const nr=new Set(["","~","null","Null","NULL"]);function Be(e){if(nr.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 r=0;r<e.length;r++){const s=e[r];if(s!=="\\"){n+=s;continue}const o=e[++r],i={n:`
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(r+1,r+1+a);if(!/^[0-9a-fA-F]+$/.test(c)||c.length!==a)throw new Q("Bad escape",t);n+=String.fromCodePoint(parseInt(c,16)),r+=a}else if(o!==`
37
- `)throw new Q(`Unknown escape \\${o}`,t)}return n}function Ve(e){let t="",n=0;return e.forEach((r,s)=>{const o=s===0?r.trimEnd():s===e.length-1?r.trimStart():r.trim();if(s>0&&o===""&&s<e.length-1){n++;return}s>0&&(t+=n?`
38
- `.repeat(n):" "),n=0,t+=o}),t}class rr{constructor(t){Ae(this,"lines");Ae(this,"i",0);Ae(this,"anchors",new Map);this.lines=t.replace(/^\uFEFF/,"").replace(/\r\n?/g,`
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:`
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
+ `)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,`
39
39
  `).split(`
40
- `).map((n,r)=>{const s=n.length-n.replace(/^ +/,"").length,o=n.slice(s);if(o.startsWith(" "))throw new Q("Tabs cannot indent YAML",r+1);return{indent:s,raw:o,text:Ot(o),num:r+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),r=this.current();if(r&&r.text!=="..."&&r.text!=="---")throw new Q(`Unexpected text: ${r.text.slice(0,40)}`,r.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 s=t[0];let o=1;for(;o<t.length;){if(t[o]==="\\"&&s==='"'){o+=2;continue}if(t[o]===s){if(s==="'"&&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:s==='"'?Ze(c,0):c.replace(/''/g,"'"),rest:i.slice(a[0].length).trim()}}if(/^[[{]/.test(t)||/^\?\s+(.*)$/.exec(t))return null;const r=/^(.*?)\s*:(?:\s+|$)/.exec(t);return!r||r[1]===""||r[1].includes(" #")?null:{key:r[1],rest:t.slice(r[0].length).trim()}}parseMapping(t){const n={};for(let s=this.current();s&&s.indent===t;s=this.current()){const o=this.splitKey(s.text);if(!o){if(s.text==="-"||s.text.startsWith("- "))break;throw new Q(`Expected "key: value": ${s.text.slice(0,40)}`,s.num)}this.i++;const i=this.parseValue(o.rest,t,s,!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[l,f]of Object.entries(c))l in n||(n[l]=f)}else n[o.key]=i}const r=this.current();if(r&&r.indent>t)throw new Q("Bad indentation",r.num);return n}parseSequence(t){const n=[];for(let r=this.current();r&&r.indent===t&&(r.text==="-"||r.text.startsWith("- "));r=this.current()){const s=r.text==="-"?"":r.text.slice(2).trimStart(),o=t+(r.text.length-s.length);if(s===""){this.i++,n.push(this.parseNested(t));continue}if(!this.takeAnchor(s).anchor&&(s==="-"||s.startsWith("- ")||this.splitKey(s))){this.lines[this.i]={...r,indent:o,raw:r.raw.slice(o-r.indent),text:s},n.push(s==="-"||s.startsWith("- ")?this.parseSequence(o):this.parseMapping(o));continue}this.i++,n.push(this.parseValue(s,t,r))}return n}takeAnchor(t){let n=t,r;for(;;){const s=/^&([^\s[\]{},]+)\s*/.exec(n);if(s){r=s[1],n=n.slice(s[0].length);continue}const o=/^!!?[^\s]*\s*/.exec(n);if(o&&n.startsWith("!")){n=n.slice(o[0].length);continue}return{anchor:r,rest:n}}}parseNested(t,n=!1){const r=this.current();return r?r.indent>t?this.parseBlock(t):n&&r.indent===t&&(r.text==="-"||r.text.startsWith("- "))?this.parseSequence(t):null:null}parseValue(t,n,r,s=!1){const{anchor:o,rest:i}=this.takeAnchor(t);let a;if(i==="")a=this.parseNested(n,s);else if(i.startsWith("*")){const c=i.slice(1).trim();if(!this.anchors.has(c))throw new Q(`Unknown alias *${c}`,r.num);a=this.anchors.get(c)}else/^[|>]/.test(i)?a=this.parseBlockScalar(i,n,r):i.startsWith("[")||i.startsWith("{")?a=this.parseFlowLines(i,r):i.startsWith('"')||i.startsWith("'")?a=this.parseQuotedLines(i,r):a=this.parsePlainLines(i,n);return o&&this.anchors.set(o,a),a}parseBlockScalar(t,n,r){const s=/^([|>])([1-9])?([-+])?([1-9])?\s*$/.exec(t);if(!s)throw new Q(`Bad block scalar header ${t}`,r.num);const o=s[1]===">",i=s[3]??"",a=Number(s[2]??s[4]??0),c=[];let l=a?n+a:-1;for(;this.i<this.lines.length;){const d=this.lines[this.i],p=d.raw.trim()==="";if(!p){if(l<0){if(d.indent<=n)break;l=d.indent}if(d.indent<l)break}c.push(p?"":" ".repeat(d.indent-l)+d.raw),this.i++}let f=0;for(;c.length&&c[c.length-1]==="";)c.pop(),f++;let u;return o?(u="",c.forEach((d,p)=>{if(p===0){u=d;return}const b=c[p-1],$=d.startsWith(" ")||b.startsWith(" ");d===""?u+=`
41
- `:b===""||$?u+=(b===""?"":`
42
- `)+d:u+=` ${d}`})):u=c.join(`
43
- `),c.length?i==="-"?u:i==="+"?`${u}
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+=`
41
+ `:m===""||k?f+=(m===""?"":`
42
+ `)+d:f+=` ${d}`})):f=c.join(`
43
+ `),c.length?i==="-"?f:i==="+"?`${f}
44
44
  ${`
45
- `.repeat(f)}`:`${u}
45
+ `.repeat(u)}`:`${f}
46
46
  `:i==="+"?`
47
- `.repeat(f):""}parseQuotedLines(t,n){const r=t[0],s=[];let o=t.slice(1),i=n.num;for(;;){const a=this.findClosingQuote(o,r);if(a>=0){s.push(o.slice(0,a));const l=Ot(o.slice(a+1)).trim();if(l)throw new Q(`Text after a quoted scalar: ${l.slice(0,20)}`,i);break}if(s.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(r==='"'){const a=[];for(const c of s)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(s).replace(/''/g,"'")}findClosingQuote(t,n){for(let r=0;r<t.length;r++){if(n==='"'&&t[r]==="\\"){r++;continue}if(t[r]===n){if(n==="'"&&t[r+1]==="'"){r++;continue}return r}}return-1}parsePlainLines(t,n){const r=[t];for(;this.i<this.lines.length;){const s=this.lines[this.i];if(s.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("- ")){r.push(...Array.from({length:o-this.i},()=>"")),this.i=o;continue}break}if(s.indent<=n||this.splitKey(s.text)||s.text.startsWith("- "))break;r.push(s.text),this.i++}return r.length===1?Be(t):Ve(r)}parseFlowLines(t,n){let r=t;for(;!sr(r);){if(this.i>=this.lines.length)throw new Q("Unclosed flow collection",n.num);r+=` ${this.lines[this.i++].text}`}const s=new ir(r,n.num,this.anchors),o=s.parseValue();if(s.skipSpace(),!s.atEnd())throw new Q("Text after a flow collection",n.num);return o}}function sr(e){let t=0,n=null;for(let r=0;r<e.length;r++){const s=e[r];if(n){s==="\\"&&n==='"'?r++:s===n&&(n=null);continue}s==='"'||s==="'"?n=s:s==="["||s==="{"?t++:(s==="]"||s==="}")&&t--}return t<=0&&!n}class ir{constructor(t,n,r){Ae(this,"pos",0);this.text=t,this.line=n,this.anchors=r}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 r=this.text[this.pos];if(t==='"'&&r==="\\"){n+=r+this.text[this.pos+1],this.pos+=2;continue}if(r===t){if(t==="'"&&this.text[this.pos+1]==="'"){n+="'",this.pos+=2;continue}return this.pos++,t==='"'?Ze(n,this.line):n}n+=r,this.pos++}return this.fail("Unclosed quote")}parsePlain(t){const n=this.pos;for(;this.pos<this.text.length;){const r=this.text[this.pos];if(r===","||r==="]"||r==="}"||r===":"&&(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],r=n==='"'||n==="'"?this.parseQuoted():this.parsePlain(!0);this.skipSpace();let s=null;this.text[this.pos]===":"&&(this.pos++,this.skipSpace(),s=this.text[this.pos]===","||this.text[this.pos]==="}"?null:this.parseValue()),t[String(r)]=s,this.skipSpace(),this.text[this.pos]===","?this.pos++:this.text[this.pos]!=="}"&&this.fail("Expected , or }")}}}function Yt(e){return new rr(e).parseDocument()}function Xt(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 or=/^[-?:,[\]{}#&*!|>'"%@`]/;function Zt(e){return e===""||e!==e.trim()||or.test(e)||/: |:$| #|[\t\n\r]/.test(e)||Xt(e)||typeof Be(e)!="string"}function ar(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 Zt(t)?JSON.stringify(t):t}function cr(e){return Zt(e)?JSON.stringify(e):e}function jt(e){return Array.isArray(e)?e.length>0:!!e&&typeof e=="object"&&Object.keys(e).length>0}function et(e,t,n,r){const s=" ".repeat(t);if(Array.isArray(e)){if(!e.length){n.push(`${r}[]`);return}r&&n.push(r.trimEnd());for(const o of e)if(jt(o)){const i=[];et(o,t+2,i,""),n.push(`${s}- ${i[0].trimStart()}`,...i.slice(1))}else Ke(o,t,n,`${s}- `);return}if(e&&typeof e=="object"){const o=Object.entries(e).filter(([,i])=>i!==void 0);if(!o.length){n.push(`${r}{}`);return}r&&n.push(r.trimEnd());for(const[i,a]of o){const c=`${s}${cr(i)}:`;jt(a)?et(a,Array.isArray(a)?t:t+2,n,c):Ke(a,t,n,`${c} `)}return}Ke(e,t,n,r)}function Ke(e,t,n,r){if(Array.isArray(e)){n.push(`${r}[]`);return}if(e&&typeof e=="object"){n.push(`${r}{}`);return}if(typeof e=="string"&&e.includes(`
48
- `)&&!Xt(e)){const s=e.endsWith(`
49
- `),o=(s?e.slice(0,-1):e).split(`
50
- `),i=o[0].startsWith(" "),a=" ".repeat(t+2),c=s?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=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(`
49
+ `),o=(r?e.slice(0,-1):e).split(`
50
+ `),i=o[0].startsWith(" "),a=" ".repeat(t+2),c=r?e.endsWith(`
51
51
 
52
- `)?"+":"":"-";n.push(`${r}|${i?"2":""}${c}`);for(const l of o)n.push(l?a+l:"");return}n.push(r+ar(e))}function en(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+ps(e))}function nn(e){const t=[];return et(e,0,t,""),`${t.join(`
53
53
  `)}
54
- `}function Re(e,t=Yt){const n=e.trimStart();if(n.startsWith("{")||n.startsWith("["))try{return JSON.parse(n)}catch{}return t(e)}function ht(e){return t=>{var r;const n=(r=/^#\/(?:components\/schemas|definitions)\/(.+)$/.exec(t))==null?void 0:r[1];return n?e==null?void 0:e[decodeURIComponent(n.replace(/~1/g,"/").replace(/~0/g,"~"))]:void 0}}function pr(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 lr(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 yt(e,t={}){const n=t.maxDepth??6,r=t.arrayItems??1,s=t.now??(()=>new Date),o=(i,a,c)=>{var f,u,d,p,b,$;if(!i)return null;if(i.$ref){if(c.has(i.$ref)||a>n)return null;const h=(f=t.resolveRef)==null?void 0:f.call(t,i.$ref);return h?o(h,a,new Set([...c,i.$ref])):null}if(i.example!==void 0)return i.example;if((u=i.examples)!=null&&u.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((p=i.allOf)!=null&&p.length){const h={};let A;for(const k of i.allOf){const x=o(k,a,c);x&&typeof x=="object"&&!Array.isArray(x)?Object.assign(h,x):x!=null&&(A=x)}return i.properties&&Object.assign(h,o({...i,allOf:void 0},a,c)),Object.keys(h).length?h:A??null}const l=((b=i.oneOf)==null?void 0:b[0])??(($=i.anyOf)==null?void 0:$[0]);if(l)return o(l,a,c);switch(pr(i)){case"string":return lr(i,s);case"integer":return i.minimum??0;case"number":return i.minimum??0;case"boolean":return!0;case"array":return a>=n?[]:Array.from({length:r},()=>o(i.items,a+1,c));case"object":{if(a>=n)return{};const h={};for(const[A,k]of Object.entries(i.properties??{}))t.usage==="request"&&k.readOnly||t.usage==="response"&&k.writeOnly||(h[A]=o(k,a+1,c));return!i.properties&&i.additionalProperties&&typeof i.additionalProperties=="object"&&(h.key=o(i.additionalProperties,a+1,c)),h}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,r]of Object.entries(e))t[n]=He(r);return{type:"object",properties:t}}default:return{}}}function ur(e,t){var l;const n=(l=e.examples)==null?void 0:l[0];if(n){const f={};for(const u of n.headers??[])f[u.key]=u.value;return{status:n.status,headers:f,body:n.body??""}}const r=Object.entries(e.responses??{}),[s,o]=r.find(([f])=>/^2\d\d$/.test(f))??r.find(([f])=>f==="default")??["200",void 0],i=/^\d{3}$/.test(s)?Number(s):200;if(!o)return{status:i,headers:{},body:""};const a=o.contentType??"application/json";let c=o.example??"";if(!c&&o.schema){const f=yt(o.schema,{resolveRef:ht(t==null?void 0:t.schemas),usage:"response"});c=typeof f=="string"?f:JSON.stringify(f,null,2)}return{status:i,headers:{"Content-Type":a},body:c}}const j=e=>!!e&&typeof e=="object"&&!Array.isArray(e),z=e=>typeof e=="string"?e:void 0,tn=["get","put","post","delete","options","head","patch","trace"],fr=["query","path","header","cookie"];function tt(e,t){const n=t.indexOf("#"),r=n>=0?t.slice(n+1):"";if(!r||r==="/")return e;let s=e;for(const o of r.split("/").slice(1)){const i=decodeURIComponent(o).replace(/~1/g,"/").replace(/~0/g,"~");if(j(s))s=s[i];else if(Array.isArray(s))s=s[Number(i)];else return}return s}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=[r=>r==="application/json",r=>/\+json$|\/json/.test(r),r=>r==="application/x-www-form-urlencoded",r=>r==="multipart/form-data",r=>/xml/.test(r),r=>r.startsWith("text/"),()=>!0];for(const r of n){const s=t.find(r);if(s)return[s,j(e[s])?e[s]:{}]}}function nn(e,t={}){var T,U,H;let n=typeof e=="string"?Re(e,t.parseYaml):e;if(!j(n))throw new Error("Not an OpenAPI document");if(typeof n.swagger=="string")n=rn(n);else if(typeof n.openapi!="string")throw new Error('Not an OpenAPI document: no "openapi" or "swagger" version');const r=n,s=t.baseUrlVariable??"baseUrl",o=new Map,i=m=>{var v;if(m.startsWith("#"))return tt(r,m);const y=m.split("#")[0];if(!o.has(y)){const _=(v=t.resolveRef)==null?void 0:v.call(t,y);o.set(y,typeof _=="string"?Re(_,t.parseYaml):_)}return tt(o.get(y),m)},a=m=>{let y=m;for(let v=0;v<20&&j(y)&&typeof y.$ref=="string";v++)y=i(y.$ref);return y},c=(m,y=0)=>{if(!j(m))return;if(typeof m.$ref=="string")return/^#\/components\/schemas\//.test(m.$ref)?{$ref:m.$ref}:y>12?{}:c(i(m.$ref),y+1);const v={...m};if(j(m.properties)){v.properties={};for(const[_,C]of Object.entries(m.properties))v.properties[_]=c(C,y+1)??{}}m.items!==void 0&&(v.items=c(m.items,y+1)),j(m.additionalProperties)&&(v.additionalProperties=c(m.additionalProperties,y+1));for(const _ of["allOf","oneOf","anyOf"]){const C=m[_];Array.isArray(C)&&(v[_]=C.map(q=>c(q,y+1)??{}))}return v},l=j(r.components)?r.components:{},f={};if(j(l.schemas))for(const[m,y]of Object.entries(l.schemas))f[m]=c(y)??{};const u=ht(f),d=m=>{if(!j(m))return;const y=Object.values(m)[0],v=a(y);return j(v)?v.value:void 0},p=new Map,b=(m,y=!1)=>(p.has(m)||p.set(m,{key:m,value:"",secret:y||void 0}),`{{${m}}}`),$=j(l.securitySchemes)?l.securitySchemes:{},h=(m,y)=>{const v=a($[m]);if(!j(v))return;const _=m.replace(/[^\w.-]/g,"_");switch(v.type){case"apiKey":{const C=v.in==="query"||v.in==="cookie"?v.in:"header";return{type:"apiKey",key:z(v.name)??"X-API-Key",value:b(_,!0),in:C}}case"http":{const C=(z(v.scheme)??"").toLowerCase();return C==="basic"?{type:"basic",username:b("username"),password:b("password",!0)}:C==="digest"?{type:"digest",username:b("username"),password:b("password",!0)}:C==="bearer"?{type:"bearer",token:b(_,!0)}:{type:"custom",headers:[{key:"Authorization",value:`${z(v.scheme)??""} ${b(_,!0)}`}]}}case"oauth2":{const C=j(v.flows)?v.flows:{},P=["authorizationCode","clientCredentials","password","implicit"].find(ie=>j(C[ie]))??"clientCredentials",D=C[P]??{},B=Array.isArray(y)&&y.length?y.join(" "):void 0;return{type:"oauth2",grant:P,tokenUrl:z(D.tokenUrl),authUrl:z(D.authorizationUrl),clientId:b("clientId"),clientSecret:P==="implicit"?void 0:b("clientSecret",!0),scope:B,usePkce:P==="authorizationCode"||void 0,username:P==="password"?b("username"):void 0,password:P==="password"?b("password",!0):void 0}}case"openIdConnect":return{type:"oauth2",grant:"authorizationCode",authUrl:z(v.openIdConnectUrl),clientId:b("clientId"),usePkce:!0,scope:Array.isArray(y)&&y.length?y.join(" "):"openid"};case"mutualTLS":return{type:"mtls"};default:return}},A=m=>{if(Array.isArray(m)){if(!m.length)return{type:"none"};for(const y of m){if(!j(y))continue;const v=Object.keys(y);if(!v.length)return{type:"none"};const _=h(v[0],y[v[0]]);if(_)return _}}},k=m=>{var B,ie;const y=a(m);if(!j(y)||typeof y.name!="string")return null;const v=fr.find(oe=>oe===y.in);if(!v||v==="header"&&/^(accept|content-type|authorization)$/i.test(y.name))return null;const _=c(y.schema)??(j(y.content)?c((B=Je(y.content))==null?void 0:B[1].schema):void 0),C=_!=null&&_.$ref?u(_.$ref):_,q=y.example??d(y.examples)??(C==null?void 0:C.example)??(C==null?void 0:C.default)??((ie=C==null?void 0:C.enum)==null?void 0:ie[0]),P=v==="path"||y.required===!0,D={key:y.name,value:ue(q),in:v};return P&&(D.required=!0),!P&&q===void 0&&(D.enabled=!1),typeof y.description=="string"&&(D.description=y.description),_&&(D.schema=_),typeof y.style=="string"&&(D.style=y.style),typeof y.explode=="boolean"&&(D.explode=y.explode),D},x=(m,y)=>{const v=c(y.schema),_=y.example??d(y.examples),C=_!==void 0?_:yt(v,{resolveRef:u,usage:"request"}),q=P=>{const D=P!=null&&P.$ref?u(P.$ref):P;return(D==null?void 0:D.properties)??{}};if(m==="application/x-www-form-urlencoded"){const P=j(C)?C:{};return{kind:"form",fields:(Object.keys(P).length?Object.keys(P):Object.keys(q(v))).map(B=>({key:B,value:ue(P[B])}))}}if(m.startsWith("multipart/")){const P=j(C)?C:{};return{kind:"multipart",parts:Object.entries(q(v)).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(m)?{kind:"json",text:typeof C=="string"?C:JSON.stringify(C??{},null,2)}:m==="application/graphql"?{kind:"graphql",query:ue(C)}:/xml/.test(m)?{kind:"xml",text:typeof C=="string"?C:""}:m.startsWith("text/")?{kind:"text",text:ue(C),contentType:m==="text/plain"?void 0:m}:{kind:"binary",contentType:m}},g=m=>{const y=a(m);if(!j(y))return{};const v={};typeof y.description=="string"&&(v.description=y.description);const _=j(y.content)?Je(y.content):void 0;if(_){const[C,q]=_;v.contentType=C;const P=c(q.schema);P&&(v.schema=P);const D=q.example??d(q.examples);D!==void 0&&(v.example=typeof D=="string"?D:JSON.stringify(D,null,2))}return j(y.headers)&&(v.headers=Object.entries(y.headers).map(([C,q])=>{const P=a(q);return{key:C,value:"",description:j(P)?z(P.description):void 0}})),v},S=A(r.security),w=[],O=j(r.paths)?r.paths:{};for(const[m,y]of Object.entries(O)){const v=a(y);if(!j(v))continue;const _=Array.isArray(v.parameters)?v.parameters:[];for(const C of tn){const q=v[C];if(!j(q))continue;const P=[];for(const Y of[..._,...Array.isArray(q.parameters)?q.parameters:[]]){const pe=k(Y);if(!pe)continue;const vt=P.findIndex(Tt=>Tt.key===pe.key&&Tt.in===pe.in);vt>=0?P[vt]=pe:P.push(pe)}let D={kind:"none"};const B=a(q.requestBody);if(j(B)&&j(B.content)){const Y=Je(B.content);Y&&(D=x(Y[0],Y[1]),((T=ke(D))==null?void 0:T.split(";")[0])!==Y[0]&&D.kind!=="multipart"&&P.push({key:"Content-Type",value:Y[0],in:"header"}))}const ie={};if(j(q.responses))for(const[Y,pe]of Object.entries(q.responses))ie[Y]=g(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 Ue=A(q.security);Ue&&S&&JSON.stringify(Ue)===JSON.stringify(S)&&(Ue=void 0);const le=Array.isArray(q.tags)?q.tags.filter(Y=>typeof Y=="string"):void 0,Cn=he({name:z(q.summary)??z(q.operationId)??`${C.toUpperCase()} ${m}`,method:C.toUpperCase(),url:`{{${s}}}${m}`,params:P,body:D,auth:Ue,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:Cn,tag:le==null?void 0:le[0],segment:m.split("/").filter(Boolean)[0]})}}const L=[],R=t.groupBy??"tag";if(R==="none")L.push(...w.map(m=>m.request));else{const m=new Map,y=Array.isArray(r.tags)?r.tags.filter(j):[];if(R==="tag")for(const v of y)typeof v.name=="string"&&m.set(v.name,ye({name:v.name,description:z(v.description)}));for(const{request:v,tag:_,segment:C}of w){const q=R==="tag"?_:C;if(!q){L.push(v);continue}m.has(q)||m.set(q,ye({name:q})),m.get(q).items.push(v)}L.unshift(...[...m.values()].filter(v=>v.items.length))}const M=(Array.isArray(r.servers)?r.servers.filter(j):[]).map(m=>{let y=z(m.url)??"";if(j(m.variables))for(const[v,_]of Object.entries(m.variables))j(_)&&(y=y.split(`{${v}}`).join(ue(_.default)));return{url:y,description:z(m.description)}}),N=j(r.info)?r.info:{};return be({name:z(N.title)??"API",description:z(N.description),version:N.version===void 0?void 0:ue(N.version),items:L,variables:[{key:s,value:((H=M[0])==null?void 0:H.url)??""},...p.values()],auth:S,servers:M.length?M:void 0,schemas:Object.keys(f).length?f:void 0})}function rn(e){const t=h=>{if(Array.isArray(h))return h.map(t);if(!j(h))return h;const A={};for(const[k,x]of Object.entries(h))A[k]=k==="$ref"&&typeof x=="string"?x.replace("#/definitions/","#/components/schemas/").replace("#/responses/","#/components/responses/"):t(x);return A},n=t(e),r=Array.isArray(n.consumes)?n.consumes:["application/json"],s=Array.isArray(n.produces)?n.produces:["application/json"],o=j(n.parameters)?n.parameters:{},i=h=>{if(j(h)){if(typeof h.$ref=="string"&&h.$ref.startsWith("#/parameters/")){const A=o[h.$ref.slice(13)];return j(A)?A:void 0}return h}},a=h=>{const A={};for(const k of["type","format","items","enum","default","minimum","maximum","pattern","minLength","maxLength"])h[k]!==void 0&&(A[k]=h[k]);return A.type==="file"&&(A.type="string",A.format="binary"),A},c=(h,A)=>{if(!j(h)||typeof h.$ref=="string")return h;const k={description:h.description??""};if(h.schema!==void 0){const x=j(h.examples)?h.examples:{};k.content=Object.fromEntries(A.map(g=>[g,x[g]!==void 0?{schema:h.schema,example:x[g]}:{schema:h.schema}]))}return j(h.headers)&&(k.headers=Object.fromEntries(Object.entries(h.headers).map(([x,g])=>[x,j(g)?{description:g.description,schema:a(g)}:g]))),k},l=(h,A)=>{const k=Array.isArray(h.consumes)?h.consumes:r,x={...h};delete x.consumes,delete x.produces,delete x.schemes;const g=[],S=[];for(const w of[...A,...Array.isArray(h.parameters)?h.parameters:[]]){const O=i(w);if(O)if(O.in==="body")x.requestBody={description:O.description,required:O.required,content:Object.fromEntries(k.map(L=>[L,{schema:O.schema}]))};else if(O.in==="formData")S.push(O);else{const L={name:O.name,in:O.in,description:O.description,required:O.required,schema:a(O)};O["x-example"]!==void 0&&(L.example=O["x-example"]),g.push(L)}}if(S.length){const O=k.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));x.requestBody={content:{[O]:{schema:{type:"object",properties:Object.fromEntries(S.map(R=>[String(R.name),{...a(R),description:R.description}])),...L.length?{required:L}:{}}}}}}if(x.parameters=g,j(h.responses)){const w=Array.isArray(h.produces)?h.produces:s;x.responses=Object.fromEntries(Object.entries(h.responses).map(([O,L])=>[O,c(L,w)]))}return x},f={};if(j(n.paths))for(const[h,A]of Object.entries(n.paths)){if(!j(A))continue;const k=Array.isArray(A.parameters)?A.parameters:[],x={};for(const[g,S]of Object.entries(A))tn.includes(g)&&j(S)?x[g]=l(S,k):g!=="parameters"&&(x[g]=S);f[h]=x}const u={};if(j(n.securityDefinitions)){const h={implicit:"implicit",password:"password",application:"clientCredentials",accessCode:"authorizationCode"};for(const[A,k]of Object.entries(n.securityDefinitions))j(k)&&(k.type==="basic"?u[A]={type:"http",scheme:"basic",description:k.description}:k.type==="apiKey"?u[A]={type:"apiKey",name:k.name,in:k.in,description:k.description}:k.type==="oauth2"&&(u[A]={type:"oauth2",description:k.description,flows:{[h[String(k.flow)]??"clientCredentials"]:{authorizationUrl:k.authorizationUrl,tokenUrl:k.tokenUrl,scopes:k.scopes??{}}}}))}const d={};if(j(n.responses))for(const[h,A]of Object.entries(n.responses))d[h]=c(A,s);const p=z(n.host),b=z(n.basePath)??"",$=Array.isArray(n.schemes)&&typeof n.schemes[0]=="string"?n.schemes[0]:"https";return{openapi:"3.0.3",info:n.info,servers:p?[{url:`${$}://${p}${b}`}]:b?[{url:b}]:void 0,tags:n.tags,security:n.security,paths:f,components:{schemas:n.definitions,responses:d,securitySchemes:u}}}function dr(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,r={scopes:Object.fromEntries(t.map(s=>[s,""]))};return e.tokenUrl&&(r.tokenUrl=e.tokenUrl),e.authUrl&&(r.authorizationUrl=e.authUrl),{name:"oauth2",scheme:{type:"oauth2",flows:{[n]:r}},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 De(e){if(e!==void 0)try{return JSON.parse(e)}catch{return e}}function mr(e,t){let n=e.split("?")[0].split("#")[0];for(const r of t)if(r&&n.startsWith(r)){n=n.slice(r.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 hr(e,t){const n=t==null?void 0:t.split(";")[0].trim();switch(e.kind){case"none":return;case"json":{const r=De(e.text);return{content:{[n??"application/json"]:{schema:He(r),example:r}}}}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(r=>[r.key,{type:"string",example:r.value||void 0}]))}}}};case"multipart":return{content:{"multipart/form-data":{schema:{type:"object",properties:Object.fromEntries(e.parts.filter(I).map(r=>[r.key,r.type==="file"?{type:"string",format:"binary"}:{type:"string",example:r.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:De(se(e))}}};case"soap":return{content:{[n??"text/xml"]:{schema:{type:"string"},example:e.envelope}}};default:return}}function sn(e,t={}){var p,b,$,h,A,k,x;const n=t.baseUrlVariable??"baseUrl",r=(p=e.variables.find(g=>g.key===n))==null?void 0:p.value,s=(b=e.servers)!=null&&b.length?e.servers:r?[{url:r}]:void 0,o=[`{{${n}}}`,...(s??[]).map(g=>g.url)],i={},a=g=>{if(!g||g.type==="inherit")return;if(g.type==="none")return e.auth&&e.auth.type!=="none"?[]:void 0;const S=dr(g);if(S)return i[S.name]=S.scheme,[{[S.name]:S.scopes}]},c=a(e.auth),l={},f=new Map;for(const{request:g,folders:S}of ze(e.items)){const w=mr(g.url,o),O=g.method.toLowerCase();if(l[w]??(l[w]={}),l[w][O])continue;for(const m of S)f.set(m.name,m.description);const L=($=g.tags)!=null&&$.length?g.tags:S.length?[S[S.length-1].name]:void 0,R=g.params.filter(m=>!(m.in==="header"&&/^(accept|content-type|authorization)$/i.test(m.key))).map(m=>{const y={name:m.key,in:m.in};return m.description&&(y.description=m.description),(m.in==="path"||m.required)&&(y.required=!0),y.schema=m.schema??{type:"string"},m.value&&(y.example=m.value),m.style&&(y.style=m.style),m.explode!==void 0&&(y.explode=m.explode),y}),M=(h=g.params.find(m=>m.in==="header"&&/^content-type$/i.test(m.key)))==null?void 0:h.value,N={summary:g.name};g.operationId&&(N.operationId=g.operationId),g.description&&(N.description=g.description),L&&(N.tags=L),g.deprecated&&(N.deprecated=!0),R.length&&(N.parameters=R);const T=hr(g.body,M);T&&(N.requestBody=T);const U={};for(const[m,y]of Object.entries(g.responses??{})){const v={description:y.description??""};if(y.contentType){const _={};y.schema&&(_.schema=y.schema),y.example!==void 0&&(_.example=/json/.test(y.contentType)?De(y.example):y.example),v.content={[y.contentType]:_}}U[m]=v}for(const m of g.examples??[]){const y=String(m.status);if(U[y])continue;const v=((x=(k=(A=m.headers)==null?void 0:A.find(_=>/^content-type$/i.test(_.key)))==null?void 0:k.value)==null?void 0:x.split(";")[0])??"application/json";U[y]={description:m.name,content:{[v]:{example:/json/.test(v)?De(m.body):m.body}}}}N.responses=Object.keys(U).length?U:{200:{description:"OK"}};const H=a(g.auth);H&&(N.security=H),l[w][O]=N}const u={openapi:"3.1.0",info:{title:e.name,version:e.version??"1.0.0",...e.description?{description:e.description}:{}}};s&&(u.servers=s.map(g=>g.description?g:{url:g.url})),f.size&&(u.tags=[...f].map(([g,S])=>S?{name:g,description:S}:{name:g})),c&&(u.security=c),u.paths=l;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&&(u.components=d),u}function yr(e,t={}){return en(sn(e,t))}const W=e=>!!e&&typeof e=="object"&&!Array.isArray(e),E=e=>typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):void 0,we=e=>Array.isArray(e)?e.filter(W):[],on="https://schema.getpostman.com/json/collection/v2.1.0/collection.json";function gt(e){return W(e)&&W(e.info)&&Array.isArray(e.item)}function ge(e){if(typeof e=="string")return e||void 0;if(W(e))return E(e.content)}function Oe(e){return we(e).map(t=>{const n={key:E(t.key)??"",value:E(t.value)??""};t.disabled===!0&&(n.enabled=!1);const r=ge(t.description);return r&&(n.description=r),n})}function bt(e){if(!W(e)||typeof e.type!="string")return;const t=e[e.type],n=r=>{var s;if(Array.isArray(t))return E((s=t.filter(W).find(o=>o.key===r))==null?void 0:s.value);if(W(t))return E(t[r])};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 r=n("in");return{type:"apiKey",key:n("key")??"X-API-Key",value:n("value")??"",in:r==="query"?"query":"header"}}case"oauth2":{const r=n("grant_type")??"authorization_code";return{type:"oauth2",grant:r==="client_credentials"?"clientCredentials":r==="password_credentials"||r==="password"?"password":r==="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:r==="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 gr(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(e.raw);let n;if(t!==void 0)n=ce(t).base;else{const o=E(e.protocol),i=Array.isArray(e.host)?e.host.join("."):E(e.host)??"",a=E(e.port),c=Array.isArray(e.path)?e.path.map(l=>(W(l)?E(l.value):E(l))??"").join("/"):E(e.path)??"";n=`${o?`${o}://`:""}${i}${a?`:${a}`:""}${c?`/${c.replace(/^\//,"")}`:""}`}const r=Array.isArray(e.query)?Oe(e.query).map(o=>({...o,in:"query"})):t!==void 0?ce(t).query.map(o=>({...o,in:"query"})):[],s=Oe(e.variable).map(o=>({...o,in:"path",required:!0}));return{url:n,params:[...s,...r]}}function br(e){if(!W(e))return{kind:"none"};switch(e.mode){case"raw":{const t=E(e.raw)??"",n=W(e.options)&&W(e.options.raw)?E(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:Oe(e.urlencoded)};case"formdata":return{kind:"multipart",parts:we(e.formdata).map(t=>{const n=t.type==="file",r=Array.isArray(t.src)?E(t.src[0]):E(t.src),s={key:E(t.key)??"",value:n?"":E(t.value)??"",type:n?"file":"text",...n&&r?{fileName:r}:{},...E(t.contentType)?{contentType:E(t.contentType)}:{}};return t.disabled===!0?{...s,enabled:!1}:s})};case"file":return{kind:"binary",fileName:W(e.file)?E(e.file.src):void 0};case"graphql":{const t=W(e.graphql)?e.graphql:{};return{kind:"graphql",query:E(t.query)??"",variables:E(t.variables)}}default:return{kind:"none"}}}function an(e){const t={};for(const n of we(e)){const r=W(n.script)?n.script:{},s=Array.isArray(r.exec)?r.exec.map(o=>E(o)??"").join(`
55
- `):E(r.exec)??"";s.trim()&&(n.listen==="prerequest"&&(t.preRequest=s),n.listen==="test"&&(t.test=s))}return t.preRequest||t.test?t:void 0}function kr(e){const t=W(e.request)?e.request:typeof e.request=="string"?{url:e.request}:{},{url:n,params:r}=gr(t.url),s=Oe(t.header).map(i=>({...i,in:"header"})),o=we(e.response).map(i=>({name:E(i.name)??"Example",status:Number(i.code??200)||200,headers:Oe(i.header),body:E(i.body)}));return he({id:E(e.id)??void 0,name:E(e.name)??"Request",method:(E(t.method)??"GET").toUpperCase(),url:n,params:[...r,...s],body:br(t.body),auth:bt(t.auth),description:ge(t.description)??ge(e.description),scripts:an(e.event),examples:o.length?o:void 0})}function cn(e){return we(e).map(t=>Array.isArray(t.item)?ye({id:E(t.id)??void 0,name:E(t.name)??"Folder",description:ge(t.description),items:cn(t.item),auth:bt(t.auth)}):kr(t))}function pn(e){return we(e).map(t=>{const n={key:E(t.key)??"",value:E(t.value)??""};t.type==="secret"&&(n.secret=!0),(t.disabled===!0||t.enabled===!1)&&(n.enabled=!1);const r=ge(t.description);return r&&(n.description=r),n})}function ln(e){const t=typeof e=="string"?JSON.parse(e):e;if(!gt(t))throw new Error("Not a Postman collection");const n=t,r=n.info,s=an(n.event),o=be({id:E(r._postman_id)??void 0,name:E(r.name)??"Postman collection",description:ge(r.description),version:W(r.version)?E(r.version.raw):E(r.version),items:cn(n.item),variables:pn(n.variable),auth:bt(n.auth)});if(s){const i=a=>a.map(c=>c.kind==="folder"?{...c,items:i(c.items)}:c.scripts?c:{...c,scripts:s});o.items=i(o.items)}return o}function un(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:E(t.id)??Ee("e"),name:E(t.name)??"Environment",values:pn(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(([,r])=>r!==void 0).map(([r,s])=>V(r,s))};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 je=e=>{const t={key:e.key,value:e.value};return I(e)||(t.disabled=!0),e.description&&(t.description=e.description),t};function $r(e){const t=e.params.filter(u=>u.in==="query"),n=$e({...e,params:e.params.filter(u=>u.in==="query"&&I(u))}).replace(/%7B%7B(.*?)%7D%7D/g,"{{$1}}").replace(new RegExp("(?<!\\{)\\{([A-Za-z_][\\w.-]*)\\}(?!\\})","g"),":$1"),r=ce(e.url).base,s=/^([a-z][\w+.-]*):\/\//i.exec(r),o=s?r.slice(s[0].length):r,i=o.indexOf("/"),a=i<0?o:o.slice(0,i),c=i<0?[]:o.slice(i+1).split("/"),l={raw:n,host:a?a.startsWith("{{")?[a]:a.split("."):[],path:c.map(u=>u.replace(/^\{([A-Za-z_][\w.-]*)\}$/,":$1"))};s&&(l.protocol=s[1]),t.length&&(l.query=t.map(je));const f=e.params.filter(u=>u.in==="path");return f.length&&(l.variable=f.map(je)),l}function wr(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(je)};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 Ar(e){const t=[];return e!=null&&e.preRequest&&t.push({listen:"prerequest",script:{type:"text/javascript",exec:e.preRequest.split(`
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(`
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 fn(e){if(e.kind==="folder"){const a={name:e.name,item:e.items.map(fn)};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(je),url:$r(e)},n=wr(e.body);n&&(t.body=n);const r=nt(e.auth);r&&(t.auth=r),e.description&&(t.description=e.description);const s=e.params.filter(a=>a.in==="cookie"&&I(a));s.length&&t.header.push({key:"Cookie",value:s.map(a=>`${a.key}=${a.value}`).join("; ")});const o={name:e.name,request:t},i=Ar(e.scripts);return i&&(o.event=i),o.response=(e.examples??[]).map(a=>({name:a.name,code:a.status,header:(a.headers??[]).map(je),body:a.body??""})),o}function vr(e){const t={info:{_postman_id:e.id,name:e.name,...e.description?{description:e.description}:{},schema:on},item:e.items.map(fn)};e.variables.length&&(t.variable=e.variables.map(r=>{const s={key:r.key,value:r.value,type:r.secret?"secret":"string"};return r.enabled===!1&&(s.disabled=!0),s}));const n=nt(e.auth);return n&&(t.auth=n),t}function Tr(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,rt=e=>Array.isArray(e)?e.filter(de):[],xr=/^(image|font|audio|video)\/|^text\/css|javascript|^application\/(x-)?font|wasm/;function ve(e){return rt(e).map(t=>({key:K(t.name)??"",value:K(t.value)??""}))}function kt(e){return de(e)&&de(e.log)&&Array.isArray(e.log.entries)}function dn(e,t={}){const n=typeof e=="string"?JSON.parse(e):e;if(!kt(n))throw new Error("Not a HAR log");const r=rt(n.log.entries),s=t.skipStatic??!0,o=[];for(const i of r){if(t.filter&&!t.filter(i))continue;const a=de(i.request)?i.request:{},c=de(i.response)?i.response:{},l=de(c.content)?c.content:{},f=(K(l.mimeType)??"").toLowerCase();if(s&&xr.test(f))continue;const{base:u,query:d}=ce(K(a.url)??""),p=Array.isArray(a.queryString)?ve(a.queryString):d,b=ve(a.cookies),$=ve(a.headers).filter(w=>!w.key.startsWith(":")&&!/^(content-length|host|connection)$/i.test(w.key)&&!(b.length&&/^cookie$/i.test(w.key))),h=[...p.map(w=>({...w,in:"query"})),...$.map(w=>({...w,in:"header"})),...b.map(w=>({...w,in:"cookie"}))];let A={kind:"none"};const k=de(a.postData)?a.postData:void 0;if(k){const w=K(k.mimeType)??"",O=rt(k.params);O.length&&w.includes("multipart")?A={kind:"multipart",parts:O.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"})}:O.length?A={kind:"form",fields:ve(O)}:K(k.text)!==void 0&&(A=lt(K(k.text)??"",w||void 0))}const x=(K(a.method)??"GET").toUpperCase(),g=[],S=Number(c.status);if(Number.isFinite(S)&&S>0){let w=K(l.text);w!==void 0&&l.encoding==="base64"&&/json|xml|text|javascript/.test(f)&&(w=dt(w)),g.push({name:`${S} ${K(c.statusText)??""}`.trim(),status:S,headers:ve(c.headers).filter(O=>!O.key.startsWith(":")),body:w})}o.push(he({name:mt(x,u),method:x,url:u,params:h,body:A,examples:g.length?g:void 0}))}return be({name:t.name??"HAR import",items:o})}const Ge=e=>({name:e.key,value:e.value});function Sr(e,t={}){const n=Array.isArray(e)?e:ze(e.items).map(i=>i.request),r=t.transform??(i=>i),s=(t.now??(()=>new Date))().toISOString(),o=n.map(i=>{var $,h,A,k,x;const a=$e(i,r),c=i.params.filter(g=>g.in==="header"&&I(g)).map(g=>({key:r(g.key),value:r(g.value)})),l=i.params.filter(g=>g.in==="cookie"&&I(g)).map(g=>({key:r(g.key),value:r(g.value)})),f=(($=c.find(g=>/^content-type$/i.test(g.key)))==null?void 0:$.value)??ke(i.body),u={method:i.method.toUpperCase(),url:a,httpVersion:"HTTP/1.1",headers:c.map(Ge),queryString:i.params.filter(g=>g.in==="query"&&I(g)).map(g=>({name:r(g.key),value:r(g.value)})),cookies:l.map(Ge),headersSize:-1,bodySize:-1},d=i.body;d.kind==="form"?u.postData={mimeType:f,params:d.fields.filter(I).map(g=>({name:r(g.key),value:r(g.value)})),text:r(se(d)??"")}:d.kind==="multipart"?u.postData={mimeType:f,params:d.parts.filter(I).map(g=>g.type==="file"?{name:r(g.key),fileName:g.fileName??"",contentType:g.contentType}:{name:r(g.key),value:r(g.value)})}:d.kind!=="none"&&d.kind!=="binary"&&(u.postData={mimeType:f,text:r(se(d)??"")});const p=(h=i.examples)==null?void 0:h[0],b=((k=(A=p==null?void 0:p.headers)==null?void 0:A.find(g=>/^content-type$/i.test(g.key)))==null?void 0:k.value)??"";return{startedDateTime:s,time:0,request:u,response:{status:(p==null?void 0:p.status)??0,statusText:p?p.name.replace(new RegExp(`^${p.status}\\s*`),""):"",httpVersion:"HTTP/1.1",headers:((p==null?void 0:p.headers)??[]).map(Ge),cookies:[],content:{size:((x=p==null?void 0:p.body)==null?void 0:x.length)??0,mimeType:b,...(p==null?void 0:p.body)!==void 0?{text:p.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 Nr=`query IntrospectionQuery {
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 {
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 mn(e){var o,i,a,c;const n=typeof e=="string"?JSON.parse(e):e,r=((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(!r||!Array.isArray(r.types))throw new Error("Not a GraphQL introspection result");const s={};for(const l of r.types)l!=null&&l.name&&(s[l.name]=l);return{queryType:((i=r.queryType)==null?void 0:i.name)??void 0,mutationType:((a=r.mutationType)==null?void 0:a.name)??void 0,subscriptionType:((c=r.subscriptionType)==null?void 0:c.name)??void 0,types:s}}function Me(e){return e?e.kind==="NON_NULL"?`${Me(e.ofType)}!`:e.kind==="LIST"?`[${Me(e.ofType)}]`:e.name??"":""}function $t(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 hn(e){const t=[],n=[["query",e.queryType],["mutation",e.mutationType],["subscription",e.subscriptionType]];for(const[r,s]of n){const o=s?e.types[s]:void 0;for(const i of(o==null?void 0:o.fields)??[])i.name.startsWith("__")||t.push({kind:r,field:i})}return t}function yn(e,t){var r;const n=(r=e.types[$t(t)??""])==null?void 0:r.kind;return n==="SCALAR"||n==="ENUM"||n===void 0}function Or(e){var t;return((t=e.args)==null?void 0:t.some(n=>n.type.kind==="NON_NULL"&&n.defaultValue==null))??!1}function st(e,t,n,r){const s=e.types[$t(t)??""];if(!s||s.kind==="SCALAR"||s.kind==="ENUM")return"";const o=[];if(s.kind==="UNION"||s.kind==="INTERFACE"&&!(s.fields??[]).length){o.push(`${r} __typename`);for(const i of s.possibleTypes??[]){const a=st(e,i,Math.max(n-1,0),`${r} `);a&&o.push(`${r} ... on ${i.name} ${a}`)}return`{
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`{
93
93
  ${o.join(`
94
94
  `)}
95
- ${r}}`}for(const i of s.fields??[])if(!(i.isDeprecated||Or(i))){if(yn(e,i.type))o.push(`${r} ${i.name}`);else if(n>0){const a=st(e,i.type,n-1,`${r} `);a&&o.push(`${r} ${i.name} ${a}`)}}return o.length||o.push(`${r} __typename`),`{
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`),`{
96
96
  ${o.join(`
97
97
  `)}
98
- ${r}}`}function Se(e,t,n=0){var s,o;if(t.kind==="NON_NULL"&&t.ofType)return Se(e,t.ofType,n);if(t.kind==="LIST"&&t.ofType)return[Se(e,t.ofType,n)];const r=e.types[t.name??""];switch((r==null?void 0:r.kind)??"SCALAR"){case"ENUM":return((o=(s=r==null?void 0:r.enumValues)==null?void 0:s[0])==null?void 0:o.name)??"";case"INPUT_OBJECT":{if(n>4)return{};const i={};for(const a of(r==null?void 0:r.inputFields)??[])(a.type.kind==="NON_NULL"||n===0)&&(i[a.name]=Se(e,a.type,n+1));return i}default:switch(t.name){case"Int":case"Float":return 0;case"Boolean":return!1;default:return""}}}function jr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function gn(e,t,n={}){const{kind:r,field:s}=t,o=n.depth??2,i=jr(s.name),a=s.args??[],c=a.length?`(${a.map(p=>`$${p.name}: ${Me(p.type)}`).join(", ")})`:"",l=a.length?`(${a.map(p=>`${p.name}: $${p.name}`).join(", ")})`:"",f=yn(e,s.type)?"":` ${st(e,s.type,o-1," ")}`,u=`${r} ${i}${c} {
99
- ${s.name}${l}${f}
100
- }`,d={};for(const p of a)p.defaultValue==null&&(d[p.name]=Se(e,p.type));return{query:u,variables:d,operationName:i}}function bn(e,t={}){const n=typeof e=="object"&&e&&"types"in e&&!Array.isArray(e.types)?e:mn(e),r={query:"Queries",mutation:"Mutations",subscription:"Subscriptions",...t.folderNames},s=new Map;for(const o of hn(n)){const i=gn(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});s.has(o.kind)||s.set(o.kind,[]),s.get(o.kind).push(a)}return be({name:t.name??"GraphQL API",items:[...s].map(([o,i])=>ye({name:r[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",Cr="http://schemas.xmlsoap.org/soap/envelope/",_r="http://www.w3.org/2003/05/soap-envelope",ee=(e,t)=>`{${e??""}}${t}`;function Z(e,t,n){return Array.from(e.childNodes).filter(r=>r.nodeType===1&&r.localName===n&&(t===null||r.namespaceURI===t))}function ne(e,t,n){return Z(e,t,n)[0]}function ae(e,t){if(!t)return;const n=t.indexOf(":"),r=n<0?null:t.slice(0,n),s=n<0?t:t.slice(n+1);return{namespace:e.lookupNamespaceURI(r)??void 0,name:s}}function Ct(e){var r;const t=ne(e,G,"documentation");return((r=t==null?void 0:t.textContent)==null?void 0:r.trim())||void 0}function Er(){const e=globalThis.DOMParser;if(!e)throw new Error("No DOMParser: pass one (xmldom, jsdom) in Node");return new e}function kn(e,t=Er()){const r=t.parseFromString(e,"text/xml").documentElement;if(!r||r.localName!=="definitions"||r.namespaceURI!==G)throw new Error("Not a WSDL 1.1 document");const s=r.getAttribute("targetNamespace")??void 0,o={elements:new Map,types:new Map,qualified:new Map},i=ne(r,G,"types");for(const u of i?Z(i,me,"schema"):[]){const d=u.getAttribute("targetNamespace")??void 0;o.qualified.set(d??"",u.getAttribute("elementFormDefault")==="qualified");for(const p of Z(u,me,"element")){const b=p.getAttribute("name");b&&o.elements.set(ee(d,b),p)}for(const p of[...Z(u,me,"complexType"),...Z(u,me,"simpleType")]){const b=p.getAttribute("name");b&&o.types.set(ee(d,b),p)}}const a=new Map;for(const u of Z(r,G,"message")){const d=Z(u,G,"part").map(p=>({name:p.getAttribute("name")??"",element:ae(p,p.getAttribute("element")),type:ae(p,p.getAttribute("type"))}));a.set(ee(s,u.getAttribute("name")??""),d)}const c=new Map;for(const u of Z(r,G,"portType")){const d=new Map;for(const p of Z(u,G,"operation")){const b=ne(p,G,"input"),$=ne(p,G,"output"),h=b?ae(b,b.getAttribute("message")):void 0,A=$?ae($,$.getAttribute("message")):void 0;d.set(p.getAttribute("name")??"",{doc:Ct(p),input:h?ee(h.namespace,h.name):void 0,output:A?ee(A.namespace,A.name):void 0})}c.set(ee(s,u.getAttribute("name")??""),d)}const l=new Map;for(const u of Z(r,G,"binding")){const d=ne(u,Qe,"binding"),p=ne(u,Ye,"binding"),b=d??p,$=ee(s,u.getAttribute("name")??"");if(!b){l.set($,null);continue}const h=d?Qe:Ye,A=ae(u,u.getAttribute("type")),k=A?c.get(ee(A.namespace,A.name)):void 0,x=b.getAttribute("style")==="rpc"?"rpc":"document",g=Z(u,G,"operation").map(S=>{const w=S.getAttribute("name")??"",O=ne(S,h,"operation"),L=((O==null?void 0:O.getAttribute("style"))??x)==="rpc"?"rpc":"document",R=k==null?void 0:k.get(w),M=R!=null&&R.input?a.get(R.input):void 0,N=R!=null&&R.output?a.get(R.output):void 0,T=ne(S,G,"input"),U=T?ne(T,h,"body"):void 0,H={name:w,soapAction:(O==null?void 0:O.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"))??s,name:w},H.inputParts=(M??[]).map(y=>({name:y.name,type:y.type}));else{const y=(M==null?void 0:M.find(v=>v.element))??(M==null?void 0:M[0]);y!=null&&y.element&&(H.inputElement=y.element)}const m=N==null?void 0:N.find(y=>y.element);return m!=null&&m.element&&(H.outputElement=m.element),H});l.set($,{version:d?"1.1":"1.2",operations:g})}const f=Z(r,G,"service").map(u=>({name:u.getAttribute("name")??"Service",documentation:Ct(u),ports:Z(u,G,"port").flatMap(d=>{const p=ae(d,d.getAttribute("binding")),b=p?l.get(ee(p.namespace,p.name)):void 0;if(!b)return[];const $=ne(d,Qe,"address")??ne(d,Ye,"address");return[{name:d.getAttribute("name")??"",binding:(p==null?void 0:p.name)??"",version:b.version,address:($==null?void 0:$.getAttribute("location"))??"",operations:b.operations}]})}));return{targetNamespace:s,services:f,schema:o}}function $n(e,t,n,r,s,o,i){const a=t.getAttribute("name")??t.getAttribute("ref")??"element";let c=t,l=n;if(t.getAttribute("ref")){const k=ae(t,t.getAttribute("ref")),x=k?e.schema.elements.get(ee(k.namespace,k.name)):void 0;x&&(c=x,l=k==null?void 0:k.namespace)}const f=c.getAttribute("name")??a.split(":").pop()??a,u=s&&l?it(l,r):"",d=u?`${u}:${f}`:f,b=c.getAttribute("minOccurs")==="0"||t.getAttribute("minOccurs")==="0"?`${o}<!--Optional:-->
101
- `:"";let $=ne(c,me,"complexType");const h=ae(c,c.getAttribute("type"));if(!$&&h&&h.namespace!==me){const k=e.schema.types.get(ee(h.namespace,h.name));(k==null?void 0:k.localName)==="complexType"&&($=k)}if(!$||i>6)return`${b}${o}<${d}>?</${d}>`;const A=Ur(e,$,l,r,o,i);return A?`${b}${o}<${d}>
102
- ${A}
103
- ${o}</${d}>`:`${b}${o}<${d}/>`}function Ur(e,t,n,r,s,o){const i=e.schema.qualified.get(n??"")??!1,a=[],c=l=>{for(const f of Array.from(l.childNodes)){if(f.nodeType!==1)continue;const u=f;if(u.namespaceURI===me){if(u.localName==="element")a.push($n(e,u,n,r,i,`${s} `,o+1));else if(["sequence","all","choice","complexContent","extension"].includes(u.localName)){if(u.localName==="extension"){const d=ae(u,u.getAttribute("base")),p=d?e.schema.types.get(ee(d.namespace,d.name)):void 0;p&&c(p)}c(u)}}}};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 wn(e,t,n="1.1"){const r=new Map,s=n==="1.2"?"soap":"soapenv";let o;const i=t.inputElement;if(t.style==="rpc"){const l=i==null?void 0:i.namespace,f=l?it(l,r):"",u=f?`${f}:${t.name}`:t.name,d=(t.inputParts??[]).map(p=>` <${p.name}>?</${p.name}>`);o=d.length?` <${u}>
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} {
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}>
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}>
105
105
  ${d.join(`
106
106
  `)}
107
- </${u}>`:` <${u}/>`}else if(i){const l=e.schema.elements.get(ee(i.namespace,i.name));if(l)o=$n(e,l,i.namespace,r,!0," ",0);else{const f=i.namespace?it(i.namespace,r):"",u=f?`${f}:${i.name}`:i.name;o=` <${u}>?</${u}>`}}else o="";const c=[`xmlns:${s}="${n==="1.2"?_r:Cr}"`,...[...r].map(([l,f])=>`xmlns:${f}="${l}"`)].join(" ");return[`<${s}:Envelope ${c}>`,` <${s}:Header/>`,` <${s}:Body>`,...o?[o]:[],` </${s}:Body>`,`</${s}:Envelope>`].join(`
108
- `)}function An(e,t={}){var s;const n=kn(e,t.parser),r=n.services.flatMap(o=>o.ports.map(i=>ye({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:wn(n,a,i.version),action:a.soapAction??"",version:i.version},description:a.documentation}))})));return be({name:t.name??((s=n.services[0])==null?void 0:s.name)??"SOAP service",items:r.length===1?r[0].items:r})}const _t=[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],qr=Array.from({length:64},(e,t)=>Math.floor(Math.abs(Math.sin(t+1))*2**32)>>>0);function wt(e){const t=typeof e=="string"?new TextEncoder().encode(e):e,n=t.length*8,r=new Uint8Array(((t.length+8>>6)+1)*64);r.set(t),r[t.length]=128;const s=new DataView(r.buffer);s.setUint32(r.length-8,n>>>0,!0),s.setUint32(r.length-4,Math.floor(n/2**32),!0);let o=1732584193,i=4023233417,a=2562383102,c=271733878;const l=new Uint32Array(16);for(let u=0;u<r.length;u+=64){for(let h=0;h<16;h++)l[h]=s.getUint32(u+h*4,!0);let d=o,p=i,b=a,$=c;for(let h=0;h<64;h++){let A,k;h<16?(A=p&b|~p&$,k=h):h<32?(A=$&p|~$&b,k=(5*h+1)%16):h<48?(A=p^b^$,k=(3*h+5)%16):(A=b^(p|~$),k=7*h%16);const x=d+A+qr[h]+l[k]>>>0;d=$,$=b,b=p,p=p+(x<<_t[h]|x>>>32-_t[h])>>>0}o=o+d>>>0,i=i+p>>>0,a=a+b>>>0,c=c+$>>>0}const f=new DataView(new ArrayBuffer(16));return[o,i,a,c].forEach((u,d)=>f.setUint32(d*4,u,!0)),Array.from(new Uint8Array(f.buffer),u=>u.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[r,s]of Object.entries(e))n[r]=ot(s,t);return n}return e}const Ir=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 Ne(e){return Array.from(new Uint8Array(e),t=>t.toString(16).padStart(2,"0")).join("")}function At(e){let t="";for(const n of e instanceof Uint8Array?e:new Uint8Array(e))t+=String.fromCharCode(n);return btoa(t)}function Pe(e){const t=typeof e=="string"?Ir.encode(e):e;return new Uint8Array(t)}async function Ce(e,t){return at().digest(e,Pe(t))}async function fe(e,t,n){const r=t instanceof ArrayBuffer?new Uint8Array(t):Pe(t),s=await at().importKey("raw",Pe(r),{name:"HMAC",hash:e},!1,["sign"]);return at().sign("HMAC",s,Pe(n))}function Xe(e){return encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)}function J(e,t,n){const r=t.toLowerCase(),s=e.findIndex(([o])=>o.toLowerCase()===r);s>=0?e[s]=[e[s][0],n]:e.push([t,n])}function Le(e,t){var r;const n=t.toLowerCase();return(r=e.find(([s])=>s.toLowerCase()===n))==null?void 0:r[1]}function vn(e){const t=/Digest\s+(.*)$/i.exec(e);if(!t)return;const n={};for(const r of t[1].matchAll(/(\w+)=(?:"([^"]*)"|([^\s,]+))/g))n[r[1].toLowerCase()]=r[2]??r[3];return n}async function Te(e,t){return/sha-?256/i.test(e)?Ne(await Ce("SHA-256",t)):wt(t)}async function Tn(e,t,n,r={}){var p;if(!e.realm||!e.nonce)return;const s=e.algorithm??"MD5",o=n.replace(/^[a-z][\w+.-]*:\/\/[^/]*/i,"")||"/",i=(p=e.qop)!=null&&p.split(",").map(b=>b.trim()).includes("auth")?"auth":e.qop?e.qop.split(",")[0].trim():void 0,a=r.cnonce??wt(String(Math.random())).slice(0,16),c=(r.nc??1).toString(16).padStart(8,"0");let l=await Te(s,`${e.username}:${e.realm}:${e.password}`);/-sess$/i.test(s)&&(l=await Te(s,`${l}:${e.nonce}:${a}`));const f=await Te(s,`${t}:${o}`),u=i?await Te(s,`${l}:${e.nonce}:${c}:${a}:${i}:${f}`):await Te(s,`${l}:${e.nonce}:${f}`),d=[`username="${e.username}"`,`realm="${e.realm}"`,`nonce="${e.nonce}"`,`uri="${o}"`,`algorithm=${s}`,`response="${u}"`];return i&&d.push(`qop=${i}`,`nc=${c}`,`cnonce="${a}"`),e.opaque&&d.push(`opaque="${e.opaque}"`),`Digest ${d.join(", ")}`}async function xn(e,t,n=new Date){var g;const r=new URL(e.url),s=n.toISOString().replace(/[:-]|\.\d{3}/g,""),o=s.slice(0,8);let i="";typeof e.body=="string"?i=e.body:((g=e.body)==null?void 0:g.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":Ne(await Ce("SHA-256",i)),c=t.service==="s3";J(e.headers,"X-Amz-Date",s),c&&J(e.headers,"X-Amz-Content-Sha256",a),t.sessionToken&&J(e.headers,"X-Amz-Security-Token",t.sessionToken);const l=r.pathname.split("/").map(S=>c?S:Xe(S)).join("/")||"/",f=[...r.searchParams.entries()].map(([S,w])=>[Xe(S),Xe(w)]).sort(([S,w],[O,L])=>S===O?w<L?-1:w>L?1:0:S<O?-1:1).map(([S,w])=>`${S}=${w}`).join("&"),u=new Map([["host",r.host]]);for(const[S,w]of e.headers){const O=S.toLowerCase();(O.startsWith("x-amz-")||O==="content-type")&&u.set(O,w.trim().replace(/\s+/g," "))}const d=[...u.keys()].sort(),p=d.map(S=>`${S}:${u.get(S)}
109
- `).join(""),b=d.join(";"),$=[e.method.toUpperCase(),l,f,p,b,a].join(`
110
- `),h=`${o}/${t.region}/${t.service}/aws4_request`,A=["AWS4-HMAC-SHA256",s,h,Ne(await Ce("SHA-256",$))].join(`
111
- `);let k=await fe("SHA-256",`AWS4${t.secretAccessKey}`,o);k=await fe("SHA-256",k,t.region),k=await fe("SHA-256",k,t.service),k=await fe("SHA-256",k,"aws4_request");const x=Ne(await fe("SHA-256",k,A));J(e.headers,"Authorization",`AWS4-HMAC-SHA256 Credential=${t.accessKeyId}/${h}, SignedHeaders=${b}, Signature=${x}`)}async function Sn(e,t,n=new Date){const r=/^[a-z][\w+.-]*:\/\//i.test(e.url)?new URL(e.url):new URL(e.url,"http://localhost"),s=t.template??`{method}
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)}
109
+ `).join(""),m=d.join(";"),k=[e.method.toUpperCase(),p,u,l,m,a].join(`
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}
112
112
  {path}
113
113
  {timestamp}
114
- {body}`,o=String(Math.floor(n.getTime()/1e3)),i=s.replace(/\\n/g,`
115
- `).replace(/\{method\}/g,e.method.toUpperCase()).replace(/\{path\}/g,r.pathname+r.search).replace(/\{query\}/g,r.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"?At(a):Ne(a);J(e.headers,t.header,`${t.prefix??""}${c}`),s.includes("{timestamp}")&&J(e.headers,t.timestampHeader??"X-Timestamp",o)}async function ct(e,t={}){var b;const n=$=>ft($,t.variables??{},t),r=t.auth??e.auth,s=!r||r.type==="inherit"?{type:"none"}:ot(r,n),o=[],i=e.params.filter($=>$.in==="header"&&I($)).map($=>[n($.key),n($.value)]),a=e.params.filter($=>$.in==="cookie"&&I($)).map($=>`${n($.key)}=${n($.value)}`);switch(s.type){case"basic":J(i,"Authorization",`Basic ${We(`${s.username}:${s.password}`)}`);break;case"bearer":s.token&&J(i,"Authorization",`${s.prefix??"Bearer"} ${s.token}`);break;case"oauth2":s.accessToken&&J(i,"Authorization",`${s.tokenType??"Bearer"} ${s.accessToken}`);break;case"apiKey":s.in==="header"?J(i,s.key,s.value):s.in==="query"?o.push({key:s.key,value:s.value,in:"query"}):a.push(`${s.key}=${s.value}`);break;case"custom":for(const $ of s.headers.filter(I))J(i,$.key,$.value);break}a.length&&J(i,"Cookie",[Le(i,"Cookie"),...a].filter(Boolean).join("; "));const c=$e({...e,params:[...e.params,...o]},n);let l;const f=e.body;f.kind==="multipart"?l={kind:"multipart",parts:f.parts.filter(I).map($=>({...$,key:n($.key),value:n($.value)}))}:f.kind==="binary"?l={kind:"binary",fileName:f.fileName,contentType:f.contentType,data:f.data}:f.kind!=="none"&&(l=n(se(f)??""));const u=ke(f);u&&f.kind!=="multipart"&&!Le(i,"Content-Type")&&J(i,"Content-Type",u),f.kind==="soap"&&f.version==="1.1"&&f.action!==void 0&&!Le(i,"SOAPAction")&&J(i,"SOAPAction",`"${n(f.action)}"`);const d={method:e.method.toUpperCase(),url:c,headers:i,body:l,settings:{...e.settings}},p=((b=t.now)==null?void 0:b.call(t))??new Date;if(s.type==="digest"){const $=await Tn(s,d.method,c);$&&J(d.headers,"Authorization",$)}else s.type==="awsSigV4"?await xn(d,s,p):s.type==="hmac"&&await Sn(d,s,p);return d}async function Pr(e,t,n={},r){let s=await ct(e,n),o=await t(s,r);const i=n.auth??e.auth;if(o.status===401&&(i==null?void 0:i.type)==="digest"&&!i.nonce){const a=vn(Le(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 s=await ct(e,{...n,auth:c}),o=await t(s,r),{response:o,sent:s,auth:c}}}return{response:o,sent:s,auth:i}}const Lr=/^text\/|json|xml|javascript|ecmascript|x-www-form-urlencoded|graphql|yaml|csv|html/i;function Et(e,t){const n=Uint8Array.from(atob(e),r=>r.charCodeAt(0));return new Blob([n],t?{type:t}:void 0)}function Rr(e=(...t)=>fetch(...t)){return async(t,n)=>{var l,f,u;const r=new Headers;for(const[d,p]of t.headers)r.append(d,p);let s;if(typeof t.body=="string")s=t.body;else if(((l=t.body)==null?void 0:l.kind)==="multipart"){const d=new FormData;for(const p of t.body.parts)if(p.type==="file"){const b=(f=t.body.files)==null?void 0:f[p.key];d.append(p.key,b?Et(b,p.contentType):new Blob([]),p.fileName??p.key)}else d.append(p.key,p.value);s=d,r.delete("Content-Type")}else((u=t.body)==null?void 0:u.kind)==="binary"&&t.body.data&&(s=Et(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:r,body:t.method==="GET"||t.method==="HEAD"?void 0:s,redirect:t.settings.followRedirects===!1?"manual":"follow",signal:o.signal}),p=await d.arrayBuffer(),b=d.headers.get("content-type")??"",$=!b||Lr.test(b),h=[];return d.headers.forEach((A,k)=>h.push([k,A])),{status:d.status,statusText:d.statusText,headers:h,body:$?new TextDecoder().decode(p):"",bodyBase64:$?void 0:At(p),timeMs:Date.now()-c,size:p.byteLength,url:d.url||t.url}}finally{a&&clearTimeout(a),n==null||n.removeEventListener("abort",i)}}}function Ut(e){return At(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Hr(){const e=new Uint8Array(32);globalThis.crypto.getRandomValues(e);const t=Ut(e),n=Ut(await Ce("SHA-256",t));return{verifier:t,challenge:n}}function Dr(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 r=e.authUrl??"";return`${r}${r.includes("?")?"&":"?"}${n.toString()}`}async function _e(e,t,n){if(!e.tokenUrl)throw new Error("OAuth 2: no token URL");const r=[["Content-Type","application/x-www-form-urlencoded"],["Accept","application/json"]],s=new URLSearchParams(t);e.clientAuth==="body"||!e.clientSecret?(s.set("client_id",e.clientId),e.clientSecret&&s.set("client_secret",e.clientSecret)):r.push(["Authorization",`Basic ${We(`${encodeURIComponent(e.clientId)}:${encodeURIComponent(e.clientSecret)}`)}`]),e.scope&&!s.has("scope")&&t.grant_type!=="authorization_code"&&t.grant_type!=="refresh_token"&&s.set("scope",e.scope),e.audience&&s.set("audience",e.audience);const o=await n({method:"POST",url:e.tokenUrl,headers:r,body:s.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}`,l=typeof i.error_description=="string"?`: ${i.error_description}`:"";throw new Error(`OAuth 2 token request failed — ${c}${l}`)}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 Mr(e,t){if(e.grant==="clientCredentials")return _e(e,{grant_type:"client_credentials"},t);if(e.grant==="password")return _e(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 zr(e,t,n,r){const s={grant_type:"authorization_code",code:t};return e.redirectUri&&(s.redirect_uri=e.redirectUri),r&&(s.code_verifier=r),_e(e,s,n)}async function Wr(e,t,n){return _e(e,{grant_type:"refresh_token",refresh_token:t},n)}async function Br(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 r=await t({method:"POST",url:e.deviceUrl,headers:[["Content-Type","application/x-www-form-urlencoded"],["Accept","application/json"]],body:n.toString(),settings:{}}),s=JSON.parse(r.body);if(typeof s.device_code!="string")throw new Error(`OAuth 2 device authorization failed — HTTP ${r.status}`);return{deviceCode:s.device_code,userCode:String(s.user_code??""),verificationUri:String(s.verification_uri_complete??s.verification_uri??""),interval:Number(s.interval??5),expiresIn:s.expires_in===void 0?void 0:Number(s.expires_in)}}async function Fr(e,t,n){try{return await _e(e,{grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:t},n)}catch(r){const s=r instanceof Error?r.message:"";if(s.includes("authorization_pending"))return"pending";if(s.includes("slow_down"))return"slow_down";throw r}}const Nn={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"},xe=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 Vr(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 qt(e,t){const n=e.includes("```")?"````":"```";return`${n}${t}
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}
116
116
  ${e}
117
- ${n}`}function Kr(e,t,n,r,s,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(`> **${r.deprecated}**`,""),e.description&&a.push(e.description,"");const l=e.params.filter(I);l.length&&a.push(`${i}# ${r.parameters}`,"",`| ${r.name} | ${r.location} | ${r.required} | ${r.type} | ${r.description} |`,"|---|---|---|---|---|",...l.map(p=>`| \`${xe(p.key)}\` | ${p.in} | ${p.required||p.in==="path"?r.yes:r.no} | ${xe(pt(p.schema))} | ${xe(p.description)} |`),"");const f=e.body;if(f.kind!=="none")if(a.push(`${i}# ${r.requestBody}`,""),f.kind==="form"||f.kind==="multipart"){const p=f.kind==="form"?f.fields:f.parts;a.push(...p.filter(I).map(b=>`- \`${b.key}\`${"type"in b&&b.type==="file"?" (file)":b.value?`: ${b.value}`:""}`),"")}else if(f.kind==="binary")a.push(`${f.contentType??"application/octet-stream"}${f.fileName?` — ${f.fileName}`:""}`,"");else{const p=f.kind==="json"||f.kind==="graphql"?"json":f.kind==="text"?"":"xml";a.push(qt(se(f)??"",p),"")}const u=Object.entries(e.responses??{});if(u.length&&a.push(`${i}# ${r.responses}`,"",`| ${r.status} | ${r.description} | ${r.type} |`,"|---|---|---|",...u.map(([p,b])=>`| ${p} | ${xe(b.description)} | ${xe(b.schema?pt(b.schema):b.contentType)} |`),""),s.codeLanguage!==!1){const p=n.filter(A=>A.kind==="folder"),b=s.codeLanguage??"curl",$=Qt(e,b,{auth:Rt(e,p,t)}),h=((d=Kt.find(A=>A.id===b))==null?void 0:d.syntax)??"shell";a.push(`${i}# ${r.example}`,"",qt($,h),"")}return a}function Jr(e,t={}){var o;const n={...Nn,...t.labels},r=[`# ${e.name}`,""];e.description&&r.push(e.description,""),e.version&&r.push(`**${n.version}:** ${e.version}`,""),(o=e.servers)!=null&&o.length&&r.push(`## ${n.servers}`,"",...e.servers.map(i=>`- \`${i.url}\`${i.description?` — ${i.description}`:""}`),""),e.auth&&e.auth.type!=="none"&&e.auth.type!=="inherit"&&r.push(`## ${n.authentication}`,"",Vr(e.auth,n),"");const s=(i,a,c)=>{for(const l of i)l.kind==="folder"?(r.push(`${"#".repeat(Math.min(a,6))} ${l.name}`,""),l.description&&r.push(l.description,""),s(l.items,a+1,[...c,l])):r.push(...Kr(l,e,c,n,t,Math.min(a,5)))};return s(e.items,2,[]),`${r.join(`
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(`
118
118
  `).replace(/\n{3,}/g,`
119
119
 
120
120
  `).trimEnd()}
121
- `}function On(e,t){try{return Re(e,t)}catch{return}}function jn(e,t={}){const n=e.trim();if(!n)return;if(Bt(n))return"curl";if(n.startsWith("<"))return/<(\w+:)?definitions[\s>]/.test(n)&&/schemas\.xmlsoap\.org\/wsdl/.test(n)?"wsdl":void 0;const r=On(n,t.parseYaml);if(!r||typeof r!="object")return;const s=r;if(typeof s.openapi=="string"||typeof s.swagger=="string")return"openapi";if(gt(s))return"postman";if(Array.isArray(s.values)&&(s._postman_variable_scope!==void 0||typeof s.name=="string"))return"postman-environment";if(kt(s))return"har";const o=s.data;if(s.__schema||o!=null&&o.__schema)return"graphql"}function Gr(e,t={}){const n=jn(e,t),r=()=>On(e.trim(),t.parseYaml);switch(n){case"curl":return{kind:n,request:Vt(e)};case"openapi":return{kind:n,collection:nn(r(),t)};case"postman":return{kind:n,collection:ln(r())};case"postman-environment":return{kind:n,environment:un(r())};case"har":return{kind:n,collection:dn(r())};case"graphql":return{kind:n,collection:bn(r())};case"wsdl":return{kind:n,collection:An(e,{parser:t.xmlParser})};default:throw new Error("Unknown API document: expected curl, OpenAPI, Swagger, Postman, HAR, GraphQL introspection or WSDL")}}exports.GRAPHQL_INTROSPECTION_QUERY=Nr;exports.NICE_API_AUTH_TYPES=qn;exports.NICE_API_CODE_LANGUAGES=Kt;exports.NICE_API_MARKDOWN_LABELS=Nn;exports.NICE_API_METHODS=Un;exports.NiceYamlError=Q;exports.POSTMAN_SCHEMA_V21=on;exports.bodyContentType=ke;exports.bodyFromText=lt;exports.bodyText=se;exports.buildAuthorizationUrl=Dr;exports.buildGraphqlOperation=gn;exports.buildRequestUrl=$e;exports.buildSoapEnvelope=wn;exports.collectionToMarkdown=Jr;exports.createPkcePair=Hr;exports.detectApiDocument=jn;exports.digest=Ce;exports.digestAuthorization=Tn;exports.effectiveAuth=Rt;exports.exchangeAuthorizationCode=zr;exports.exportHar=Sr;exports.exportOpenApi=sn;exports.exportOpenApiYaml=yr;exports.exportPostman=vr;exports.exportPostmanEnvironment=Tr;exports.fetchOAuth2Token=Mr;exports.fetchTransport=Rr;exports.findApiItem=It;exports.findVariables=Dt;exports.flattenApiRequests=ze;exports.fromBase64=dt;exports.generateCode=Qt;exports.graphqlExampleValue=Se;exports.graphqlOperations=hn;exports.graphqlTypeName=Me;exports.headerValue=Pn;exports.hmac=fe;exports.importApiDocument=Gr;exports.importGraphqlIntrospection=bn;exports.importHar=dn;exports.importOpenApi=nn;exports.importPostman=ln;exports.importPostmanEnvironment=un;exports.importWsdl=An;exports.inferSchema=He;exports.interpolate=ft;exports.isCurlCommand=Bt;exports.isEnabled=I;exports.isHar=kt;exports.isPostmanCollection=gt;exports.joinUrl=zn;exports.jsonPointer=tt;exports.md5Hex=wt;exports.mockFromSchema=yt;exports.mockResponse=ur;exports.namedType=$t;exports.newApiCollection=be;exports.newApiFolder=ye;exports.newApiId=Ee;exports.newApiRequest=he;exports.paramsIn=Lt;exports.parseCurl=Vt;exports.parseDigestChallenge=vn;exports.parseFormEncoded=ut;exports.parseGraphqlIntrospection=mn;exports.parseJsonOrYaml=Re;exports.parseWsdl=kn;exports.parseYaml=Yt;exports.pathParamNames=Mt;exports.pollDeviceToken=Fr;exports.refreshOAuth2Token=Wr;exports.requestName=mt;exports.resolvePlainScalar=Be;exports.resolveRequest=ct;exports.rowsToRecord=In;exports.schemaResolver=ht;exports.sendApiRequest=Pr;exports.setRequestUrl=Wt;exports.signAwsV4=xn;exports.signHmac=Sn;exports.splitUrl=ce;exports.startDeviceAuthorization=Br;exports.stringifyYaml=en;exports.swagger2ToOpenApi3=rn;exports.syncPathParams=zt;exports.toBase64=We;exports.toCurl=Ie;exports.tokenizeCommand=Ft;exports.unresolvedVariables=Hn;exports.updateApiItem=Pt;exports.variableScope=Dn;
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;