@redocly/cli 2.71.2 → 2.72.1

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.
Files changed (159) hide show
  1. package/README.md +1 -1
  2. package/THIRD_PARTY_NOTICES +29 -7
  3. package/lib/chunks/{EHJ3FMW6.js → 2AW4F6ZZ.js} +1 -1
  4. package/lib/chunks/{3EQNI6CT.js → 2MF3MKAD.js} +1 -1
  5. package/lib/chunks/{UYZXI3NO.js → 2X2KHSF3.js} +1 -1
  6. package/lib/chunks/{YF4FMOTE.js → 3FA5W77S.js} +1 -1
  7. package/lib/chunks/{VPTYPV6P.js → 3FVHXIZN.js} +1 -1
  8. package/lib/chunks/{P5T6BIKW.js → 3N53VPSU.js} +1 -1
  9. package/lib/chunks/{KLGUZBJO.js → 3N73A66H.js} +1 -1
  10. package/lib/chunks/{JO76DPXR.js → 3WOXO2JS.js} +1 -1
  11. package/lib/chunks/{ORWIUECT.js → 4A5R4H5W.js} +1 -1
  12. package/lib/chunks/{NXREEI2S.js → 4LTPQZBP.js} +1 -1
  13. package/lib/chunks/{L325HIGK.js → 4QC7OVHI.js} +1 -1
  14. package/lib/chunks/{FDKY4PGX.js → 542GVIYM.js} +1 -1
  15. package/lib/chunks/5JF6EUWW.js +9 -0
  16. package/lib/chunks/{6X42UQ3O.js → 5MZU5MHZ.js} +1 -1
  17. package/lib/chunks/{DZT5NLUB.js → 5UPBGRBZ.js} +1 -1
  18. package/lib/chunks/{WO6IIVA3.js → 6LZX65VY.js} +8 -8
  19. package/lib/chunks/{NEWT5A6S.js → 6RTITFQA.js} +1 -1
  20. package/lib/chunks/{IQLQH23V.js → 6Y6B2SKE.js} +1 -1
  21. package/lib/chunks/765BYRQR.js +7 -0
  22. package/lib/chunks/{2TG3DP4I.js → 7NZS5HXU.js} +1 -1
  23. package/lib/chunks/{5CR6AOLY.js → A65OW7M7.js} +3 -3
  24. package/lib/chunks/ARUYNQHA.js +7 -0
  25. package/lib/chunks/BJ6Z66KZ.js +7 -0
  26. package/lib/chunks/{T77BOGYV.js → BWGBTYNU.js} +1 -1
  27. package/lib/chunks/{DM4EUYBB.js → BZTZIEWS.js} +2 -2
  28. package/lib/chunks/{4S6LRPCX.js → CBFNHKDJ.js} +1 -1
  29. package/lib/chunks/{OFIQ2EST.js → CYCPHJNX.js} +33 -33
  30. package/lib/chunks/DSBDKSRR.js +53 -0
  31. package/lib/chunks/E2CEKR6N.js +22 -0
  32. package/lib/chunks/{HRZLSSOF.js → EMWHLZB6.js} +1 -1
  33. package/lib/chunks/{DWXDCKZ7.js → ENIFTFYK.js} +1 -1
  34. package/lib/chunks/{BIS2ZFGS.js → ETJMQLWJ.js} +1 -1
  35. package/lib/chunks/{ADACRYTN.js → EU5WR2O3.js} +1 -1
  36. package/lib/chunks/{FAFMGLT6.js → FLQQ3VRQ.js} +1 -1
  37. package/lib/chunks/{BPJTNQBC.js → FZZACVYL.js} +1 -1
  38. package/lib/chunks/{N4GCIKY4.js → G7A4OE2M.js} +1 -1
  39. package/lib/chunks/{HP7UD4BA.js → GCAL2PYM.js} +1 -1
  40. package/lib/chunks/{MJ2NI6MR.js → GGHLD27S.js} +1 -1
  41. package/lib/chunks/{U4MI7HDM.js → GMPHU6KM.js} +1 -1
  42. package/lib/chunks/{HTFKP5HH.js → GWBLS542.js} +1 -1
  43. package/lib/chunks/{U2F3JOT2.js → GXILNSWK.js} +1 -1
  44. package/lib/chunks/{5AVTCY6F.js → HM7M6465.js} +1 -1
  45. package/lib/chunks/{5HPO77VR.js → I2JZXLJ6.js} +2 -2
  46. package/lib/chunks/I3YF3GEY.js +13 -0
  47. package/lib/chunks/{YWRFPTTI.js → IIQW437Z.js} +1 -1
  48. package/lib/chunks/{4H3DPQDW.js → IM4YIUUN.js} +1 -1
  49. package/lib/chunks/{LET2MPMU.js → JDMRVD45.js} +1 -1
  50. package/lib/chunks/{XVS7B4RZ.js → KIFXQTTL.js} +1 -1
  51. package/lib/chunks/{UVKUPD4U.js → L4VSY42B.js} +1 -1
  52. package/lib/chunks/LH3ONQEX.js +17 -0
  53. package/lib/chunks/{SSEMMWPY.js → LUNR7GV4.js} +1 -1
  54. package/lib/chunks/{LY6BDOEF.js → LY5MGNMA.js} +1 -1
  55. package/lib/chunks/{XQEXWC5L.js → MAACTVYP.js} +1 -1
  56. package/lib/chunks/{GFSMOHUE.js → MTKICX4T.js} +1 -1
  57. package/lib/chunks/{ZXOX7NF2.js → NMAWU5S4.js} +1 -1
  58. package/lib/chunks/{I4TK6NG7.js → PJHQKG7X.js} +1 -1
  59. package/lib/chunks/PTBPNZRZ.js +7 -0
  60. package/lib/chunks/{CZX7WE2R.js → PUZ5QSL3.js} +1 -1
  61. package/lib/chunks/{JRVXIEVC.js → PW2XFZOB.js} +1 -1
  62. package/lib/chunks/{TH44RKLO.js → QAT3DPT3.js} +1 -1
  63. package/lib/chunks/{QXXAC25O.js → R67IVFZH.js} +1 -1
  64. package/lib/chunks/RA4FAJM3.js +59 -0
  65. package/lib/chunks/{AZ5LIJEO.js → RF5LL2UZ.js} +1 -1
  66. package/lib/chunks/{JOUEVI3E.js → RQPH22PV.js} +1 -1
  67. package/lib/chunks/S3B562IT.js +7 -0
  68. package/lib/chunks/{3FR3456Q.js → S43EG4DB.js} +1 -1
  69. package/lib/chunks/{CER2D6ZD.js → S7VIXBKD.js} +7 -7
  70. package/lib/chunks/{VJZDR6KS.js → TFPMT2XD.js} +1529 -4
  71. package/lib/chunks/{AXGFQS75.js → U56BQ2BR.js} +2 -2
  72. package/lib/chunks/{KJNBOXDI.js → UOTHMCTM.js} +3 -3
  73. package/lib/chunks/{CR5TYFBN.js → VHZJNDWE.js} +2 -2
  74. package/lib/chunks/{BOTTA3HA.js → VOYPXV3Z.js} +1 -1
  75. package/lib/chunks/{UTEOWLD5.js → VS4MTPCM.js} +1 -1
  76. package/lib/chunks/{QTSECOQB.js → WEPGHS5R.js} +2 -2
  77. package/lib/chunks/{LKNL5LEV.js → WRKMMY3F.js} +1 -1
  78. package/lib/chunks/{7JS7JGWP.js → WTJ3S4D7.js} +1 -1
  79. package/lib/chunks/X22IMAJK.js +199 -0
  80. package/lib/chunks/{W7TN2XCW.js → X3FFOCXC.js} +1 -1
  81. package/lib/chunks/{CRJEY7P3.js → XTI7EXWX.js} +1 -1
  82. package/lib/chunks/{BH4FA7AH.js → YA5KTHFN.js} +1 -1
  83. package/lib/chunks/{Z6GFQV2Y.js → YA6D5EUI.js} +1 -1
  84. package/lib/chunks/{HMYFTLS7.js → ZFET6WME.js} +1 -1
  85. package/lib/chunks/{R32HBYOH.js → ZXB5O6JQ.js} +1 -1
  86. package/lib/eject-assets/AGENTS.md +1 -1
  87. package/lib/eject-assets/generators/cli/docs.ts +1 -1
  88. package/lib/eject-assets/generators/cli/engine-source.ts +1 -1
  89. package/lib/eject-assets/generators/cli/index.ts +2 -2
  90. package/lib/eject-assets/generators/cli/render.ts +1 -1
  91. package/lib/eject-assets/generators/go/client.ts +1 -1
  92. package/lib/eject-assets/generators/go/descriptor.ts +1 -1
  93. package/lib/eject-assets/generators/go/index.ts +2 -2
  94. package/lib/eject-assets/generators/go/models.ts +1 -1
  95. package/lib/eject-assets/generators/go/naming.ts +1 -1
  96. package/lib/eject-assets/generators/go/operations.ts +1 -1
  97. package/lib/eject-assets/generators/go/pagination.ts +1 -1
  98. package/lib/eject-assets/generators/go/types.ts +1 -1
  99. package/lib/eject-assets/generators/java/client.ts +66 -0
  100. package/lib/eject-assets/generators/java/descriptor.ts +72 -0
  101. package/lib/eject-assets/generators/java/index.ts +245 -0
  102. package/lib/eject-assets/generators/java/models.ts +362 -0
  103. package/lib/eject-assets/generators/java/naming.ts +135 -0
  104. package/lib/eject-assets/generators/java/operations.ts +300 -0
  105. package/lib/eject-assets/generators/java/pagination.ts +94 -0
  106. package/lib/eject-assets/generators/java/types.ts +103 -0
  107. package/lib/eject-assets/generators/mock/faker.ts +1 -1
  108. package/lib/eject-assets/generators/mock/index.ts +2 -2
  109. package/lib/eject-assets/generators/mock/render.ts +1 -1
  110. package/lib/eject-assets/generators/mock/sample.ts +1 -1
  111. package/lib/eject-assets/generators/mock/values.ts +1 -1
  112. package/lib/eject-assets/generators/php/client.ts +1 -1
  113. package/lib/eject-assets/generators/php/descriptor.ts +1 -1
  114. package/lib/eject-assets/generators/php/index.ts +2 -2
  115. package/lib/eject-assets/generators/php/models.ts +1 -1
  116. package/lib/eject-assets/generators/php/naming.ts +1 -1
  117. package/lib/eject-assets/generators/php/operations.ts +1 -1
  118. package/lib/eject-assets/generators/php/pagination.ts +1 -1
  119. package/lib/eject-assets/generators/php/types.ts +1 -1
  120. package/lib/eject-assets/generators/python/client.ts +1 -1
  121. package/lib/eject-assets/generators/python/descriptor.ts +1 -1
  122. package/lib/eject-assets/generators/python/index.ts +2 -2
  123. package/lib/eject-assets/generators/python/models.ts +1 -1
  124. package/lib/eject-assets/generators/python/naming.ts +1 -1
  125. package/lib/eject-assets/generators/python/operations.ts +1 -1
  126. package/lib/eject-assets/generators/python/pagination.ts +1 -1
  127. package/lib/eject-assets/generators/python/types.ts +1 -1
  128. package/lib/eject-assets/generators/swr/index.ts +2 -2
  129. package/lib/eject-assets/generators/swr/render.ts +1 -1
  130. package/lib/eject-assets/generators/tanstack-query/index.ts +2 -2
  131. package/lib/eject-assets/generators/tanstack-query/render.ts +1 -1
  132. package/lib/eject-assets/generators/transformers/index.ts +2 -2
  133. package/lib/eject-assets/generators/transformers/render.ts +1 -1
  134. package/lib/eject-assets/generators/typescript/banner.ts +1 -1
  135. package/lib/eject-assets/generators/typescript/client.ts +1 -1
  136. package/lib/eject-assets/generators/typescript/descriptor.ts +1 -1
  137. package/lib/eject-assets/generators/typescript/index.ts +2 -2
  138. package/lib/eject-assets/generators/typescript/inline-runtime.ts +1 -1
  139. package/lib/eject-assets/generators/typescript/operation-signature.ts +1 -1
  140. package/lib/eject-assets/generators/typescript/operation-types.ts +1 -1
  141. package/lib/eject-assets/generators/typescript/operations.ts +1 -1
  142. package/lib/eject-assets/generators/typescript/response-headers.ts +1 -1
  143. package/lib/eject-assets/generators/typescript/type-guards.ts +1 -1
  144. package/lib/eject-assets/generators/typescript/types.ts +1 -1
  145. package/lib/eject-assets/generators/zod/index.ts +2 -2
  146. package/lib/eject-assets/generators/zod/schemas.ts +1 -1
  147. package/lib/eject-assets/skills/client-generators/SKILL.md +1 -1
  148. package/lib/eject-assets/skills/java-generator/SKILL.md +161 -0
  149. package/lib/index.js +91 -90
  150. package/lib/skills/redocly-cli/SKILL.md +3 -1
  151. package/package.json +1 -1
  152. package/lib/chunks/2ZEKFWJQ.js +0 -13
  153. package/lib/chunks/3VOQMXIZ.js +0 -7
  154. package/lib/chunks/7GADNOVY.js +0 -9
  155. package/lib/chunks/FRQHCFKP.js +0 -199
  156. package/lib/chunks/J2EPFEBO.js +0 -17
  157. package/lib/chunks/JZATGVUO.js +0 -53
  158. package/lib/chunks/KNMNSDHR.js +0 -7
  159. package/lib/chunks/U5DIFWGH.js +0 -7
@@ -0,0 +1,53 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
7
+ import{a as V}from"./2MF3MKAD.js";import{c as I,d as N,e as ue,h as G,j as _,k as me,v as B,w as H}from"./G7A4OE2M.js";import{a as ce,b as W,c as pe,d as fe}from"./I3YF3GEY.js";import"./MAACTVYP.js";import{a as ae}from"./64G5RPLP.js";import{e as ie}from"./YA5KTHFN.js";import{Q as oe,R as v,c as y,k as O,ka as S,qa as J,va as se}from"./X22IMAJK.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";import{mkdir as jt,writeFile as kt}from"node:fs/promises";import Rt from"node:path";import{performance as Jt}from"node:perf_hooks";var Be=/^[a-zA-Z][a-zA-Z0-9]*(?:[_\-.][a-zA-Z0-9]+)*$/,He=/^[0-9a-f-]{8,}$/i,ze=[["uuid",/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i],["date-time",/^\d{4}-\d{2}-\d{2}[Tt]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:[Zz]|[+-]\d{2}:\d{2})$/],["date",/^\d{4}-\d{2}-\d{2}$/],["email",/^[^\s@]+@[^\s@]+\.[^\s@]+$/],["uri",/^https?:\/\/\S+$/],["ipv4",/^(?:(?:25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|1?\d?\d)$/]],x=new WeakMap;function z(e){return{formats:ze.filter(([,t])=>t.test(e)).map(([t])=>t),values:[e],count:1,overflow:!1}}function q(e,t){if(!e)return t;if(!t)return e;let n={formats:e.formats.filter(r=>t.formats.includes(r)),values:[],count:e.count+t.count,overflow:e.overflow||t.overflow};if(!n.overflow){let r=[...e.values];for(let s of t.values)r.includes(s)||r.push(s);r.length>10?n.overflow=!0:n.values=r}return n}function D(e,t){x.set(e,t)}function U(e){return x.get(e)}function F(e,t){let n=x.get(e);n&&x.set(t,n)}function De(e){return e.length<=30&&!He.test(e)&&Be.test(e)}function X(e,t){return e.formats.length>0?{format:e.formats[0]}:t&&!e.overflow&&e.count>=4&&e.values.length>0&&e.values.length<=5&&e.values.length*2<=e.count&&e.values.every(De)?{enum:[...e.values].sort()}:{}}function T(e){let t=x.get(e);if(t){let n=typeof e.type=="string"?[e.type]:e.type??[];n.includes("string")&&Object.assign(e,X(t,n.length===1))}for(let n of Object.values(e.properties??{}))T(n);e.additionalProperties&&T(e.additionalProperties),e.items&&T(e.items);for(let n of e.oneOf??[])T(n)}function de(e){for(let t of Object.values(e.paths))for(let n of Object.values(t)){for(let r of Object.values(n.requestBody?.content??{}))T(r.schema);for(let r of Object.values(n.responses))for(let s of Object.values(r.content??{}))T(s.schema)}for(let t of Object.values(e.components?.schemas??{}))T(t);return e}var Oe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Y=/^\d+$/,Ue=/^[0-9a-hjkmnp-tv-z]{26}$/i,Fe=/^[a-z][a-z0-9]*_(?=[0-9a-z]*\d)[0-9a-z]{10,}$/i,Le=/^[a-z](?=[a-z0-9]*\d)[a-z0-9]{23,24}$/,Q=new Set(ae),Ye=new Set(["get","head"]),le="application/x-www-form-urlencoded",he="multipart/form-data";function Ke(e){return e?Y.test(e)||Oe.test(e)||Ue.test(e)||Fe.test(e)||Le.test(e)?!0:/^[0-9a-f]{16,}$/i.test(e):!1}function ee(e){let t=e.split("/"),n=[],r=new Set;return{template:t.map((o,a)=>{if(!Ke(o))return o;let i=t[a-1],c=i?`${O(i,1)}Id`:"id",p=1;for(;r.has(c);)p+=1,c=i?`${O(i,1)}Id${p}`:`id${p}`;return r.add(c),n.push({name:c,value:o}),`{${c}}`}).join("/")||"/",params:n}}function $(e){if(e===null)return{type:"null"};if(Array.isArray(e)){if(e.length===0)return{type:"array"};let t=e.slice(0,20).map($);return{type:"array",items:E(t)}}switch(typeof e){case"string":{let t={type:"string"};return D(t,z(e)),t}case"boolean":return{type:"boolean"};case"number":return Number.isInteger(e)?{type:"integer"}:{type:"number"};case"object":{let t=Object.entries(e);if(t.length>0&&(t.every(([a])=>Y.test(a))||t.every(([a])=>Oe.test(a))))return{type:"object",additionalProperties:E(t.map(([,a])=>$(a)))};let n={},r=[];for(let[o,a]of t)n[o]=$(a),r.push(o);let s={type:"object",properties:n};return r.length>0&&(s.required=r),s}default:return{}}}function E(e){if(e.length===0)return{};let[t,...n]=e,r=t;for(let s of n)r=L(r,s);return r}function ge(e){return Object.keys(e).length===0}function A(e){return e.additionalProperties?"map":e.type==="object"?"object":e.type==="array"?"array":"scalar"}function Z(e){return e.oneOf?e.oneOf.flatMap(Z):Array.isArray(e.type)?e.type.map(t=>{if(t==="object"){let r={type:"object"};return e.properties&&(r.properties=e.properties),e.required&&(r.required=e.required),e.additionalProperties&&(r.additionalProperties=e.additionalProperties),r}if(t==="array")return e.items?{type:"array",items:e.items}:{type:"array"};let n={type:t};return t==="string"&&F(e,n),n}):[e]}var We=.5,Xe=3;function ve(e,t){let n=Object.keys(e.properties??{}),r=Object.keys(t.properties??{});if(n.length===0||r.length===0)return 1;let s=new Set(r),o=n.filter(a=>s.has(a)).length;return o/(n.length+r.length-o)}function Ze(e,t){let n=A(e);if(n!==A(t))return!1;switch(n){case"scalar":return e.type===t.type||e.type==="integer"&&t.type==="number"||e.type==="number"&&t.type==="integer";case"object":return ve(e,t)>=We;default:return!0}}function we(e,t){switch(A(e)){case"scalar":{if(e.type!==t.type)return{type:"number"};if(e.type==="string"){let n=q(U(e),U(t));if(n){let r={type:"string"};return D(r,n),r}}return e}case"map":return{type:"object",additionalProperties:L(e.additionalProperties??{},t.additionalProperties??{})};case"object":{let n={...e.properties??{}};for(let[a,i]of Object.entries(t.properties??{}))n[a]=n[a]?L(n[a],i):i;let r=new Set(t.required??[]),s=(e.required??[]).filter(a=>r.has(a)),o={type:"object",properties:n};return s.length>0&&(o.required=s),o}case"array":{if(!e.items||!t.items){let n=e.items??t.items;return n?{type:"array",items:n}:{type:"array"}}return{type:"array",items:L(e.items,t.items)}}}}function Qe(e){let t=[...e],n=()=>t.filter(r=>A(r)==="object").length;for(;n()>Xe;){let r=-1,s=-1,o=-1;for(let a=0;a<t.length;a++)if(A(t[a])==="object")for(let i=a+1;i<t.length;i++){if(A(t[i])!=="object")continue;let c=ve(t[a],t[i]);c>o&&(o=c,r=a,s=i)}t[r]=we(t[r],t[s]),t.splice(s,1)}return t}var et=["boolean","integer","number","string","null"];function tt(e){if(e.length===1)return e[0];let t=[],n=new Set,r;for(let i of e)A(i)==="scalar"&&typeof i.type=="string"?(n.add(i.type),i.type==="string"&&(r=q(r,U(i)))):t.push(i);let s=et.filter(i=>n.has(i)),o=i=>{let c={type:i};return(typeof i=="string"?i==="string":i.includes("string"))&&r&&D(c,r),c};if(t.length===0)return s.length===1?o(s[0]):o(s);if(t.length===1&&s.length===1&&s[0]==="null"&&typeof t[0].type=="string")return{...t[0],type:[t[0].type,"null"]};let a=[...t];return s.length===1?a.push(o(s[0])):s.length>1&&a.push(o(s)),{oneOf:a}}function L(e,t){if(ge(e)||ge(t))return{};let n=Z(e);for(let r of Z(t)){let s=n.findIndex(o=>Ze(o,r));s===-1?n.push(r):n[s]=we(n[s],r)}return tt(Qe(n))}function nt(e){if(!e)return;let t=e.trim();if(!(!t.startsWith("{")&&!t.startsWith("[")))try{return JSON.parse(t)}catch{return}}function rt(e,t){let n=t?.match(/boundary="?([^";,]+)"?/i)?.[1];if(!n)return;let r={};for(let s of e.split(`--${n}`)){let o=s.match(/^\r?\n([\s\S]*?)\r?\n\r?\n([\s\S]*)\r?\n$/);if(!o)continue;let[,a,i]=o,c=a.match(/\bname="([^"]*)"/i)?.[1];c!==void 0&&(r[c]=/\bfilename="/i.test(a)?{type:"string",format:"binary"}:$(i))}if(Object.keys(r).length!==0)return{type:"object",properties:r,required:Object.keys(r)}}function ye(e){let t=_(e.contentType);if(e.bodyJson!==void 0)return{mime:me(t)?t:"application/json",schema:$(e.bodyJson)};if(t===le&&e.bodyText){let r={};for(let[s,o]of new URLSearchParams(e.bodyText))r[s]=o;return Object.keys(r).length===0?void 0:{mime:le,schema:$(r)}}if(t===he&&e.bodyText){let r=rt(e.bodyText,e.contentType);return r?{mime:he,schema:r}:void 0}let n=nt(e.bodyText);if(n!==void 0)return{mime:"application/json",schema:$(n)}}function Se(e,t,n){let r=e.get(t);e.set(t,r?E([r,n]):n)}async function Pe(e){let t=await N(e.trafficPath);if(t.length===0)throw new Error("No traffic files found in the provided traffic path.");let n=B(e.server),r=new Map,s=new Set,o=0,a=0,i=p=>{let f=p.request.method.toLowerCase();if(!Q.has(f))return;let u=p.request.path||"/";if(n){let d=H(p.request,n);if(d===void 0)return;u=d}if(f==="query"&&e.openapiVersion==="3.1"){a+=1;return}!n&&p.request.host&&!ue(p.request.host)&&s.add(`${p.request.protocol}//${p.request.host}`);let{template:m,params:k}=ee(G(u)),P=`${f} ${m}`,l=r.get(P);l||(l={method:f,template:m,pathParams:new Map,queryParams:new Map,requestBodies:new Map,responses:new Map},r.set(P,l));for(let{name:d,value:g}of k){let h=l.pathParams.get(d);l.pathParams.set(d,{numeric:(h?.numeric??!0)&&Y.test(g),observations:q(h?.observations,z(g))})}for(let d of new Set(p.request.query.keys())){let g=p.request.query.getAll(d),h=l.queryParams.get(d),C=g.length>0&&g.every(R=>Y.test(R)),b=h?.observations;for(let R of g)b=q(b,z(R));l.queryParams.set(d,{numeric:(h?.numeric??!0)&&C,observations:b})}if(!Ye.has(f)){let d=ye(p.request);d&&Se(l.requestBodies,d.mime,d.schema)}if(p.response&&p.response.status>=100){let d=String(p.response.status),g=l.responses.get(d);g||(g={bodies:new Map},l.responses.set(d,g)),g.statusText??=p.response.statusText||void 0;let h=ye(p.response);h&&Se(g.bodies,h.mime,h.schema)}};for(let p of t){let f=await V(p,e.format);if(!f){S.warn(`Skipping traffic file with unrecognized format: ${p}
8
+ `);continue}o+=1;for await(let u of f.parse(p))i(u)}if(o===0)throw new J("No supported traffic files found to generate an OpenAPI description from.");if(r.size===0&&a>0)throw new J("All observed HTTP exchanges use the QUERY method, which OpenAPI 3.1 does not support. Use --openapi-version 3.2 to include them.");if(r.size===0)throw new J(n?`No HTTP exchanges in the traffic matched the server "${n}".`:"No HTTP exchanges were observed in the traffic. Cannot generate an OpenAPI description.");let c=n?[n]:Array.from(s).sort();return ot(r,e.openapiVersion,e.title??"Generated API",c)}function Te(e){return Object.values(e.paths).reduce((t,n)=>t+Object.keys(n).length,0)}function be(e,t){if(e.numeric)return{type:"integer"};let n={type:"string"};return e.observations&&Object.assign(n,X(e.observations,t)),n}function ot(e,t,n,r){let s={};for(let o of e.values()){let a=s[o.template]??={},i=[...Array.from(o.pathParams).map(([p,f])=>({name:p,in:"path",required:!0,schema:be(f,!1)})),...Array.from(o.queryParams).map(([p,f])=>({name:p,in:"query",required:!1,schema:be(f,!0)}))],c={operationId:st(o.method,o.template),responses:{}};if(i.length>0&&(c.parameters=i),o.requestBodies.size>0){let p={};for(let[f,u]of o.requestBodies)p[f]={schema:u};c.requestBody={content:p}}if(o.responses.size===0)c.responses.default={description:"Observed response"};else for(let[p,f]of o.responses){let u={description:f.statusText||"Observed response"};if(f.bodies.size>0){let m={};for(let[k,P]of f.bodies)m[k]={schema:P};u.content=m}c.responses[p]=u}a[o.method]=c}return{openapi:`${t}.0`,info:{title:n,version:"1.0.0"},...r.length>0?{servers:r.map(o=>({url:o}))}:{},paths:s}}function st(e,t){let n=t.split("/").filter(Boolean).map(r=>r.replace(/[{}]/g,"")).join("-");return`${e}-${n||"root"}`}function K(e,t){return`${e.toUpperCase()} ${t}`}function $e(e,t){let n;if(e.bodyJson!==void 0)try{n=JSON.stringify(e.bodyJson)}catch{n=void 0}if(n??=e.bodyText,!n)return;let r=n.trim();if(r)return r.length>t?`${r.slice(0,t)}\u2026[truncated]`:r}function Ae(e){if(!e)return"";let t=e.bodyJson;return t===void 0?e.bodyText?_(e.contentType)||"text":"":t===null?"null":Array.isArray(t)?`array<${t.length>0?je(t[0]):""}>`:je(t)}function je(e){return y(e)?Object.keys(e).sort().join(","):e===null?"null":typeof e}async function ke(e){let t=e.perGroup??2,n=e.perOperation??4,r=e.maxBodyChars??2e3,s=B(e.server),o=await N(e.trafficPath),a=new Map;for(let c of o){let p=await V(c,e.format);if(p)for await(let f of p.parse(c)){let u=f.request.method.toUpperCase();if(!Q.has(u.toLowerCase()))continue;let m=f.request.path||"/";if(s){let R=H(f.request,s);if(R===void 0)continue;m=R}let k=G(m),{template:P}=ee(k),l=f.response&&f.response.status>=100?f.response:void 0,d=l?.status,g=`${Ae(f.request)}\u2192${Ae(l)}`,h=a.get(K(u,P));h||(h=new Map,a.set(K(u,P),h));let C=`${d??""} ${g}`,b=h.get(C);b||(b=[],h.set(C,b)),!(b.length>=t)&&b.push({method:u,path:k,query:f.request.query.toString(),status:d,requestContentType:f.request.contentType,requestBody:$e(f.request,r),responseContentType:l?.contentType,responseBody:l?$e(l,r):void 0})}}let i=new Map;for(let[c,p]of a){let f=[];for(let u=0;u<t&&f.length<n;u++)for(let m of p.values()){if(f.length>=n)break;m[u]&&f.push(m[u])}i.set(c,f)}return i}var it=e=>`You are an expert API designer. You are given one operation from an OpenAPI ${e} description that was inferred mechanically from recorded HTTP traffic, the component schemas it references, and a sample of the real recorded HTTP exchanges for that operation. The inferred description is only a hypothesis: types are coarse, every observed property is marked required, and descriptions are missing. Alternative body shapes observed in the traffic appear as "oneOf" variants or type unions. Common string formats (uuid, date-time, date, email, uri, ipv4) and small closed enums are detected conservatively from the observed values.
9
+
10
+ Refine the operation into the most accurate OpenAPI ${e} definition you can justify from the evidence, while staying conservative:
11
+ - Keep the path template and the HTTP method exactly as given. Do not rename path parameters, do not move parameters to the path item level, and keep every response status code. The result is programmatically checked and rejected otherwise.
12
+ - Keep the operationId unless it is clearly wrong.
13
+ - Narrow property types where the samples clearly support it (formats such as date-time, uuid, email, uri; integer vs number; enums when a field only ever takes a small fixed set of values). Verify the formats and enums already detected against the samples; correct or extend them where justified. The detected formats and enums were derived from the full recorded traffic while you see only a subset of it, so never remove a detected format or enum value merely because the samples do not show it \u2014 correct one only when a sample contradicts it.
14
+ - Relax "required" for properties that are plausibly optional (e.g. absent in some samples, or clearly nullable). Express nullable values as type unions such as ["string", "null"].
15
+ - When a request or response body has alternative shapes \u2014 the baseline shows "oneOf" variants, or the samples show clearly different payloads \u2014 model them explicitly with "oneOf". Name each variant in components/schemas, and add a "discriminator" when a property (such as "type" or "kind") selects the variant.
16
+ - Factor structure shared between variants or schemas with "allOf": extract the common base into components/schemas and compose each variant as "allOf" of the base plus its specific properties.
17
+ - Keep the $ref references to the component schemas you were given. You may refine the definition of a referenced component when the samples justify it, and you may add new components, but never rename an existing component and never reuse a reserved component name listed in the input.
18
+ - Add concise, useful "summary" and "description" fields to the operation, its parameters and important schema properties.
19
+ - Add example values drawn from the real samples where helpful, but never copy values that look like secrets or personal data (tokens, API keys, passwords, session identifiers, email addresses, personal names); use clearly fictional placeholder values instead.
20
+
21
+ Output ONLY a YAML document with this exact top-level structure:
22
+
23
+ paths:
24
+ <the path template exactly as given>:
25
+ <the method>:
26
+ ...the refined operation...
27
+ components:
28
+ schemas:
29
+ ...only the component schemas you changed or added; omit "components" entirely when there are none...
30
+
31
+ Do not wrap the output in Markdown code fences. Do not add any commentary before or after the document.`;function at(e){return e.length===0?"(no sample exchanges were captured)":e.map((t,n)=>{let r=[],s=t.query?`?${t.query}`:"";return r.push(`### Exchange ${n+1}`),r.push(`${t.method} ${t.path}${s}`),t.requestContentType&&r.push(`Request Content-Type: ${t.requestContentType}`),t.requestBody&&r.push(`Request body: ${t.requestBody}`),t.status!==void 0&&r.push(`Response status: ${t.status}`),t.responseContentType&&r.push(`Response Content-Type: ${t.responseContentType}`),t.responseBody&&r.push(`Response body: ${t.responseBody}`),r.join(`
32
+ `)}).join(`
33
+
34
+ `)}function Re(e){let t=[];return t.push(`# Operation to refine (inferred from traffic)
35
+
36
+ \`\`\`yaml
37
+ ${v({paths:{[e.path]:{[e.method]:e.operation}}})}\`\`\``),Object.keys(e.components).length>0&&t.push(`# Component schemas referenced by this operation (current definitions)
38
+
39
+ \`\`\`yaml
40
+ ${v({components:{schemas:e.components}})}\`\`\``),e.reservedComponentNames.length>0&&t.push(`# Reserved component names (used elsewhere in the description; do not redefine or reuse them)
41
+
42
+ ${e.reservedComponentNames.join(", ")}`),t.push(`# Recorded HTTP exchanges for this operation
43
+
44
+ ${at(e.samples)}`),t.push(`Refine ${e.method.toUpperCase()} ${e.path} as instructed and output only the YAML document.`),{system:it(e.openapiVersion),user:t.join(`
45
+
46
+ `)}}var Je=/^#\/components\/schemas\/(.+)$/;function te(e,t){if(Array.isArray(e)){for(let n of e)te(n,t);return}if(y(e)){if(typeof e.$ref=="string"){let n=e.$ref.match(Je);n&&t.add(n[1])}if(y(e.discriminator)&&y(e.discriminator.mapping)){for(let n of Object.values(e.discriminator.mapping))if(typeof n=="string"){let r=n.match(Je);t.add(r?r[1]:n)}}for(let n of Object.values(e))te(n,t)}}function Ee(e,t){let n=new Set,r=[e];for(;r.length>0;){let s=new Set;te(r.pop(),s);for(let o of s)!n.has(o)&&o in t&&(n.add(o),r.push(t[o]))}return n}function ct(e){let t=e.components?.schemas;if(!t)return;let n=Ee(e.paths,t);for(let r of Object.keys(t))n.has(r)||delete t[r];Object.keys(t).length===0&&delete e.components}function pt(e,t,n){let r=ce(e),s;try{s=oe(r)}catch(f){throw new Error(`the provider did not return valid YAML: ${f instanceof Error?f.message:String(f)}`)}if(!y(s))throw new Error('the response is not a YAML document with a "paths" object');let o=s.paths;if(!y(o))throw new Error('the response is not a YAML document with a "paths" object');let a=o[t];if(!y(a))throw new Error(`the response does not keep the path template "${t}"`);let i=a[n];if(!y(i))throw new Error(`the response does not contain the ${n.toUpperCase()} operation`);let c=s.components,p=y(c)?c.schemas:void 0;return{operation:i,components:y(p)?p:{}}}function ft(e,t){let n=y(t.responses)?t.responses:{};return Object.keys(e.responses).filter(r=>!(r in n))}async function ut(e){let t=e.document.components?.schemas??{},n=Ee(e.operation,t),r={};for(let m of n)r[m]=t[m];let s=Object.keys(t).filter(m=>!n.has(m)),{system:o,user:a}=Re({openapiVersion:e.document.openapi,path:e.path,method:e.method,operation:e.operation,components:r,reservedComponentNames:s,samples:e.samples}),{text:i}=await pe(e.provider,{system:o,user:a,model:e.model}),c=pt(i,e.path,e.method),p=ft(e.operation,c.operation);if(p.length>0)throw new Error(`the response dropped observed response status(es): ${p.join(", ")}`);if(typeof c.operation.operationId!="string")throw new Error("the response dropped the operationId");let f=Object.keys(c.components).filter(m=>s.includes(m));if(f.length>0)throw new Error(`the response redefines reserved component(s): ${f.join(", ")}`);let u={openapi:e.document.openapi,info:e.document.info,paths:{[e.path]:{[e.method]:c.operation}},components:{schemas:{...t,...c.components}}};return await W(v(u),e.config),c}function mt(e,t,n,r){e.paths[t][n]=r.operation,Object.keys(r.components).length>0&&(e.components??={schemas:{}},Object.assign(e.components.schemas,r.components))}async function Me(e){let t=structuredClone(e.baseline),n=await se({extends:["spec"]}),r=[];for(let[i,c]of Object.entries(e.baseline.paths))for(let[p,f]of Object.entries(c))r.push({path:i,method:p,operation:f});let o=(await fe({items:r,concurrency:e.concurrency??1,action:"Refining",successNote:"refined",failureNote:"kept the baseline",label:({path:i,method:c})=>`${c.toUpperCase()} ${i}`,run:async({path:i,method:c,operation:p})=>{let f=await ut({provider:e.provider,model:e.model,document:t,path:i,method:c,operation:p,samples:e.samplesByOperation.get(K(c,i))??[],config:n});return mt(t,i,c,f),f}})).filter(i=>i!==null).length;if(o===0)throw new Error(`the ${e.provider} provider did not produce a usable refinement for any operation`);ct(t);let a=v(t);return await W(a,n),{yaml:a,document:t,refined:o,total:r.length}}var dt=2,lt=2,ht=.75,gt=2,xe=new Set(["integer","number"]),qe=new WeakMap;function w(e){let t=qe.get(e);if(t!==void 0)return t;let n;if(e.$ref!==void 0)n=`ref(${e.$ref})`;else if(e.oneOf)n=`oneOf(${e.oneOf.map(w).sort().join("|")})`;else{let s=[`type=${(Array.isArray(e.type)?[...e.type].sort().join(","):e.type)??""}`];if(e.properties){let o=Object.entries(e.properties).map(([a,i])=>`${JSON.stringify(a)}:${w(i)}`).sort().join(",");s.push(`props{${o}}`)}e.additionalProperties&&s.push(`values(${w(e.additionalProperties)})`),e.items&&s.push(`items(${w(e.items)})`),n=s.join(";")}return qe.set(e,n),n}function yt(e){return e.$ref===void 0&&e.type==="object"&&e.oneOf===void 0&&e.additionalProperties===void 0&&Object.keys(e.properties??{}).length>=dt}function Ce(e,t){for(let n of t)e.set(n,(e.get(n)??0)+1)}function M(e,t,n){if(e.oneOf){e.oneOf.forEach((o,a)=>M(o,{...t,path:`${t.path}/oneOf/${a}`,fallbackHints:[]},n));return}let r=t.container,s=`${t.path}/`;if(yt(e)){let o=w(e),a=n.get(o);a||(a={keys:[o],schemas:[],merged:{},contexts:new Set,primaryVotes:new Map,fallbackVotes:new Map},n.set(o,a)),a.schemas.push(e),a.contexts.add(`${t.container}#${t.path}`),Ce(a.primaryVotes,t.primaryHints),Ce(a.fallbackVotes,t.fallbackHints),r=o,s=""}for(let[o,a]of Object.entries(e.properties??{}))M(a,{container:r,path:`${s}${o}`,primaryHints:[o],fallbackHints:[]},n);e.additionalProperties&&M(e.additionalProperties,{container:r,path:`${s}additionalProperties`,primaryHints:t.primaryHints.map(o=>O(o,1)),fallbackHints:t.fallbackHints.map(o=>O(o,1))},n),e.items&&M(e.items,{container:r,path:`${s}items`,primaryHints:t.primaryHints.map(o=>O(o,1)),fallbackHints:t.fallbackHints.map(o=>O(o,1))},n)}function St(e){return e.split("/").filter(n=>n&&!n.startsWith("{")).at(-1)}function bt(e){let t=new Map;for(let[n,r]of Object.entries(e.paths)){let s=St(n),o=s?O(s,1):void 0;for(let[a,i]of Object.entries(r)){for(let[c,p]of Object.entries(i.requestBody?.content??{}))M(p.schema,{container:`request ${a} ${n} ${c}`,path:"",primaryHints:o?[o]:[],fallbackHints:o?[`${o} request`]:[]},t);for(let[c,p]of Object.entries(i.responses)){let f=Number(c)>=400;for(let[u,m]of Object.entries(p.content??{}))M(m.schema,{container:`response ${a} ${n} ${c} ${u}`,path:"",primaryHints:f?["error"]:o?[o]:[],fallbackHints:f?o?[`${o} error`]:[]:o?[`${o} response`]:[]},t)}}}return t}function Ie(e){return Object.keys(e.properties??{})}function Ot(e,t){let n=Ie(e),r=new Set(Ie(t)),s=n.filter(a=>r.has(a)).length,o=n.length+r.size-s;return o===0?0:s/o}function Ne(e){if(e.$ref!==void 0||e.properties||e.additionalProperties||e.items||e.oneOf)return;let t=typeof e.type=="string"?[e.type]:e.type;if(!(!t||t.some(n=>n==="object"||n==="array")))return t}function ne(e){return Object.keys(e).length===0}function _e(e,t){if(w(e)===w(t)||ne(e)||ne(t))return!0;let n=Ne(e),r=Ne(t);if(n&&r){let o=new Set(n.filter(i=>i!=="null")),a=new Set(r.filter(i=>i!=="null"));return o.size===a.size&&[...o].every(i=>a.has(i))?!0:[...o].every(i=>xe.has(i))&&[...a].every(i=>xe.has(i))}let s=o=>o.type==="array"||o.items!==void 0;return s(e)&&s(t)?!e.items||!t.items||_e(e.items,t.items):!1}function vt(e,t){let n=t.merged.properties??{};return Object.entries(e.merged.properties??{}).every(([r,s])=>!(r in n)||_e(s,n[r]))}function wt(e){let t=[...e];for(;t.length>1;){let n=-1,r=-1,s=0;for(let i=0;i<t.length;i++)for(let c=i+1;c<t.length;c++){let p=Ot(t[i].merged,t[c].merged);p>=ht&&p>s&&vt(t[i],t[c])&&(s=p,n=i,r=c)}if(n===-1)break;let o=t[n],a=t[r];o.keys.push(...a.keys),o.schemas.push(...a.schemas),o.merged=E([o.merged,a.merged]);for(let i of a.contexts)o.contexts.add(i);for(let[i,c]of a.primaryVotes)o.primaryVotes.set(i,(o.primaryVotes.get(i)??0)+c);for(let[i,c]of a.fallbackVotes)o.fallbackVotes.set(i,(o.fallbackVotes.get(i)??0)+c);t.splice(r,1)}return t}function re(e,t){return e<t?-1:e>t?1:0}function Pt(e){return e.split(/[^a-zA-Z0-9]+/).filter(Boolean).map(t=>t[0].toUpperCase()+t.slice(1)).join("")}function Ge(e){return[...e.entries()].sort(([t,n],[r,s])=>s-n||re(t,r)).map(([t])=>t)}function Tt(e){let t=[...e].sort((r,s)=>s.contexts.size-r.contexts.size||s.schemas.length-r.schemas.length||re(r.keys[0],s.keys[0])),n=new Set;return t.map(r=>{let s=[...Ge(r.primaryVotes),...Ge(r.fallbackVotes)].map(Pt).filter(a=>a.length>0);s.length===0&&s.push("Schema");let o=s.find(a=>!n.has(a));for(let a=2;o===void 0;a++){let i=`${s[0]}${a}`;n.has(i)||(o=i)}return n.add(o),{group:r,name:o}})}function j(e,t,n=!1){if(!n){let s=t.get(w(e));if(s!==void 0)return{$ref:`#/components/schemas/${s}`}}let r={...e};return F(e,r),e.properties&&(r.properties=Object.fromEntries(Object.entries(e.properties).map(([s,o])=>[s,j(o,t)]))),e.additionalProperties&&(r.additionalProperties=j(e.additionalProperties,t)),e.items&&(r.items=j(e.items,t)),e.oneOf&&(r.oneOf=e.oneOf.map(s=>j(s,t))),r}function $t(e){let t=Object.values(e.properties??{}),n=t.filter(r=>r.type==="array"&&(!r.items||ne(r.items)));return n.length>0&&t.length-n.length<=gt}function At(e){let t=0,n=0;for(let r of e.primaryVotes.values())t+=r,n=Math.max(n,r);return n*2>t}function Ve(e){let t=bt(e);for(let i of t.values())i.merged=E(i.schemas);let r=wt([...t.values()]).filter(i=>i.contexts.size>=lt&&(At(i)||!i.schemas.some($t)));if(r.length===0)return e;let s=Tt(r),o=new Map;for(let{group:i,name:c}of s)for(let p of i.keys)o.set(p,c);let a={};for(let{group:i,name:c}of[...s].sort((p,f)=>re(p.name,f.name)))a[c]=j(i.merged,o,!0);for(let i of Object.values(e.paths))for(let c of Object.values(i)){for(let p of Object.values(c.requestBody?.content??{}))p.schema=j(p.schema,o);for(let p of Object.values(c.responses))for(let f of Object.values(p.content??{}))f.schema=j(f.schema,o)}return e.components={schemas:a},e}async function Et(e,t){let n=I(e);await jt(Rt.dirname(n),{recursive:!0}),await kt(n,t,"utf8")}async function bn({argv:e}){if(e.type!=="openapi")throw new J(`Unsupported spec type "${e.type}". Only "openapi" is supported.`);let t=Jt.now(),n=I(e.traffic),r=e["traffic-format"],s=de(Ve(await Pe({trafficPath:n,format:r,openapiVersion:e["openapi-version"],title:e.title,server:e.server})));S.info(`Inferred a baseline OpenAPI description from traffic: ${Te(s)} operation(s).
47
+ `);let o=v(s);if(e["with-ai"]){let a=e["ai-provider"];S.info(`Refining the description with AI provider "${a}"...
48
+ `),S.warn(`Note: --with-ai sends samples of the recorded traffic (URLs, query strings, request and response bodies) to the selected AI provider. Make sure the traffic contains no secrets or personal data you are not allowed to share.
49
+ `);let i=await ke({trafficPath:n,format:r,server:e.server});try{let c=await Me({provider:a,model:e["ai-model"],baseline:s,samplesByOperation:i,concurrency:e["ai-concurrency"]});o=c.yaml,S.info(`AI refinement complete: ${c.refined} of ${c.total} operation(s) refined (${a}).
50
+ `)}catch(c){S.warn(`AI refinement failed, falling back to the baseline description: ${c instanceof Error?c.message:String(c)}
51
+ `)}}e.output?(await Et(e.output,o),S.info(`Written to: ${I(e.output)}
52
+ `)):S.output(o),S.info(`Done in ${ie(t)}.
53
+ `)}export{bn as handleGenerateSpec};
@@ -0,0 +1,22 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ import { fileURLToPath as __fileURLToPath } from 'node:url';
3
+ import { dirname as __pathDirname } from 'node:path';
4
+ const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
7
+ import{b as R}from"./TFPMT2XD.js";import{b as A,c as J,d as ie,e as W,f as ce,g as le,h as ue,i as me,j as fe}from"./BZTZIEWS.js";import{a as te,b as se,c as x,d as b,e as v,f as j,g as L,h as P,j as O,k as N,l as re,n as oe}from"./A65OW7M7.js";import{a as F}from"./WZXA5XPB.js";import{ka as ae}from"./X22IMAJK.js";var T=x.java,w=class extends te{constructor(){super(" ")}typeName(n){return b(n,{style:"pascal",reserved:T})}memberName(n){return b(n,{style:"camel",reserved:T})}identifier(n){return b(n,{style:"camel",reserved:T})}identifiers(n,s){return v(n,{style:"camel",reserved:T,taken:s})}string(n){let s='"';for(let a of n){let r=a.codePointAt(0);a==="\\"?s+="\\\\":a==='"'?s+='\\"':a===`
8
+ `?s+="\\n":a==="\r"?s+="\\r":a===" "?s+="\\t":r<32||r===127?s+=`\\u${r.toString(16).padStart(4,"0")}`:r>=55296&&r<=57343?s+="\\uFFFD":s+=a}return s+'"'}literal(n){return n==null?"null":typeof n=="boolean"?String(n):typeof n=="number"?Number.isInteger(n)?`${n}L`:String(n):typeof n=="string"?this.string(n):Array.isArray(n)?`java.util.List.of(${n.map(a=>this.literal(a)).join(", ")})`:`java.util.Map.of(${Object.entries(n).map(([a,r])=>`${this.string(a)}, ${this.literal(r)}`).join(", ")})`}comment(n){for(let s of de(n))this.line(s===""?"//":`// ${s}`);return this}doc(n,s){let a=de(s).map(r=>r.replaceAll("*/","*&#47;"));if(a.length===0)return this;if(a.length===1)return this.line(`/** ${n} \u2014 ${a[0]} */`);this.line("/**"),this.line(` * ${n} \u2014 ${a[0]}`);for(let r of a.slice(1))this.line(r===""?" *":` * ${r}`);return this.line(" */")}};function de(e){return re(e).map(n=>n.replaceAll("\\","\\u005c"))}var h=x.java,K=new w,$e=new Set([...[...R.replace(/\/\*[\s\S]*?\*\/|\/\/.*$/gm,"").replace(/'(?:[^'\\]|\\.)'/g,"''").replace(/"(?:[^"\\]|\\.)*"/g,'""').matchAll(/\b[A-Z][A-Za-z0-9]*\b/g)].map(e=>e[0]),"Servers","Void"]);function g(e){let n=K.typeName(e);return $e.has(n)?`${n}Model`:n}function D(e){return K.memberName(e)}function c(e){return K.string(e)}function Q(e,n){let s=b(e,{style:"pascal",reserved:h});if($e.has(s))throw new F(`The output file name "${e}" gives the Java class the name "${s}", which the SDK already uses for one of its own types. Choose another --output name, for example "${e}-sdk.ts".`);let a=n.schemas.find(r=>g(r.name)===s);if(a!==void 0)throw new F(`The output file name "${e}" gives the Java class the same name as the "${a.name}" schema, which cannot nest inside it. Choose another --output name, for example "${e}-sdk.ts".`);return s}function z(e){let n=G(e);return n===""?"api":/^[0-9]/.test(n)?`_${n}`:h.has(n)||n==="java"?`${n}_`:n}function G(e){return se.pascal(e).toLowerCase()}var Se=["getClass","hashCode","equals","clone","toString","notify","notifyAll","wait","finalize"],pe=["","WithHeaders","Pages","Items"];function Z(e){let n=new Set(Se),s=new Map;for(let a of e.services.flatMap(r=>r.operations)){let r=b(a.name,{style:"camel",reserved:h}),t=r;for(let o=2;pe.some(i=>n.has(t+i));o++)t=`${r}${o}`;for(let o of pe)n.add(t+o);s.set(a.name,t)}return s}function we(e){return le(e).map(s=>s.kind==="literal"?c(s.value):D(s.name)).join(" + ")}function he(e,n){let s=n.servers??[];if(s.length===0)return;let a=new Set;e.line("/** The declared servers; the description's defaults are in each method's doc. */"),e.block("public static final class Servers {",()=>{s.forEach((r,t)=>{let o=b(r.description??`server${t+1}`,{style:"camel",reserved:h});a.has(o)&&(o=`${o}${t+1}`),a.add(o);let i=r.variables.map(u=>`String ${D(u.name)}`),l=r.variables.map(u=>`${D(u.name)} default: ${c(u.default)}`).join(", ");t>0&&e.blank(),e.doc(o,`The ${c(r.description??r.url)} base URL${l===""?".":` (${l}).`}`),e.block(`public static String ${o}(${i.join(", ")}) {`,()=>{e.line(`return ${we(r)};`)},"}")})},"}"),e.blank()}function C(e,n){let s=n.schemas.find(o=>o.name===e);if(s===void 0)return"other";let a=s.schema,r=N(a);if(r!==void 0&&(r.scalar==="string"||r.scalar==="integer"))return"enum";if((a.kind==="object"||a.kind==="intersection")&&L(a,n)!==void 0)return"record";let t=P(a,n);return t!==void 0&&t.cases.length>0&&t.cases.every(o=>C(o.schemaName,n)==="record")?"union":"other"}var ge={string:"String",integer:"Long",number:"Double",boolean:"Boolean"};function be(e){let n=e.metadata?.format;return n==="date"||n==="date-time"}function $(e,n,s="string"){let a=O(e);switch(a.kind){case"scalar":if(s==="Date"&&a.scalar==="string"){if(a.metadata?.format==="date-time")return"OffsetDateTime";if(a.metadata?.format==="date")return"LocalDate"}return ge[a.scalar];case"array":return`List<${$(a.items,n,s)}>`;case"record":return`Map<String, ${$(a.value,n,s)}>`;case"ref":{if(C(a.name,n)!=="other")return g(a.name);let t=j(a,n);return t===void 0?"Object":$(t,n,s)}case"enum":return ge[a.scalar];case"literal":return typeof a.value=="string"?"String":typeof a.value=="boolean"?"Boolean":"Double";case"omit":return $({kind:"ref",name:a.base},n,s);case"union":case"null":case"object":case"intersection":case"unknown":return"Object"}}function k(e,n,s,a,r=0){let t=O(e);switch(t.kind){case"scalar":return a==="Date"&&t.scalar==="string"&&be(t)?t.metadata?.format==="date"?`asLocalDate(${n})`:`asOffsetDateTime(${n})`:`${Y[t.scalar]}(${n})`;case"enum":return`${Y[t.scalar]}(${n})`;case"literal":return`${Y[typeof t.value=="string"?"string":typeof t.value=="boolean"?"boolean":"number"]}(${n})`;case"omit":return k({kind:"ref",name:t.base},n,s,a,r);case"ref":{let o=C(t.name,s);if(o==="record")return`${g(t.name)}.fromJson(${n})`;if(o==="enum"){let l=N(j(t,s)).scalar==="string"?"asString":"asLong";return`${g(t.name)}.fromWire(${l}(${n}))`}if(o==="union")return`parse${g(t.name)}(${n})`;let i=j(t,s);return i===void 0?void 0:k(i,n,s,a,r)}case"array":case"record":{let o=r===0?"item":`item${r+1}`,i=k(t.kind==="array"?t.items:t.value,o,s,a,r+1)??o;return`${t.kind==="array"?"asList":"asMap"}(${n}, ${o} -> ${i})`}case"union":case"null":case"object":case"intersection":case"unknown":return}}var Y={string:"asString",integer:"asLong",number:"asDouble",boolean:"asBoolean"},je=["data","json","toJson","fromJson","hashCode","equals","toString","getClass","wait","notify","notifyAll","clone","finalize"];function Ae(e,n){let s=[];for(let a of n.schemas){if(C(a.name,n)!=="union")continue;P(a.schema,n).cases.some(t=>t.schemaName===e)&&s.push(g(a.name))}return s}function Ee(e,n,s,a,r,t){let o=s.map(m=>m.writeOnly?{...m,required:!1}:m),i=v(o.map(m=>m.name),{style:"camel",reserved:h,taken:je}),l=g(n),u=["JsonValue",...Ae(n,a)];e.doc(l,t),e.block(`public record ${l}(`,()=>{o.forEach((m,f)=>{let d=f<o.length-1?",":"";e.line(`${$(m.schema,a,r)} ${i[f]}${d}`)})},`) implements ${u.join(", ")} {`),e.indent(()=>{e.block(`public static ${l} fromJson(Object json) {`,()=>{e.line("Map<String, Object> data = asObject(json);"),e.block("if (data == null) {",()=>{e.line("return null;")},"}"),e.block(`return new ${l}(`,()=>{o.forEach((m,f)=>{let d=`data.get(${c(m.name)})`,y=f<o.length-1?",":"";e.line(`${k(m.schema,d,a,r)??d}${y}`)})},");")},"}"),e.blank(),e.line("@Override"),e.block("public Map<String, Object> toJson() {",()=>{e.line("Map<String, Object> data = new LinkedHashMap<>();"),o.forEach((m,f)=>{let d=`data.put(${c(m.name)}, ${i[f]});`;m.required?e.line(d):e.block(`if (${i[f]} != null) {`,()=>{e.line(d)},"}")}),e.line("return data;")},"}")}),e.line("}"),e.blank()}function qe(e,n,s,a,r){let t=g(n),o=a==="string"?"String":"Long",i=N({kind:"enum",values:s,scalar:a}).memberNames;e.doc(t,r),e.block(`public enum ${t} implements WireValue {`,()=>{s.forEach((l,u)=>{let m=typeof l=="string"?c(l):`${l}L`;e.line(`${i[u]}(${m})${u<s.length-1?",":";"}`)}),e.blank(),e.line(`private final ${o} wire;`),e.blank(),e.block(`${t}(${o} wire) {`,()=>{e.line("this.wire = wire;")},"}"),e.blank(),e.line("@Override"),e.block(`public ${o} wire() {`,()=>{e.line("return wire;")},"}"),e.blank(),e.line("/** The member for a wire value; null for null, an exception for an unknown value. */"),e.block(`public static ${t} fromWire(${o} wire) {`,()=>{e.block("if (wire == null) {",()=>{e.line("return null;")},"}"),e.block(`for (${t} member : values()) {`,()=>{e.block("if (member.wire.equals(wire)) {",()=>{e.line("return member;")},"}")},"}"),e.line(`throw new IllegalArgumentException("Unknown ${t} value: " + wire);`)},"}")},"}"),e.blank()}function X(e,n,s="string"){for(let{name:a,schema:r}of n.schemas){let t=N(r);if(t!==void 0&&(t.scalar==="string"||t.scalar==="integer")){qe(e,a,t.values,t.scalar,r.description);continue}if(r.kind==="object"||r.kind==="intersection"){let i=L(r,n);if(i!==void 0){Ee(e,a,i.properties,n,s,i.description??r.description);continue}}let o=P(r,n);if(o!==void 0){let i=g(a),l=C(a,n)==="union",u=o.cases.map(m=>`${m.value} -> ${g(m.schemaName)}`).join(", ");e.doc(i,`A discriminated union on ${c(o.property)}: ${u}.`),l&&(e.line(`public sealed interface ${i} extends JsonValue {}`),e.blank()),e.block(`public static ${l?i:"Object"} parse${i}(Object json) {`,()=>{e.line("Map<String, Object> data = asObject(json);"),e.block("if (data == null) {",()=>{e.line("return null;")},"}"),e.block(`switch (String.valueOf(data.get(${c(o.property)}))) {`,()=>{for(let m of o.cases){let f={kind:"ref",name:m.schemaName},d=k(f,"data",n,s)??"data";e.line(`case ${c(m.value)}:`),e.indent(()=>e.line(`return ${d};`))}e.line("default:"),e.indent(()=>e.line(l?`throw new IllegalArgumentException("Unknown ${o.property} value: " + data.get(${c(o.property)}));`:"return data;"))},"}")},"}"),e.blank();continue}}}function Oe(e,n="string"){let s=new w;return X(s,e,n),s.toString()}function Ne(e,n){return`List.of(${ue(e,n).map(a=>`List.of(${a.map(t=>t.kind==="apiKey"?`new SecuritySpec(${c(t.scheme)}, "apiKey", ${c(t.name)}, ${c(t.in)})`:`SecuritySpec.of(${c(t.scheme)}, ${c(t.kind)})`).join(", ")})`).join(", ")})`}function Re(e){if(e===void 0)return"null";let n=s=>s===void 0?"null":c(s);return`new PaginationSpec(${[c(e.style),n(e.param),n(e.nextCursor),n(e.hasMore),n(e.nextLink),n(e.limitParam),n(e.items)].join(", ")})`}function I(e,n,s){return`new Operation(${c(e.specName??e.name)}, ${c(e.method.toUpperCase())}, ${c(e.path)}, ${Ne(e,n)}, ${Re(s)})`}function ee(e,n){let s=e.successResponseHeaders??[],a=v(s.map(t=>t.name),{style:"camel",reserved:h});return`new String[][] {${s.map((t,o)=>{let i=oe(t.schema,n);return`{${c(t.name)}, ${c(a[o])}, ${c(i)}}`}).join(", ")}}`}var Ce=["body","params","op","auth","query","url","spec","payload","response","data","headers","extraHeaders","pageParams","call","base","item","page","config"];function ye(e){return W(e)||e.requestBody!==void 0&&ce(e.requestBody.contentType)}function V(e,n,s){if(e.queryParams.length!==0)return v([`${n}Params`],{style:"pascal",reserved:h,taken:s.schemas.map(a=>g(a.name))})[0]}function U(e,n,s,a,r){let t=v(e.pathParams.map(f=>f.name),{style:"camel",reserved:h,taken:Ce}),o=v(e.queryParams.map(f=>f.name),{style:"camel",reserved:h}),i=e.pathParams.map((f,d)=>({java:t[d],wire:f.name})),l=e.queryParams.map((f,d)=>({java:o[d],wire:f.name,type:$(f.schema,s,r),isArray:j(O(f.schema),s)?.kind==="array"})),u=V(e,n,s),m=[...e.pathParams.map((f,d)=>`${$(f.schema,s,r)} ${t[d]}`),...a&&e.requestBody?[`${ye(e)?"Object":$(e.requestBody.schema,s,r)} body`]:[],...u===void 0?[]:[`${u} params`]];return{pathArgs:i,queryFields:l,paramsClass:u,signature:m}}function ve(e,n,s,a,r){let{queryFields:t,paramsClass:o}=U(n,s,a,!1,r);o!==void 0&&(e.line(`/** The query parameters of ${s}; an unset field is not sent. */`),e.block(`public static final class ${o} {`,()=>{for(let i of t)e.line(`public ${i.type} ${i.java};`);for(let i of t)e.blank(),e.block(`public ${o} ${i.java}(${i.type} ${i.java}) {`,()=>{e.line(`this.${i.java} = ${i.java};`),e.line("return this;")},"}")},"}"),e.blank())}function B(e,n,s){n.paramsClass!==void 0&&e.block("if (params != null) {",()=>{for(let a of n.queryFields)e.block(`if (params.${a.java} != null) {`,()=>{a.isArray?e.block(`for (Object item : params.${a.java}) {`,()=>{e.line(`addQuery(${s}, ${c(a.wire)}, item);`)},"}"):e.line(`addQuery(${s}, ${c(a.wire)}, params.${a.java});`)},"}")},"}")}function H(e){return`buildUrl(config.serverUrl, op.path(), pathParams(${e.pathArgs.map(({java:s,wire:a})=>`${c(a)}, textValue(${s})`).join(", ")}))`}function ne(e,n,s,a,r,t,o=!1){let i=U(n,s,a,!0,r),l=J(n),u=A(n),m=l===void 0&&u===void 0&&n.successResponses.some(S=>S.contentType!==""),f=u!==void 0?$(u,a,r):m?"byte[]":"void",d=o?`Envelope<${f==="void"?"Void":f}>`:l!==void 0?"Iterable<ServerSentEvent>":f,y=o?`${s}WithHeaders`:s;e.doc(y,o?`Like ${s}, returning an Envelope with the declared response headers.`:n.summary??`${n.method.toUpperCase()} ${n.path}`),e.block(`public ${d} ${y}(${i.signature.join(", ")}) {`,()=>{if(e.line(`Operation op = ${I(n,a,t)};`),l!==void 0){let E=l.schema!==void 0&&l.schema.kind!=="unknown";e.line("Map<String, List<String>> base = new LinkedHashMap<>();"),B(e,i,"base"),e.line(`String url = ${H(i)};`),e.block("return iterSse(extraHeaders -> {",()=>{e.line("ResolvedAuth auth = resolveAuth(op.security(), config.auth);"),e.line("Map<String, List<String>> query = cloneQuery(auth.query());"),e.line("query.putAll(base);"),e.line("Map<String, String> headers = new LinkedHashMap<>(auth.headers());"),e.line("headers.putAll(extraHeaders);"),e.line("return send(config, new RequestSpec(op.id(), op.method(), url).headers(headers).query(query));")},`}, ${E});`);return}if(e.line("ResolvedAuth auth = resolveAuth(op.security(), config.auth);"),e.line("Map<String, List<String>> query = auth.query();"),B(e,i,"query"),e.line(`String url = ${H(i)};`),e.line("RequestSpec spec = new RequestSpec(op.id(), op.method(), url).headers(auth.headers()).query(query);"),n.requestBody!==void 0){let E=c(n.requestBody.contentType),_=W(n)?"multipartBody(body)":ye(n)?`binaryBody(body, ${E})`:ie(n)?"multipartBody(body)":`jsonBody(body, ${E})`;e.line(`Body payload = ${_};`),e.line("spec.body(payload.body(), payload.contentType());")}e.line("HttpResponse<InputStream> response = send(config, spec);"),e.block("if (response.statusCode() >= 400) {",()=>{e.line("throw apiErrorFrom(response, url);")},"}");let S=m?"readBody(response)":u===void 0?void 0:k(u,"decodeJson(response)",a,r)??"decodeJson(response)";if(o){S===void 0?(e.line("readBody(response);"),e.line(`return new Envelope<>(null, readEnvelopeHeaders(response, ${ee(n,a)}), response.statusCode());`)):(e.line(`${f} data = ${S};`),e.line(`return new Envelope<>(data, readEnvelopeHeaders(response, ${ee(n,a)}), response.statusCode());`));return}if(S===void 0){e.line("readBody(response);");return}e.line(`return ${S};`)},"}"),e.blank()}function ke(e,n,s,a,r,t){let o=U(n,s,a,!1,r),i=A(n),l=i===void 0?"Object":$(i,a,r),u=me(i,t.items,a),m=u===void 0?"Object":$(u,a,r),f=i===void 0?"page":k(i,"page",a,r)??"page",d=u===void 0?"item":k(u,"item",a,r,1)??"item",y=()=>{e.line(`Operation op = ${I(n,a,t)};`),e.line("Map<String, List<String>> base = new LinkedHashMap<>();"),B(e,o,"base"),e.block("PageCall call = pageParams -> {",()=>{e.line("ResolvedAuth auth = resolveAuth(op.security(), config.auth);"),e.line("Map<String, List<String>> query = cloneQuery(auth.query());"),e.line("query.putAll(pageParams);"),e.line(`String url = ${H(o)};`),e.line("HttpResponse<InputStream> response = send(config, new RequestSpec(op.id(), op.method(), url).headers(auth.headers()).query(query));"),e.block("if (response.statusCode() >= 400) {",()=>{e.line("throw apiErrorFrom(response, url);")},"}"),e.line("return new PageResult(decodeJson(response), response);")},"};")};e.line(`/** ${s} response pages, following the pagination rule automatically. */`),e.block(`public Iterable<${l}> ${s}Pages(${o.signature.join(", ")}) {`,()=>{y(),e.line(`return mapIterable(iterPages(call, op.pagination(), base), page -> ${f});`)},"}"),e.blank(),e.line(`/** The items of every ${s} page. */`),e.block(`public Iterable<${m}> ${s}Items(${o.signature.join(", ")}) {`,()=>{y(),e.line(`return mapIterable(flattenItems(iterPages(call, op.pagination(), base), op.pagination().items()), item -> ${d});`)},"}"),e.blank()}function Pe(){return R.split(`
9
+ `).filter(e=>e.startsWith("import "))}function Je(){let e=R.split(`
10
+ `),n=e.findIndex(a=>a.startsWith("abstract class Runtime {")),s=e.lastIndexOf("}");return e.slice(n+1,s).map(a=>a.startsWith(" ")?a.slice(4):a)}var En=({model:e,output:n,banner:s,emit:a,pagination:r})=>{let t=new w,o=a.dateType??"string",i=Q(n.stem,e),l=z(e.title);l!==G(e.title)&&ae.warn(`generate-client: the API title ${JSON.stringify(e.title)} cannot be a Java package as is, so the java SDK uses package "${l}" \u2014 rename the API title in the description to choose another.
11
+ `);let u=a.runtime==="module",m=`${i}Runtime`,f=e.services.flatMap(p=>p.operations),d=Z(e),y=new Map;for(let p of f){let q=r?.get(p.name)?.spec;q!==void 0&&y.set(p.name,q)}t.line(`// Code generated by @redocly/client-generator (java) from ${c(e.title)} ${e.version}. DO NOT EDIT.`),t.line("// Regenerate with `redocly generate-client`. Java >= 17, standard library only \u2014 zero dependencies."),t.blank(),t.line(`package ${l};`),t.blank();for(let p of Pe())t.line(p);t.blank(),t.doc(i,`Client for ${e.title} (${e.version}).`),t.block(`public final class ${i}${u?` extends ${m}`:""} {`,()=>{if(X(t,e,o),he(t,e),!u){t.line("// \u2500\u2500\u2500 Embedded runtime (@redocly/client-generator java runtime) \u2500\u2500\u2500");for(let p of Je())t.line(p);t.blank()}for(let p of f)ve(t,p,d.get(p.name),e,o);t.line("private final Config config;"),t.blank(),t.block(`public ${i}(Config config) {`,()=>{t.line("this.config = config;"),t.block("if (config.serverUrl.isEmpty()) {",()=>{t.line(`config.serverUrl = ${c(a.serverUrl??e.serverUrl??"")};`)},"}")},"}"),t.blank(),t.block(`public ${i}() {`,()=>{t.line("this(new Config());")},"}"),t.blank();for(let p of f){let q=d.get(p.name),M=y.get(p.name);ne(t,p,q,e,o,M),J(p)===void 0&&(p.successResponseHeaders?.length??0)>0&&ne(t,p,q,e,o,M,!0),M!==void 0&&ke(t,p,q,e,o,M)}},"}");let S={path:n.path.replace(/[^\\/]+$/,`${i}.java`),content:t.toString()};if(!u)return[S];let E=s.map(p=>`// ${p}`).join(`
12
+ `),_=R.replace(/^abstract class Runtime \{$/m,`public abstract class ${m} {`);return[S,{path:n.path.replace(/[^\\/]+$/,`${m}.java`),content:`${E}
13
+ package ${l};
14
+
15
+ ${_.replace(/^\/\/.*\n/gm,"").trimStart().trimEnd()}
16
+ `}]};function Me(e,n){let s=n.emit.dateType??"string",a=n.outputPath.replace(/^.*[\\/]/,"").replace(/\.[^.]+$/,""),r=Q(a,n.model),t=Z(n.model).get(e.name)??b(e.name,{reserved:h}),o=[...e.pathParams.map(u=>c(`<${b(u.name,{reserved:h})}>`)),...e.requestBody?["body"]:[],...V(e,t,n.model)===void 0?[]:[`new ${r}.${V(e,t,n.model)}()`]],i=`client.${t}(${o.join(", ")})`,l=J(e)!==void 0?`for (var event : ${i}) {
17
+ System.out.println(event.data());
18
+ }`:A(e)===void 0?`${i};`:`${$(A(e),n.model,s)} result = ${i};`;return{lang:"java",label:"Java SDK",source:`import ${z(n.model.title)}.${r};
19
+
20
+ ${r} client = new ${r}(new ${r}.Config());
21
+ ${l}
22
+ `}}var qn=({model:e,output:n,emit:s,pagination:a})=>[{path:n.path.replace(/\.[^.\\/]+$/,".java.md"),content:fe(e,{title:`${e.title} Java SDK reference`,frontmatter:s.docsFrontmatter===!0,language:{name:"java",label:"Java",fence:"java",requires:"The SDK needs Java 17 or newer and the standard library only."},sample:r=>Me(r,{model:e,emit:s,outputPath:n.path}),paginated:new Set(a?.keys()??[])})}];export{$ as a,Oe as b,En as c,Me as d,qn as e};
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a as x,b as y,c as g,d}from"./5AVTCY6F.js";import{b as P,d as h,e as m}from"./R32HBYOH.js";import{m as v}from"./5CR6AOLY.js";import{join as B}from"node:path";function b(e,t){let n=x(e,"tanstack-query");if(n.length===0)return"";let r=t.pagination??new Map;return[I(n,t,r),...n.some(s=>M(s,r))?[j]:[],...n.filter(y).map(s=>F(s,t.queryKeyPrefix)),S(e,n,r,t.queryKeyPrefix,t.argsStyle),...E(n,r)].join(`
7
+ import{a as x,b as y,c as g,d}from"./HM7M6465.js";import{b as P,d as h,e as m}from"./ZXB5O6JQ.js";import{m as v}from"./A65OW7M7.js";import{join as B}from"node:path";function b(e,t){let n=x(e,"tanstack-query");if(n.length===0)return"";let r=t.pagination??new Map;return[I(n,t,r),...n.some(s=>M(s,r))?[j]:[],...n.filter(y).map(s=>F(s,t.queryKeyPrefix)),S(e,n,r,t.queryKeyPrefix,t.argsStyle),...E(n,r)].join(`
8
8
  `)}function p(e,t){if(!y(e))return!1;let n=t.get(e.name);return n===void 0||n.spec.style==="link"?!1:n.spec.style!=="body-link"||e.queryParams.length>0}function M(e,t){return p(e,t)&&t.get(e.name)?.spec.style==="body-link"}var j=`/** The query parameters of a next-page link; a repeated key becomes an array. */
9
9
  const nextLinkQuery = (link: string) => {
10
10
  const query: Record<string, string | string[]> = {};
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a as Ate,b as Ote}from"./5HPO77VR.js";import{d as Rte}from"./3VOQMXIZ.js";import{b as Ete,e as Tte}from"./BH4FA7AH.js";import{O as xte,S as wte,ba as wP,c as bte,fa as o1,ga as Cte,ha as kte,la as k2,oa as Ste,t as yte}from"./FRQHCFKP.js";import"./NEWT5A6S.js";import{a as ru,b as vte,c as ar,d as Mqe,e as yl,f as Dqe}from"./RFWIIJFG.js";var Ute=ar(tn=>{"use strict";var SP=Symbol.for("react.transitional.element"),Fqe=Symbol.for("react.portal"),zqe=Symbol.for("react.fragment"),Bqe=Symbol.for("react.strict_mode"),Uqe=Symbol.for("react.profiler"),Hqe=Symbol.for("react.consumer"),Vqe=Symbol.for("react.context"),Wqe=Symbol.for("react.forward_ref"),Gqe=Symbol.for("react.suspense"),jqe=Symbol.for("react.memo"),Lte=Symbol.for("react.lazy"),Yqe=Symbol.for("react.activity"),Ite=Symbol.iterator;function qqe(i){return i===null||typeof i!="object"?null:(i=Ite&&i[Ite]||i["@@iterator"],typeof i=="function"?i:null)}var Mte={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Dte=Object.assign,Fte={};function E2(i,s,u){this.props=i,this.context=s,this.refs=Fte,this.updater=u||Mte}E2.prototype.isReactComponent={};E2.prototype.setState=function(i,s){if(typeof i!="object"&&typeof i!="function"&&i!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,i,s,"setState")};E2.prototype.forceUpdate=function(i){this.updater.enqueueForceUpdate(this,i,"forceUpdate")};function zte(){}zte.prototype=E2.prototype;function EP(i,s,u){this.props=i,this.context=s,this.refs=Fte,this.updater=u||Mte}var TP=EP.prototype=new zte;TP.constructor=EP;Dte(TP,E2.prototype);TP.isPureReactComponent=!0;var _te=Array.isArray;function kP(){}var Yi={H:null,A:null,T:null,S:null},Bte=Object.prototype.hasOwnProperty;function AP(i,s,u){var h=u.ref;return{$$typeof:SP,type:i,key:s,ref:h!==void 0?h:null,props:u}}function Zqe(i,s){return AP(i.type,s,i.props)}function RP(i){return typeof i=="object"&&i!==null&&i.$$typeof===SP}function Kqe(i){var s={"=":"=0",":":"=2"};return"$"+i.replace(/[=:]/g,function(u){return s[u]})}var Pte=/\/+/g;function CP(i,s){return typeof i=="object"&&i!==null&&i.key!=null?Kqe(""+i.key):s.toString(36)}function Xqe(i){switch(i.status){case"fulfilled":return i.value;case"rejected":throw i.reason;default:switch(typeof i.status=="string"?i.then(kP,kP):(i.status="pending",i.then(function(s){i.status==="pending"&&(i.status="fulfilled",i.value=s)},function(s){i.status==="pending"&&(i.status="rejected",i.reason=s)})),i.status){case"fulfilled":return i.value;case"rejected":throw i.reason}}throw i}function S2(i,s,u,h,m){var S=typeof i;(S==="undefined"||S==="boolean")&&(i=null);var v=!1;if(i===null)v=!0;else switch(S){case"bigint":case"string":case"number":v=!0;break;case"object":switch(i.$$typeof){case SP:case Fqe:v=!0;break;case Lte:return v=i._init,S2(v(i._payload),s,u,h,m)}}if(v)return m=m(i),v=h===""?"."+CP(i,0):h,_te(m)?(u="",v!=null&&(u=v.replace(Pte,"$&/")+"/"),S2(m,s,u,"",function(I){return I})):m!=null&&(RP(m)&&(m=Zqe(m,u+(m.key==null||i&&i.key===m.key?"":(""+m.key).replace(Pte,"$&/")+"/")+v)),s.push(m)),1;v=0;var N=h===""?".":h+":";if(_te(i))for(var O=0;O<i.length;O++)h=i[O],S=N+CP(h,O),v+=S2(h,s,u,S,m);else if(O=qqe(i),typeof O=="function")for(i=O.call(i),O=0;!(h=i.next()).done;)h=h.value,S=N+CP(h,O++),v+=S2(h,s,u,S,m);else if(S==="object"){if(typeof i.then=="function")return S2(Xqe(i),s,u,h,m);throw s=String(i),Error("Objects are not valid as a React child (found: "+(s==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":s)+"). If you meant to render a collection of children, use an array instead.")}return v}function s6(i,s,u){if(i==null)return i;var h=[],m=0;return S2(i,h,"","",function(S){return s.call(u,S,m++)}),h}function Jqe(i){if(i._status===-1){var s=i._result;s=s(),s.then(function(u){(i._status===0||i._status===-1)&&(i._status=1,i._result=u)},function(u){(i._status===0||i._status===-1)&&(i._status=2,i._result=u)}),i._status===-1&&(i._status=0,i._result=s)}if(i._status===1)return i._result.default;throw i._result}var Nte=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},Qqe={map:s6,forEach:function(i,s,u){s6(i,function(){s.apply(this,arguments)},u)},count:function(i){var s=0;return s6(i,function(){s++}),s},toArray:function(i){return s6(i,function(s){return s})||[]},only:function(i){if(!RP(i))throw Error("React.Children.only expected to receive a single React element child.");return i}};tn.Activity=Yqe;tn.Children=Qqe;tn.Component=E2;tn.Fragment=zqe;tn.Profiler=Uqe;tn.PureComponent=EP;tn.StrictMode=Bqe;tn.Suspense=Gqe;tn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Yi;tn.__COMPILER_RUNTIME={__proto__:null,c:function(i){return Yi.H.useMemoCache(i)}};tn.cache=function(i){return function(){return i.apply(null,arguments)}};tn.cacheSignal=function(){return null};tn.cloneElement=function(i,s,u){if(i==null)throw Error("The argument must be a React element, but you passed "+i+".");var h=Dte({},i.props),m=i.key;if(s!=null)for(S in s.key!==void 0&&(m=""+s.key),s)!Bte.call(s,S)||S==="key"||S==="__self"||S==="__source"||S==="ref"&&s.ref===void 0||(h[S]=s[S]);var S=arguments.length-2;if(S===1)h.children=u;else if(1<S){for(var v=Array(S),N=0;N<S;N++)v[N]=arguments[N+2];h.children=v}return AP(i.type,m,h)};tn.createContext=function(i){return i={$$typeof:Vqe,_currentValue:i,_currentValue2:i,_threadCount:0,Provider:null,Consumer:null},i.Provider=i,i.Consumer={$$typeof:Hqe,_context:i},i};tn.createElement=function(i,s,u){var h,m={},S=null;if(s!=null)for(h in s.key!==void 0&&(S=""+s.key),s)Bte.call(s,h)&&h!=="key"&&h!=="__self"&&h!=="__source"&&(m[h]=s[h]);var v=arguments.length-2;if(v===1)m.children=u;else if(1<v){for(var N=Array(v),O=0;O<v;O++)N[O]=arguments[O+2];m.children=N}if(i&&i.defaultProps)for(h in v=i.defaultProps,v)m[h]===void 0&&(m[h]=v[h]);return AP(i,S,m)};tn.createRef=function(){return{current:null}};tn.forwardRef=function(i){return{$$typeof:Wqe,render:i}};tn.isValidElement=RP;tn.lazy=function(i){return{$$typeof:Lte,_payload:{_status:-1,_result:i},_init:Jqe}};tn.memo=function(i,s){return{$$typeof:jqe,type:i,compare:s===void 0?null:s}};tn.startTransition=function(i){var s=Yi.T,u={};Yi.T=u;try{var h=i(),m=Yi.S;m!==null&&m(u,h),typeof h=="object"&&h!==null&&typeof h.then=="function"&&h.then(kP,Nte)}catch(S){Nte(S)}finally{s!==null&&u.types!==null&&(s.types=u.types),Yi.T=s}};tn.unstable_useCacheRefresh=function(){return Yi.H.useCacheRefresh()};tn.use=function(i){return Yi.H.use(i)};tn.useActionState=function(i,s,u){return Yi.H.useActionState(i,s,u)};tn.useCallback=function(i,s){return Yi.H.useCallback(i,s)};tn.useContext=function(i){return Yi.H.useContext(i)};tn.useDebugValue=function(){};tn.useDeferredValue=function(i,s){return Yi.H.useDeferredValue(i,s)};tn.useEffect=function(i,s){return Yi.H.useEffect(i,s)};tn.useEffectEvent=function(i){return Yi.H.useEffectEvent(i)};tn.useId=function(){return Yi.H.useId()};tn.useImperativeHandle=function(i,s,u){return Yi.H.useImperativeHandle(i,s,u)};tn.useInsertionEffect=function(i,s){return Yi.H.useInsertionEffect(i,s)};tn.useLayoutEffect=function(i,s){return Yi.H.useLayoutEffect(i,s)};tn.useMemo=function(i,s){return Yi.H.useMemo(i,s)};tn.useOptimistic=function(i,s){return Yi.H.useOptimistic(i,s)};tn.useReducer=function(i,s,u){return Yi.H.useReducer(i,s,u)};tn.useRef=function(i){return Yi.H.useRef(i)};tn.useState=function(i){return Yi.H.useState(i)};tn.useSyncExternalStore=function(i,s,u){return Yi.H.useSyncExternalStore(i,s,u)};tn.useTransition=function(){return Yi.H.useTransition()};tn.version="19.2.7"});var Hte=ar((Jr,l6)=>{"use strict";process.env.NODE_ENV!=="production"&&(function(){function i(ee,Ee){Object.defineProperty(h.prototype,ee,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",Ee[0],Ee[1])}})}function s(ee){return ee===null||typeof ee!="object"?null:(ee=Nr&&ee[Nr]||ee["@@iterator"],typeof ee=="function"?ee:null)}function u(ee,Ee){ee=(ee=ee.constructor)&&(ee.displayName||ee.name)||"ReactClass";var tt=ee+"."+Ee;yn[tt]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",Ee,ee),yn[tt]=!0)}function h(ee,Ee,tt){this.props=ee,this.context=Ee,this.refs=Pn,this.updater=tt||ur}function m(){}function S(ee,Ee,tt){this.props=ee,this.context=Ee,this.refs=Pn,this.updater=tt||ur}function v(){}function N(ee){return""+ee}function O(ee){try{N(ee);var Ee=!1}catch{Ee=!0}if(Ee){Ee=console;var tt=Ee.error,ht=typeof Symbol=="function"&&Symbol.toStringTag&&ee[Symbol.toStringTag]||ee.constructor.name||"Object";return tt.call(Ee,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",ht),N(ee)}}function I(ee){if(ee==null)return null;if(typeof ee=="function")return ee.$$typeof===$n?null:ee.displayName||ee.name||null;if(typeof ee=="string")return ee;switch(ee){case _n:return"Fragment";case Me:return"Profiler";case cr:return"StrictMode";case Gt:return"Suspense";case Mt:return"SuspenseList";case hr:return"Activity"}if(typeof ee=="object")switch(typeof ee.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),ee.$$typeof){case kr:return"Portal";case wt:return ee.displayName||"Context";case nt:return(ee._context.displayName||"Context")+".Consumer";case or:var Ee=ee.render;return ee=ee.displayName,ee||(ee=Ee.displayName||Ee.name||"",ee=ee!==""?"ForwardRef("+ee+")":"ForwardRef"),ee;case yt:return Ee=ee.displayName||null,Ee!==null?Ee:I(ee.type)||"Memo";case er:Ee=ee._payload,ee=ee._init;try{return I(ee(Ee))}catch{}}return null}function H(ee){if(ee===_n)return"<>";if(typeof ee=="object"&&ee!==null&&ee.$$typeof===er)return"<...>";try{var Ee=I(ee);return Ee?"<"+Ee+">":"<...>"}catch{return"<...>"}}function M(){var ee=br.A;return ee===null?null:ee.getOwner()}function Y(){return Error("react-stack-top-frame")}function J(ee){if(lo.call(ee,"key")){var Ee=Object.getOwnPropertyDescriptor(ee,"key").get;if(Ee&&Ee.isReactWarning)return!1}return ee.key!==void 0}function we(ee,Ee){function tt(){Un||(Un=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",Ee))}tt.isReactWarning=!0,Object.defineProperty(ee,"key",{get:tt,configurable:!0})}function ke(){var ee=I(this.type);return Eo[ee]||(Eo[ee]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),ee=this.props.ref,ee!==void 0?ee:null}function pe(ee,Ee,tt,ht,_t,qt){var Kt=tt.ref;return ee={$$typeof:lr,type:ee,key:Ee,props:tt,_owner:ht},(Kt!==void 0?Kt:null)!==null?Object.defineProperty(ee,"ref",{enumerable:!1,get:ke}):Object.defineProperty(ee,"ref",{enumerable:!1,value:null}),ee._store={},Object.defineProperty(ee._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(ee,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(ee,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:_t}),Object.defineProperty(ee,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:qt}),Object.freeze&&(Object.freeze(ee.props),Object.freeze(ee)),ee}function Fe(ee,Ee){return Ee=pe(ee.type,Ee,ee.props,ee._owner,ee._debugStack,ee._debugTask),ee._store&&(Ee._store.validated=ee._store.validated),Ee}function ze(ee){ft(ee)?ee._store&&(ee._store.validated=1):typeof ee=="object"&&ee!==null&&ee.$$typeof===er&&(ee._payload.status==="fulfilled"?ft(ee._payload.value)&&ee._payload.value._store&&(ee._payload.value._store.validated=1):ee._store&&(ee._store.validated=1))}function ft(ee){return typeof ee=="object"&&ee!==null&&ee.$$typeof===lr}function St(ee){var Ee={"=":"=0",":":"=2"};return"$"+ee.replace(/[=:]/g,function(tt){return Ee[tt]})}function mt(ee,Ee){return typeof ee=="object"&&ee!==null&&ee.key!=null?(O(ee.key),St(""+ee.key)):Ee.toString(36)}function Ve(ee){switch(ee.status){case"fulfilled":return ee.value;case"rejected":throw ee.reason;default:switch(typeof ee.status=="string"?ee.then(v,v):(ee.status="pending",ee.then(function(Ee){ee.status==="pending"&&(ee.status="fulfilled",ee.value=Ee)},function(Ee){ee.status==="pending"&&(ee.status="rejected",ee.reason=Ee)})),ee.status){case"fulfilled":return ee.value;case"rejected":throw ee.reason}}throw ee}function Lt(ee,Ee,tt,ht,_t){var qt=typeof ee;(qt==="undefined"||qt==="boolean")&&(ee=null);var Kt=!1;if(ee===null)Kt=!0;else switch(qt){case"bigint":case"string":case"number":Kt=!0;break;case"object":switch(ee.$$typeof){case lr:case kr:Kt=!0;break;case er:return Kt=ee._init,Lt(Kt(ee._payload),Ee,tt,ht,_t)}}if(Kt){Kt=ee,_t=_t(Kt);var Pr=ht===""?"."+mt(Kt,0):ht;return xn(_t)?(tt="",Pr!=null&&(tt=Pr.replace(Bo,"$&/")+"/"),Lt(_t,Ee,tt,"",function(Dr){return Dr})):_t!=null&&(ft(_t)&&(_t.key!=null&&(Kt&&Kt.key===_t.key||O(_t.key)),tt=Fe(_t,tt+(_t.key==null||Kt&&Kt.key===_t.key?"":(""+_t.key).replace(Bo,"$&/")+"/")+Pr),ht!==""&&Kt!=null&&ft(Kt)&&Kt.key==null&&Kt._store&&!Kt._store.validated&&(tt._store.validated=2),_t=tt),Ee.push(_t)),1}if(Kt=0,Pr=ht===""?".":ht+":",xn(ee))for(var yr=0;yr<ee.length;yr++)ht=ee[yr],qt=Pr+mt(ht,yr),Kt+=Lt(ht,Ee,tt,qt,_t);else if(yr=s(ee),typeof yr=="function")for(yr===ee.entries&&(kn||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),kn=!0),ee=yr.call(ee),yr=0;!(ht=ee.next()).done;)ht=ht.value,qt=Pr+mt(ht,yr++),Kt+=Lt(ht,Ee,tt,qt,_t);else if(qt==="object"){if(typeof ee.then=="function")return Lt(Ve(ee),Ee,tt,ht,_t);throw Ee=String(ee),Error("Objects are not valid as a React child (found: "+(Ee==="[object Object]"?"object with keys {"+Object.keys(ee).join(", ")+"}":Ee)+"). If you meant to render a collection of children, use an array instead.")}return Kt}function It(ee,Ee,tt){if(ee==null)return ee;var ht=[],_t=0;return Lt(ee,ht,"","",function(qt){return Ee.call(tt,qt,_t++)}),ht}function Pt(ee){if(ee._status===-1){var Ee=ee._ioInfo;Ee!=null&&(Ee.start=Ee.end=performance.now()),Ee=ee._result;var tt=Ee();if(tt.then(function(_t){if(ee._status===0||ee._status===-1){ee._status=1,ee._result=_t;var qt=ee._ioInfo;qt!=null&&(qt.end=performance.now()),tt.status===void 0&&(tt.status="fulfilled",tt.value=_t)}},function(_t){if(ee._status===0||ee._status===-1){ee._status=2,ee._result=_t;var qt=ee._ioInfo;qt!=null&&(qt.end=performance.now()),tt.status===void 0&&(tt.status="rejected",tt.reason=_t)}}),Ee=ee._ioInfo,Ee!=null){Ee.value=tt;var ht=tt.displayName;typeof ht=="string"&&(Ee.name=ht)}ee._status===-1&&(ee._status=0,ee._result=tt)}if(ee._status===1)return Ee=ee._result,Ee===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
7
+ import{a as Ate,b as Ote}from"./I2JZXLJ6.js";import{d as Rte}from"./PTBPNZRZ.js";import{b as Ete,e as Tte}from"./YA5KTHFN.js";import{T as xte,X as wte,c as bte,ga as wP,ka as o1,la as Cte,ma as kte,qa as k2,ta as Ste,u as yte}from"./X22IMAJK.js";import"./6RTITFQA.js";import{a as ru,b as vte,c as ar,d as Mqe,e as yl,f as Dqe}from"./RFWIIJFG.js";var Ute=ar(tn=>{"use strict";var SP=Symbol.for("react.transitional.element"),Fqe=Symbol.for("react.portal"),zqe=Symbol.for("react.fragment"),Bqe=Symbol.for("react.strict_mode"),Uqe=Symbol.for("react.profiler"),Hqe=Symbol.for("react.consumer"),Vqe=Symbol.for("react.context"),Wqe=Symbol.for("react.forward_ref"),Gqe=Symbol.for("react.suspense"),jqe=Symbol.for("react.memo"),Lte=Symbol.for("react.lazy"),Yqe=Symbol.for("react.activity"),Ite=Symbol.iterator;function qqe(i){return i===null||typeof i!="object"?null:(i=Ite&&i[Ite]||i["@@iterator"],typeof i=="function"?i:null)}var Mte={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Dte=Object.assign,Fte={};function E2(i,s,u){this.props=i,this.context=s,this.refs=Fte,this.updater=u||Mte}E2.prototype.isReactComponent={};E2.prototype.setState=function(i,s){if(typeof i!="object"&&typeof i!="function"&&i!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,i,s,"setState")};E2.prototype.forceUpdate=function(i){this.updater.enqueueForceUpdate(this,i,"forceUpdate")};function zte(){}zte.prototype=E2.prototype;function EP(i,s,u){this.props=i,this.context=s,this.refs=Fte,this.updater=u||Mte}var TP=EP.prototype=new zte;TP.constructor=EP;Dte(TP,E2.prototype);TP.isPureReactComponent=!0;var _te=Array.isArray;function kP(){}var Yi={H:null,A:null,T:null,S:null},Bte=Object.prototype.hasOwnProperty;function AP(i,s,u){var h=u.ref;return{$$typeof:SP,type:i,key:s,ref:h!==void 0?h:null,props:u}}function Zqe(i,s){return AP(i.type,s,i.props)}function RP(i){return typeof i=="object"&&i!==null&&i.$$typeof===SP}function Kqe(i){var s={"=":"=0",":":"=2"};return"$"+i.replace(/[=:]/g,function(u){return s[u]})}var Pte=/\/+/g;function CP(i,s){return typeof i=="object"&&i!==null&&i.key!=null?Kqe(""+i.key):s.toString(36)}function Xqe(i){switch(i.status){case"fulfilled":return i.value;case"rejected":throw i.reason;default:switch(typeof i.status=="string"?i.then(kP,kP):(i.status="pending",i.then(function(s){i.status==="pending"&&(i.status="fulfilled",i.value=s)},function(s){i.status==="pending"&&(i.status="rejected",i.reason=s)})),i.status){case"fulfilled":return i.value;case"rejected":throw i.reason}}throw i}function S2(i,s,u,h,m){var S=typeof i;(S==="undefined"||S==="boolean")&&(i=null);var v=!1;if(i===null)v=!0;else switch(S){case"bigint":case"string":case"number":v=!0;break;case"object":switch(i.$$typeof){case SP:case Fqe:v=!0;break;case Lte:return v=i._init,S2(v(i._payload),s,u,h,m)}}if(v)return m=m(i),v=h===""?"."+CP(i,0):h,_te(m)?(u="",v!=null&&(u=v.replace(Pte,"$&/")+"/"),S2(m,s,u,"",function(I){return I})):m!=null&&(RP(m)&&(m=Zqe(m,u+(m.key==null||i&&i.key===m.key?"":(""+m.key).replace(Pte,"$&/")+"/")+v)),s.push(m)),1;v=0;var N=h===""?".":h+":";if(_te(i))for(var O=0;O<i.length;O++)h=i[O],S=N+CP(h,O),v+=S2(h,s,u,S,m);else if(O=qqe(i),typeof O=="function")for(i=O.call(i),O=0;!(h=i.next()).done;)h=h.value,S=N+CP(h,O++),v+=S2(h,s,u,S,m);else if(S==="object"){if(typeof i.then=="function")return S2(Xqe(i),s,u,h,m);throw s=String(i),Error("Objects are not valid as a React child (found: "+(s==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":s)+"). If you meant to render a collection of children, use an array instead.")}return v}function s6(i,s,u){if(i==null)return i;var h=[],m=0;return S2(i,h,"","",function(S){return s.call(u,S,m++)}),h}function Jqe(i){if(i._status===-1){var s=i._result;s=s(),s.then(function(u){(i._status===0||i._status===-1)&&(i._status=1,i._result=u)},function(u){(i._status===0||i._status===-1)&&(i._status=2,i._result=u)}),i._status===-1&&(i._status=0,i._result=s)}if(i._status===1)return i._result.default;throw i._result}var Nte=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},Qqe={map:s6,forEach:function(i,s,u){s6(i,function(){s.apply(this,arguments)},u)},count:function(i){var s=0;return s6(i,function(){s++}),s},toArray:function(i){return s6(i,function(s){return s})||[]},only:function(i){if(!RP(i))throw Error("React.Children.only expected to receive a single React element child.");return i}};tn.Activity=Yqe;tn.Children=Qqe;tn.Component=E2;tn.Fragment=zqe;tn.Profiler=Uqe;tn.PureComponent=EP;tn.StrictMode=Bqe;tn.Suspense=Gqe;tn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Yi;tn.__COMPILER_RUNTIME={__proto__:null,c:function(i){return Yi.H.useMemoCache(i)}};tn.cache=function(i){return function(){return i.apply(null,arguments)}};tn.cacheSignal=function(){return null};tn.cloneElement=function(i,s,u){if(i==null)throw Error("The argument must be a React element, but you passed "+i+".");var h=Dte({},i.props),m=i.key;if(s!=null)for(S in s.key!==void 0&&(m=""+s.key),s)!Bte.call(s,S)||S==="key"||S==="__self"||S==="__source"||S==="ref"&&s.ref===void 0||(h[S]=s[S]);var S=arguments.length-2;if(S===1)h.children=u;else if(1<S){for(var v=Array(S),N=0;N<S;N++)v[N]=arguments[N+2];h.children=v}return AP(i.type,m,h)};tn.createContext=function(i){return i={$$typeof:Vqe,_currentValue:i,_currentValue2:i,_threadCount:0,Provider:null,Consumer:null},i.Provider=i,i.Consumer={$$typeof:Hqe,_context:i},i};tn.createElement=function(i,s,u){var h,m={},S=null;if(s!=null)for(h in s.key!==void 0&&(S=""+s.key),s)Bte.call(s,h)&&h!=="key"&&h!=="__self"&&h!=="__source"&&(m[h]=s[h]);var v=arguments.length-2;if(v===1)m.children=u;else if(1<v){for(var N=Array(v),O=0;O<v;O++)N[O]=arguments[O+2];m.children=N}if(i&&i.defaultProps)for(h in v=i.defaultProps,v)m[h]===void 0&&(m[h]=v[h]);return AP(i,S,m)};tn.createRef=function(){return{current:null}};tn.forwardRef=function(i){return{$$typeof:Wqe,render:i}};tn.isValidElement=RP;tn.lazy=function(i){return{$$typeof:Lte,_payload:{_status:-1,_result:i},_init:Jqe}};tn.memo=function(i,s){return{$$typeof:jqe,type:i,compare:s===void 0?null:s}};tn.startTransition=function(i){var s=Yi.T,u={};Yi.T=u;try{var h=i(),m=Yi.S;m!==null&&m(u,h),typeof h=="object"&&h!==null&&typeof h.then=="function"&&h.then(kP,Nte)}catch(S){Nte(S)}finally{s!==null&&u.types!==null&&(s.types=u.types),Yi.T=s}};tn.unstable_useCacheRefresh=function(){return Yi.H.useCacheRefresh()};tn.use=function(i){return Yi.H.use(i)};tn.useActionState=function(i,s,u){return Yi.H.useActionState(i,s,u)};tn.useCallback=function(i,s){return Yi.H.useCallback(i,s)};tn.useContext=function(i){return Yi.H.useContext(i)};tn.useDebugValue=function(){};tn.useDeferredValue=function(i,s){return Yi.H.useDeferredValue(i,s)};tn.useEffect=function(i,s){return Yi.H.useEffect(i,s)};tn.useEffectEvent=function(i){return Yi.H.useEffectEvent(i)};tn.useId=function(){return Yi.H.useId()};tn.useImperativeHandle=function(i,s,u){return Yi.H.useImperativeHandle(i,s,u)};tn.useInsertionEffect=function(i,s){return Yi.H.useInsertionEffect(i,s)};tn.useLayoutEffect=function(i,s){return Yi.H.useLayoutEffect(i,s)};tn.useMemo=function(i,s){return Yi.H.useMemo(i,s)};tn.useOptimistic=function(i,s){return Yi.H.useOptimistic(i,s)};tn.useReducer=function(i,s,u){return Yi.H.useReducer(i,s,u)};tn.useRef=function(i){return Yi.H.useRef(i)};tn.useState=function(i){return Yi.H.useState(i)};tn.useSyncExternalStore=function(i,s,u){return Yi.H.useSyncExternalStore(i,s,u)};tn.useTransition=function(){return Yi.H.useTransition()};tn.version="19.2.7"});var Hte=ar((Jr,l6)=>{"use strict";process.env.NODE_ENV!=="production"&&(function(){function i(ee,Ee){Object.defineProperty(h.prototype,ee,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",Ee[0],Ee[1])}})}function s(ee){return ee===null||typeof ee!="object"?null:(ee=Nr&&ee[Nr]||ee["@@iterator"],typeof ee=="function"?ee:null)}function u(ee,Ee){ee=(ee=ee.constructor)&&(ee.displayName||ee.name)||"ReactClass";var tt=ee+"."+Ee;yn[tt]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",Ee,ee),yn[tt]=!0)}function h(ee,Ee,tt){this.props=ee,this.context=Ee,this.refs=Pn,this.updater=tt||ur}function m(){}function S(ee,Ee,tt){this.props=ee,this.context=Ee,this.refs=Pn,this.updater=tt||ur}function v(){}function N(ee){return""+ee}function O(ee){try{N(ee);var Ee=!1}catch{Ee=!0}if(Ee){Ee=console;var tt=Ee.error,ht=typeof Symbol=="function"&&Symbol.toStringTag&&ee[Symbol.toStringTag]||ee.constructor.name||"Object";return tt.call(Ee,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",ht),N(ee)}}function I(ee){if(ee==null)return null;if(typeof ee=="function")return ee.$$typeof===$n?null:ee.displayName||ee.name||null;if(typeof ee=="string")return ee;switch(ee){case _n:return"Fragment";case Me:return"Profiler";case cr:return"StrictMode";case Gt:return"Suspense";case Mt:return"SuspenseList";case hr:return"Activity"}if(typeof ee=="object")switch(typeof ee.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),ee.$$typeof){case kr:return"Portal";case wt:return ee.displayName||"Context";case nt:return(ee._context.displayName||"Context")+".Consumer";case or:var Ee=ee.render;return ee=ee.displayName,ee||(ee=Ee.displayName||Ee.name||"",ee=ee!==""?"ForwardRef("+ee+")":"ForwardRef"),ee;case yt:return Ee=ee.displayName||null,Ee!==null?Ee:I(ee.type)||"Memo";case er:Ee=ee._payload,ee=ee._init;try{return I(ee(Ee))}catch{}}return null}function H(ee){if(ee===_n)return"<>";if(typeof ee=="object"&&ee!==null&&ee.$$typeof===er)return"<...>";try{var Ee=I(ee);return Ee?"<"+Ee+">":"<...>"}catch{return"<...>"}}function M(){var ee=br.A;return ee===null?null:ee.getOwner()}function Y(){return Error("react-stack-top-frame")}function J(ee){if(lo.call(ee,"key")){var Ee=Object.getOwnPropertyDescriptor(ee,"key").get;if(Ee&&Ee.isReactWarning)return!1}return ee.key!==void 0}function we(ee,Ee){function tt(){Un||(Un=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",Ee))}tt.isReactWarning=!0,Object.defineProperty(ee,"key",{get:tt,configurable:!0})}function ke(){var ee=I(this.type);return Eo[ee]||(Eo[ee]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),ee=this.props.ref,ee!==void 0?ee:null}function pe(ee,Ee,tt,ht,_t,qt){var Kt=tt.ref;return ee={$$typeof:lr,type:ee,key:Ee,props:tt,_owner:ht},(Kt!==void 0?Kt:null)!==null?Object.defineProperty(ee,"ref",{enumerable:!1,get:ke}):Object.defineProperty(ee,"ref",{enumerable:!1,value:null}),ee._store={},Object.defineProperty(ee._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(ee,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(ee,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:_t}),Object.defineProperty(ee,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:qt}),Object.freeze&&(Object.freeze(ee.props),Object.freeze(ee)),ee}function Fe(ee,Ee){return Ee=pe(ee.type,Ee,ee.props,ee._owner,ee._debugStack,ee._debugTask),ee._store&&(Ee._store.validated=ee._store.validated),Ee}function ze(ee){ft(ee)?ee._store&&(ee._store.validated=1):typeof ee=="object"&&ee!==null&&ee.$$typeof===er&&(ee._payload.status==="fulfilled"?ft(ee._payload.value)&&ee._payload.value._store&&(ee._payload.value._store.validated=1):ee._store&&(ee._store.validated=1))}function ft(ee){return typeof ee=="object"&&ee!==null&&ee.$$typeof===lr}function St(ee){var Ee={"=":"=0",":":"=2"};return"$"+ee.replace(/[=:]/g,function(tt){return Ee[tt]})}function mt(ee,Ee){return typeof ee=="object"&&ee!==null&&ee.key!=null?(O(ee.key),St(""+ee.key)):Ee.toString(36)}function Ve(ee){switch(ee.status){case"fulfilled":return ee.value;case"rejected":throw ee.reason;default:switch(typeof ee.status=="string"?ee.then(v,v):(ee.status="pending",ee.then(function(Ee){ee.status==="pending"&&(ee.status="fulfilled",ee.value=Ee)},function(Ee){ee.status==="pending"&&(ee.status="rejected",ee.reason=Ee)})),ee.status){case"fulfilled":return ee.value;case"rejected":throw ee.reason}}throw ee}function Lt(ee,Ee,tt,ht,_t){var qt=typeof ee;(qt==="undefined"||qt==="boolean")&&(ee=null);var Kt=!1;if(ee===null)Kt=!0;else switch(qt){case"bigint":case"string":case"number":Kt=!0;break;case"object":switch(ee.$$typeof){case lr:case kr:Kt=!0;break;case er:return Kt=ee._init,Lt(Kt(ee._payload),Ee,tt,ht,_t)}}if(Kt){Kt=ee,_t=_t(Kt);var Pr=ht===""?"."+mt(Kt,0):ht;return xn(_t)?(tt="",Pr!=null&&(tt=Pr.replace(Bo,"$&/")+"/"),Lt(_t,Ee,tt,"",function(Dr){return Dr})):_t!=null&&(ft(_t)&&(_t.key!=null&&(Kt&&Kt.key===_t.key||O(_t.key)),tt=Fe(_t,tt+(_t.key==null||Kt&&Kt.key===_t.key?"":(""+_t.key).replace(Bo,"$&/")+"/")+Pr),ht!==""&&Kt!=null&&ft(Kt)&&Kt.key==null&&Kt._store&&!Kt._store.validated&&(tt._store.validated=2),_t=tt),Ee.push(_t)),1}if(Kt=0,Pr=ht===""?".":ht+":",xn(ee))for(var yr=0;yr<ee.length;yr++)ht=ee[yr],qt=Pr+mt(ht,yr),Kt+=Lt(ht,Ee,tt,qt,_t);else if(yr=s(ee),typeof yr=="function")for(yr===ee.entries&&(kn||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),kn=!0),ee=yr.call(ee),yr=0;!(ht=ee.next()).done;)ht=ht.value,qt=Pr+mt(ht,yr++),Kt+=Lt(ht,Ee,tt,qt,_t);else if(qt==="object"){if(typeof ee.then=="function")return Lt(Ve(ee),Ee,tt,ht,_t);throw Ee=String(ee),Error("Objects are not valid as a React child (found: "+(Ee==="[object Object]"?"object with keys {"+Object.keys(ee).join(", ")+"}":Ee)+"). If you meant to render a collection of children, use an array instead.")}return Kt}function It(ee,Ee,tt){if(ee==null)return ee;var ht=[],_t=0;return Lt(ee,ht,"","",function(qt){return Ee.call(tt,qt,_t++)}),ht}function Pt(ee){if(ee._status===-1){var Ee=ee._ioInfo;Ee!=null&&(Ee.start=Ee.end=performance.now()),Ee=ee._result;var tt=Ee();if(tt.then(function(_t){if(ee._status===0||ee._status===-1){ee._status=1,ee._result=_t;var qt=ee._ioInfo;qt!=null&&(qt.end=performance.now()),tt.status===void 0&&(tt.status="fulfilled",tt.value=_t)}},function(_t){if(ee._status===0||ee._status===-1){ee._status=2,ee._result=_t;var qt=ee._ioInfo;qt!=null&&(qt.end=performance.now()),tt.status===void 0&&(tt.status="rejected",tt.reason=_t)}}),Ee=ee._ioInfo,Ee!=null){Ee.value=tt;var ht=tt.displayName;typeof ht=="string"&&(Ee.name=ht)}ee._status===-1&&(ee._status=0,ee._result=tt)}if(ee._status===1)return Ee=ee._result,Ee===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
8
8
 
9
9
  Your code should look like:
10
10
  const MyComponent = lazy(() => import('./MyComponent'))
@@ -4,5 +4,5 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a as p,b as a}from"./CRJEY7P3.js";import{h as c,m as l}from"./FAFMGLT6.js";import"./KFQC57GK.js";import{fa as i,la as n}from"./FRQHCFKP.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function w({argv:e,config:s,version:f}){let[r,o,...g]=e.project.split("/");if(!r||!o||g.length>0)throw new n(`Specify the project as \`<organization>/<project>\`, for example \`acme/developer-portal\`. Got: \`${e.project}\`.`);let t=c(s,e.residency),m=l(t,r,o),d=p(t,f);i.info(`Cloning ${r}/${o} from ${t}
7
+ import{a as p,b as a}from"./XTI7EXWX.js";import{h as c,m as l}from"./FLQQ3VRQ.js";import"./KFQC57GK.js";import{ka as i,qa as n}from"./X22IMAJK.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";async function w({argv:e,config:s,version:f}){let[r,o,...g]=e.project.split("/");if(!r||!o||g.length>0)throw new n(`Specify the project as \`<organization>/<project>\`, for example \`acme/developer-portal\`. Got: \`${e.project}\`.`);let t=c(s,e.residency),m=l(t,r,o),d=p(t,f);i.info(`Cloning ${r}/${o} from ${t}
8
8
  `);let{code:j}=await a(["clone",...d.flatMap(C=>["--config",C]),"--",m,e.directory??o]);if(j!==0)throw new n("git clone failed.")}export{w as handleProjectClone};
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a,b,c,d,e,f,g}from"./QTSECOQB.js";import"./FRQHCFKP.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{d as RESET_ESCAPE_CODE,c as calculateTotals,f as conditionallyMaskSecrets,b as generate,e as maskSecrets,a as parseRuntimeExpression,g as run};
7
+ import{a,b,c,d,e,f,g}from"./WEPGHS5R.js";import"./X22IMAJK.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";export{d as RESET_ESCAPE_CODE,c as calculateTotals,f as conditionallyMaskSecrets,b as generate,e as maskSecrets,a as parseRuntimeExpression,g as run};
@@ -4,6 +4,6 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a as X}from"./KFQC57GK.js";import{j as z,k as O,la as g,n as G,o as V,qa as Y,xa as J}from"./FRQHCFKP.js";import{e as W}from"./RFWIIJFG.js";var te=W(X(),1);var C=W(X(),1);function Z(){return process.env.HTTPS_PROXY||process.env.HTTP_PROXY||process.env.http_proxy||process.env.https_proxy}function K(o){let t=process.env.NO_PROXY||process.env.no_proxy;if(!t)return!1;let e=t.split(",").map(s=>s.trim().toLowerCase()).filter(Boolean);if(e.length===0)return!1;let r;try{r=new URL(o).hostname.toLowerCase()}catch{return!1}return e.some(s=>!!(s==="*"||r===s||s.startsWith(".")&&r.endsWith(s)||!s.startsWith(".")&&r.endsWith("."+s)))}var Q=async(o,{timeout:t,...e}={})=>{let r=Z(),s=r&&!K(o),n;s?n=new C.ProxyAgent({uri:r}):t&&(n=new C.Agent({connect:{timeout:t}}));try{return await(0,C.fetch)(o,{signal:t?AbortSignal.timeout(t):void 0,...e,dispatcher:n})}catch(i){throw await n?.destroy(),i}};var fe=/^[\x21-\x7e]+( [\x21-\x7e]+)*$/;function ee(){let o=process.env.REDOCLY_ENVIRONMENT?.trim();return o&&fe.test(o)?o:void 0}var u=class extends Error{status;constructor(t,e){super(t),this.status=e}},h=class{command;version;sunsetWarnings=[];constructor(t,e="2.0"){this.command=t,this.version=e}async request(t,e){let r=ee(),s={...e.headers,"user-agent":`redocly-cli/${this.version} ${this.command}${r?` ${r}`:""}`};try{let n=await Q(t,{...e,headers:s});return this.collectSunsetWarning(n),n}catch(n){let i=n.cause??n,a=`Failed to fetch. Caused by ${i.message||i.name}.`;throw typeof i.code=="string"&&(a+=` Code: ${i.code}`),new Error(a)}}collectSunsetWarning(t){let e=this.getSunsetDate(t);if(!e)return;let r=new Date(e);e>Date.now()?this.sunsetWarnings.push({sunsetDate:r,isSunsetExpired:!1}):this.sunsetWarnings.push({sunsetDate:r,isSunsetExpired:!0})}getSunsetDate(t){let{headers:e}=t;if(!e)return;let r=e.get("sunset")||e.get("Sunset");if(r)return Date.parse(r)}},P=class{client;domain;authHeaders;constructor(t,e,r){this.client=t,this.domain=e,this.authHeaders=r}projectUrl(t,e){return`${this.domain}/api/orgs/${encodeURIComponent(t)}/projects/${encodeURIComponent(e)}`}async fetchJson(t,e,r){try{let s=await this.client.request(t,{...e,headers:{"Content-Type":"application/json",...this.authHeaders}});return await this.getParsedResponse(s)}catch(s){let n=`${r}. ${s.message}`;throw s instanceof u?new u(n,s.status):new Error(n)}}async getParsedResponse(t){let e=await t.json();if(t.ok)return e;throw new u(`${e.title||t.statusText||"Unknown error"}.`,t.status)}},k=class extends P{async find(t,e){try{let r=await this.client.request(`${this.domain}/api/orgs/${encodeURIComponent(t)}/projects/${encodeURIComponent(e)}`,{timeout:6e3,method:"GET",headers:{"Content-Type":"application/json",...this.authHeaders}});return r.status===404?void 0:await this.getParsedResponse(r)}catch(r){let s=`Failed to fetch project. ${r.message}`;throw r instanceof u?new u(s,r.status):new Error(s)}}},D=class extends P{async getDefaultBranch(t,e){try{let r=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/sources`,{timeout:6e3,method:"GET",headers:{"Content-Type":"application/json",...this.authHeaders}}),s=await this.getParsedResponse(r),[n]=s.data;if(!n)throw new Error("Project source not found.");return n.branchName}catch(r){let s=`Failed to fetch default branch. ${r.message}`;throw r instanceof u?new u(s,r.status):new Error(s)}}async upsert(t,e,r){try{let s=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/remotes`,{timeout:6e3,method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders},body:JSON.stringify({mountPath:r.mountPath,mountBranchName:r.mountBranchName,type:"CICD",autoMerge:!0})});return await this.getParsedResponse(s)}catch(s){let n=`Failed to upsert remote. ${s.message}`;throw s instanceof u?new u(n,s.status):new Error(n)}}async push(t,e,r,s){let n=new te.FormData;n.append("remoteId",r.remoteId),n.append("commit[message]",r.commit.message),n.append("commit[author][name]",r.commit.author.name),n.append("commit[author][email]",r.commit.author.email),n.append("commit[branchName]",r.commit.branchName),r.commit.url&&n.append("commit[url]",r.commit.url),r.commit.namespace&&n.append("commit[namespaceId]",r.commit.namespace),r.commit.sha&&n.append("commit[sha]",r.commit.sha),r.commit.repository&&n.append("commit[repositoryId]",r.commit.repository),r.commit.createdAt&&n.append("commit[createdAt]",r.commit.createdAt);for(let i of s){let a=Buffer.isBuffer(i.stream)?new Blob([i.stream]):new Blob([await me(i.stream)]);n.append(`files[${i.path}]`,a,i.path)}r.isMainBranch&&n.append("isMainBranch","true"),r.replace&&n.append("replace","true");try{let i=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/pushes`,{method:"POST",headers:{...this.authHeaders},body:n});return await this.getParsedResponse(i)}catch(i){let a=`Failed to push. ${i.message}`;throw i instanceof u?new u(a,i.status):new Error(a)}}async getPush({organizationId:t,projectId:e,pushId:r}){try{let s=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/pushes/${r}`,{timeout:6e3,method:"GET",headers:{"Content-Type":"application/json",...this.authHeaders}});return await this.getParsedResponse(s)}catch(s){let n=`Failed to get push status. ${s.message}`;throw s instanceof u?new u(n,s.status):new Error(n)}}},F=class extends P{create(t,e,r){return this.fetchJson(`${this.projectUrl(t,e)}/pull-requests`,{method:"POST",body:JSON.stringify(r)},"Failed to open a pull request")}async findLatest(t,e,r){let s=new URLSearchParams({branchName:r,limit:"1"}),{data:n}=await this.fetchJson(`${this.projectUrl(t,e)}/pull-requests?${s}`,{method:"GET",timeout:6e3},"Failed to get the pull request");return n[0]}listChecks(t,e,r){return this.fetchJson(`${this.projectUrl(t,e)}/pull-requests/${encodeURIComponent(r)}/checks`,{method:"GET",timeout:6e3},"Failed to get the checks")}},j=class extends P{async findLatestByCommit(t,e,r){let s=new URLSearchParams({limit:"1",filter:`commitHash:${r}`}),{data:n}=await this.fetchJson(`${this.projectUrl(t,e)}/builds?${s}`,{method:"GET",timeout:6e3},"Failed to get the build");return n[0]}},y=class{apiClient;projects;remotes;constructor({domain:t,apiKey:e,command:r,version:s}){this.apiClient=new h(r,s);let n={Authorization:`Bearer ${e}`};this.projects=new k(this.apiClient,t,n),this.remotes=new D(this.apiClient,t,n)}getSunsetWarning(){return re(this.apiClient.sunsetWarnings)}};function re(o){let[t]=[...o].sort((e,r)=>e.isSunsetExpired!==r.isSunsetExpired?e.isSunsetExpired?-1:1:e.sunsetDate>r.sunsetDate?1:-1);return t}async function me(o){let t=[];for await(let e of o)t.push(e);return Buffer.concat(t)}function ge(){if(process.env.REDOCLY_AUTHORIZATION)return process.env.REDOCLY_AUTHORIZATION;throw new Error("No api key provided, please use environment variable REDOCLY_AUTHORIZATION.")}var we=/^http:\/\/(localhost|127\.0\.0\.1)(:\d+)?$/,E={us:"https://app.cloud.redocly.com",eu:"https://app.cloud.eu.redocly.com"};function ye(){return process.env.REDOCLY_DOMAIN||E.us}var ne=ve((o,t)=>{try{let e=t||o?.resolvedConfig.residency;return Te(e)?E[e]:e?new URL(e).origin:o?.resolvedConfig.scorecard?.fromProjectUrl?new URL(o.resolvedConfig.scorecard.fromProjectUrl).origin:E.us}catch{throw new $}});function S(o){try{ne(void 0,o)}catch{return!1}return!0}function ve(o){return(...t)=>{let e=o(...t);if(!e.startsWith("https://")&&!we.test(e))throw new $;return e}}var $=class extends Error{constructor(){super("Invalid Reunite URL")}};function Te(o){return typeof o=="string"&&o in E}import{Buffer as L}from"node:buffer";import A from"node:crypto";import{mkdirSync as Re,existsSync as oe,writeFileSync as Ce,readFileSync as Pe,rmSync as xe}from"node:fs";import{homedir as Ue}from"node:os";import ie from"node:path";import*as se from"node:child_process";var v=class{baseUrl;apiClient;clientName="redocly-cli";constructor(t,e){this.baseUrl=t,this.apiClient=new h("login",e)}async run(t){let e=await this.getDeviceCode();t?.({verificationUri:e.verificationUri,verificationUriComplete:e.verificationUriComplete,userCode:e.userCode}),this.openBrowser(e.verificationUriComplete);let r=await this.pollingAccessToken(e.deviceCode,e.interval,e.expiresIn);return this.withResidency(r)}openBrowser(t){if(!/^https?:\/\//.test(t))return;let[e,r]=process.platform==="win32"?["rundll32",["url.dll,FileProtocolHandler",t]]:process.platform==="darwin"?["open",[t]]:["xdg-open",[t]];se.spawn(e,r,{stdio:"ignore",detached:!0}).on("error",()=>{}).unref()}async verifyToken(t){try{return!!(await this.sendRequest("/session","GET",void 0,{Cookie:`accessToken=${t};`})).user}catch{return!1}}async verifyApiKey(t){try{return!!(await this.sendRequest("/api-keys-verify","POST",{apiKey:t})).success}catch{return!1}}async refreshToken(t){let e=await this.sendRequest("/device-rotate-token","POST",{grant_type:"refresh_token",client_name:this.clientName,refresh_token:t});if(!e.access_token)throw new Error("Failed to refresh token");return this.withResidency({access_token:e.access_token,refresh_token:e.refresh_token,expires_in:e.expires_in})}async pollingAccessToken(t,e,r){return new Promise((s,n)=>{let i=setInterval(async()=>{let c=await this.getAccessToken(t);c.access_token&&(clearInterval(i),clearTimeout(a),s(c)),c.error&&c.error!=="authorization_pending"&&(clearInterval(i),clearTimeout(a),n(c.error_description))},e*1e3),a=setTimeout(async()=>{clearInterval(i),clearTimeout(a),n("Authorization has expired. Please try again.")},r*1e3)})}async getAccessToken(t){return await this.sendRequest("/device-token","POST",{client_name:this.clientName,device_code:t,grant_type:"urn:ietf:params:oauth:grant-type:device_code"})}async getDeviceCode(){let{device_code:t,user_code:e,verification_uri:r,verification_uri_complete:s,interval:n=10,expires_in:i=300}=await this.sendRequest("/device-authorize","POST",{client_name:this.clientName});return{deviceCode:t,userCode:e,verificationUri:r,verificationUriComplete:s,interval:n,expiresIn:i}}async sendRequest(t,e="GET",r=void 0,s={}){let n=`${this.baseUrl}/api${t}`,i=await this.apiClient.request(n,{body:r&&JSON.stringify(r),method:e,headers:{"Content-Type":"application/json",...s},timeout:6e3});return i.status===204?{success:!0}:await i.json()}withResidency(t){return{...t,residency:this.baseUrl}}};var Ee="4618dbc9-8aed-4e27-aaf0-225f4603e5a4",ae="aes-256-cbc",H=class{version;credentialsFolderPath;credentialsFilePath;credentialsFileName;key;iv;constructor(t){this.version=t;let e=Ue();this.credentialsFolderPath=ie.join(e,".redocly"),this.credentialsFileName="credentials",this.credentialsFilePath=ie.join(this.credentialsFolderPath,this.credentialsFileName),this.key=A.createHash("sha256").update(`${this.credentialsFolderPath}${Ee}`).digest(),this.iv=A.createHash("md5").update(this.credentialsFolderPath).digest(),Re(this.credentialsFolderPath,{recursive:!0})}async login(t,e){let s=await new v(t,this.version).run(e);if(!s)throw new Error("Failed to login. No credentials received.");await this.saveCredentials(s)}async logout(){try{this.removeCredentials()}catch{}}async isAuthorized(t,e){return e?new v(t,this.version).verifyApiKey(e):!!await this.getAccessToken(t)}getAccessToken=async t=>{let e=new v(t,this.version),r=await this.readCredentials();if(!r||!S(t)||r.residency&&r.residency!==t)return null;if(await e.verifyToken(r.access_token))return r.access_token;try{let n=await e.refreshToken(r.refresh_token);return await this.saveCredentials(n),n.access_token}catch{return null}};async saveCredentials(t){try{let e=this.encryptCredentials(t);Ce(this.credentialsFilePath,e,"utf8")}catch(e){throw new Error(`Failed to save credentials: ${e.message}`)}}async readCredentials(){if(!oe(this.credentialsFilePath))return null;try{let t=Pe(this.credentialsFilePath,"utf8");return this.decryptCredentials(t)}catch{return null}}async removeCredentials(){oe(this.credentialsFilePath)&&xe(this.credentialsFilePath)}encryptCredentials(t){let e=A.createCipheriv(ae,this.key,this.iv);return L.concat([e.update(JSON.stringify(t),"utf8"),e.final()]).toString("hex")}decryptCredentials(t){let e=A.createDecipheriv(ae,this.key,this.iv),r=L.concat([e.update(L.from(t,"hex")),e.final()]);return JSON.parse(r.toString("utf8"))}};var $e=/^(https?:\/\/[^/]+)\/api\/orgs\/([^/]+)\/projects\/([^/]+)\/git\/?$/;function Se(o,t,e){return`${o}/api/orgs/${encodeURIComponent(t)}/projects/${encodeURIComponent(e)}/git`}function _e(o){let[,t,e,r]=o.match($e)??[];if(!(!t||!e||!r||!S(t)))return{reuniteUrl:t,organization:decodeURIComponent(e),project:decodeURIComponent(r)}}async function Ie({branch:o,title:t,description:e,base:r,draft:s,...n}){let{pullRequests:i}=ce(n,"project pr create");return i.create(n.organization,n.project,{branchName:o,title:t,description:e,targetBranchName:r,isDraft:s})}async function Fe({branch:o,...t}){let{pullRequests:e,builds:r}=ce(t,"project pr status"),{organization:s,project:n}=t,i=await e.findLatest(s,n,o);if(!i)return;let[a,c]=await Promise.all([e.listChecks(s,n,i.id),i.headCommitHash?r.findLatestByCommit(s,n,i.headCommitHash):void 0]);return{pullRequest:i,checks:a,previewUrl:c?.deploymentStatus==="SUCCESS"?c.url:void 0}}function ce({reuniteUrl:o,accessToken:t,version:e},r){let s=new h(r,e),n={Cookie:`accessToken=${t}`};return{pullRequests:new F(s,o,n),builds:new j(s,o,n)}}import*as T from"node:fs";import*as p from"node:path";var je=/\/orgs\/([^/]+)\/projects\//,Ae=[401,403];async function x(o,{organization:t,project:e,onSlugDeprecated:r}){let s=await Ne(o,t,e);if(!s)return{organizationId:t,projectId:e};let n={organizationId:Oe(s.uri),projectId:s.id};return(n.organizationId!==t||n.projectId!==e)&&r?.(n),n}async function Ne(o,t,e){try{let r=await o.projects.find(t,e);if(!r)throw new u(`Project "${e}" was not found in organization "${t}". Use the IDs from the organization and project settings in Reunite.`,404);return r}catch(r){if(r instanceof u&&Ae.includes(r.status))return;throw r}}function Oe(o){let t=o.match(je)?.[1];if(!t)throw new Error(`Could not read the organization ID from the project URI "${o}".`);return t}async function ke({domain:o,apiKey:t,organization:e,project:r,mountPath:s,files:n,defaultBranch:i,commit:a,version:c,replace:_,onUploadStart:I,onSunsetWarning:R,onSlugDeprecated:N}){let f=new y({domain:o,apiKey:t,command:"push",version:c});try{let{organizationId:d,projectId:l}=await x(f,{organization:e,project:r,onSlugDeprecated:N}),b=await f.remotes.getDefaultBranch(d,l),m=await f.remotes.upsert(d,l,{mountBranchName:b,mountPath:s});I?.(m);let{id:U}=await f.remotes.push(d,l,{remoteId:m.id,commit:a,isMainBranch:i===a.branchName,replace:_},n.map(M=>({path:G(M.name),stream:T.createReadStream(M.path)})));return{pushId:U,organizationId:d,projectId:l}}finally{let d=f.getSunsetWarning();d&&R?.(d)}}function De(o,t){let e={};for(let s of o)if(T.statSync(s).isDirectory()){let n=s;ue(n,[]).forEach(a=>r(a,n))}else r(s,p.dirname(s));function r(s,n){let i=p.relative(n,s);e[i]&&t?.(e[i],s),e[i]=s}return Object.entries(e).map(([s,n])=>({name:s,path:p.resolve(n)}))}function ue(o,t){let e=T.readdirSync(o);for(let r of e){let s=p.join(o,r);T.statSync(s).isDirectory()?t=ue(s,t):t.push(s)}return t}async function le({operation:o,condition:t,onConditionNotMet:e,startTime:r=Date.now(),retryTimeoutMs:s=6e5,retryIntervalMs:n=5e3}){async function i(){let a=await o();if(t(a))return a;if(Date.now()-r>s)throw new Error("Timeout exceeded.");return await e?.(a),await z(n),i()}return i()}var Le=1200,He=5e3,qe=["pending","running"];async function Be(o){let t=de(o);try{let e=await x(t,o);return await pe(t,e,o.pushId)}finally{he(t,o)}}async function be({buildType:o,maxExecutionTime:t=Le,retryIntervalMs:e=He,startTime:r=Date.now(),onRetry:s,...n}){let i=de(n);try{let a=await x(i,n);return await le({operation:()=>pe(i,a,n.pushId),condition:c=>!qe.includes(c.status[o].deploy.status),onConditionNotMet:s,startTime:r,retryTimeoutMs:t*1e3,retryIntervalMs:e})}finally{he(i,n)}}function de({domain:o,apiKey:t,version:e}){return new y({domain:o,apiKey:t,command:"push-status",version:e})}function he(o,{onSunsetWarning:t}){let e=o.getSunsetWarning();e&&t?.(e)}function pe(o,{organizationId:t,projectId:e},r){return o.remotes.getPush({organizationId:t,projectId:e,pushId:r})}async function Me({projectUrl:o,auth:t,isApiKey:e=!1,onDebug:r}){let s=We(o);if(!s)throw new g(`Invalid project URL format: ${o}`);try{let n=await ze({...s,auth:t,isApiKey:e,onDebug:r}),i=n.config.scorecardClassic||n.config.scorecard;if(!i)throw new Error("No scorecard configuration found.");let a=n.config.pluginsUrl,c=a?await Ge(a,r):void 0;return{scorecard:i,plugins:c,pluginsUrl:a}}catch(n){throw new g(n instanceof Error?n.message:String(n))}}function We(o){let t=new URL(o),e=t.pathname.match(/\/org\/(?<orgSlug>[^/]+)\/project\/(?<projectSlug>[^/]+)/);if(!e?.groups)return;let{orgSlug:r,projectSlug:s}=e.groups;return{residency:t.origin,orgSlug:r,projectSlug:s}}async function ze({residency:o,orgSlug:t,projectSlug:e,auth:r,isApiKey:s,onDebug:n}){let i=new URL(`${o}/api/orgs/${t}/projects/${e}`),a=await fetch(i,{headers:Ve(r,s)});if(n?.(`Project fetch response status: ${a.status}`),a.status===401||a.status===403)throw n?.(`Authentication failed with status ${a.status}.`),n?.("Check that your credentials are valid and have the necessary permissions."),new Error(`Unauthorized access to project: ${e}. Please check your credentials.`);if(a.status!==200)throw new Error(`Failed to fetch project: ${e}. Status: ${a.status}`);return n?.("Successfully received project configuration."),a.json()}async function Ge(o,t){t?.(`Fetching plugins from: ${o}`);try{let e=await fetch(o);if(t?.(`Plugins fetch response status: ${e.status}`),e.status!==200){t?.("Failed to fetch plugins");return}return e.text()}catch(e){t?.(`Error fetching plugins: ${e instanceof Error?e.message:String(e)}`);return}}function Ve(o,t){return t?{Authorization:`Bearer ${o}`}:{Cookie:`accessToken=${o}`}}async function q(o,t,e=[],r=[],s){let n={};for(let i of e){let a={[i.name]:{root:o,rules:t}},c=await Y({apis:a,...i,plugins:r},{configPath:s});n[i.name]=c.forAlias(i.name)}return n}function B(o,t){if(o){for(let e of o)if(Object.entries(e.where?.metadata||{}).every(([s,n])=>Ye(s,n,t)))return e}}function Ye(o,t,e){if(t.match(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}Z)?\/(\d{4}-\d{2}-\d{2})?$/)){if(!e[o])return!1;let[r,s]=t.split("/"),n=new Date(e[o]);return!(n<new Date(r)||s&&n>new Date(s))}else if(t.match(/^\/.*\//)){if(!e[o])return!1;try{return V(t).test(e[o])}catch{throw new g(`Invalid regex in scorecard target "${o}": ${t}`)}}return e[o]===t}import{pathToFileURL as Je}from"node:url";async function Xe(o,t){if(!o)return[];let e=Je(t??process.cwd()).href+"/",r=o.replaceAll("__redocly_dirname",`"${e}"`);return(await import(`data:text/javascript;base64,${btoa(r)}`)).default.map(i=>i())}var Ze=".redocly.com";function Ke(o){try{return new URL(o).hostname.toLowerCase().endsWith(Ze)}catch{return!1}}async function Qe({apiPath:o,document:t,externalRefResolver:e,scorecardConfig:r,configPath:s,plugins:n=[],targetLevel:i,metadata:a={},onDebug:c}){let _=[],I=new Map,R=r.levels||[];if(i&&!R.some(l=>l.name===i))throw new g(`Target level "${i}" not found in the scorecard configuration levels.
7
+ import{a as X}from"./KFQC57GK.js";import{Ca as J,j as z,k as O,n as G,o as V,qa as g,va as Y}from"./X22IMAJK.js";import{e as W}from"./RFWIIJFG.js";var te=W(X(),1);var C=W(X(),1);function Z(){return process.env.HTTPS_PROXY||process.env.HTTP_PROXY||process.env.http_proxy||process.env.https_proxy}function K(o){let t=process.env.NO_PROXY||process.env.no_proxy;if(!t)return!1;let e=t.split(",").map(s=>s.trim().toLowerCase()).filter(Boolean);if(e.length===0)return!1;let r;try{r=new URL(o).hostname.toLowerCase()}catch{return!1}return e.some(s=>!!(s==="*"||r===s||s.startsWith(".")&&r.endsWith(s)||!s.startsWith(".")&&r.endsWith("."+s)))}var Q=async(o,{timeout:t,...e}={})=>{let r=Z(),s=r&&!K(o),n;s?n=new C.ProxyAgent({uri:r}):t&&(n=new C.Agent({connect:{timeout:t}}));try{return await(0,C.fetch)(o,{signal:t?AbortSignal.timeout(t):void 0,...e,dispatcher:n})}catch(i){throw await n?.destroy(),i}};var fe=/^[\x21-\x7e]+( [\x21-\x7e]+)*$/;function ee(){let o=process.env.REDOCLY_ENVIRONMENT?.trim();return o&&fe.test(o)?o:void 0}var u=class extends Error{status;constructor(t,e){super(t),this.status=e}},h=class{command;version;sunsetWarnings=[];constructor(t,e="2.0"){this.command=t,this.version=e}async request(t,e){let r=ee(),s={...e.headers,"user-agent":`redocly-cli/${this.version} ${this.command}${r?` ${r}`:""}`};try{let n=await Q(t,{...e,headers:s});return this.collectSunsetWarning(n),n}catch(n){let i=n.cause??n,a=`Failed to fetch. Caused by ${i.message||i.name}.`;throw typeof i.code=="string"&&(a+=` Code: ${i.code}`),new Error(a)}}collectSunsetWarning(t){let e=this.getSunsetDate(t);if(!e)return;let r=new Date(e);e>Date.now()?this.sunsetWarnings.push({sunsetDate:r,isSunsetExpired:!1}):this.sunsetWarnings.push({sunsetDate:r,isSunsetExpired:!0})}getSunsetDate(t){let{headers:e}=t;if(!e)return;let r=e.get("sunset")||e.get("Sunset");if(r)return Date.parse(r)}},P=class{client;domain;authHeaders;constructor(t,e,r){this.client=t,this.domain=e,this.authHeaders=r}projectUrl(t,e){return`${this.domain}/api/orgs/${encodeURIComponent(t)}/projects/${encodeURIComponent(e)}`}async fetchJson(t,e,r){try{let s=await this.client.request(t,{...e,headers:{"Content-Type":"application/json",...this.authHeaders}});return await this.getParsedResponse(s)}catch(s){let n=`${r}. ${s.message}`;throw s instanceof u?new u(n,s.status):new Error(n)}}async getParsedResponse(t){let e=await t.json();if(t.ok)return e;throw new u(`${e.title||t.statusText||"Unknown error"}.`,t.status)}},k=class extends P{async find(t,e){try{let r=await this.client.request(`${this.domain}/api/orgs/${encodeURIComponent(t)}/projects/${encodeURIComponent(e)}`,{timeout:6e3,method:"GET",headers:{"Content-Type":"application/json",...this.authHeaders}});return r.status===404?void 0:await this.getParsedResponse(r)}catch(r){let s=`Failed to fetch project. ${r.message}`;throw r instanceof u?new u(s,r.status):new Error(s)}}},D=class extends P{async getDefaultBranch(t,e){try{let r=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/sources`,{timeout:6e3,method:"GET",headers:{"Content-Type":"application/json",...this.authHeaders}}),s=await this.getParsedResponse(r),[n]=s.data;if(!n)throw new Error("Project source not found.");return n.branchName}catch(r){let s=`Failed to fetch default branch. ${r.message}`;throw r instanceof u?new u(s,r.status):new Error(s)}}async upsert(t,e,r){try{let s=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/remotes`,{timeout:6e3,method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders},body:JSON.stringify({mountPath:r.mountPath,mountBranchName:r.mountBranchName,type:"CICD",autoMerge:!0})});return await this.getParsedResponse(s)}catch(s){let n=`Failed to upsert remote. ${s.message}`;throw s instanceof u?new u(n,s.status):new Error(n)}}async push(t,e,r,s){let n=new te.FormData;n.append("remoteId",r.remoteId),n.append("commit[message]",r.commit.message),n.append("commit[author][name]",r.commit.author.name),n.append("commit[author][email]",r.commit.author.email),n.append("commit[branchName]",r.commit.branchName),r.commit.url&&n.append("commit[url]",r.commit.url),r.commit.namespace&&n.append("commit[namespaceId]",r.commit.namespace),r.commit.sha&&n.append("commit[sha]",r.commit.sha),r.commit.repository&&n.append("commit[repositoryId]",r.commit.repository),r.commit.createdAt&&n.append("commit[createdAt]",r.commit.createdAt);for(let i of s){let a=Buffer.isBuffer(i.stream)?new Blob([i.stream]):new Blob([await me(i.stream)]);n.append(`files[${i.path}]`,a,i.path)}r.isMainBranch&&n.append("isMainBranch","true"),r.replace&&n.append("replace","true");try{let i=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/pushes`,{method:"POST",headers:{...this.authHeaders},body:n});return await this.getParsedResponse(i)}catch(i){let a=`Failed to push. ${i.message}`;throw i instanceof u?new u(a,i.status):new Error(a)}}async getPush({organizationId:t,projectId:e,pushId:r}){try{let s=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/pushes/${r}`,{timeout:6e3,method:"GET",headers:{"Content-Type":"application/json",...this.authHeaders}});return await this.getParsedResponse(s)}catch(s){let n=`Failed to get push status. ${s.message}`;throw s instanceof u?new u(n,s.status):new Error(n)}}},F=class extends P{create(t,e,r){return this.fetchJson(`${this.projectUrl(t,e)}/pull-requests`,{method:"POST",body:JSON.stringify(r)},"Failed to open a pull request")}async findLatest(t,e,r){let s=new URLSearchParams({branchName:r,limit:"1"}),{data:n}=await this.fetchJson(`${this.projectUrl(t,e)}/pull-requests?${s}`,{method:"GET",timeout:6e3},"Failed to get the pull request");return n[0]}listChecks(t,e,r){return this.fetchJson(`${this.projectUrl(t,e)}/pull-requests/${encodeURIComponent(r)}/checks`,{method:"GET",timeout:6e3},"Failed to get the checks")}},j=class extends P{async findLatestByCommit(t,e,r){let s=new URLSearchParams({limit:"1",filter:`commitHash:${r}`}),{data:n}=await this.fetchJson(`${this.projectUrl(t,e)}/builds?${s}`,{method:"GET",timeout:6e3},"Failed to get the build");return n[0]}},y=class{apiClient;projects;remotes;constructor({domain:t,apiKey:e,command:r,version:s}){this.apiClient=new h(r,s);let n={Authorization:`Bearer ${e}`};this.projects=new k(this.apiClient,t,n),this.remotes=new D(this.apiClient,t,n)}getSunsetWarning(){return re(this.apiClient.sunsetWarnings)}};function re(o){let[t]=[...o].sort((e,r)=>e.isSunsetExpired!==r.isSunsetExpired?e.isSunsetExpired?-1:1:e.sunsetDate>r.sunsetDate?1:-1);return t}async function me(o){let t=[];for await(let e of o)t.push(e);return Buffer.concat(t)}function ge(){if(process.env.REDOCLY_AUTHORIZATION)return process.env.REDOCLY_AUTHORIZATION;throw new Error("No api key provided, please use environment variable REDOCLY_AUTHORIZATION.")}var we=/^http:\/\/(localhost|127\.0\.0\.1)(:\d+)?$/,E={us:"https://app.cloud.redocly.com",eu:"https://app.cloud.eu.redocly.com"};function ye(){return process.env.REDOCLY_DOMAIN||E.us}var ne=ve((o,t)=>{try{let e=t||o?.resolvedConfig.residency;return Te(e)?E[e]:e?new URL(e).origin:o?.resolvedConfig.scorecard?.fromProjectUrl?new URL(o.resolvedConfig.scorecard.fromProjectUrl).origin:E.us}catch{throw new $}});function S(o){try{ne(void 0,o)}catch{return!1}return!0}function ve(o){return(...t)=>{let e=o(...t);if(!e.startsWith("https://")&&!we.test(e))throw new $;return e}}var $=class extends Error{constructor(){super("Invalid Reunite URL")}};function Te(o){return typeof o=="string"&&o in E}import{Buffer as L}from"node:buffer";import A from"node:crypto";import{mkdirSync as Re,existsSync as oe,writeFileSync as Ce,readFileSync as Pe,rmSync as xe}from"node:fs";import{homedir as Ue}from"node:os";import ie from"node:path";import*as se from"node:child_process";var v=class{baseUrl;apiClient;clientName="redocly-cli";constructor(t,e){this.baseUrl=t,this.apiClient=new h("login",e)}async run(t){let e=await this.getDeviceCode();t?.({verificationUri:e.verificationUri,verificationUriComplete:e.verificationUriComplete,userCode:e.userCode}),this.openBrowser(e.verificationUriComplete);let r=await this.pollingAccessToken(e.deviceCode,e.interval,e.expiresIn);return this.withResidency(r)}openBrowser(t){if(!/^https?:\/\//.test(t))return;let[e,r]=process.platform==="win32"?["rundll32",["url.dll,FileProtocolHandler",t]]:process.platform==="darwin"?["open",[t]]:["xdg-open",[t]];se.spawn(e,r,{stdio:"ignore",detached:!0}).on("error",()=>{}).unref()}async verifyToken(t){try{return!!(await this.sendRequest("/session","GET",void 0,{Cookie:`accessToken=${t};`})).user}catch{return!1}}async verifyApiKey(t){try{return!!(await this.sendRequest("/api-keys-verify","POST",{apiKey:t})).success}catch{return!1}}async refreshToken(t){let e=await this.sendRequest("/device-rotate-token","POST",{grant_type:"refresh_token",client_name:this.clientName,refresh_token:t});if(!e.access_token)throw new Error("Failed to refresh token");return this.withResidency({access_token:e.access_token,refresh_token:e.refresh_token,expires_in:e.expires_in})}async pollingAccessToken(t,e,r){return new Promise((s,n)=>{let i=setInterval(async()=>{let c=await this.getAccessToken(t);c.access_token&&(clearInterval(i),clearTimeout(a),s(c)),c.error&&c.error!=="authorization_pending"&&(clearInterval(i),clearTimeout(a),n(c.error_description))},e*1e3),a=setTimeout(async()=>{clearInterval(i),clearTimeout(a),n("Authorization has expired. Please try again.")},r*1e3)})}async getAccessToken(t){return await this.sendRequest("/device-token","POST",{client_name:this.clientName,device_code:t,grant_type:"urn:ietf:params:oauth:grant-type:device_code"})}async getDeviceCode(){let{device_code:t,user_code:e,verification_uri:r,verification_uri_complete:s,interval:n=10,expires_in:i=300}=await this.sendRequest("/device-authorize","POST",{client_name:this.clientName});return{deviceCode:t,userCode:e,verificationUri:r,verificationUriComplete:s,interval:n,expiresIn:i}}async sendRequest(t,e="GET",r=void 0,s={}){let n=`${this.baseUrl}/api${t}`,i=await this.apiClient.request(n,{body:r&&JSON.stringify(r),method:e,headers:{"Content-Type":"application/json",...s},timeout:6e3});return i.status===204?{success:!0}:await i.json()}withResidency(t){return{...t,residency:this.baseUrl}}};var Ee="4618dbc9-8aed-4e27-aaf0-225f4603e5a4",ae="aes-256-cbc",H=class{version;credentialsFolderPath;credentialsFilePath;credentialsFileName;key;iv;constructor(t){this.version=t;let e=Ue();this.credentialsFolderPath=ie.join(e,".redocly"),this.credentialsFileName="credentials",this.credentialsFilePath=ie.join(this.credentialsFolderPath,this.credentialsFileName),this.key=A.createHash("sha256").update(`${this.credentialsFolderPath}${Ee}`).digest(),this.iv=A.createHash("md5").update(this.credentialsFolderPath).digest(),Re(this.credentialsFolderPath,{recursive:!0})}async login(t,e){let s=await new v(t,this.version).run(e);if(!s)throw new Error("Failed to login. No credentials received.");await this.saveCredentials(s)}async logout(){try{this.removeCredentials()}catch{}}async isAuthorized(t,e){return e?new v(t,this.version).verifyApiKey(e):!!await this.getAccessToken(t)}getAccessToken=async t=>{let e=new v(t,this.version),r=await this.readCredentials();if(!r||!S(t)||r.residency&&r.residency!==t)return null;if(await e.verifyToken(r.access_token))return r.access_token;try{let n=await e.refreshToken(r.refresh_token);return await this.saveCredentials(n),n.access_token}catch{return null}};async saveCredentials(t){try{let e=this.encryptCredentials(t);Ce(this.credentialsFilePath,e,"utf8")}catch(e){throw new Error(`Failed to save credentials: ${e.message}`)}}async readCredentials(){if(!oe(this.credentialsFilePath))return null;try{let t=Pe(this.credentialsFilePath,"utf8");return this.decryptCredentials(t)}catch{return null}}async removeCredentials(){oe(this.credentialsFilePath)&&xe(this.credentialsFilePath)}encryptCredentials(t){let e=A.createCipheriv(ae,this.key,this.iv);return L.concat([e.update(JSON.stringify(t),"utf8"),e.final()]).toString("hex")}decryptCredentials(t){let e=A.createDecipheriv(ae,this.key,this.iv),r=L.concat([e.update(L.from(t,"hex")),e.final()]);return JSON.parse(r.toString("utf8"))}};var $e=/^(https?:\/\/[^/]+)\/api\/orgs\/([^/]+)\/projects\/([^/]+)\/git\/?$/;function Se(o,t,e){return`${o}/api/orgs/${encodeURIComponent(t)}/projects/${encodeURIComponent(e)}/git`}function _e(o){let[,t,e,r]=o.match($e)??[];if(!(!t||!e||!r||!S(t)))return{reuniteUrl:t,organization:decodeURIComponent(e),project:decodeURIComponent(r)}}async function Ie({branch:o,title:t,description:e,base:r,draft:s,...n}){let{pullRequests:i}=ce(n,"project pr create");return i.create(n.organization,n.project,{branchName:o,title:t,description:e,targetBranchName:r,isDraft:s})}async function Fe({branch:o,...t}){let{pullRequests:e,builds:r}=ce(t,"project pr status"),{organization:s,project:n}=t,i=await e.findLatest(s,n,o);if(!i)return;let[a,c]=await Promise.all([e.listChecks(s,n,i.id),i.headCommitHash?r.findLatestByCommit(s,n,i.headCommitHash):void 0]);return{pullRequest:i,checks:a,previewUrl:c?.deploymentStatus==="SUCCESS"?c.url:void 0}}function ce({reuniteUrl:o,accessToken:t,version:e},r){let s=new h(r,e),n={Cookie:`accessToken=${t}`};return{pullRequests:new F(s,o,n),builds:new j(s,o,n)}}import*as T from"node:fs";import*as p from"node:path";var je=/\/orgs\/([^/]+)\/projects\//,Ae=[401,403];async function x(o,{organization:t,project:e,onSlugDeprecated:r}){let s=await Ne(o,t,e);if(!s)return{organizationId:t,projectId:e};let n={organizationId:Oe(s.uri),projectId:s.id};return(n.organizationId!==t||n.projectId!==e)&&r?.(n),n}async function Ne(o,t,e){try{let r=await o.projects.find(t,e);if(!r)throw new u(`Project "${e}" was not found in organization "${t}". Use the IDs from the organization and project settings in Reunite.`,404);return r}catch(r){if(r instanceof u&&Ae.includes(r.status))return;throw r}}function Oe(o){let t=o.match(je)?.[1];if(!t)throw new Error(`Could not read the organization ID from the project URI "${o}".`);return t}async function ke({domain:o,apiKey:t,organization:e,project:r,mountPath:s,files:n,defaultBranch:i,commit:a,version:c,replace:_,onUploadStart:I,onSunsetWarning:R,onSlugDeprecated:N}){let f=new y({domain:o,apiKey:t,command:"push",version:c});try{let{organizationId:d,projectId:l}=await x(f,{organization:e,project:r,onSlugDeprecated:N}),b=await f.remotes.getDefaultBranch(d,l),m=await f.remotes.upsert(d,l,{mountBranchName:b,mountPath:s});I?.(m);let{id:U}=await f.remotes.push(d,l,{remoteId:m.id,commit:a,isMainBranch:i===a.branchName,replace:_},n.map(M=>({path:G(M.name),stream:T.createReadStream(M.path)})));return{pushId:U,organizationId:d,projectId:l}}finally{let d=f.getSunsetWarning();d&&R?.(d)}}function De(o,t){let e={};for(let s of o)if(T.statSync(s).isDirectory()){let n=s;ue(n,[]).forEach(a=>r(a,n))}else r(s,p.dirname(s));function r(s,n){let i=p.relative(n,s);e[i]&&t?.(e[i],s),e[i]=s}return Object.entries(e).map(([s,n])=>({name:s,path:p.resolve(n)}))}function ue(o,t){let e=T.readdirSync(o);for(let r of e){let s=p.join(o,r);T.statSync(s).isDirectory()?t=ue(s,t):t.push(s)}return t}async function le({operation:o,condition:t,onConditionNotMet:e,startTime:r=Date.now(),retryTimeoutMs:s=6e5,retryIntervalMs:n=5e3}){async function i(){let a=await o();if(t(a))return a;if(Date.now()-r>s)throw new Error("Timeout exceeded.");return await e?.(a),await z(n),i()}return i()}var Le=1200,He=5e3,qe=["pending","running"];async function Be(o){let t=de(o);try{let e=await x(t,o);return await pe(t,e,o.pushId)}finally{he(t,o)}}async function be({buildType:o,maxExecutionTime:t=Le,retryIntervalMs:e=He,startTime:r=Date.now(),onRetry:s,...n}){let i=de(n);try{let a=await x(i,n);return await le({operation:()=>pe(i,a,n.pushId),condition:c=>!qe.includes(c.status[o].deploy.status),onConditionNotMet:s,startTime:r,retryTimeoutMs:t*1e3,retryIntervalMs:e})}finally{he(i,n)}}function de({domain:o,apiKey:t,version:e}){return new y({domain:o,apiKey:t,command:"push-status",version:e})}function he(o,{onSunsetWarning:t}){let e=o.getSunsetWarning();e&&t?.(e)}function pe(o,{organizationId:t,projectId:e},r){return o.remotes.getPush({organizationId:t,projectId:e,pushId:r})}async function Me({projectUrl:o,auth:t,isApiKey:e=!1,onDebug:r}){let s=We(o);if(!s)throw new g(`Invalid project URL format: ${o}`);try{let n=await ze({...s,auth:t,isApiKey:e,onDebug:r}),i=n.config.scorecardClassic||n.config.scorecard;if(!i)throw new Error("No scorecard configuration found.");let a=n.config.pluginsUrl,c=a?await Ge(a,r):void 0;return{scorecard:i,plugins:c,pluginsUrl:a}}catch(n){throw new g(n instanceof Error?n.message:String(n))}}function We(o){let t=new URL(o),e=t.pathname.match(/\/org\/(?<orgSlug>[^/]+)\/project\/(?<projectSlug>[^/]+)/);if(!e?.groups)return;let{orgSlug:r,projectSlug:s}=e.groups;return{residency:t.origin,orgSlug:r,projectSlug:s}}async function ze({residency:o,orgSlug:t,projectSlug:e,auth:r,isApiKey:s,onDebug:n}){let i=new URL(`${o}/api/orgs/${t}/projects/${e}`),a=await fetch(i,{headers:Ve(r,s)});if(n?.(`Project fetch response status: ${a.status}`),a.status===401||a.status===403)throw n?.(`Authentication failed with status ${a.status}.`),n?.("Check that your credentials are valid and have the necessary permissions."),new Error(`Unauthorized access to project: ${e}. Please check your credentials.`);if(a.status!==200)throw new Error(`Failed to fetch project: ${e}. Status: ${a.status}`);return n?.("Successfully received project configuration."),a.json()}async function Ge(o,t){t?.(`Fetching plugins from: ${o}`);try{let e=await fetch(o);if(t?.(`Plugins fetch response status: ${e.status}`),e.status!==200){t?.("Failed to fetch plugins");return}return e.text()}catch(e){t?.(`Error fetching plugins: ${e instanceof Error?e.message:String(e)}`);return}}function Ve(o,t){return t?{Authorization:`Bearer ${o}`}:{Cookie:`accessToken=${o}`}}async function q(o,t,e=[],r=[],s){let n={};for(let i of e){let a={[i.name]:{root:o,rules:t}},c=await Y({apis:a,...i,plugins:r},{configPath:s});n[i.name]=c.forAlias(i.name)}return n}function B(o,t){if(o){for(let e of o)if(Object.entries(e.where?.metadata||{}).every(([s,n])=>Ye(s,n,t)))return e}}function Ye(o,t,e){if(t.match(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}Z)?\/(\d{4}-\d{2}-\d{2})?$/)){if(!e[o])return!1;let[r,s]=t.split("/"),n=new Date(e[o]);return!(n<new Date(r)||s&&n>new Date(s))}else if(t.match(/^\/.*\//)){if(!e[o])return!1;try{return V(t).test(e[o])}catch{throw new g(`Invalid regex in scorecard target "${o}": ${t}`)}}return e[o]===t}import{pathToFileURL as Je}from"node:url";async function Xe(o,t){if(!o)return[];let e=Je(t??process.cwd()).href+"/",r=o.replaceAll("__redocly_dirname",`"${e}"`);return(await import(`data:text/javascript;base64,${btoa(r)}`)).default.map(i=>i())}var Ze=".redocly.com";function Ke(o){try{return new URL(o).hostname.toLowerCase().endsWith(Ze)}catch{return!1}}async function Qe({apiPath:o,document:t,externalRefResolver:e,scorecardConfig:r,configPath:s,plugins:n=[],targetLevel:i,metadata:a={},onDebug:c}){let _=[],I=new Map,R=r.levels||[];if(i&&!R.some(l=>l.name===i))throw new g(`Target level "${i}" not found in the scorecard configuration levels.
8
8
  `);let N=B(r.targets,a)?.rules,f=await q(o,N,R,n,s||"");for(let l of R){c?.(`
9
9
  Validating level: "${l.name}"`),n.length>0&&c?.(`Using ${n.length} ${O("plugin",n.length)} for this level.`),c?.("Linting document against level rules...");let m=(await J({document:t,externalRefResolver:e,config:f[l.name]})).filter(({ignored:U})=>!U).map(U=>({...U,scorecardLevel:l.name}));c?.(`Found ${m.length} ${O("problem",m.length)} for level "${l.name}".`),I.set(l.name,m),_.push(...m)}let d=et(I,R,i);return{problems:_,achievedLevel:d,targetLevelAchieved:i?d===i:!0}}function et(o,t,e){let r=null;for(let s of t){if((o.get(s.name)||[]).some(a=>a.severity==="error"))return r||"Non Conformant";if(r=s.name,e&&s.name===e)return s.name}return r||"Non Conformant"}export{u as a,h as b,y as c,re as d,ge as e,E as f,ye as g,ne as h,S as i,$ as j,v as k,H as l,Se as m,_e as n,Ie as o,Fe as p,x as q,ke as r,De as s,Be as t,be as u,Me as v,q as w,B as x,Xe as y,Ke as z,Qe as A};
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{i as c,l as a}from"./FAFMGLT6.js";import"./KFQC57GK.js";import{fa as s}from"./FRQHCFKP.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function g({operation:i,input:r,version:n}){let t=await l(r),e=`${t.protocol}://${t.host}`;if(i!=="get"||!c(e))return"";let o=process.env.REDOCLY_AUTHORIZATION||await new a(n).getAccessToken(e);return o?`username=redocly
7
+ import{i as c,l as a}from"./FLQQ3VRQ.js";import"./KFQC57GK.js";import{ka as s}from"./X22IMAJK.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";async function g({operation:i,input:r,version:n}){let t=await l(r),e=`${t.protocol}://${t.host}`;if(i!=="get"||!c(e))return"";let o=process.env.REDOCLY_AUTHORIZATION||await new a(n).getAccessToken(e);return o?`username=redocly
8
8
  password=${o}
9
9
  `:(s.error(`You are not logged in to ${e}. Run \`redocly login --residency ${e}\` or set the REDOCLY_AUTHORIZATION environment variable.
10
10
  `),`quit=1
@@ -4,5 +4,5 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{c,la as H}from"./FRQHCFKP.js";import{existsSync as J}from"node:fs";import{open as L,readdir as T,stat as B}from"node:fs/promises";import x from"node:path";var I=new Set([".yaml",".yml",".json"]);async function V(e){let n=[];async function t(r){let o=await T(r,{withFileTypes:!0});for(let s of o){if(s.name.startsWith("."))continue;let i=x.join(r,s.name);if(s.isDirectory()){await t(i);continue}s.isFile()&&I.has(x.extname(s.name).toLowerCase())&&n.push(i)}}return await t(e),n.sort(),n}async function Q(e,n=4096){let t=await L(e,"r");try{let r=Buffer.allocUnsafe(n),{bytesRead:o}=await t.read(r,0,n,0);return r.toString("utf8",0,o)}finally{await t.close()}}function Z(e){return x.resolve(process.cwd(),e)}async function v(e){if(!J(e))throw new H(`Traffic file or folder not found: ${e}`);let n=await B(e);if(n.isFile())return[e];if(!n.isDirectory())return[];let t=[];async function r(o){let s=await T(o,{withFileTypes:!0});for(let i of s){if(i.name.startsWith("."))continue;let a=x.join(o,i.name);if(i.isDirectory()){await r(a);continue}i.isFile()&&t.push(a)}}return await r(e),t.sort(),t}var z="drift.local",q=`http://${z}`;function l(e){return e===z}var F=new Set(["accept","accept-charset","accept-encoding","accept-language","authorization","baggage","cache-control","cdn-loop","cookie","connection","content-length","content-type","dpr","dnt","downlink","ect","forwarded","host","if-match","if-modified-since","if-none-match","if-range","if-unmodified-since","origin","pragma","priority","range","referer","sec-fetch-dest","sec-fetch-mode","sec-fetch-site","sec-fetch-user","sec-gpc","sentry-trace","te","traceparent","tracestate","upgrade","upgrade-insecure-requests","user-agent","via","x-client-trace-id","x-cloud-trace-context","x-correlation-id","x-http-method-override","x-hub-signature","x-hub-signature-256","x-method-override","x-real-ip","x-request-id","x-forwarded-for","x-forwarded-host","x-forwarded-port","x-forwarded-proto"]),j=["cf-","sec-ch-","sec-fetch-","x-amz-","x-amzn-","x-b3-","x-envoy-","x-forwarded-","x-github-"],C=`
7
+ import{c,qa as H}from"./X22IMAJK.js";import{existsSync as J}from"node:fs";import{open as L,readdir as T,stat as B}from"node:fs/promises";import x from"node:path";var I=new Set([".yaml",".yml",".json"]);async function V(e){let n=[];async function t(r){let o=await T(r,{withFileTypes:!0});for(let s of o){if(s.name.startsWith("."))continue;let i=x.join(r,s.name);if(s.isDirectory()){await t(i);continue}s.isFile()&&I.has(x.extname(s.name).toLowerCase())&&n.push(i)}}return await t(e),n.sort(),n}async function Q(e,n=4096){let t=await L(e,"r");try{let r=Buffer.allocUnsafe(n),{bytesRead:o}=await t.read(r,0,n,0);return r.toString("utf8",0,o)}finally{await t.close()}}function Z(e){return x.resolve(process.cwd(),e)}async function v(e){if(!J(e))throw new H(`Traffic file or folder not found: ${e}`);let n=await B(e);if(n.isFile())return[e];if(!n.isDirectory())return[];let t=[];async function r(o){let s=await T(o,{withFileTypes:!0});for(let i of s){if(i.name.startsWith("."))continue;let a=x.join(o,i.name);if(i.isDirectory()){await r(a);continue}i.isFile()&&t.push(a)}}return await r(e),t.sort(),t}var z="drift.local",q=`http://${z}`;function l(e){return e===z}var F=new Set(["accept","accept-charset","accept-encoding","accept-language","authorization","baggage","cache-control","cdn-loop","cookie","connection","content-length","content-type","dpr","dnt","downlink","ect","forwarded","host","if-match","if-modified-since","if-none-match","if-range","if-unmodified-since","origin","pragma","priority","range","referer","sec-fetch-dest","sec-fetch-mode","sec-fetch-site","sec-fetch-user","sec-gpc","sentry-trace","te","traceparent","tracestate","upgrade","upgrade-insecure-requests","user-agent","via","x-client-trace-id","x-cloud-trace-context","x-correlation-id","x-http-method-override","x-hub-signature","x-hub-signature-256","x-method-override","x-real-ip","x-request-id","x-forwarded-for","x-forwarded-host","x-forwarded-port","x-forwarded-proto"]),j=["cf-","sec-ch-","sec-fetch-","x-amz-","x-amzn-","x-b3-","x-envoy-","x-forwarded-","x-github-"],C=`
8
8
  `;function te(e){return e.split(C)}function S(e,n,t){let r=n.toLowerCase(),o=e[r];if(o===void 0){e[r]=t;return}e[r]=r==="set-cookie"?`${o}${C}${t}`:`${o},${t}`}function w(e){if(!c(e)&&!Array.isArray(e))return{};let n={};if(Array.isArray(e)){for(let t of e){if(!c(t))continue;let{name:r,value:o}=t;typeof r=="string"&&o!==void 0&&S(n,r,String(o))}return n}for(let[t,r]of Object.entries(e))if(r!=null){if(Array.isArray(r)){for(let o of r)S(n,t,String(o));continue}S(n,t,String(r))}return n}function m(e){try{return new URL(e)}catch{return new URL(e,q)}}function N(e){return e.length>1&&e.endsWith("/")?e.slice(0,-1):e}function b(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function re(e){let n=[],t=0,r=e.startsWith("/")?e:`/${e}`,s=N(r).split("/").map(i=>{if(!i)return"";let a=[...i.matchAll(/\{([^}]+)\}/g)],h=n.length,f="",p=0,u=0;for(let[y,d]of a.entries()){let R=i.slice(u,d.index);f+=b(R),p+=R.length,n.push(d[1]),u=d.index+d[0].length;let E=a[y+1];if(!E){f+="([^/]+)";continue}let A=i.slice(u,E.index);f+=A?`((?:(?!${b(A)})[^/])+)`:"([^/])"}let g=i.slice(u);return f+=b(g),p+=g.length,n.length===h?t+=2:p>0&&(t+=1),f}).join("/");return{regex:new RegExp(`^${s||"/"}$`),params:n,score:t}}function k(e,n){if(n&&O(e))try{return JSON.parse(n)}catch{return}}function $(e){return e?e.split(";")[0]?.trim().toLowerCase()??"":""}function O(e){let n=$(e);return n==="application/json"||n.endsWith("+json")}function oe(e,n){let t=$(n);if(!t)return e["application/json"]??e["*/*"];if(e[t]!==void 0)return e[t];let[r,o]=t.split("/");if(r&&o){let s=`${r}/*`;if(e[s]!==void 0)return e[s]}return e["*/*"]}function ie(e){let n=new Set,t=[];for(let r of e){let o=r.trim().toLowerCase();o.length!==0&&(o.endsWith("*")?t.push(o.slice(0,-1)):n.add(o))}return{names:n,prefixes:t}}function se(e,n){let t=e.toLowerCase();return t.startsWith(":")||F.has(t)||j.some(r=>t.startsWith(r))?!0:n?n.names.has(t)||n.prefixes.some(r=>t.startsWith(r)):!1}import{createReadStream as W}from"node:fs";import{readFile as D}from"node:fs/promises";import{createInterface as _}from"node:readline";function M(e){if(e!=null){if(typeof e=="string")return e;if(Buffer.isBuffer(e))return e.toString("utf8");if(c(e)||Array.isArray(e))try{return JSON.stringify(e)}catch{return String(e)}return String(e)}}function ge(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()!==""){let n=Number(e);if(Number.isFinite(n))return n}}function P(e,n){if(e!=null){if(n==="base64"&&typeof e=="string")try{return Buffer.from(e,"base64").toString("utf8")}catch{return e}return M(e)}}function le(e,n,t){let r=e.method?.toUpperCase(),o=e.url;if(!r||!o)return null;let s=w(e.requestHeaders),i=m(o);if(l(i.host)&&s.host)try{i=new URL(`${i.protocol}//${s.host}${i.pathname}${i.search}`)}catch{i=m(o)}let a=e.requestContentType??s["content-type"],h=P(e.requestBody),f={method:r,url:i.toString(),path:i.pathname,query:i.searchParams,protocol:i.protocol,protocolKnown:e.schemeKnown??/^https?:\/\//i.test(o),host:l(i.host)?void 0:i.host||void 0,headers:s,contentType:a,bodyText:h,bodyJson:k(a,h)},p,u=e.responseStatus;if(u!==void 0){let g=w(e.responseHeaders),y=e.responseContentType??g["content-type"],d=P(e.responseBody);p={status:u,statusText:e.responseStatusText,headers:g,contentType:y,bodyText:d,bodyJson:k(y,d)}}return{index:n,source:t,startedAt:e.startedAt,request:f,response:p,raw:e.raw}}async function*me(e){let n=W(e,{encoding:"utf8"}),t=_({input:n,crlfDelay:1/0});for await(let r of t){let o=r.trim();if(o)try{let s=JSON.parse(o);c(s)&&(yield s)}catch{}}}async function*he(e,n){let t=await D(e,"utf8"),r=JSON.parse(t);if(n)for(let o of n.split("."))r=c(r)?r[o]:void 0;if(Array.isArray(r))for(let o of r)c(o)&&(yield o)}function ye(e){return w(e)["content-type"]}function Se(e){return e?.replace(/\/+$/,"")||void 0}function U(e,n){if(!n||n==="/")return e||"/";if(e===n)return"/";if(e.startsWith(`${n}/`))return e.slice(n.length)||"/"}function be(e,n){if(n.startsWith("/"))return U(e.path,n);let t=m(n.includes("://")?n:`http://${n}`);if(!(l(t.host)||e.host!==void 0&&e.host.toLowerCase()!==t.host))return U(e.path,N(t.pathname))}export{V as a,Q as b,Z as c,v as d,l as e,te as f,m as g,N as h,re as i,$ as j,O as k,oe as l,ie as m,se as n,M as o,ge as p,P as q,le as r,me as s,he as t,ye as u,Se as v,be as w};
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a,b,c,d,e}from"./FDKY4PGX.js";import"./XQEXWC5L.js";import"./FAFMGLT6.js";import"./KFQC57GK.js";import"./BH4FA7AH.js";import"./FRQHCFKP.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{a as DeploymentError,b as handlePushStatus,c as handleReuniteError,d as printSlugDeprecation,e as printSunsetWarning};
7
+ import{a,b,c,d,e}from"./542GVIYM.js";import"./MAACTVYP.js";import"./FLQQ3VRQ.js";import"./KFQC57GK.js";import"./YA5KTHFN.js";import"./X22IMAJK.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";export{a as DeploymentError,b as handlePushStatus,c as handleReuniteError,d as printSlugDeprecation,e as printSunsetWarning};
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a as G}from"./VJZDR6KS.js";import{b as j,c as N,d as Q,e as O,f as Z,g as Y,h as X,i as ee,j as ne}from"./DM4EUYBB.js";import{a as F,b as W,c as L,d as x,e as _,g as A,h as U,i as z,j as K,k as J,l as D,n as V}from"./5CR6AOLY.js";import{a as H}from"./WZXA5XPB.js";var B=L.go,P=class extends F{constructor(){super(" ")}typeName(t){return d(t)}memberName(t){return d(t)}identifier(t){return x(t,{style:"camel",reserved:B})}identifiers(t,n){let r=new Set(n??[]);return t.map(o=>{let a=d(o),s=a;for(let l=2;r.has(s);l++)s=`${a}${l}`;return r.add(s),s})}packageName(t){let n=t.toLowerCase().replace(/[^a-z0-9]/g,"");return n===""||/^[0-9]/.test(n)?"client":n}string(t){let n='"';for(let r of t){let o=r.codePointAt(0);r==="\\"?n+="\\\\":r==='"'?n+='\\"':r===`
7
+ import{a as G}from"./TFPMT2XD.js";import{b as j,c as N,d as Q,e as O,f as Z,g as Y,h as X,i as ee,j as ne}from"./BZTZIEWS.js";import{a as F,b as W,c as L,d as x,e as _,g as A,h as U,i as z,j as K,k as J,l as D,n as V}from"./A65OW7M7.js";import{a as H}from"./WZXA5XPB.js";var B=L.go,P=class extends F{constructor(){super(" ")}typeName(t){return d(t)}memberName(t){return d(t)}identifier(t){return x(t,{style:"camel",reserved:B})}identifiers(t,n){let r=new Set(n??[]);return t.map(o=>{let a=d(o),s=a;for(let l=2;r.has(s);l++)s=`${a}${l}`;return r.add(s),s})}packageName(t){let n=t.toLowerCase().replace(/[^a-z0-9]/g,"");return n===""||/^[0-9]/.test(n)?"client":n}string(t){let n='"';for(let r of t){let o=r.codePointAt(0);r==="\\"?n+="\\\\":r==='"'?n+='\\"':r===`
8
8
  `?n+="\\n":r==="\r"?n+="\\r":r===" "?n+="\\t":o<32||o===127?n+=`\\x${o.toString(16).padStart(2,"0")}`:o>=55296&&o<=57343?n+="\\uFFFD":n+=r}return n+'"'}literal(t){return t==null?"nil":typeof t=="boolean"||typeof t=="number"?String(t):typeof t=="string"?this.string(t):Array.isArray(t)?`[]any{${t.map(r=>this.literal(r)).join(", ")}}`:`map[string]any{${Object.entries(t).map(([r,o])=>`${this.string(r)}: ${this.literal(o)}`).join(", ")}}`}comment(t){for(let n of D(t))this.line(n===""?"//":`// ${n}`);return this}doc(t,n){let r=D(n);if(r.length===0)return this;this.line(`// ${t} \u2014 ${r[0]}`);let o=!1;for(let a of r.slice(1)){if(a===""){o||this.line("//"),o=!0;continue}this.line(`// ${a}`),o=!1}return this}layout(t){return ue(fe(t))}toString(){return this.layout(super.toString())}};function d(e){let t=x(e,{style:"pascal",reserved:B});return t.startsWith("_")?`N${t.slice(1)}`:t}function ue(e){return`${e.replace(/\n{3,}/g,`
9
9
 
10
10
  `).trimEnd()}
@@ -4,5 +4,5 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{l as t}from"./FAFMGLT6.js";import"./KFQC57GK.js";import{fa as o}from"./FRQHCFKP.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function i({version:n}){new t(n).logout(),o.output(`Logged out from the Redocly account. \u270B
7
+ import{l as t}from"./FLQQ3VRQ.js";import"./KFQC57GK.js";import{ka as o}from"./X22IMAJK.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";async function i({version:n}){new t(n).logout(),o.output(`Logged out from the Redocly account. \u270B
8
8
  `)}export{i as handleLogout};
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a}from"./JOUEVI3E.js";import"./5AVTCY6F.js";import"./L325HIGK.js";import"./R32HBYOH.js";import"./DM4EUYBB.js";import"./5CR6AOLY.js";import"./WZXA5XPB.js";import"./FRQHCFKP.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{a as swrGenerator};
7
+ import{a}from"./RQPH22PV.js";import"./HM7M6465.js";import"./4QC7OVHI.js";import"./BZTZIEWS.js";import"./ZXB5O6JQ.js";import"./A65OW7M7.js";import"./WZXA5XPB.js";import"./X22IMAJK.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";export{a as swrGenerator};
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{$ as e,fa as t}from"./FRQHCFKP.js";function r({verificationUri:o,userCode:n}){t.output(`Attempting to automatically open the SSO authorization page in your default browser.
7
+ import{ea as e,ka as t}from"./X22IMAJK.js";function r({verificationUri:o,userCode:n}){t.output(`Attempting to automatically open the SSO authorization page in your default browser.
8
8
  `),t.output(`If the browser does not open or you wish to use a different device to authorize this request, open the following URL:
9
9
 
10
10
  `),t.output(e(o)),t.output(`
@@ -4,6 +4,6 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a}from"./L325HIGK.js";import{fa as p}from"./FRQHCFKP.js";function g(t,r){let n=t.services.flatMap(e=>e.operations),s=n.filter(e=>e.sse!==void 0);s.length>0&&p.warn(`generate-client: ${r} skipped ${s.length} server-sent-events operation(s) \u2014 iterate the sdk's exported async generators directly: ${s.map(e=>e.name).join(", ")}.
7
+ import{a}from"./4QC7OVHI.js";import{ka as p}from"./X22IMAJK.js";function g(t,r){let n=t.services.flatMap(e=>e.operations),s=n.filter(e=>e.sse!==void 0);s.length>0&&p.warn(`generate-client: ${r} skipped ${s.length} server-sent-events operation(s) \u2014 iterate the sdk's exported async generators directly: ${s.map(e=>e.name).join(", ")}.
8
8
  `);let i=new Set(t.schemas.map(e=>e.name)),o=n.filter(e=>e.sse===void 0&&m(e,i));return o.length>0&&p.warn(`generate-client: ${r} skipped ${o.length} operation(s) whose variables type name collides with a schema \u2014 rename the schema or the operation: ${o.map(e=>e.name).join(", ")}.
9
9
  `),n.filter(e=>e.sse===void 0&&!m(e,i))}function m(t,r){let n=a(t);return n.hasInputs&&r.has(n.variablesTypeName)}function x(t){return t.method==="get"||t.method==="head"}function u(t){return a(t).hasInputs}function f(t){return a(t).variablesTypeName}function $(t,r,n){let s=[];return a(t).hasInputs?s.push(r):n&&s.push("{}"),n&&s.push("{ ...init, envelope: undefined }"),`${t.name}(${s.join(", ")})`}function v(t,r,n){let s=t.map(e=>e.name).sort(),i=t.filter(u).map(f).sort();return n&&i.push("RequestOptions"),`import { ${[...s,...i.map(e=>`type ${e}`)].join(", ")} } from ${JSON.stringify(r)};`}export{g as a,x as b,u as c,f as d,$ as e,v as f};
@@ -4,5 +4,5 @@ import { dirname as __pathDirname } from 'node:path';
4
4
  const require = __createRequire(import.meta.url);
5
5
  var __filename = __fileURLToPath(import.meta.url);
6
6
  var __dirname = __pathDirname(__filename);
7
- import{a as C,e as P,g as L,h as v,i as R,k as V}from"./3VOQMXIZ.js";import{u as S}from"./BH4FA7AH.js";import{_ as u,c as m,ga as k,t as I}from"./FRQHCFKP.js";var _=" ",z=" ";function _e(e){let t=Math.max(...e.map(o=>S(o).length)),n=t+z.length*2,r=_+u("\u2551"+" ".repeat(n)+"\u2551");return["",_+u("\u2554"+"\u2550".repeat(n)+"\u2557"),r,...e.map(o=>{let i=" ".repeat(t-S(o).length);return`${_}${u("\u2551")}${z}${o}${i}${z}${u("\u2551")}`}),r,_+u("\u255A"+"\u2550".repeat(n)+"\u255D"),"",""].join(`
8
- `)}import{execSync as ne}from"node:child_process";import*as p from"node:fs";import{existsSync as re,writeFileSync as oe,readFileSync as M}from"node:fs";import*as $ from"node:os";import{tmpdir as U}from"node:os";import{dirname as J,join as A}from"node:path";async function F(e=L){try{let{fetchWithTimeout:t}=await import("./QXBSAWH3.js");return await t(P,{timeout:e}),!0}catch{return!1}}var y="***";function be(e){return process.env.REDOCLY_TELEMETRY!=="off"&&e?.resolvedConfig.telemetry!=="off"}async function Oe({config:e,argv:t,exit_code:n,execution_time:r,spec_version:o,spec_keyword:i,spec_full_version:s,respect_x_security_auth_types:c,respect_source_description_types:f,respect_criterion_object_types:N,lint_rules_with_errors:T,lint_rules_with_warnings:b,lint_rules_with_ignored_problems:O,generate_client:a,eject_generator:l,bundle:G}){try{if(!t||!await F(1e3))return;let{_:[h],$0:pe,...D}=t,{RedoclyOAuthClient:K,getReuniteUrl:H}=await import("./7JS7JGWP.js"),q=new K(C),Q=H(e,D.residency),Z=await q.isAuthorized(Q),g=de();g||(g=`ann_${V()}`,ue(g));let E=k(o),X=[{id:h,object:"command",uri:`urn:redocly:cli:command:${h}`,logged_in:Z?"yes":"no",command:h,...ae(D,process.argv.slice(2)),node_version:process.version,npm_version:le(),version:C,exit_code:n,execution_time:r,metadata:process.env.REDOCLY_CLI_TELEMETRY_METADATA,environment_ci:process.env.CI,environment:process.env.REDOCLY_ENVIRONMENT,has_config:typeof e?.document?.parsed>"u"?"no":"yes",spec_version:o,spec_keyword:i,spec_full_version:s,respect_x_security_auth_types:E==="arazzo1"&&c?.length?JSON.stringify(c):void 0,respect_source_description_types:E==="arazzo1"&&f?.length?JSON.stringify(f):void 0,respect_criterion_object_types:E==="arazzo1"&&N?.length?JSON.stringify(N):void 0,lint_rules_with_errors:T?.length?JSON.stringify(T):void 0,lint_rules_with_warnings:b?.length?JSON.stringify(b):void 0,lint_rules_with_ignored_problems:O?.length?JSON.stringify(O):void 0,generate_client_builtin_generators:a?.generate_client_builtin_generators?.length?JSON.stringify(a.generate_client_builtin_generators):void 0,generate_client_custom_generators_count:a?.generate_client_custom_generators_count,generate_client_toolkit_imports:a?.generate_client_toolkit_imports?.length?JSON.stringify(a.generate_client_toolkit_imports):void 0,generate_client_error_category:a?.generate_client_error_category,generate_client_ejected_generators:a?.generate_client_ejected_generators?.length?JSON.stringify(a.generate_client_ejected_generators):void 0,generate_client_composed_apis_count:a?.generate_client_composed_apis_count,eject_generator_action:l?.eject_generator_action,eject_generator_name:l?.eject_generator_name,eject_generator_outcome:l?.eject_generator_outcome,eject_generator_conflicts:l?.eject_generator_conflicts,eject_generator_from_version:l?.eject_generator_from_version,eject_generator_to_version:l?.eject_generator_to_version,bundle_overlays_count:G?.bundle_overlays_count}],ee=R.mapToCloudEvent({type:"com.redocly.command.ran",source:"urn:redocly:cli",origin:"redocly-cli",env:"production",osPlatform:$.platform(),actor:{id:g,object:"user",uri:""},category:"product",data:X}),{otelTelemetry:te}=await import("./GFSMOHUE.js");te.send(ee)}catch{}}function De(e,t){for(let n of e.sourceDescriptions??[])n.type&&t.add(n.type)}function Ie(e,t){for(let n of e.workflows??[]){d(n.successActions,t),d(n.failureActions,t);for(let r of n.steps??[])W(r.successCriteria,t),d(r.onSuccess,t),d(r.onFailure,t)}d(Object.values(e.components?.successActions??{}),t),d(Object.values(e.components?.failureActions??{}),t)}function d(e,t){for(let n of e??[])W(n.criteria,t)}function W(e,t){for(let n of e??[]){let r=ie(n);r&&t.add(r)}}function ie(e){let t=e.type;return typeof t=="string"?t:t?.type||(e.condition?"simple":void 0)}function ke(e,t){for(let n of e.workflows??[]){for(let r of n["x-security"]??[]){let o=r.scheme;if(o?.type){let i=o.type==="http"?o.scheme:o.type;i&&t.add(i)}}for(let r of n.steps??[])for(let o of r["x-security"]??[]){let i=o.scheme;if(i?.type){let c=i.type==="http"?i.scheme:i.type;c&&t.add(c)}let s=o.schemeName;s&&t.add(s)}}}function se(e){return p.existsSync(e)&&p.statSync(e).isFile()}function ce(e){return p.existsSync(e)&&p.statSync(e).isDirectory()}function w(e){return e&&(I(e)?e.split("://")[0]+"://url":se(e)?e.replace(/.+\.([^.]+)$/,(t,n)=>"file-"+n):ce(e)?"folder":e)}function j(e,t,n){let r=Array.isArray(t)?t:[t];for(let o of r)o.length>1&&(e=e.replaceAll(o,n));return e}function Y(e,t){let n={};for(let[r,o]of Object.entries(e))t.includes(r)?n[r]=y:m(o)?n[r]=Y(o,t):n[r]=o;return n}function x(e,t,n=[]){if(Array.isArray(e))return e.forEach(r=>x(r,t,n)),n;if(m(e))for(let[r,o]of Object.entries(e))t.includes(r)&&typeof o=="string"?n.push(o):(m(o)||Array.isArray(o))&&x(o,t,n);return n}function ae(e,t){let n=["organization","o","input","i","author","a","clientCert","clientKey","caCert","server","S"],r=t.join(" "),o={};for(let[i,s]of Object.entries(e))if(n.includes(i))o[i]=y,r=j(r,s,y);else if(typeof s=="string"){let c=w(s);o[i]=c,r=j(r,s,c)}else if(Array.isArray(s)){o[i]=s.map(w);for(let c of s){let f=w(c);r.includes(c)&&(r=r.replaceAll(c,f))}}else if(m(s)){let c=x(s,n);for(let f of c)r=j(r,f,y);o[i]=Y(s,n)}else o[i]=s;return{arguments:JSON.stringify(o),raw_input:r}}var fe=process.platform==="win32"?A(J(process.execPath),"node_modules","npm","package.json"):A(J(process.execPath),"..","lib","node_modules","npm","package.json");function le(){try{return JSON.parse(M(fe,"utf8")).version}catch{}try{return ne("npm -v",{stdio:["ignore","pipe","ignore"]}).toString().trim()}catch{return"unknown"}}var ue=e=>{if(!(process.env.CI||!e))try{let n=A(U(),v);oe(n,e)}catch{}},de=()=>{if(!process.env.CI)try{let t=A(U(),v);return re(t)?M(t).toString().trim():void 0}catch{return}};export{_e as a,be as b,Oe as c,De as d,Ie as e,ke as f};
7
+ import{a as C,e as P,g as L,h as v,i as R,k as V}from"./PTBPNZRZ.js";import{u as S}from"./YA5KTHFN.js";import{c as m,da as u,la as k,u as I}from"./X22IMAJK.js";var _=" ",z=" ";function _e(e){let t=Math.max(...e.map(o=>S(o).length)),n=t+z.length*2,r=_+u("\u2551"+" ".repeat(n)+"\u2551");return["",_+u("\u2554"+"\u2550".repeat(n)+"\u2557"),r,...e.map(o=>{let i=" ".repeat(t-S(o).length);return`${_}${u("\u2551")}${z}${o}${i}${z}${u("\u2551")}`}),r,_+u("\u255A"+"\u2550".repeat(n)+"\u255D"),"",""].join(`
8
+ `)}import{execSync as ne}from"node:child_process";import*as p from"node:fs";import{existsSync as re,writeFileSync as oe,readFileSync as M}from"node:fs";import*as $ from"node:os";import{tmpdir as U}from"node:os";import{dirname as J,join as A}from"node:path";async function F(e=L){try{let{fetchWithTimeout:t}=await import("./QXBSAWH3.js");return await t(P,{timeout:e}),!0}catch{return!1}}var y="***";function be(e){return process.env.REDOCLY_TELEMETRY!=="off"&&e?.resolvedConfig.telemetry!=="off"}async function Oe({config:e,argv:t,exit_code:n,execution_time:r,spec_version:o,spec_keyword:i,spec_full_version:s,respect_x_security_auth_types:c,respect_source_description_types:f,respect_criterion_object_types:N,lint_rules_with_errors:T,lint_rules_with_warnings:b,lint_rules_with_ignored_problems:O,generate_client:a,eject_generator:l,bundle:G}){try{if(!t||!await F(1e3))return;let{_:[h],$0:pe,...D}=t,{RedoclyOAuthClient:K,getReuniteUrl:H}=await import("./WTJ3S4D7.js"),q=new K(C),Q=H(e,D.residency),Z=await q.isAuthorized(Q),g=de();g||(g=`ann_${V()}`,ue(g));let E=k(o),X=[{id:h,object:"command",uri:`urn:redocly:cli:command:${h}`,logged_in:Z?"yes":"no",command:h,...ae(D,process.argv.slice(2)),node_version:process.version,npm_version:le(),version:C,exit_code:n,execution_time:r,metadata:process.env.REDOCLY_CLI_TELEMETRY_METADATA,environment_ci:process.env.CI,environment:process.env.REDOCLY_ENVIRONMENT,has_config:typeof e?.document?.parsed>"u"?"no":"yes",spec_version:o,spec_keyword:i,spec_full_version:s,respect_x_security_auth_types:E==="arazzo1"&&c?.length?JSON.stringify(c):void 0,respect_source_description_types:E==="arazzo1"&&f?.length?JSON.stringify(f):void 0,respect_criterion_object_types:E==="arazzo1"&&N?.length?JSON.stringify(N):void 0,lint_rules_with_errors:T?.length?JSON.stringify(T):void 0,lint_rules_with_warnings:b?.length?JSON.stringify(b):void 0,lint_rules_with_ignored_problems:O?.length?JSON.stringify(O):void 0,generate_client_builtin_generators:a?.generate_client_builtin_generators?.length?JSON.stringify(a.generate_client_builtin_generators):void 0,generate_client_custom_generators_count:a?.generate_client_custom_generators_count,generate_client_toolkit_imports:a?.generate_client_toolkit_imports?.length?JSON.stringify(a.generate_client_toolkit_imports):void 0,generate_client_error_category:a?.generate_client_error_category,generate_client_ejected_generators:a?.generate_client_ejected_generators?.length?JSON.stringify(a.generate_client_ejected_generators):void 0,generate_client_composed_apis_count:a?.generate_client_composed_apis_count,eject_generator_action:l?.eject_generator_action,eject_generator_name:l?.eject_generator_name,eject_generator_outcome:l?.eject_generator_outcome,eject_generator_conflicts:l?.eject_generator_conflicts,eject_generator_from_version:l?.eject_generator_from_version,eject_generator_to_version:l?.eject_generator_to_version,bundle_overlays_count:G?.bundle_overlays_count}],ee=R.mapToCloudEvent({type:"com.redocly.command.ran",source:"urn:redocly:cli",origin:"redocly-cli",env:"production",osPlatform:$.platform(),actor:{id:g,object:"user",uri:""},category:"product",data:X}),{otelTelemetry:te}=await import("./MTKICX4T.js");te.send(ee)}catch{}}function De(e,t){for(let n of e.sourceDescriptions??[])n.type&&t.add(n.type)}function Ie(e,t){for(let n of e.workflows??[]){d(n.successActions,t),d(n.failureActions,t);for(let r of n.steps??[])W(r.successCriteria,t),d(r.onSuccess,t),d(r.onFailure,t)}d(Object.values(e.components?.successActions??{}),t),d(Object.values(e.components?.failureActions??{}),t)}function d(e,t){for(let n of e??[])W(n.criteria,t)}function W(e,t){for(let n of e??[]){let r=ie(n);r&&t.add(r)}}function ie(e){let t=e.type;return typeof t=="string"?t:t?.type||(e.condition?"simple":void 0)}function ke(e,t){for(let n of e.workflows??[]){for(let r of n["x-security"]??[]){let o=r.scheme;if(o?.type){let i=o.type==="http"?o.scheme:o.type;i&&t.add(i)}}for(let r of n.steps??[])for(let o of r["x-security"]??[]){let i=o.scheme;if(i?.type){let c=i.type==="http"?i.scheme:i.type;c&&t.add(c)}let s=o.schemeName;s&&t.add(s)}}}function se(e){return p.existsSync(e)&&p.statSync(e).isFile()}function ce(e){return p.existsSync(e)&&p.statSync(e).isDirectory()}function w(e){return e&&(I(e)?e.split("://")[0]+"://url":se(e)?e.replace(/.+\.([^.]+)$/,(t,n)=>"file-"+n):ce(e)?"folder":e)}function j(e,t,n){let r=Array.isArray(t)?t:[t];for(let o of r)o.length>1&&(e=e.replaceAll(o,n));return e}function Y(e,t){let n={};for(let[r,o]of Object.entries(e))t.includes(r)?n[r]=y:m(o)?n[r]=Y(o,t):n[r]=o;return n}function x(e,t,n=[]){if(Array.isArray(e))return e.forEach(r=>x(r,t,n)),n;if(m(e))for(let[r,o]of Object.entries(e))t.includes(r)&&typeof o=="string"?n.push(o):(m(o)||Array.isArray(o))&&x(o,t,n);return n}function ae(e,t){let n=["organization","o","input","i","author","a","clientCert","clientKey","caCert","server","S"],r=t.join(" "),o={};for(let[i,s]of Object.entries(e))if(n.includes(i))o[i]=y,r=j(r,s,y);else if(typeof s=="string"){let c=w(s);o[i]=c,r=j(r,s,c)}else if(Array.isArray(s)){o[i]=s.map(w);for(let c of s){let f=w(c);r.includes(c)&&(r=r.replaceAll(c,f))}}else if(m(s)){let c=x(s,n);for(let f of c)r=j(r,f,y);o[i]=Y(s,n)}else o[i]=s;return{arguments:JSON.stringify(o),raw_input:r}}var fe=process.platform==="win32"?A(J(process.execPath),"node_modules","npm","package.json"):A(J(process.execPath),"..","lib","node_modules","npm","package.json");function le(){try{return JSON.parse(M(fe,"utf8")).version}catch{}try{return ne("npm -v",{stdio:["ignore","pipe","ignore"]}).toString().trim()}catch{return"unknown"}}var ue=e=>{if(!(process.env.CI||!e))try{let n=A(U(),v);oe(n,e)}catch{}},de=()=>{if(!process.env.CI)try{let t=A(U(),v);return re(t)?M(t).toString().trim():void 0}catch{return}};export{_e as a,be as b,Oe as c,De as d,Ie as e,ke as f};