@redocly/cli 2.58.0 → 2.58.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 (123) hide show
  1. package/THIRD_PARTY_NOTICES +1 -1
  2. package/lib/chunks/{TAEOWXJJ.js → 263OU3EK.js} +1 -1
  3. package/lib/chunks/{5WKNTF7W.js → 2CAHRLJ3.js} +1 -1
  4. package/lib/chunks/{JPHYX7OV.js → 4R5JMLPR.js} +1 -1
  5. package/lib/chunks/{R5A3H7N2.js → 4U5QHDPF.js} +1 -1
  6. package/lib/chunks/{65C4QORD.js → 4WEATF5W.js} +1 -1
  7. package/lib/chunks/{BZNIB4HL.js → 4Y6NCJUT.js} +1 -1
  8. package/lib/chunks/{2ERUBDSZ.js → 5TPCSTMC.js} +1 -1
  9. package/lib/chunks/{FBHTM4LH.js → 6MXKU6BN.js} +1 -1
  10. package/lib/chunks/{PWVCTNVT.js → 6NXEK35A.js} +1 -1
  11. package/lib/chunks/{4BCJL2BX.js → 6VBDC3HP.js} +1 -1
  12. package/lib/chunks/{3TNSVCBC.js → 7HGHXQBL.js} +1 -1
  13. package/lib/chunks/{MWJGFN4Y.js → 7INWM6QM.js} +1 -1
  14. package/lib/chunks/{252ZXXJ7.js → AW5K6TIG.js} +1 -1
  15. package/lib/chunks/{7KZRKMQI.js → B2Q7DOT4.js} +1 -1
  16. package/lib/chunks/{6HHP5O4K.js → BNNOQCQA.js} +1 -1
  17. package/lib/chunks/{YPT2KQ2K.js → BQBQIRKC.js} +1 -1
  18. package/lib/chunks/{EPFKYDYC.js → BWDHENL3.js} +1 -1
  19. package/lib/chunks/{X5U3XCIW.js → CMHJY4T2.js} +1 -1
  20. package/lib/chunks/{LWTH3K75.js → CTTC32GG.js} +1 -1
  21. package/lib/chunks/{DVJIGHFR.js → DEZGXWTS.js} +1 -1
  22. package/lib/chunks/{PB256IKB.js → DTH2KLMU.js} +2 -2
  23. package/lib/chunks/{WFGS4GSF.js → ENBAORPS.js} +3 -3
  24. package/lib/chunks/{M4JX2FBY.js → FYDETXDC.js} +1 -1
  25. package/lib/chunks/{7BM3QKWP.js → GACZ2YWU.js} +1 -1
  26. package/lib/chunks/{ERFOEXTV.js → H4NHEW6K.js} +1 -1
  27. package/lib/chunks/{3RJ5Q24M.js → H67F6VQQ.js} +1 -1
  28. package/lib/chunks/{NRU2WFMW.js → IBYLYDST.js} +2 -2
  29. package/lib/chunks/{C6B5SYPM.js → IXAUPJML.js} +1 -1
  30. package/lib/chunks/{MT5H2R3P.js → JD3HIQIK.js} +56 -56
  31. package/lib/chunks/{YMMEOUYX.js → JFQX5N4D.js} +1 -1
  32. package/lib/chunks/{T6HGKHGP.js → JIN2S34E.js} +1 -1
  33. package/lib/chunks/{FIMSBOF2.js → K3GO5B32.js} +1 -1
  34. package/lib/chunks/{3QTDDZ3U.js → K4HCHGLF.js} +1 -1
  35. package/lib/chunks/{ABUS6H76.js → K4MJBKZB.js} +1 -1
  36. package/lib/chunks/{ROE2PM62.js → KIUUH6YY.js} +1 -1
  37. package/lib/chunks/{PZEYEOIF.js → KMRFAGWI.js} +1 -1
  38. package/lib/chunks/{JXAUEF5V.js → KRKCMWGM.js} +1 -1
  39. package/lib/chunks/{YTAL3SI4.js → LHKIMOHX.js} +2 -2
  40. package/lib/chunks/{U4WMP25Y.js → LRFPMBTV.js} +1 -1
  41. package/lib/chunks/{46SNGFKM.js → M7T6N7AK.js} +1 -1
  42. package/lib/chunks/{RREAI5RF.js → MSKEZAFV.js} +1 -1
  43. package/lib/chunks/{6ESHHDEM.js → MULE7RHG.js} +1 -1
  44. package/lib/chunks/{YFBPBQ7G.js → MVXFJBMU.js} +1 -1
  45. package/lib/chunks/{JF6HX6A6.js → NMS2HUB3.js} +1 -1
  46. package/lib/chunks/{7HX6H6PZ.js → NX3RWANU.js} +1 -1
  47. package/lib/chunks/{BNAH4YGC.js → PI42YPSD.js} +1 -1
  48. package/lib/chunks/{YLFY2DKU.js → PJXZKT3O.js} +1 -1
  49. package/lib/chunks/{TTWBJ74O.js → PY4MYMQT.js} +1 -1
  50. package/lib/chunks/{2LDRZLQD.js → PZF2WPD3.js} +1 -1
  51. package/lib/chunks/{2523PDUF.js → Q4ESEW3O.js} +1 -1
  52. package/lib/chunks/{6G6YWZOW.js → QK7R3ZTY.js} +1 -1
  53. package/lib/chunks/{GDFQSHUE.js → R2IHROCG.js} +1 -1
  54. package/lib/chunks/{NYQDTPTE.js → ROQ7FTVG.js} +1 -1
  55. package/lib/chunks/{NSNQAVBA.js → RVRYLTME.js} +1 -1
  56. package/lib/chunks/{H7Z35EAH.js → RW4XUFPU.js} +1 -1
  57. package/lib/chunks/{3TRGOJ74.js → SQUNMRDS.js} +1 -1
  58. package/lib/chunks/{LIAO3NFX.js → TDNSQRQT.js} +1 -1
  59. package/lib/chunks/{SXYE4UNQ.js → TGAC4ILD.js} +1 -1
  60. package/lib/chunks/{D2IJWX6B.js → URZNERQS.js} +1 -1
  61. package/lib/chunks/{OQ2G774U.js → V2PTVECL.js} +1 -1
  62. package/lib/chunks/{QXUO5IQJ.js → VJQJVOIN.js} +1 -1
  63. package/lib/chunks/{VNSAGJ2H.js → WDWS64N7.js} +1 -1
  64. package/lib/chunks/{6XXDGMQI.js → WYZDPMVU.js} +1 -1
  65. package/lib/chunks/{V34PUN4E.js → XTW63JDM.js} +1 -1
  66. package/lib/chunks/{XARQ5LTM.js → YURX7H3N.js} +1 -1
  67. package/lib/chunks/{QZJD7SST.js → YZRKJF2V.js} +1 -1
  68. package/lib/chunks/{OJE7THLM.js → Z7JI42WA.js} +1 -1
  69. package/lib/chunks/{N6VRECSO.js → ZIIE7LXR.js} +1 -1
  70. package/lib/eject-assets/generators/cli/docs.ts +1 -1
  71. package/lib/eject-assets/generators/cli/engine-source.ts +1 -1
  72. package/lib/eject-assets/generators/cli/index.ts +2 -2
  73. package/lib/eject-assets/generators/cli/render.ts +1 -1
  74. package/lib/eject-assets/generators/go/client.ts +1 -1
  75. package/lib/eject-assets/generators/go/descriptor.ts +1 -1
  76. package/lib/eject-assets/generators/go/index.ts +2 -2
  77. package/lib/eject-assets/generators/go/models.ts +1 -1
  78. package/lib/eject-assets/generators/go/naming.ts +1 -1
  79. package/lib/eject-assets/generators/go/operations.ts +1 -1
  80. package/lib/eject-assets/generators/go/pagination.ts +1 -1
  81. package/lib/eject-assets/generators/go/types.ts +1 -1
  82. package/lib/eject-assets/generators/mock/faker.ts +1 -1
  83. package/lib/eject-assets/generators/mock/index.ts +2 -2
  84. package/lib/eject-assets/generators/mock/render.ts +1 -1
  85. package/lib/eject-assets/generators/mock/sample.ts +1 -1
  86. package/lib/eject-assets/generators/mock/values.ts +1 -1
  87. package/lib/eject-assets/generators/php/client.ts +1 -1
  88. package/lib/eject-assets/generators/php/descriptor.ts +1 -1
  89. package/lib/eject-assets/generators/php/index.ts +2 -2
  90. package/lib/eject-assets/generators/php/models.ts +1 -1
  91. package/lib/eject-assets/generators/php/naming.ts +1 -1
  92. package/lib/eject-assets/generators/php/operations.ts +1 -1
  93. package/lib/eject-assets/generators/php/pagination.ts +1 -1
  94. package/lib/eject-assets/generators/php/types.ts +1 -1
  95. package/lib/eject-assets/generators/python/client.ts +1 -1
  96. package/lib/eject-assets/generators/python/descriptor.ts +1 -1
  97. package/lib/eject-assets/generators/python/index.ts +2 -2
  98. package/lib/eject-assets/generators/python/models.ts +1 -1
  99. package/lib/eject-assets/generators/python/naming.ts +1 -1
  100. package/lib/eject-assets/generators/python/operations.ts +1 -1
  101. package/lib/eject-assets/generators/python/pagination.ts +1 -1
  102. package/lib/eject-assets/generators/python/types.ts +1 -1
  103. package/lib/eject-assets/generators/swr/index.ts +2 -2
  104. package/lib/eject-assets/generators/swr/render.ts +1 -1
  105. package/lib/eject-assets/generators/tanstack-query/index.ts +2 -2
  106. package/lib/eject-assets/generators/tanstack-query/render.ts +1 -1
  107. package/lib/eject-assets/generators/transformers/index.ts +2 -2
  108. package/lib/eject-assets/generators/transformers/render.ts +1 -1
  109. package/lib/eject-assets/generators/typescript/banner.ts +1 -1
  110. package/lib/eject-assets/generators/typescript/client.ts +1 -1
  111. package/lib/eject-assets/generators/typescript/descriptor.ts +1 -1
  112. package/lib/eject-assets/generators/typescript/index.ts +2 -2
  113. package/lib/eject-assets/generators/typescript/inline-runtime.ts +1 -1
  114. package/lib/eject-assets/generators/typescript/operation-signature.ts +1 -1
  115. package/lib/eject-assets/generators/typescript/operation-types.ts +1 -1
  116. package/lib/eject-assets/generators/typescript/operations.ts +1 -1
  117. package/lib/eject-assets/generators/typescript/response-headers.ts +1 -1
  118. package/lib/eject-assets/generators/typescript/type-guards.ts +1 -1
  119. package/lib/eject-assets/generators/typescript/types.ts +1 -1
  120. package/lib/eject-assets/generators/zod/index.ts +2 -2
  121. package/lib/eject-assets/generators/zod/schemas.ts +1 -1
  122. package/lib/index.js +5 -5
  123. package/package.json +1 -1
@@ -664,7 +664,7 @@ Packages:
664
664
  @redocly/ajv@8.18.3 — Copyright (c) 2015-2021 Evgeny Poberezkin
665
665
  @redocly/cli-otel@0.3.7 — Copyright 2025 Redocly Inc, all rights reserved.
666
666
  @redocly/config@0.22.0 — Copyright 2024 Redocly Inc.
667
- @redocly/config@0.59.0 — Copyright 2024 Redocly Inc.
667
+ @redocly/config@0.61.1 — Copyright 2024 Redocly Inc.
668
668
  @redocly/openapi-core@1.34.20
669
669
  agent-base@7.1.4 — Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
670
670
  ajv-formats@3.0.1 — Copyright (c) 2020 Evgeny Poberezkin
@@ -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{ga as t}from"./MT5H2R3P.js";import*as e from"node:process";var o=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],n=class{frames;currentFrame;intervalId;message;constructor(){this.frames=o,this.currentFrame=0,this.intervalId=null,this.message=""}showFrame(){t.info("\r"+this.frames[this.currentFrame]+" "+this.message),this.currentFrame=(this.currentFrame+1)%this.frames.length}start(r){if(this.message!==r){if(this.message=r,!e.stderr.isTTY){t.info(`${r}...
7
+ import{ga as t}from"./JD3HIQIK.js";import*as e from"node:process";var o=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],n=class{frames;currentFrame;intervalId;message;constructor(){this.frames=o,this.currentFrame=0,this.intervalId=null,this.message=""}showFrame(){t.info("\r"+this.frames[this.currentFrame]+" "+this.message),this.currentFrame=(this.currentFrame+1)%this.frames.length}start(r){if(this.message!==r){if(this.message=r,!e.stderr.isTTY){t.info(`${r}...
8
8
  `);return}this.intervalId===null&&(this.intervalId=setInterval(()=>{this.showFrame()},100))}}stop(){this.intervalId!==null&&(clearInterval(this.intervalId),this.intervalId=null,t.info("\r")),this.message=""}};function h(i){i.stop(),e.stderr.isTTY&&t.info("\x1B[2K")}function m(i,r){let[s]=r.inFlight;if(!s)return;let a=r.inFlight.size>1?` (+${r.inFlight.size-1} more)`:"";i.start(`[${r.position}/${r.total}] ${r.action} ${s}${a}`)}export{n as a,h as b,m as c};
@@ -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 ye,e as ve,f as Se,g as we,h as O,i as Re,k,l as A,m as Ie,n as Pe,v as be,w as Oe}from"./YFBPBQ7G.js";import{$ as E,J as ot,T as ce,W as at,X as pe,Y as g,Z as $,_ as de,aa as q,c as d,ca as S,ea as v,ga as R,ha as le,ia as fe,ja as me,ka as he,pa as ge,q as ae,v as ue}from"./MT5H2R3P.js";import{e as oe}from"./RFWIIJFG.js";import ke from"node:path";function I(t){return t?t.trim():""}function B(t){let e=I(t.operationId)||I(t.path);return[I(t.ruleId),I(t.severity),I(t.message),e,I(t.target),I(t.schemaPath)].join("")}var _=t=>pe(S(t));function ut(t){return t==="error"?"error":t==="warning"?"warning":"note"}function ct(t){if(t==null)return"";let e=String(t);return!e.includes(",")&&!e.includes('"')&&!e.includes(`
7
+ import{a as ye,e as ve,f as Se,g as we,h as O,i as Re,k,l as A,m as Ie,n as Pe,v as be,w as Oe}from"./MVXFJBMU.js";import{$ as E,J as ot,T as ce,W as at,X as pe,Y as g,Z as $,_ as de,aa as q,c as d,ca as S,ea as v,ga as R,ha as le,ia as fe,ja as me,ka as he,pa as ge,q as ae,v as ue}from"./JD3HIQIK.js";import{e as oe}from"./RFWIIJFG.js";import ke from"node:path";function I(t){return t?t.trim():""}function B(t){let e=I(t.operationId)||I(t.path);return[I(t.ruleId),I(t.severity),I(t.message),e,I(t.target),I(t.schemaPath)].join("")}var _=t=>pe(S(t));function ut(t){return t==="error"?"error":t==="warning"?"warning":"note"}function ct(t){if(t==null)return"";let e=String(t);return!e.includes(",")&&!e.includes('"')&&!e.includes(`
8
8
  `)?e:`"${e.replace(/"/g,'""')}"`}function pt(t){return ke.isAbsolute(t)?ke.relative(process.cwd(),t)||".":t}function dt(t){if(!t)return null;let e=t.operationPathTemplate;return typeof e=="string"&&e.length>0?e:null}function lt(t){return Object.entries(t).sort((e,r)=>{let n=r[1]-e[1];return n!==0?n:e[0].localeCompare(r[0])})}function ft(t){let e=[],r=new Map;for(let n of t){let s=B({ruleId:n.ruleId,severity:n.severity,message:n.message,operationId:n.operationId,path:n.path,target:n.target,schemaPath:n.schemaPath}),i=r.get(s);if(i!==void 0){e[i].occurrences+=1;continue}r.set(s,e.length),e.push({finding:n,occurrences:1})}return e}function mt(t){let e=ft(t.findings).map(n=>({occurrences:n.occurrences,exchangeIndex:n.finding.exchangeIndex,ruleId:n.finding.ruleId,severity:n.finding.severity,category:n.finding.category,message:n.finding.message,operationId:n.finding.operationId,specSource:n.finding.specSource,target:n.finding.target,schemaPath:n.finding.schemaPath,dataPath:n.finding.dataPath,details:n.finding.details,method:n.finding.method,url:n.finding.url,path:n.finding.path,status:n.finding.status})),r={run:{id:t.runId,specSource:t.meta.specSource,trafficPath:t.meta.trafficPath,format:t.meta.format,matchMode:t.meta.matchMode,server:t.meta.server,totalExchanges:t.summary.totalExchanges,documentedExchanges:t.summary.documentedExchanges,undocumentedExchanges:t.summary.undocumentedExchanges,skippedExchanges:t.summary.skippedExchanges,findingsBySeverity:t.summary.findingsBySeverity,findingsByRule:t.summary.findingsByRule,totalProblems:t.summary.totalProblemGroups,durationMs:t.summary.durationMs},problems:e};return`${JSON.stringify(r,null,2)}
9
9
  `}function ht(t){let e=["run_id","finding_id","exchange_index","severity","category","rule_id","message","method","path","url","status","operation_id","spec_source","target","schema_path","data_path"],r=t.findings.map(s=>[t.runId,s.id,s.exchangeIndex,s.severity,s.category,s.ruleId,s.message,s.method,s.path,s.url,s.status,s.operationId,s.specSource,s.target,s.schemaPath,s.dataPath]);return`${[e,...r].map(s=>s.map(ct).join(",")).join(`
10
10
  `)}
@@ -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{b as k,f as v}from"./N6VRECSO.js";import{K as A,L as S,M as y,T as f,U as w,ba as d,fa as l,ga as n,ia as x,ja as h,ka as O,ma as g,pa as b,q as u,v as p}from"./MT5H2R3P.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{performance as F}from"perf_hooks";function I(o){let t=Object.fromEntries(Object.entries(o).map(([s,{metric:e,total:r,counts:a}])=>[s,{metric:e,total:r,counts:a}]));n.output(JSON.stringify(t,null,2))}function P(o){let t=`| Feature | Count |
7
+ import{b as k,f as v}from"./ZIIE7LXR.js";import{K as A,L as S,M as y,T as f,U as w,ba as d,fa as l,ga as n,ia as x,ja as h,ka as O,ma as g,pa as b,q as u,v as p}from"./JD3HIQIK.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{performance as F}from"perf_hooks";function I(o){let t=Object.fromEntries(Object.entries(o).map(([s,{metric:e,total:r,counts:a}])=>[s,{metric:e,total:r,counts:a}]));n.output(JSON.stringify(t,null,2))}function P(o){let t=`| Feature | Count |
8
8
  | --- | --- |
9
9
  `,s=[];for(let{metric:e,total:r,counts:a}of Object.values(o)){t+=`| ${e} | ${r} |
10
10
  `;let c=Object.entries(a??{});c.length&&s.push(`
@@ -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{u as o}from"./N6VRECSO.js";import{$ as t}from"./MT5H2R3P.js";var r=" ",a=" ";function g(i){let p=Math.max(...i.map(n=>o(n).length)),e=p+a.length*2,c=r+t("\u2551"+" ".repeat(e)+"\u2551");return["",r+t("\u2554"+"\u2550".repeat(e)+"\u2557"),c,...i.map(n=>{let h=" ".repeat(p-o(n).length);return`${r}${t("\u2551")}${a}${n}${h}${a}${t("\u2551")}`}),c,r+t("\u255A"+"\u2550".repeat(e)+"\u255D"),"",""].join(`
7
+ import{u as o}from"./ZIIE7LXR.js";import{$ as t}from"./JD3HIQIK.js";var r=" ",a=" ";function g(i){let p=Math.max(...i.map(n=>o(n).length)),e=p+a.length*2,c=r+t("\u2551"+" ".repeat(e)+"\u2551");return["",r+t("\u2554"+"\u2550".repeat(e)+"\u2557"),c,...i.map(n=>{let h=" ".repeat(p-o(n).length);return`${r}${t("\u2551")}${a}${n}${h}${a}${t("\u2551")}`}),c,r+t("\u255A"+"\u2550".repeat(e)+"\u255D"),"",""].join(`
8
8
  `)}export{g 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{a as o,c as n}from"./HBUZKWXC.js";import{ga as t}from"./MT5H2R3P.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{spawn as m}from"node:child_process";var j=async({argv:e})=>{t.info(`
7
+ import{a as o,c as n}from"./HBUZKWXC.js";import{ga as t}from"./JD3HIQIK.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{spawn as m}from"node:child_process";var j=async({argv:e})=>{t.info(`
8
8
  Launching eject using NPX.
9
9
 
10
10
  `);let{npxExecutableName:c,sanitize:r,shell:i}=n(),p=r(e.path,o),a=r(e["project-dir"],o);m(c,["-y","@redocly/realm","eject",`${e.type}`,p,`-d=${a}`,e.force?`--force=${e.force}`:""],{stdio:"inherit",shell:i}).on("error",s=>{throw t.info(`Eject launch failed: ${s.message}`),new Error("Eject launch failed.")})};export{j as handleEject};
@@ -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{b as D}from"./N6VRECSO.js";import{T as C,U as j,ga as $,ia as k,ja as M,ka as S,ma as b,q as F,t as R,v as x}from"./MT5H2R3P.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{relative as I,resolve as U}from"node:path";var A=20;async function B({argv:o,config:t,collectSpecData:r}){let[{path:s}]=await D([o.api],t),n=new C(t.resolve),e=await n.resolveDocument(null,s,!0);r?.(e);let i=k(e.parsed),d=F(t.extendTypes(x(i),i),t),p=new Map,u=({source:l,pointer:c},f,N)=>{let v=`${l.absoluteRef}${c}`,y=p.get(v);if(!y){p.set(v,{absoluteRef:l.absoluteRef,pointer:c,types:[f],resolvesTo:N});return}y.types.includes(f)||y.types.push(f),y.resolvesTo||(y.resolvesTo=N)},m={any:{enter(l,{location:c,type:f}){u(c,f.name)}},ref(l,{location:c,type:f},N){u(c,f.name,N.location)}},h={problems:[],specVersion:i,config:t,visitorsData:{}},a=await j({rootDocument:e,rootType:d.Root,externalRefResolver:n});if(S({document:e,rootType:d.Root,normalizedVisitors:M([{severity:"warn",ruleId:"inspect-node-types",visitor:m}],d),resolvedRefMap:a,ctx:h}),o.pointer){let l=W(p,o.pointer,e.source.absoluteRef);o.parents?L(w(p,l,e.source.absoluteRef)):$.output(`${l.types.join(`
7
+ import{b as D}from"./ZIIE7LXR.js";import{T as C,U as j,ga as $,ia as k,ja as M,ka as S,ma as b,q as F,t as R,v as x}from"./JD3HIQIK.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{relative as I,resolve as U}from"node:path";var A=20;async function B({argv:o,config:t,collectSpecData:r}){let[{path:s}]=await D([o.api],t),n=new C(t.resolve),e=await n.resolveDocument(null,s,!0);r?.(e);let i=k(e.parsed),d=F(t.extendTypes(x(i),i),t),p=new Map,u=({source:l,pointer:c},f,N)=>{let v=`${l.absoluteRef}${c}`,y=p.get(v);if(!y){p.set(v,{absoluteRef:l.absoluteRef,pointer:c,types:[f],resolvesTo:N});return}y.types.includes(f)||y.types.push(f),y.resolvesTo||(y.resolvesTo=N)},m={any:{enter(l,{location:c,type:f}){u(c,f.name)}},ref(l,{location:c,type:f},N){u(c,f.name,N.location)}},h={problems:[],specVersion:i,config:t,visitorsData:{}},a=await j({rootDocument:e,rootType:d.Root,externalRefResolver:n});if(S({document:e,rootType:d.Root,normalizedVisitors:M([{severity:"warn",ruleId:"inspect-node-types",visitor:m}],d),resolvedRefMap:a,ctx:h}),o.pointer){let l=W(p,o.pointer,e.source.absoluteRef);o.parents?L(w(p,l,e.source.absoluteRef)):$.output(`${l.types.join(`
8
8
  `)}
9
9
  `);return}let g=[...p.values()];if(o.summary)V(g);else if(o.type){let l=o.type,c=g.filter(({types:f})=>f.includes(l));if(c.length===0)throw new b(`No nodes of type '${l}'. Run the command with --summary to see the types used in this description.`);o.parents?L(c.flatMap(f=>w(p,f,e.source.absoluteRef)),l):E(c)}else E(g)}function w(o,t,r,s=new Set){let n=`${t.absoluteRef}${t.pointer}`;if(s.has(n))return[[t]];s.add(n);let e=[],i=t.pointer.split("/");for(let p=1;p<i.length;p++){let u=p===1?"#/":i.slice(0,p).join("/");if(u===t.pointer)continue;let m=o.get(`${t.absoluteRef}${u}`);m&&e.push(m)}e.push(t);let d=[];e[0].absoluteRef===r&&e[0].pointer==="#/"&&d.push(e);for(let[p,u]of e.entries()){let m=[...o.values()].filter(a=>a.resolvesTo?.source.absoluteRef===u.absoluteRef&&a.resolvesTo.pointer===u.pointer),h=e.slice(p+1);for(let a of m)d.push(...w(o,a,r,s).map(g=>[...g,...h]))}return d.length?d:[e]}function L(o,t){let r=new Set(o.map(s=>s.map(({types:n})=>t&&n.includes(t)?t:n.join(", ")).join(" \u2192 ")));for(let s of r)$.output(`${s}
10
10
  `)}function W(o,t,r){let[s,n]=t.split("#"),e=s?R(s)?s:U(process.cwd(),s):r,i=o.get(`${e}#${n||"/"}`);if(!i)throw new b(`No node at ${t}. ${z(o,e,`#${n||"/"}`,s)??`Check the pointer, and make sure the file is referenced from ${T(r)}.`}`);return i}function z(o,t,r,s){let n=r.split("/");for(let e=n.length-1;e>=1;e--){let i=e===1?"#/":n.slice(0,e).join("/"),d=o.get(`${t}${i}`);if(!d)continue;let p=n[e].toLowerCase(),u=e===1?"#/":`${i}/`,m=[...o.values()].filter(c=>c.absoluteRef===t&&c.pointer.startsWith(u)&&!c.pointer.slice(u.length).includes("/")),h=m.filter(c=>c.pointer.slice(u.length).toLowerCase().includes(p)),a=(h.length?h:m).map(c=>` ${s}${c.pointer}`),g=a.length-A;g>0&&(a.length=A,a.push(` \u2026and ${g} more`));let l=`The closest node is ${d.types.join(", ")} at ${s}${i}.`;return a.length?`${l} Did you mean:
@@ -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 o,b as t,c as e}from"./HBUZKWXC.js";import{ga as r}from"./MT5H2R3P.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{spawn as p}from"node:child_process";var u=async({argv:n})=>{r.info(`
7
+ import{a as o,b as t,c as e}from"./HBUZKWXC.js";import{ga as r}from"./JD3HIQIK.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{spawn as p}from"node:child_process";var u=async({argv:n})=>{r.info(`
8
8
  Launching translate using NPX.
9
9
 
10
10
  `);let{npxExecutableName:s,sanitize:a,shell:i}=e(),l=a(n["project-dir"],o),c=a(n.locale,t);p(s,["-y","@redocly/realm","translate",c,`-d=${l}`],{stdio:"inherit",shell:i}).on("error",m=>{throw r.info(`Translate launch failed: ${m.message}`),new Error("Translate launch failed.")})};export{u as handleTranslations};
@@ -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"./QXUO5IQJ.js";import"./M4JX2FBY.js";import"./NRU2WFMW.js";import"./WZXA5XPB.js";import"./MT5H2R3P.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{a as zodGenerator};
7
+ import{a}from"./VJQJVOIN.js";import"./FYDETXDC.js";import"./IBYLYDST.js";import"./WZXA5XPB.js";import"./JD3HIQIK.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{a as zodGenerator};
@@ -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{c as a,d as b}from"./NYQDTPTE.js";import"./NRU2WFMW.js";import"./WZXA5XPB.js";import"./MT5H2R3P.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{b as generateClient,a as runGenerators};
7
+ import{c as a,d as b}from"./ROQ7FTVG.js";import"./IBYLYDST.js";import"./WZXA5XPB.js";import"./JD3HIQIK.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{b as generateClient,a as runGenerators};
@@ -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{b as A,c as F,d as S,e as l}from"./OJE7THLM.js";import"./TAEOWXJJ.js";import{e as $,g as x,n as I,o as P}from"./3TRGOJ74.js";import{f as p}from"./N6VRECSO.js";import"./LRUXN6H5.js";import{_ as w,ga as n,l as u}from"./MT5H2R3P.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function O({argv:t,config:o,version:c}){let h=performance.now(),j=Date.now(),{organization:g,project:d,"mount-path":z,verbose:D}=t,f=t.domain||x(),e,r,y,b,s=[];try{let i=$();if(e=P(t.files,(a,T)=>{n.warn(`File ${a} is overwritten by ${T}
7
+ import{b as A,c as F,d as S,e as l}from"./Z7JI42WA.js";import"./263OU3EK.js";import{e as $,g as x,n as I,o as P}from"./SQUNMRDS.js";import{f as p}from"./ZIIE7LXR.js";import"./LRUXN6H5.js";import{_ as w,ga as n,l as u}from"./JD3HIQIK.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function O({argv:t,config:o,version:c}){let h=performance.now(),j=Date.now(),{organization:g,project:d,"mount-path":z,verbose:D}=t,f=t.domain||x(),e,r,y,b,s=[];try{let i=$();if(e=P(t.files,(a,T)=>{n.warn(`File ${a} is overwritten by ${T}
8
8
  `)}),!e.length)return p("push",h,"No files to upload");let m=await I({domain:f,apiKey:i,organization:g,project:d,mountPath:z,files:e,defaultBranch:t["default-branch"],commit:{message:t.message,branchName:t.branch,sha:t["commit-sha"],url:t["commit-url"],createdAt:t["created-at"],namespace:t.namespace,repository:t.repository,author:U(t.author)},version:c,replace:t.replace,onUploadStart:a=>{n.info(`Uploading to ${a.mountPath} ${e.length} ${u("file",e.length)}:
9
9
  `)},onSunsetWarning:a=>s.push(a),onSlugDeprecated:S});r=m.pushId,y=m.organizationId,b=m.projectId}catch(i){l("push",s),F("\u2717 File upload failed.",i)}for(let i of e)n.info(w(`\u2713 ${i.name}
10
10
  `));return n.info(`
@@ -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"./6XXDGMQI.js";import{ga as p}from"./MT5H2R3P.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"./WYZDPMVU.js";import{ga as p}from"./JD3HIQIK.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,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"./3RJ5Q24M.js";import"./M4JX2FBY.js";import"./NRU2WFMW.js";import"./WZXA5XPB.js";import"./MT5H2R3P.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{a as mockGenerator};
7
+ import{a}from"./H67F6VQQ.js";import"./FYDETXDC.js";import"./IBYLYDST.js";import"./WZXA5XPB.js";import"./JD3HIQIK.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{a as mockGenerator};
@@ -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 c}from"./QZJD7SST.js";import{h as s,l as a}from"./3TRGOJ74.js";import"./LRUXN6H5.js";import{_ as t,ga as e,ma as i}from"./MT5H2R3P.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function y({argv:r,config:l,version:d}){let o=s(l,r.residency);try{let n=new a(d);r.verbose&&(e.info(`OAuth client initialized.
7
+ import{a as c}from"./YZRKJF2V.js";import{h as s,l as a}from"./SQUNMRDS.js";import"./LRUXN6H5.js";import{_ as t,ga as e,ma as i}from"./JD3HIQIK.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function y({argv:r,config:l,version:d}){let o=s(l,r.residency);try{let n=new a(d);r.verbose&&(e.info(`OAuth client initialized.
8
8
  `),e.info(`Local credentials file path: ${n.credentialsFilePath}
9
9
  `)),await n.login(o,c),e.output(t(`\u2705 Logged in
10
10
 
@@ -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{c as U}from"./2U6O26CV.js";import{b as R,c as L,d as Y,f as se,g as K,h as oe,i as re}from"./M4JX2FBY.js";import{a as X,c as F,d as k,e as D,g as B,h as T,i as Z,j as ee,k as ne,l as H,n as te}from"./UW4UC7ZI.js";var M=F.python,j=class extends X{constructor(){super(" ")}typeName(n){return k(n,{style:"pascal",reserved:M})}memberName(n){let t=k(n,{style:"snake",reserved:M});return{identifier:t,renamed:t!==n}}identifier(n){return k(n,{style:"snake",reserved:M})}identifiers(n,t){return D(n,{style:"snake",reserved:M,taken:t})}constName(n){return k(n,{style:"screaming",reserved:M})}string(n){let t='"';for(let s of n){let r=s.codePointAt(0);s==="\\"?t+="\\\\":s==='"'?t+='\\"':s===`
7
+ import{c as U}from"./2U6O26CV.js";import{b as R,c as L,d as Y,f as se,g as K,h as oe,i as re}from"./FYDETXDC.js";import{a as X,c as F,d as k,e as D,g as B,h as T,i as Z,j as ee,k as ne,l as H,n as te}from"./UW4UC7ZI.js";var M=F.python,j=class extends X{constructor(){super(" ")}typeName(n){return k(n,{style:"pascal",reserved:M})}memberName(n){let t=k(n,{style:"snake",reserved:M});return{identifier:t,renamed:t!==n}}identifier(n){return k(n,{style:"snake",reserved:M})}identifiers(n,t){return D(n,{style:"snake",reserved:M,taken:t})}constName(n){return k(n,{style:"screaming",reserved:M})}string(n){let t='"';for(let s of n){let r=s.codePointAt(0);s==="\\"?t+="\\\\":s==='"'?t+='\\"':s===`
8
8
  `?t+="\\n":s==="\r"?t+="\\r":s===" "?t+="\\t":r<32||r===127?t+=`\\x${r.toString(16).padStart(2,"0")}`:r>=55296&&r<=57343?t+=`\\u${r.toString(16).padStart(4,"0")}`:t+=s}return t+'"'}literal(n){return n==null?"None":n===!0?"True":n===!1?"False":typeof n=="number"?String(n):typeof n=="string"?this.string(n):Array.isArray(n)?`[${n.map(s=>this.literal(s)).join(", ")}]`:`{${Object.entries(n).map(([s,r])=>`${this.string(s)}: ${this.literal(r)}`).join(", ")}}`}comment(n){for(let t of H(n))this.line(t===""?"#":`# ${t}`);return this}doc(n){let t=H(n);if(t.length===0)return this;if(t.length===1)return this.line(`"""${t[0]}"""`);this.line(`"""${t[0]}`);for(let s of t.slice(1))this.line(s);return this.line('"""')}};var N=F.python,f=new j;function O(e){return f.typeName(e)}function q(e){let{identifier:n,renamed:t}=f.memberName(e);return{python:n,renamed:t}}function I(e){let n=e.services.flatMap(s=>s.operations),t=D(n.map(s=>s.name),{style:"snake",reserved:N});return n.map((s,r)=>({op:s,ident:t[r]}))}var W=["self","body","headers","timeout","retry","idempotency_key"];function ae(e){return f.literal(e)}function ie(e){if(e!==void 0)return{style:e.style,...e.param!==void 0?{param:e.param}:{},...e.nextCursor!==void 0?{next_cursor:e.nextCursor}:{},...e.hasMore!==void 0?{has_more:e.hasMore}:{},...e.limitParam!==void 0?{limit_param:e.limitParam}:{},...e.items!==void 0?{items:e.items}:{}}}function ce(e,n){let t=new Set;return`[${(e.successResponseHeaders??[]).map(r=>{let a=k(r.name,{style:"snake",reserved:N}),c=a,i=2;for(;t.has(c);)c=`${a}_${i++}`;t.add(c);let m=te(r.schema,n);return`(${f.string(r.name)}, ${f.string(c)}, ${f.string(m)})`}).join(", ")}]`}function y(e,n="string"){if(Z(e))return`Optional[${y(ee(e),n)}]`;switch(e.kind){case"scalar":if(n==="Date"&&e.scalar==="string"){if(e.metadata?.format==="date-time")return"datetime";if(e.metadata?.format==="date")return"date"}return{string:"str",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"array":return`List[${y(e.items,n)}]`;case"record":return`Dict[str, ${y(e.value,n)}]`;case"ref":return O(e.name);case"literal":return`Literal[${f.literal(e.value)}]`;case"enum":return{string:"str",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"union":return`Union[${e.members.map(t=>y(t,n)).join(", ")}]`;case"null":return"None";case"omit":return O(e.base);case"object":case"intersection":case"unknown":return"Any"}}function G(e,n,t,s,r,a,c,i=!1){let m=D([...n.pathParams,...n.queryParams].map(S=>S.name),{style:"snake",reserved:N,taken:W}),l=n.pathParams.map((S,v)=>({param:S,python:m[v]})),o=n.queryParams.map((S,v)=>({param:S,python:m[n.pathParams.length+v]})),d=l.map(({param:S,python:v})=>`${v}: ${y(S.schema,a)}`),u=n.requestBody?[`body: ${y(n.requestBody.schema,a)}`]:[],$=[...o.map(({param:S,python:v})=>{let A=y(S.schema,a),E=A.startsWith("Optional[")?A:`Optional[${A}]`;return`${v}: ${E} = None`}),"headers: Optional[Dict[str, str]] = None","timeout: Optional[float] = None","retry: Optional[Dict[str, Any]] = None","idempotency_key: Any = None"],h=R(n),g=L(n),x=i?`Envelope[${h===void 0?"None":y(h,a)}]`:g!==void 0?`${r?"AsyncIterator":"Iterator"}[ServerSentEvent]`:s==="result"?"Result":h===void 0?"None":y(h,a),P=r&&g===void 0?"async def":"def",p=r?"await ":"",_=r?"send_async":"send",b=["self",...d,...u,"*",...$].join(", "),w=i?`${t}_with_headers`:t;e.block(`${P} ${w}(${b}) -> ${x}:`,()=>{e.doc(i?`Like ${t}(), returning an Envelope with the declared response headers.`:n.summary),e.line(`op = _OPERATIONS["${t}"]`),e.line('auth_headers, auth_query = resolve_auth(op.get("security") or [], self._auth)'),e.line("params: Dict[str, Any] = dict(auth_query)");for(let{param:E,python:C}of o)e.block(`if ${C} is not None:`,()=>{e.line(`params[${f.string(E.name)}] = encode(${C})`)});let S=l.map(({param:E,python:C})=>`${f.string(E.name)}: ${C}`).join(", ");if(e.line(`url = build_url(self._server_url, op["path"], {${S}})`),g!==void 0){let E=g.schema!==void 0&&g.schema.kind!=="unknown"?"json":"text";e.block("def _open(extra_headers: Dict[str, str]):",()=>{e.line('return self._http.stream(op["method"], url, headers={**auth_headers, **(headers or {}), **extra_headers}, params=params, timeout=timeout)')}),e.line(`return ${r?"aiter_sse":"iter_sse"}(_open, data_kind="${E}")`);return}Y(n)&&e.line("form_data, form_files = to_multipart(body)");let v=n.requestBody?Y(n)?", data=form_data, files=form_files":", json_body=encode(body)":"";e.line(`response = ${p}${_}(self._http, self._config, op, url, method=op["method"], headers={**auth_headers, **(headers or {})}, params=params${v}, timeout=timeout, retry=retry, idempotency_key=idempotency_key)`);let A=h===void 0?"None":`decode(${y(h,a)}, _safe_json(response))`;i?(e.block("if not response.is_success:",()=>{e.line("raise ApiError(url, response.status_code, response.reason_phrase, _safe_json(response))")}),e.line(`return Envelope(data=${A}, headers=read_envelope_headers(response, ${ce(n,c)}), response=response)`)):s==="result"?(e.block("if not response.is_success:",()=>{e.line("return Result(data=None, error=_safe_json(response), response=response)")}),e.line(`return Result(data=${A}, error=None, response=response)`)):(e.block("if not response.is_success:",()=>{e.line("raise ApiError(url, response.status_code, response.reason_phrase, _safe_json(response))")}),e.line(h===void 0?"return None":`return ${A}`))}),e.blank()}function le(e,n,t,s,r,a){let c=R(n),i=c===void 0?"Any":y(c,a),m=D([...n.pathParams,...n.queryParams].map(p=>p.name),{style:"snake",reserved:N,taken:W}),l=n.pathParams.map((p,_)=>({param:p,python:m[_]})),o=n.queryParams.map((p,_)=>({param:p,python:m[n.pathParams.length+_]})),d=l.map(({param:p,python:_})=>`${_}: ${y(p.schema,a)}`),u=[...o.map(({param:p,python:_})=>{let b=y(p.schema,a),w=b.startsWith("Optional[")?b:`Optional[${b}]`;return`${_}: ${w} = None`}),"headers: Optional[Dict[str, str]] = None","timeout: Optional[float] = None","retry: Optional[Dict[str, Any]] = None"],$=["self",...d,"*",...u].join(", "),h=s?"AsyncIterator":"Iterator",g=s?"aiter_pages":"iter_pages",x=s?"aiter_items":"iter_items",P=()=>{e.line("base: Dict[str, Any] = {}");for(let{param:b,python:w}of o)e.block(`if ${w} is not None:`,()=>{e.line(`base[${f.string(b.name)}] = encode(${w})`)});let p=s?"async def":"def",_=s?"await ":"";e.block(`${p} _page(page_params: Dict[str, Any]) -> Tuple[Any, Any]:`,()=>{e.line('auth_headers, auth_query = resolve_auth(op.get("security") or [], self._auth)');let b=l.map(({param:w,python:S})=>`${f.string(w.name)}: ${S}`).join(", ");e.line(`url = build_url(self._server_url, op["path"], {${b}})`),e.line(`response = ${_}${s?"send_async":"send"}(self._http, self._config, op, url, method=op["method"], headers={**auth_headers, **(headers or {})}, params={**page_params, **auth_query}, timeout=timeout, retry=retry)`),e.block("if not response.is_success:",()=>{e.line("raise ApiError(url, response.status_code, response.reason_phrase, _safe_json(response))")}),e.line("return _safe_json(response), response")})};s?(e.block(`async def ${t}_pages(${$}) -> ${h}[${i}]:`,()=>{e.line(`op = _OPERATIONS["${t}"]`),P(),e.block(`async for page in ${g}(_page, op["pagination"], base):`,()=>{e.line(i==="Any"?"yield page":`yield decode(${i}, page)`)})}),e.blank(),e.block(`async def ${t}_items(${$}) -> ${h}[${r}]:`,()=>{e.line(`op = _OPERATIONS["${t}"]`),P(),e.block(`async for item in ${x}(_page, op["pagination"], base):`,()=>{e.line(r==="Any"?"yield item":`yield decode(${r}, item)`)})})):(e.block(`def ${t}_pages(${$}) -> ${h}[${i}]:`,()=>{e.line(`op = _OPERATIONS["${t}"]`),P(),e.line(i==="Any"?`return ${g}(_page, op["pagination"], base)`:`return (decode(${i}, page) for page in ${g}(_page, op["pagination"], base))`)}),e.blank(),e.block(`def ${t}_items(${$}) -> ${h}[${r}]:`,()=>{e.line(`op = _OPERATIONS["${t}"]`),P(),e.line(r==="Any"?`return ${x}(_page, op["pagination"], base)`:`return (decode(${r}, item) for item in ${x}(_page, op["pagination"], base))`)})),e.blank()}function me(e){return se(e).map(t=>t.kind==="literal"?f.string(t.value):q(t.name).python).join(" + ")}function de(e,n){let t=n.servers??[];if(t.length===0)return;let s=new Set;e.block("class Servers:",()=>{e.line('"""The declared servers; variables default to the values from the description."""'),e.blank(),t.forEach((r,a)=>{let c=k(r.description??`server${a+1}`,{style:"snake",reserved:N});s.has(c)&&(c=`${c}_${a+1}`),s.add(c);let i=r.variables.map(m=>`${q(m.name).python}: str = ${f.string(m.default)}`);a>0&&e.blank(),e.line("@staticmethod"),e.block(`def ${c}(${i.join(", ")}) -> str:`,()=>{e.line(`return ${me(r)}`)})})}),e.blank()}function V(e,n,t,s,r,a,c){let i=s?"AsyncClient":"Client",m=s?"httpx.AsyncClient":"httpx.Client";e.block(`class ${i}:`,()=>{e.doc(`${s?"Async ":""}client for ${n.title} (${n.version}).`),e.block(`def __init__(self, server_url: str = ${f.string(a)}, *, auth: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, timeout: Optional[float] = None, retry: Optional[Dict[str, Any]] = None, middleware: Optional[List[Any]] = None, idempotency_key: Any = None, http_client: Optional[${m}] = None) -> None:`,()=>{e.line("self._server_url = server_url"),e.line("self._auth = auth or {}"),e.line("self._config: Dict[str, Any] = {"),e.indent(()=>{e.line('"headers": headers or {},'),e.line('"timeout": timeout,'),e.line('"retry": retry or {},'),e.line('"middleware": middleware or [],'),e.line('"idempotency_key": idempotency_key,')}),e.line("}"),e.line(`self._http = http_client or ${m}()`)}),e.blank();for(let{op:l,ident:o}of I(n)){G(e,l,o,t,s,c),L(l)===void 0&&(l.successResponseHeaders?.length??0)>0&&G(e,l,o,t,s,c,n,!0);let d=r.get(o);if(d!==void 0){let u=R(l),$=oe(u,typeof d.items=="string"?d.items:void 0,n);le(e,l,o,s,$===void 0?"Any":y($,c),c)}}}),e.blank()}function z(e){let n=new Map,t=new Set,s=[];for(let{name:a,schema:c}of e.schemas){let i=T(c,e);if(!(i===void 0||!i.cases.every(l=>B(l.schema,e)?.properties.some(o=>o.name===i.property)===!0))){for(let l of i.cases){let o=n.get(l.schemaName);if(o!==void 0&&o.value!==l.value){t.add(l.schemaName);continue}n.set(l.schemaName,{property:i.property,value:l.value})}s.push({name:a,property:i.property,members:i.cases.map(l=>l.schemaName)})}}let r=new Map;for(let a of s)a.members.some(c=>t.has(c))||r.set(a.name,q(a.property).python);for(let a of t)n.delete(a);return{pins:n,unions:r}}function fe(e,n,t,s,r,a,c){let i=r==="pydantic";i||e.line("@dataclass");let m=i?`class ${O(n)}(BaseModel):`:`class ${O(n)}:`;e.block(m,()=>{e.doc(a),i&&(e.line("model_config = ConfigDict(populate_by_name=True)"),e.blank());let l=[...t.filter(d=>d.required),...t.filter(d=>!d.required)],o=[];l.length===0&&e.line("pass");for(let d of l){let{python:u,renamed:$}=q(d.name);$&&!i&&o.push([u,d.name]);let h=$&&i?`alias=${f.string(d.name)}`:void 0,g=c?.property===d.name?`Literal[${f.literal(c.value)}]`:y(d.schema,s);if(d.required){let x=h===void 0?"":` = Field(${h})`;e.line(`${u}: ${g}${x}`)}else{let x=g.startsWith("Optional[")?g:`Optional[${g}]`,P=h===void 0?"None":`Field(default=None, ${h})`;e.line(`${u}: ${x} = ${P}`)}}if(o.length>0){e.blank(),e.line("# Python field name -> wire (JSON) name, for (de)serialization.");let d=o.map(([u,$])=>`"${u}": ${f.string($)}`).join(", ");e.line(`_field_map: ClassVar[Dict[str, str]] = {${d}}`)}}),e.blank(),e.blank()}function J(e,n="string",t="dataclass"){let s=new j,{pins:r,unions:a}=t==="pydantic"?z(e):{pins:new Map,unions:new Map};s.line("from __future__ import annotations"),s.blank(),t==="dataclass"&&s.line("from dataclasses import dataclass"),s.line("from enum import Enum");let c=["Any","AsyncIterator","Dict","Iterator","List","Literal","Optional","Tuple","Union"];t==="dataclass"&&c.splice(2,0,"ClassVar"),a.size>0&&c.unshift("Annotated"),s.line(`from typing import ${c.join(", ")}`),t==="pydantic"&&s.line("from pydantic import BaseModel, ConfigDict, Field"),n==="Date"&&s.line("from datetime import date, datetime"),s.blank(),s.blank();let i=[];for(let{name:m,schema:l}of e.schemas){let o=ne(l);if(o!==void 0){let d=o.scalar==="string"?"str, Enum":"int, Enum";s.block(`class ${O(m)}(${d}):`,()=>{s.doc(l.description),o.values.forEach((u,$)=>{s.line(`${o.memberNames[$]} = ${f.literal(u)}`)})}),s.blank(),s.blank();continue}if(l.kind==="object"||l.kind==="intersection"){let d=B(l,e);if(d!==void 0){fe(s,m,d.properties,n,t,d.description??l.description,r.get(m));continue}}i.push(()=>{let d=T(l,e);if(d!==void 0){let h=d.cases.map(g=>`${g.value} -> ${O(g.schemaName)}`).join(", ");s.line(`# Discriminated by "${d.property}": ${h}`)}let u=a.get(m),$=u===void 0?y(l,n):`Annotated[${y(l,n)}, Field(discriminator=${f.string(u)})]`;s.line(`${O(m)} = ${$}`),s.blank()})}for(let m of i)m();return s.toString()}function pe(e,n){let t=[];for(let{name:s,schema:r}of e.schemas){if(n.has(s))continue;let a=T(r,e);if(a===void 0)continue;let c=a.cases.map(i=>`${f.string(i.value)}: ${O(i.schemaName)}`).join(", ");t.push(`DISCRIMINATORS[${O(s)}] = (${f.string(a.property)}, {${c}})`)}return t}var nn={type:"object",properties:{models:{enum:["dataclass","pydantic"],default:"dataclass",description:"Model style: standard-library dataclasses (default, httpx is the only dependency), or pydantic BaseModel classes (adds pydantic)."}},additionalProperties:!1};function Q(e){let n=e.lastIndexOf("/")>=0?"/":"\\",t=e.lastIndexOf(n),s=t>=0?e.slice(0,t+1):"",r=(t>=0?e.slice(t+1):e).replace(/\.[^.]+$/,"");return`${s}${k(r,{style:"snake",reserved:N})}.py`}var tn=({model:e,output:n,banner:t,emit:s,options:r,pagination:a})=>{let c=s.errorMode??"throw",i=s.dateType??"string",m=r?.models??"dataclass",l=m==="pydantic"?z(e):void 0,o=new j;if(o.line(`# Generated by @redocly/client-generator (python) from "${e.title}" ${e.version}.`),o.line("# Do not edit by hand \u2014 regenerate with `redocly generate-client`."),o.line(m==="pydantic"?"# Requires Python >= 3.9, httpx, and pydantic: pip install httpx pydantic":"# Requires Python >= 3.9 and httpx: pip install httpx"),o.blank(),o.line(J(e,i,m).trimEnd()),o.blank(),o.blank(),de(o,e),s.runtime==="module"){o.line("# \u2500\u2500\u2500 Runtime (real modules beside this file, written by the same run) \u2500\u2500\u2500");for(let p of Object.keys(U))o.line(`from ${p.replace(/\.py$/,"")} import *`);o.blank(),o.blank()}else{o.line("# \u2500\u2500\u2500 Embedded runtime (@redocly/client-generator python runtime) \u2500\u2500\u2500");for(let p of Object.values(U)){let _=p.split(`
9
9
  `).filter(b=>!b.startsWith("from __future__")&&!b.startsWith("from ._")).join(`
10
10
  `).trim();o.line(_),o.blank()}o.blank()}let d=pe(e,new Set(l?.unions.keys()));if(d.length>0){o.line("# Discriminated unions dispatch by their property inside decode().");for(let p of d)o.line(p);o.blank()}o.block("def _safe_json(response: httpx.Response) -> Any:",()=>{o.block("try:",()=>{o.line("return response.json()")}),o.block("except Exception:",()=>{o.line("return None")})}),o.blank();let u=new Map;for(let{op:p,ident:_}of I(e))u.set(_,ie(a?.get(p.name)?.spec));o.line("_OPERATIONS = {"),o.indent(()=>{for(let{op:p,ident:_}of I(e)){let b={id:p.specName??p.name,method:p.method.toUpperCase(),path:p.path,...K(p,e).length>0?{security:K(p,e)}:{},...u.get(_)!==void 0?{pagination:u.get(_)}:{}};o.line(`"${_}": ${ae(b)},`)}}),o.line("}"),o.blank(),o.blank();let $=s.serverUrl??e.serverUrl??"";V(o,e,c,!1,u,$,i),V(o,e,c,!0,u,$,i);let h={path:Q(n.path),content:o.toString()};if(s.runtime!=="module")return[h];let g=t.map(p=>`# ${p}`).join(`
@@ -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 q}from"./QZJD7SST.js";import{h as H,l as B,r as z,t as K,u as V,v as Z,w as _}from"./3TRGOJ74.js";import{b as J,d as M,e as Y,v as L}from"./N6VRECSO.js";import"./LRUXN6H5.js";import{$ as j,T as N,X as v,Z as O,_ as A,aa as b,ca as y,da as C,ea as R,ga as e,l as h,ma as w,na as D,sa as S,va as g}from"./MT5H2R3P.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{dirname as le}from"node:path";function W(r,t,o,n){n&&e.info(C(v(`
7
+ import{a as q}from"./YZRKJF2V.js";import{h as H,l as B,r as z,t as K,u as V,v as Z,w as _}from"./SQUNMRDS.js";import{b as J,d as M,e as Y,v as L}from"./ZIIE7LXR.js";import"./LRUXN6H5.js";import{$ as j,T as N,X as v,Z as O,_ as A,aa as b,ca as y,da as C,ea as R,ga as e,l as h,ma as w,na as D,sa as S,va as g}from"./JD3HIQIK.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{dirname as le}from"node:path";function W(r,t,o,n){n&&e.info(C(v(`
8
8
  \u2611\uFE0F Achieved Level: ${y(o)}
9
9
 
10
10
  `))),e.output(`<?xml version="1.0" encoding="UTF-8"?>
@@ -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"./2LDRZLQD.js";import"./2U6O26CV.js";import"./M4JX2FBY.js";import"./NRU2WFMW.js";import"./WZXA5XPB.js";import"./MT5H2R3P.js";import"./NEWT5A6S.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{e as goDocs,c as goGenerator,d as goSample,a as goType,b as renderGoModels};
7
+ import{a,b,c,d,e}from"./PZF2WPD3.js";import"./2U6O26CV.js";import"./FYDETXDC.js";import"./IBYLYDST.js";import"./WZXA5XPB.js";import"./JD3HIQIK.js";import"./NEWT5A6S.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{e as goDocs,c as goGenerator,d as goSample,a as goType,b as renderGoModels};
@@ -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
- var e={name:"@redocly/cli",version:"2.58.0",description:"",license:"MIT",bin:{redocly:"bin/cli.js",openapi:"bin/cli.js"},type:"module",engines:{node:">=22.12.0 || >=20.19.0 <21.0.0",npm:">=10"},engineStrict:!0,scripts:{build:"node ./scripts/build.mjs","prepare:publish-dir":"node ./scripts/prepare-publish-dir.mjs","clean:publish-dir":`node -e "require('fs').rmSync('.publish', {recursive:true, force:true})"`},publishConfig:{directory:".publish"},repository:{type:"git",url:"git+https://github.com/Redocly/redocly-cli.git"},homepage:"https://github.com/Redocly/redocly-cli",keywords:["linter","OpenAPI","Swagger","OpenAPI linter","Swagger linter","AsyncAPI linter","Arazzo linter","oas"],contributors:["Roman Hotsiy <roman@redocly.com> (https://redocly.com/)"],devDependencies:{"@modelcontextprotocol/sdk":"^1.30.0","@opentelemetry/exporter-trace-otlp-http":"0.219.0","@opentelemetry/resources":"2.8.0","@opentelemetry/sdk-trace-node":"2.8.0","@opentelemetry/semantic-conventions":"1.41.1","@redocly/cli-otel":"0.3.7","@redocly/client-generator":"0.4.21","@redocly/openapi-core":"2.58.0","@redocly/recheck":"2.58.0","@redocly/respect-core":"2.58.0","@redocly/reunite-integration":"2.58.0","@types/cookie":"0.6.0","@types/har-format":"^1.2.16","@types/react":"^17.0.0 || ^18.2.21 || ^19.2.16","@types/react-dom":"^17.0.0 || ^18.2.7 || ^19.2.3","@types/semver":"^7.5.0","@types/set-cookie-parser":"2.4.10","@types/yargs":"17.0.32",colorette:"^1.2.0",cookie:"^0.7.2",dotenv:"16.4.7",esbuild:"^0.28.0",glob:"^13.0.5",handlebars:"^4.7.9",react:"^17.0.0 || ^18.2.0 || ^19.2.7","react-dom":"^17.0.0 || ^18.2.0 || ^19.2.7",redoc:"2.5.4",semver:"^7.5.2","set-cookie-parser":"^2.3.5","styled-components":"6.4.2",typescript:"6.0.2",ulid:"^3.0.1",undici:"^6.29.0",yargs:"17.0.1"}};var{version:c,name:i,engines:s}=e,n=e.devDependencies.redoc,p="sha384-w447zOpYfw/1Tv/5AK9NfHTlQIqE3RVR6KY62jCyy9zNDgO64cMwGGP1Fj0zJVf5";export{c as a,i as b,s as c,n as d,p as e};
7
+ var e={name:"@redocly/cli",version:"2.58.1",description:"",license:"MIT",bin:{redocly:"bin/cli.js",openapi:"bin/cli.js"},type:"module",engines:{node:">=22.12.0 || >=20.19.0 <21.0.0",npm:">=10"},engineStrict:!0,scripts:{build:"node ./scripts/build.mjs","prepare:publish-dir":"node ./scripts/prepare-publish-dir.mjs","clean:publish-dir":`node -e "require('fs').rmSync('.publish', {recursive:true, force:true})"`},publishConfig:{directory:".publish"},repository:{type:"git",url:"git+https://github.com/Redocly/redocly-cli.git"},homepage:"https://github.com/Redocly/redocly-cli",keywords:["linter","OpenAPI","Swagger","OpenAPI linter","Swagger linter","AsyncAPI linter","Arazzo linter","oas"],contributors:["Roman Hotsiy <roman@redocly.com> (https://redocly.com/)"],devDependencies:{"@modelcontextprotocol/sdk":"^1.30.0","@opentelemetry/exporter-trace-otlp-http":"0.219.0","@opentelemetry/resources":"2.8.0","@opentelemetry/sdk-trace-node":"2.8.0","@opentelemetry/semantic-conventions":"1.41.1","@redocly/cli-otel":"0.3.7","@redocly/client-generator":"0.4.22","@redocly/openapi-core":"2.58.1","@redocly/recheck":"2.58.1","@redocly/respect-core":"2.58.1","@redocly/reunite-integration":"2.58.1","@types/cookie":"0.6.0","@types/har-format":"^1.2.16","@types/react":"^17.0.0 || ^18.2.21 || ^19.2.16","@types/react-dom":"^17.0.0 || ^18.2.7 || ^19.2.3","@types/semver":"^7.5.0","@types/set-cookie-parser":"2.4.10","@types/yargs":"17.0.32",colorette:"^1.2.0",cookie:"^0.7.2",dotenv:"16.4.7",esbuild:"^0.28.0",glob:"^13.0.5",handlebars:"^4.7.9",react:"^17.0.0 || ^18.2.0 || ^19.2.7","react-dom":"^17.0.0 || ^18.2.0 || ^19.2.7",redoc:"2.5.4",semver:"^7.5.2","set-cookie-parser":"^2.3.5","styled-components":"6.4.2",typescript:"6.0.2",ulid:"^3.0.1",undici:"^6.29.0",yargs:"17.0.1"}};var{version:c,name:i,engines:s}=e,n=e.devDependencies.redoc,p="sha384-w447zOpYfw/1Tv/5AK9NfHTlQIqE3RVR6KY62jCyy9zNDgO64cMwGGP1Fj0zJVf5";export{c as a,i as b,s as c,n as d,p 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{b as S,c as N,e as R,j as g,k as _,o as v,q as F,r as U,s as b,v as s}from"./N6VRECSO.js";import{$,_ as y,aa as i,ea as u,ga as n,na as k,pa as T,t as O,ta as B,ua as E}from"./MT5H2R3P.js";import{writeFileSync as L}from"fs";import{resolve as j}from"path";import{performance as q}from"perf_hooks";var P={};async function Y({argv:e,config:l,version:W,collectSpecData:G}){let A=await S(e.apis,l),a={errors:0,warnings:0,ignored:0},I=N(l);for(let{path:o,alias:c,output:J}of A)try{let d=q.now(),p=l.forAlias(c);p.skipPreprocessors(e["skip-preprocessor"]),p.skipDecorators(e["skip-decorator"]);let m=e.overlay??p.resolvedConfig.overlays?.map(t=>O(t)?t:j(I,t));m?.length&&(P.bundle_overlays_count=(P.bundle_overlays_count??0)+m.length),c===void 0?n.info(u(`bundling ${s(o)}...
7
+ import{b as S,c as N,e as R,j as g,k as _,o as v,q as F,r as U,s as b,v as s}from"./ZIIE7LXR.js";import{$,_ as y,aa as i,ea as u,ga as n,na as k,pa as T,t as O,ta as B,ua as E}from"./JD3HIQIK.js";import{writeFileSync as L}from"fs";import{resolve as j}from"path";import{performance as q}from"perf_hooks";var P={};async function Y({argv:e,config:l,version:W,collectSpecData:G}){let A=await S(e.apis,l),a={errors:0,warnings:0,ignored:0},I=N(l);for(let{path:o,alias:c,output:J}of A)try{let d=q.now(),p=l.forAlias(c);p.skipPreprocessors(e["skip-preprocessor"]),p.skipDecorators(e["skip-decorator"]);let m=e.overlay??p.resolvedConfig.overlays?.map(t=>O(t)?t:j(I,t));m?.length&&(P.bundle_overlays_count=(P.bundle_overlays_count??0)+m.length),c===void 0?n.info(u(`bundling ${s(o)}...
8
8
  `)):n.info(u(`bundling ${s(o)} using configuration for api '${c}'...
9
9
  `));let{bundle:D,problems:w,...x}=await T({ref:o,config:p,dereference:e.dereferenced,removeUnusedComponents:e["remove-unused-components"],keepUrlRefs:e["keep-url-references"],componentRenamingConflicts:e["component-renaming-conflicts-severity"],componentNamesStrategy:e["component-names-strategy"],overlays:m,collectSpecData:G}),r=B(w),{outputFile:f,ext:K}=F({entrypoint:o,output:J,argvOutput:e.output,ext:e.ext,entries:e?.apis?.length||0});if(r.errors===0||e.force)if(f){let t=g(b(D.parsed),K,e.dereferenced);_(f,t)}else{let t=g(b(D.parsed),e.ext||"yaml",e.dereferenced);n.output(t)}a.errors+=r.errors,a.warnings+=r.warnings,a.ignored+=r.ignored,E(w,{format:"codeframe",totals:r,version:W,command:"bundle"}),e.metafile&&(A.length>1&&n.warn('[WARNING] "--metafile" cannot be used with multiple apis. Skipping...'),L(e.metafile,JSON.stringify(x),"utf-8"));let h=R(d);r.errors>0?e.force?n.info(`\u2753 Created a bundle for ${i(s(o))} at ${i(f||"stdout")} with errors ${y(h)}.
10
10
  ${$("Errors ignored because of --force")}.
@@ -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 P,b as y,c as $}from"./TAEOWXJJ.js";import{ga as h,xa as x}from"./MT5H2R3P.js";function N(t){let e=t.trim(),n=e.match(/^```(?:ya?ml|json)?\s*\n([\s\S]*?)\n```$/);return n?n[1]:e}async function O(t,e){let r=(await x({source:t,config:e})).filter(o=>o.severity==="error");if(r.length>0){let o=r.slice(0,5).map(s=>`${s.ruleId}: ${s.message}`).join("; ");throw new Error(`the result has ${r.length} validation problem(s): ${o}`)}}import{spawn as T}from"node:child_process";import{mkdtemp as v}from"node:fs/promises";import{tmpdir as R}from"node:os";import S from"node:path";var I=3e5,a=class extends Error{},C;function L(){return C??=v(S.join(R(),"redocly-ai-")),C}async function w(t,e,n,r){let o=await L();return new Promise((s,u)=>{let i=T(t,e,{stdio:["pipe","pipe","pipe"],cwd:o,env:{...process.env,...r}}),l="",f="",g=!1,d=setTimeout(()=>{g=!0,i.kill("SIGKILL")},I);i.stdout.on("data",c=>{l+=c.toString()}),i.stderr.on("data",c=>{f+=c.toString()}),i.on("error",c=>{if(clearTimeout(d),c.code==="ENOENT"){u(new a(`Could not find the "${t}" CLI on PATH. Is it installed?`));return}u(c)}),i.on("close",c=>{if(clearTimeout(d),g){u(new Error(`The "${t}" CLI did not respond within ${I/1e3} seconds.`));return}s({stdout:l,stderr:f,code:c})}),i.stdin.on("error",()=>{}),i.stdin.end(n)})}async function A(t){let e=["-p","--output-format","text","--tools","","--strict-mcp-config","--setting-sources","","--no-session-persistence","--append-system-prompt",t.system];t.model&&e.push("--model",t.model);let{stdout:n,stderr:r,code:o}=await w("claude",e,t.user,{CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC:"1"});if(o!==0)throw new Error(`claude CLI exited with code ${o}: ${r.trim()||n.trim()}`);if(!n.trim())throw new Error("claude CLI returned no output.");return{text:n}}async function b(t){let e=["exec","--skip-git-repo-check","--sandbox","read-only","-c","mcp_servers={}","-c","project_doc_max_bytes=0"];t.model&&e.push("--model",t.model),e.push("-");let n=`${t.system}
7
+ import{a as P,b as y,c as $}from"./263OU3EK.js";import{ga as h,xa as x}from"./JD3HIQIK.js";function N(t){let e=t.trim(),n=e.match(/^```(?:ya?ml|json)?\s*\n([\s\S]*?)\n```$/);return n?n[1]:e}async function O(t,e){let r=(await x({source:t,config:e})).filter(o=>o.severity==="error");if(r.length>0){let o=r.slice(0,5).map(s=>`${s.ruleId}: ${s.message}`).join("; ");throw new Error(`the result has ${r.length} validation problem(s): ${o}`)}}import{spawn as T}from"node:child_process";import{mkdtemp as v}from"node:fs/promises";import{tmpdir as R}from"node:os";import S from"node:path";var I=3e5,a=class extends Error{},C;function L(){return C??=v(S.join(R(),"redocly-ai-")),C}async function w(t,e,n,r){let o=await L();return new Promise((s,u)=>{let i=T(t,e,{stdio:["pipe","pipe","pipe"],cwd:o,env:{...process.env,...r}}),l="",f="",g=!1,d=setTimeout(()=>{g=!0,i.kill("SIGKILL")},I);i.stdout.on("data",c=>{l+=c.toString()}),i.stderr.on("data",c=>{f+=c.toString()}),i.on("error",c=>{if(clearTimeout(d),c.code==="ENOENT"){u(new a(`Could not find the "${t}" CLI on PATH. Is it installed?`));return}u(c)}),i.on("close",c=>{if(clearTimeout(d),g){u(new Error(`The "${t}" CLI did not respond within ${I/1e3} seconds.`));return}s({stdout:l,stderr:f,code:c})}),i.stdin.on("error",()=>{}),i.stdin.end(n)})}async function A(t){let e=["-p","--output-format","text","--tools","","--strict-mcp-config","--setting-sources","","--no-session-persistence","--append-system-prompt",t.system];t.model&&e.push("--model",t.model);let{stdout:n,stderr:r,code:o}=await w("claude",e,t.user,{CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC:"1"});if(o!==0)throw new Error(`claude CLI exited with code ${o}: ${r.trim()||n.trim()}`);if(!n.trim())throw new Error("claude CLI returned no output.");return{text:n}}async function b(t){let e=["exec","--skip-git-repo-check","--sandbox","read-only","-c","mcp_servers={}","-c","project_doc_max_bytes=0"];t.model&&e.push("--model",t.model),e.push("-");let n=`${t.system}
8
8
 
9
9
  ${t.user}`,{stdout:r,stderr:o,code:s}=await w("codex",e,n);if(s!==0)throw new Error(`codex CLI exited with code ${s}: ${o.trim()||r.trim()}`);if(!r.trim())throw new Error("codex CLI returned no output.");return{text:r}}async function _(t){let e=["-p","--output-format","text","--trust"];t.model&&e.push("--model",t.model);let n=`${t.system}
10
10
 
@@ -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{b as m,j as C,o as a,p,q as T,r as l,s as h,t as f,u as d}from"./YFBPBQ7G.js";import{c as g}from"./MT5H2R3P.js";import A from"node:path";function L(e,n){if(C(e)!=="application/x-www-form-urlencoded"||!Array.isArray(n))return;let o=new URLSearchParams;for(let s of n){if(!g(s))continue;let t=a(s.name);t!==void 0&&o.append(t,a(s.value)??"")}return o.size>0?o.toString():void 0}function K(e,n,o){let s=e?.request,t=e?.response;if(!s)return null;let r=s?.postData,i=a(r?.mimeType),u=r?.text??L(i,r?.params),c=a(r?.encoding),y=t?.content?.text,S=a(t?.content?.encoding),q=p(t?.status);return l({method:a(s?.method),url:a(s?.url),requestHeaders:s?.headers,requestBody:T(u,c),requestContentType:i,responseStatus:q===0?void 0:q,responseStatusText:a(t?.statusText),responseHeaders:t?.headers,responseBody:T(y,S),responseContentType:a(t?.content?.mimeType),startedAt:a(e?.startedDateTime),raw:e},n,o)}var b=class{id="har";canParse(n,o){if(A.extname(n).toLowerCase()===".har")return!0;let t=o.toLowerCase();return t.includes('"log"')&&t.includes('"entries"')}async*parse(n){let o=0;for await(let s of f(n,"log.entries")){let t=K(s,o,n);t&&(yield t),o+=1}}};import $ from"node:path";function H(e){let n=a(e.url??e.uri);if(n)return{url:n};let o=a(e.host??e.headers?.host),s=a(e.path??e.request_uri),t=a(e.scheme??e.forwarded_proto);return o&&s?{url:`${t??"http"}://${o}${s}`,schemeKnown:!!t}:{url:s,schemeKnown:!!t}}function z(e,n,o){let s=e?.request??e?.req??e?.http?.request;if(!s)return null;let t=e?.response??e?.res??e?.http?.response,r=t?.body??t?.raw_body??t?.payload??t?.data,i=s?.body??s?.raw_body??s?.payload??s?.data,{url:u,schemeKnown:c}=H(s);return l({method:a(s?.method??s?.http_method),url:u,schemeKnown:c,requestHeaders:s?.headers,requestBody:i,requestContentType:d(s?.headers),responseStatus:p(t?.status??t?.statusCode),responseHeaders:t?.headers,responseBody:r,responseContentType:d(t?.headers),startedAt:a(e?.started_at??e?.startedAt??e?.timestamp),raw:e},n,o)}var x=class{id="kong";canParse(n,o){if($.extname(n).toLowerCase()===".kong")return!0;let t=o.toLowerCase();return t.includes('"latencies"')||t.includes('"request"')&&t.includes('"response"')&&t.includes('"route"')}async*parse(n){let o=(await m(n,16)).trim().slice(0,1),s=0;if(o==="["){for await(let t of f(n)){let r=z(t,s,n);r&&(yield r),s+=1}return}for await(let t of h(n)){let r=z(t,s,n);r&&(yield r),s+=1}}};import R from"node:path";function U(e){return e?.request??e?.req??e?.httpRequest??e?.http?.request??e}function I(e){return e?.response??e?.res??e?.httpResponse??e?.http?.response}function O(e,n){let o=a(n?.url??n?.uri??n?.requestUrl??e?.url);if(o)return{url:o};let s=a(n?.host??n?.headers?.host??e?.host),t=a(n?.path??e?.path??n?.pathname),r=a(n?.scheme??e?.scheme);return s&&t?{url:`${r??"http"}://${s}${t}`,schemeKnown:!!r}:{url:t,schemeKnown:!!r}}function k(e,n,o){let s=U(e),t=I(e),r=s?.body??s?.bodyText??s?.payload??s?.data??s?.rawBody,i=t?.body??t?.bodyText??t?.payload??t?.data??t?.rawBody,{url:u,schemeKnown:c}=O(e,s);return l({method:a(s?.method??s?.httpMethod??e?.method??e?.httpMethod),url:u,schemeKnown:c,requestHeaders:s?.headers,requestBody:r,requestContentType:d(s?.headers),responseStatus:p(t?.status??t?.statusCode??e?.status??e?.statusCode),responseHeaders:t?.headers,responseBody:i,responseContentType:d(t?.headers),startedAt:a(e?.startedAt??e?.timestamp??e?.time),raw:e},n,o)}var w=class{id="ndjson";canParse(n,o){let s=R.extname(n).toLowerCase();if(s===".ndjson"||s===".jsonl"||s===".jsonlines")return!0;let t=o.lastIndexOf(`
7
+ import{b as m,j as C,o as a,p,q as T,r as l,s as h,t as f,u as d}from"./MVXFJBMU.js";import{c as g}from"./JD3HIQIK.js";import A from"node:path";function L(e,n){if(C(e)!=="application/x-www-form-urlencoded"||!Array.isArray(n))return;let o=new URLSearchParams;for(let s of n){if(!g(s))continue;let t=a(s.name);t!==void 0&&o.append(t,a(s.value)??"")}return o.size>0?o.toString():void 0}function K(e,n,o){let s=e?.request,t=e?.response;if(!s)return null;let r=s?.postData,i=a(r?.mimeType),u=r?.text??L(i,r?.params),c=a(r?.encoding),y=t?.content?.text,S=a(t?.content?.encoding),q=p(t?.status);return l({method:a(s?.method),url:a(s?.url),requestHeaders:s?.headers,requestBody:T(u,c),requestContentType:i,responseStatus:q===0?void 0:q,responseStatusText:a(t?.statusText),responseHeaders:t?.headers,responseBody:T(y,S),responseContentType:a(t?.content?.mimeType),startedAt:a(e?.startedDateTime),raw:e},n,o)}var b=class{id="har";canParse(n,o){if(A.extname(n).toLowerCase()===".har")return!0;let t=o.toLowerCase();return t.includes('"log"')&&t.includes('"entries"')}async*parse(n){let o=0;for await(let s of f(n,"log.entries")){let t=K(s,o,n);t&&(yield t),o+=1}}};import $ from"node:path";function H(e){let n=a(e.url??e.uri);if(n)return{url:n};let o=a(e.host??e.headers?.host),s=a(e.path??e.request_uri),t=a(e.scheme??e.forwarded_proto);return o&&s?{url:`${t??"http"}://${o}${s}`,schemeKnown:!!t}:{url:s,schemeKnown:!!t}}function z(e,n,o){let s=e?.request??e?.req??e?.http?.request;if(!s)return null;let t=e?.response??e?.res??e?.http?.response,r=t?.body??t?.raw_body??t?.payload??t?.data,i=s?.body??s?.raw_body??s?.payload??s?.data,{url:u,schemeKnown:c}=H(s);return l({method:a(s?.method??s?.http_method),url:u,schemeKnown:c,requestHeaders:s?.headers,requestBody:i,requestContentType:d(s?.headers),responseStatus:p(t?.status??t?.statusCode),responseHeaders:t?.headers,responseBody:r,responseContentType:d(t?.headers),startedAt:a(e?.started_at??e?.startedAt??e?.timestamp),raw:e},n,o)}var x=class{id="kong";canParse(n,o){if($.extname(n).toLowerCase()===".kong")return!0;let t=o.toLowerCase();return t.includes('"latencies"')||t.includes('"request"')&&t.includes('"response"')&&t.includes('"route"')}async*parse(n){let o=(await m(n,16)).trim().slice(0,1),s=0;if(o==="["){for await(let t of f(n)){let r=z(t,s,n);r&&(yield r),s+=1}return}for await(let t of h(n)){let r=z(t,s,n);r&&(yield r),s+=1}}};import R from"node:path";function U(e){return e?.request??e?.req??e?.httpRequest??e?.http?.request??e}function I(e){return e?.response??e?.res??e?.httpResponse??e?.http?.response}function O(e,n){let o=a(n?.url??n?.uri??n?.requestUrl??e?.url);if(o)return{url:o};let s=a(n?.host??n?.headers?.host??e?.host),t=a(n?.path??e?.path??n?.pathname),r=a(n?.scheme??e?.scheme);return s&&t?{url:`${r??"http"}://${s}${t}`,schemeKnown:!!r}:{url:t,schemeKnown:!!r}}function k(e,n,o){let s=U(e),t=I(e),r=s?.body??s?.bodyText??s?.payload??s?.data??s?.rawBody,i=t?.body??t?.bodyText??t?.payload??t?.data??t?.rawBody,{url:u,schemeKnown:c}=O(e,s);return l({method:a(s?.method??s?.httpMethod??e?.method??e?.httpMethod),url:u,schemeKnown:c,requestHeaders:s?.headers,requestBody:r,requestContentType:d(s?.headers),responseStatus:p(t?.status??t?.statusCode??e?.status??e?.statusCode),responseHeaders:t?.headers,responseBody:i,responseContentType:d(t?.headers),startedAt:a(e?.startedAt??e?.timestamp??e?.time),raw:e},n,o)}var w=class{id="ndjson";canParse(n,o){let s=R.extname(n).toLowerCase();if(s===".ndjson"||s===".jsonl"||s===".jsonlines")return!0;let t=o.lastIndexOf(`
8
8
  `),i=(t===-1?o:o.slice(0,t)).split(`
9
9
  `).map(u=>u.trim()).find(Boolean);if(!i?.startsWith("{")||!i.endsWith("}"))return!1;try{return JSON.parse(i),!0}catch{return!1}}async*parse(n){let o=0;for await(let s of h(n)){let t=k(s,o,n);t&&(yield t),o+=1}}};import J from"node:path";function P(e){if(!e)return{};let n=e.trim().split(/\s+/);return n.length<2?{}:{method:n[0],path:n[1],protocol:n[2]}}function W(e,n){let o=a(n?.url??n?.request_uri??n?.uri??e?.url??e?.request_url??e?.absolute_uri),s=P(a(e?.request??n?.request_line)),t=a(n?.request_uri??n?.uri??n?.path??e?.request_uri??e?.uri)??s.path;if(o?.startsWith("http://")||o?.startsWith("https://"))return{url:o};let r=a(n?.host??n?.headers?.host??e?.host??e?.http_host??e?.server_name??e?.vhost),i=a(e?.scheme??n?.scheme??e?.request_scheme),u=!!i;if(r&&(o||t)){let c=i??"http",y=o??t;return y?.startsWith("/")?{url:`${c}://${r}${y}`,schemeKnown:u}:{url:`${c}://${r}/${y}`,schemeKnown:u}}return{url:o??t,schemeKnown:u}}function E(e,n,o){let s=g(e?.request)?e.request:e,t=g(e?.response)?e.response:void 0,r=P(a(e?.request)),i=a(s?.method??s?.request_method??e?.request_method??e?.method)??r.method,{url:u,schemeKnown:c}=W(e,s);return l({method:i,url:u,schemeKnown:c,requestHeaders:s?.headers??s?.request_headers??e?.request_headers??e?.headers,requestBody:s?.body??s?.request_body??e?.request_body??e?.body,requestContentType:d(s?.headers??s?.request_headers??e?.request_headers),responseStatus:p(t?.status??t?.status_code??e?.status??e?.status_code??e?.response_status),responseHeaders:t?.headers??t?.response_headers??e?.response_headers??e?.headers_out,responseBody:t?.body??t?.response_body??e?.response_body,responseContentType:d(t?.headers??t?.response_headers??e?.response_headers),startedAt:a(e?.time_iso8601??e?.timestamp??e?.time??e?.time_local??e?.["@timestamp"]),raw:e},n,o)}async function*j(e){if((await m(e,16)).trim().slice(0,1)==="["){yield*f(e);return}for await(let o of h(e))yield o}var N=class{id="nginx-json";canParse(n,o){let s=J.extname(n).toLowerCase(),t=n.toLowerCase();if(s===".ndjson"&&t.includes("nginx"))return!0;let r=o.toLowerCase();return r.includes('"request_uri"')||r.includes('"time_iso8601"')||r.includes('"upstream_response_time"')||r.includes('"remote_addr"')}async*parse(n){let o=0;for await(let s of j(n)){let t=E(s,o,n);t&&(yield t),o+=1}}},_=class{id="apache-json";canParse(n,o){let s=J.extname(n).toLowerCase(),t=n.toLowerCase();if(s===".ndjson"&&t.includes("apache"))return!0;let r=o.toLowerCase();return r.includes('"request_method"')||r.includes('"request_uri"')||r.includes('"vhost"')||r.includes('"response_status"')}async*parse(n){let o=0;for await(let s of j(n)){let t=E(s,o,n);t&&(yield t),o+=1}}};var B=[new b,new x,new N,new _,new w];async function le(e,n){if(n!=="auto"){let s=B.find(t=>t.id===n);if(!s)throw new Error(`Unsupported parser format: ${n}`);return s}let o=await m(e);return B.find(s=>s.canParse(e,o))}export{le 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{c as O,d as se,f as oe}from"./V34PUN4E.js";import"./UF2ZCH7W.js";import{a as Re,b as U,c as ne}from"./GHSNC2OX.js";import{a as re}from"./LRUXN6H5.js";import{$ as ee,T as Y,Z as F,_ as S,aa as I,c as Q,ea as w,ga as k,ma as te}from"./MT5H2R3P.js";import"./NEWT5A6S.js";import{c as X,e as R}from"./RFWIIJFG.js";var ye=X(V=>{"use strict";V.parse=ze;V.serialize=Fe;var _e=Object.prototype.toString,$e=Object.prototype.hasOwnProperty,Oe=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,We=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,Be=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,De=/^[\u0020-\u003A\u003D-\u007E]*$/;function ze(e,r){if(typeof e!="string")throw new TypeError("argument str must be a string");var t={},s=e.length;if(s<2)return t;var n=r&&r.decode||Ie,o=0,i=0,a=0;do{if(i=e.indexOf("=",o),i===-1)break;if(a=e.indexOf(";",o),a===-1)a=s;else if(i>a){o=e.lastIndexOf(";",i-1)+1;continue}var c=de(e,o,i),f=he(e,i,c),p=e.slice(c,f);if(!$e.call(t,p)){var u=de(e,i+1,a),m=he(e,a,u);e.charCodeAt(u)===34&&e.charCodeAt(m-1)===34&&(u++,m--);var l=e.slice(u,m);t[p]=Ne(l,n)}o=a+1}while(o<s);return t}function de(e,r,t){do{var s=e.charCodeAt(r);if(s!==32&&s!==9)return r}while(++r<t);return t}function he(e,r,t){for(;r>t;){var s=e.charCodeAt(--r);if(s!==32&&s!==9)return r+1}return t}function Fe(e,r,t){var s=t&&t.encode||encodeURIComponent;if(typeof s!="function")throw new TypeError("option encode is invalid");if(!Oe.test(e))throw new TypeError("argument name is invalid");var n=s(r);if(!We.test(n))throw new TypeError("argument val is invalid");var o=e+"="+n;if(!t)return o;if(t.maxAge!=null){var i=Math.floor(t.maxAge);if(!isFinite(i))throw new TypeError("option maxAge is invalid");o+="; Max-Age="+i}if(t.domain){if(!Be.test(t.domain))throw new TypeError("option domain is invalid");o+="; Domain="+t.domain}if(t.path){if(!De.test(t.path))throw new TypeError("option path is invalid");o+="; Path="+t.path}if(t.expires){var a=t.expires;if(!Ue(a)||isNaN(a.valueOf()))throw new TypeError("option expires is invalid");o+="; Expires="+a.toUTCString()}if(t.httpOnly&&(o+="; HttpOnly"),t.secure&&(o+="; Secure"),t.partitioned&&(o+="; Partitioned"),t.priority){var c=typeof t.priority=="string"?t.priority.toLowerCase():t.priority;switch(c){case"low":o+="; Priority=Low";break;case"medium":o+="; Priority=Medium";break;case"high":o+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(t.sameSite){var f=typeof t.sameSite=="string"?t.sameSite.toLowerCase():t.sameSite;switch(f){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return o}function Ie(e){return e.indexOf("%")!==-1?decodeURIComponent(e):e}function Ue(e){return _e.call(e)==="[object Date]"}function Ne(e,r){try{return r(e)}catch{return e}}});var be=X((gt,P)=>{"use strict";var W={decodeValues:!0,map:!1,silent:!1};function H(e){return typeof e=="string"&&!!e.trim()}function J(e,r){var t=e.split(";").filter(H),s=t.shift(),n=qe(s),o=n.name,i=n.value;r=r?Object.assign({},W,r):W;try{i=r.decodeValues?decodeURIComponent(i):i}catch(c){console.error("set-cookie-parser encountered an error while decoding a cookie with value '"+i+"'. Set options.decodeValues to false to disable this feature.",c)}var a={name:o,value:i};return t.forEach(function(c){var f=c.split("="),p=f.shift().trimLeft().toLowerCase(),u=f.join("=");p==="expires"?a.expires=new Date(u):p==="max-age"?a.maxAge=parseInt(u,10):p==="secure"?a.secure=!0:p==="httponly"?a.httpOnly=!0:p==="samesite"?a.sameSite=u:p==="partitioned"?a.partitioned=!0:a[p]=u}),a}function qe(e){var r="",t="",s=e.split("=");return s.length>1?(r=s.shift(),t=s.join("=")):t=e,{name:r,value:t}}function xe(e,r){if(r=r?Object.assign({},W,r):W,!e)return r.map?{}:[];if(e.headers)if(typeof e.headers.getSetCookie=="function")e=e.headers.getSetCookie();else if(e.headers["set-cookie"])e=e.headers["set-cookie"];else{var t=e.headers[Object.keys(e.headers).find(function(n){return n.toLowerCase()==="set-cookie"})];!t&&e.headers.cookie&&!r.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),e=t}if(Array.isArray(e)||(e=[e]),r.map){var s={};return e.filter(H).reduce(function(n,o){var i=J(o,r);return n[i.name]=i,n},s)}else return e.filter(H).map(function(n){return J(n,r)})}function Ve(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var r=[],t=0,s,n,o,i,a;function c(){for(;t<e.length&&/\s/.test(e.charAt(t));)t+=1;return t<e.length}function f(){return n=e.charAt(t),n!=="="&&n!==";"&&n!==","}for(;t<e.length;){for(s=t,a=!1;c();)if(n=e.charAt(t),n===","){for(o=t,t+=1,c(),i=t;t<e.length&&f();)t+=1;t<e.length&&e.charAt(t)==="="?(a=!0,t=i,r.push(e.substring(s,o)),s=t):t=o+1}else t+=1;(!a||t>=e.length)&&r.push(e.substring(s,e.length))}return r}P.exports=xe;P.exports.parse=xe;P.exports.parseString=J;P.exports.splitCookiesString=Ve});import{existsSync as Qe,readFileSync as Ye,writeFileSync as Ae}from"node:fs";import{dirname as et,basename as tt}from"node:path";function N(e,r){return JSON.stringify(e,(s,n)=>{if(n instanceof ArrayBuffer){if(n.byteLength>1048576)return{__type:"ArrayBuffer",data:`File too large to serialize (${n.byteLength} bytes). Maximum allowed size is 1048576 bytes.`,byteLength:n.byteLength};let o=new Uint8Array(n);return{__type:"ArrayBuffer",data:Buffer.from(o).toString("base64"),byteLength:n.byteLength}}return n instanceof File?{__type:"File",name:n.name||"[File Object]",size:n.size||0,type:n.type||"",lastModified:n.lastModified||0}:n},r)}var ie=R(Re(),1);import*as ae from"node:fs";import*as E from"node:path";function ce(e){if(e){let r=E.dirname(e);for(;r!==E.resolve(r,"..");){let t=E.join(r,".env");if(ae.existsSync(t)){ie.config({path:t});break}r=E.resolve(r,"..")}}return process.env}var C=R(re(),1);function Me(e,r={}){let{clientCert:t,clientKey:s,caCert:n}=r,o=new URL(e).origin,i=U(),a=i&&!ne(e);if(t&&s&&a)return new C.ProxyAgent({uri:i,connect:{key:Buffer.from(s),cert:Buffer.from(t),...n&&{ca:Buffer.from(n)},rejectUnauthorized:!0}});if(t&&s)return new C.Client(o,{connect:{key:Buffer.from(s),cert:Buffer.from(t),...n&&{ca:Buffer.from(n)},rejectUnauthorized:!0}});if(a)return new C.ProxyAgent({uri:i})}function fe(e){if(!U()&&(!e||Object.keys(e).length===0))return C.fetch;let t=new Map;return(s,n)=>{let o=typeof s=="string"?s:s instanceof URL?s.toString():"url"in s?s.url:void 0;if(!o)throw new Error("Invalid input URL");let i=e?Pe(o,e):void 0,a=new URL(o).origin,c=t.get(a);return c||(c=Me(o,i)||n?.dispatcher,c&&t.set(a,c)),(0,C.fetch)(s,{...n,dispatcher:c})}}function Pe(e,r){let t=new URL(e);return r[t.origin]||r[t.hostname]}import*as q from"node:path";function ue(e,r){let s=Math.max(...e.map(({file:i})=>q.basename(i).length+40)),n=[{name:"Filename",width:s},{name:"Workflows",width:10},{name:"Passed",width:7},{name:"Failed",width:7},{name:"Warnings",width:8}],o="";o+=`${w(`\u250C${n.map(i=>"\u2500".repeat(i.width+2)).join("\u252C")}\u2510`)}
7
+ import{c as O,d as se,f as oe}from"./XTW63JDM.js";import"./UF2ZCH7W.js";import{a as Re,b as U,c as ne}from"./GHSNC2OX.js";import{a as re}from"./LRUXN6H5.js";import{$ as ee,T as Y,Z as F,_ as S,aa as I,c as Q,ea as w,ga as k,ma as te}from"./JD3HIQIK.js";import"./NEWT5A6S.js";import{c as X,e as R}from"./RFWIIJFG.js";var ye=X(V=>{"use strict";V.parse=ze;V.serialize=Fe;var _e=Object.prototype.toString,$e=Object.prototype.hasOwnProperty,Oe=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,We=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,Be=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,De=/^[\u0020-\u003A\u003D-\u007E]*$/;function ze(e,r){if(typeof e!="string")throw new TypeError("argument str must be a string");var t={},s=e.length;if(s<2)return t;var n=r&&r.decode||Ie,o=0,i=0,a=0;do{if(i=e.indexOf("=",o),i===-1)break;if(a=e.indexOf(";",o),a===-1)a=s;else if(i>a){o=e.lastIndexOf(";",i-1)+1;continue}var c=de(e,o,i),f=he(e,i,c),p=e.slice(c,f);if(!$e.call(t,p)){var u=de(e,i+1,a),m=he(e,a,u);e.charCodeAt(u)===34&&e.charCodeAt(m-1)===34&&(u++,m--);var l=e.slice(u,m);t[p]=Ne(l,n)}o=a+1}while(o<s);return t}function de(e,r,t){do{var s=e.charCodeAt(r);if(s!==32&&s!==9)return r}while(++r<t);return t}function he(e,r,t){for(;r>t;){var s=e.charCodeAt(--r);if(s!==32&&s!==9)return r+1}return t}function Fe(e,r,t){var s=t&&t.encode||encodeURIComponent;if(typeof s!="function")throw new TypeError("option encode is invalid");if(!Oe.test(e))throw new TypeError("argument name is invalid");var n=s(r);if(!We.test(n))throw new TypeError("argument val is invalid");var o=e+"="+n;if(!t)return o;if(t.maxAge!=null){var i=Math.floor(t.maxAge);if(!isFinite(i))throw new TypeError("option maxAge is invalid");o+="; Max-Age="+i}if(t.domain){if(!Be.test(t.domain))throw new TypeError("option domain is invalid");o+="; Domain="+t.domain}if(t.path){if(!De.test(t.path))throw new TypeError("option path is invalid");o+="; Path="+t.path}if(t.expires){var a=t.expires;if(!Ue(a)||isNaN(a.valueOf()))throw new TypeError("option expires is invalid");o+="; Expires="+a.toUTCString()}if(t.httpOnly&&(o+="; HttpOnly"),t.secure&&(o+="; Secure"),t.partitioned&&(o+="; Partitioned"),t.priority){var c=typeof t.priority=="string"?t.priority.toLowerCase():t.priority;switch(c){case"low":o+="; Priority=Low";break;case"medium":o+="; Priority=Medium";break;case"high":o+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(t.sameSite){var f=typeof t.sameSite=="string"?t.sameSite.toLowerCase():t.sameSite;switch(f){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return o}function Ie(e){return e.indexOf("%")!==-1?decodeURIComponent(e):e}function Ue(e){return _e.call(e)==="[object Date]"}function Ne(e,r){try{return r(e)}catch{return e}}});var be=X((gt,P)=>{"use strict";var W={decodeValues:!0,map:!1,silent:!1};function H(e){return typeof e=="string"&&!!e.trim()}function J(e,r){var t=e.split(";").filter(H),s=t.shift(),n=qe(s),o=n.name,i=n.value;r=r?Object.assign({},W,r):W;try{i=r.decodeValues?decodeURIComponent(i):i}catch(c){console.error("set-cookie-parser encountered an error while decoding a cookie with value '"+i+"'. Set options.decodeValues to false to disable this feature.",c)}var a={name:o,value:i};return t.forEach(function(c){var f=c.split("="),p=f.shift().trimLeft().toLowerCase(),u=f.join("=");p==="expires"?a.expires=new Date(u):p==="max-age"?a.maxAge=parseInt(u,10):p==="secure"?a.secure=!0:p==="httponly"?a.httpOnly=!0:p==="samesite"?a.sameSite=u:p==="partitioned"?a.partitioned=!0:a[p]=u}),a}function qe(e){var r="",t="",s=e.split("=");return s.length>1?(r=s.shift(),t=s.join("=")):t=e,{name:r,value:t}}function xe(e,r){if(r=r?Object.assign({},W,r):W,!e)return r.map?{}:[];if(e.headers)if(typeof e.headers.getSetCookie=="function")e=e.headers.getSetCookie();else if(e.headers["set-cookie"])e=e.headers["set-cookie"];else{var t=e.headers[Object.keys(e.headers).find(function(n){return n.toLowerCase()==="set-cookie"})];!t&&e.headers.cookie&&!r.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),e=t}if(Array.isArray(e)||(e=[e]),r.map){var s={};return e.filter(H).reduce(function(n,o){var i=J(o,r);return n[i.name]=i,n},s)}else return e.filter(H).map(function(n){return J(n,r)})}function Ve(e){if(Array.isArray(e))return e;if(typeof e!="string")return[];var r=[],t=0,s,n,o,i,a;function c(){for(;t<e.length&&/\s/.test(e.charAt(t));)t+=1;return t<e.length}function f(){return n=e.charAt(t),n!=="="&&n!==";"&&n!==","}for(;t<e.length;){for(s=t,a=!1;c();)if(n=e.charAt(t),n===","){for(o=t,t+=1,c(),i=t;t<e.length&&f();)t+=1;t<e.length&&e.charAt(t)==="="?(a=!0,t=i,r.push(e.substring(s,o)),s=t):t=o+1}else t+=1;(!a||t>=e.length)&&r.push(e.substring(s,e.length))}return r}P.exports=xe;P.exports.parse=xe;P.exports.parseString=J;P.exports.splitCookiesString=Ve});import{existsSync as Qe,readFileSync as Ye,writeFileSync as Ae}from"node:fs";import{dirname as et,basename as tt}from"node:path";function N(e,r){return JSON.stringify(e,(s,n)=>{if(n instanceof ArrayBuffer){if(n.byteLength>1048576)return{__type:"ArrayBuffer",data:`File too large to serialize (${n.byteLength} bytes). Maximum allowed size is 1048576 bytes.`,byteLength:n.byteLength};let o=new Uint8Array(n);return{__type:"ArrayBuffer",data:Buffer.from(o).toString("base64"),byteLength:n.byteLength}}return n instanceof File?{__type:"File",name:n.name||"[File Object]",size:n.size||0,type:n.type||"",lastModified:n.lastModified||0}:n},r)}var ie=R(Re(),1);import*as ae from"node:fs";import*as E from"node:path";function ce(e){if(e){let r=E.dirname(e);for(;r!==E.resolve(r,"..");){let t=E.join(r,".env");if(ae.existsSync(t)){ie.config({path:t});break}r=E.resolve(r,"..")}}return process.env}var C=R(re(),1);function Me(e,r={}){let{clientCert:t,clientKey:s,caCert:n}=r,o=new URL(e).origin,i=U(),a=i&&!ne(e);if(t&&s&&a)return new C.ProxyAgent({uri:i,connect:{key:Buffer.from(s),cert:Buffer.from(t),...n&&{ca:Buffer.from(n)},rejectUnauthorized:!0}});if(t&&s)return new C.Client(o,{connect:{key:Buffer.from(s),cert:Buffer.from(t),...n&&{ca:Buffer.from(n)},rejectUnauthorized:!0}});if(a)return new C.ProxyAgent({uri:i})}function fe(e){if(!U()&&(!e||Object.keys(e).length===0))return C.fetch;let t=new Map;return(s,n)=>{let o=typeof s=="string"?s:s instanceof URL?s.toString():"url"in s?s.url:void 0;if(!o)throw new Error("Invalid input URL");let i=e?Pe(o,e):void 0,a=new URL(o).origin,c=t.get(a);return c||(c=Me(o,i)||n?.dispatcher,c&&t.set(a,c)),(0,C.fetch)(s,{...n,dispatcher:c})}}function Pe(e,r){let t=new URL(e);return r[t.origin]||r[t.hostname]}import*as q from"node:path";function ue(e,r){let s=Math.max(...e.map(({file:i})=>q.basename(i).length+40)),n=[{name:"Filename",width:s},{name:"Workflows",width:10},{name:"Passed",width:7},{name:"Failed",width:7},{name:"Warnings",width:8}],o="";o+=`${w(`\u250C${n.map(i=>"\u2500".repeat(i.width+2)).join("\u252C")}\u2510`)}
8
8
  `,o+=`${w(`\u2502${n.map(i=>` ${i.name.padEnd(i.width)} `).join("\u2502")}\u2502`)}
9
9
  `,o+=`${w(`\u251C${n.map(i=>"\u2500".repeat(i.width+2)).join("\u253C")}\u2524`)}
10
10
  `,e.forEach(({file:i,executedWorkflows:a,argv:c})=>{let f=q.basename(i),p=c?.workflow||[],u=c?.skip||[],m=p&&p.length?a.filter(({workflowId:A})=>p.includes(A)):a;m=u&&u.length?m.filter(({workflowId:A})=>!u.includes(A)):m;let{workflows:l}=O(m),d=w(l.total.toString().padEnd(11)),L=S(l.passed.toString().padEnd(8)),y=l.failed>0?F(l.failed.toString().padEnd(8)):w("-".padEnd(8)),b=l.warnings>0?ee(l.warnings.toString().padEnd(9)):w("-".padEnd(9)),j=`${l.failed>0?"x":"\u2713"} ${f}`.padEnd(s+1),D=l.failed>0?F(j):S(j);o+=w("\u2502")+` ${D}`+w("\u2502")+` ${d}`+w("\u2502")+` ${L}`+w("\u2502")+` ${y}`+w("\u2502")+` ${b}`+w("\u2502")+`
@@ -16,7 +16,7 @@ import{c as O,d as se,f as oe}from"./V34PUN4E.js";import"./UF2ZCH7W.js";import{a
16
16
  `);if(h._compressed=/^(gzip|compress|deflate|br)$/.test(d.headers.get("content-encoding")||""),h.response.content||(h.response.content={size:-1}),h._compressed){let x=await y.arrayBuffer();h.response.content.size=x.byteLength}else h.response.content.size=b?Buffer.byteLength(b):-1;let Z=b?Buffer.byteLength(b):-1;h.response={headers:M(d.headers),cookies:Ce(d.headers),status:d.status,statusText:d.statusText||"",httpVersion:d.httpVersion?`HTTP/${d.httpVersion}`:"HTTP/1.1",redirectURL:d.headers.location||"",content:{size:h._compressed&&h.response.content.size!==-1?h.response.content.size:Buffer.byteLength(b),mimeType:d.headers.get("content-type")||"",text:b,compression:h._compressed&&h.response.content.size!==-1?h.response.content.size-Z:0},bodySize:Z,headersSize:A};let{_timestamps:g}=h;h.timings={blocked:Math.max(v(g.start,g.socket),.01),dns:-1,connect:Math.max(v(g.lookup,g.connect),-1),ssl:g.secureConnect?Math.max(v(g.connect,g.secureConnect),-1):-1,send:v(g.secureConnect||g.connect,g.sent),wait:Math.max(v(g.sent,g.firstByte),0),receive:v(g.firstByte,g.received)},h.time=v(g.start,g.received);let _=[],$=h;do{let x=$._parent;delete $._parent,x&&_.unshift(x),$=x}while($);return m.pageref=i||"page_1",_.forEach(x=>{x.pageref=m.pageref}),d.harEntry=m,Array.isArray(o?.log?.entries)&&o.log.entries.push(..._,m),a&&(_.forEach(x=>{a(x)}),a(m)),d}};function Ee(e){let r={};for(let t of e){let{executedWorkflows:s,globalTimeoutError:n,ctx:o,secretValues:i}=t;r[t.file]=oe({value:{totalRequests:t.totalRequests,executedWorkflows:s.map(a=>Se(a)),totalTimeMs:t.totalTimeMs,globalTimeoutError:n,secretValues:i},noSecretsMasking:o.noSecretsMasking,secretsSet:o.secretsSet||new Set})}return r}function Se(e){let{ctx:r,...t}=e,s=e.executedSteps.map(i=>Ke(i,e.workflowId,r)),n=O([e]);return{...t,executedSteps:s,status:n.steps.failed>0?"error":n.steps.warnings>0?"warn":"success",totalRequests:n.totalRequests,totalTimeMs:e.totalTimeMs}}function Ke(e,r,t){if("executedSteps"in e)return Se(e);let s=t.$workflows[r].steps[e.stepId];return{type:"step",stepId:e.stepId,workflowId:r,request:{method:s?.request?.method||"",url:e.response?.requestUrl||"",headers:s?.request?.header||{},body:s?.request?.body},response:{statusCode:e.response?.statusCode||0,body:s?.response?.body,headers:e.response?.header||{},time:e.response?.time||0,size:e.response?.responseSize},checks:e.checks.map(n=>({...n,status:Ge(n)})),totalTimeMs:s?.response?.time||0,retriesLeft:e.retriesLeft,status:Ze(e.checks)}}function Ge(e){return e.passed?"success":e.severity==="error"?"error":"warn"}function Ze(e){let r=!1;for(let t of e){if(!t.passed&&t.severity==="error")return"error";!t.passed&&t.severity==="warn"&&(r=!0)}return r?"warn":"success"}import*as T from"node:fs";import*as Te from"node:path";function Le(e={},r){let t={};for(let[s,n]of Object.entries(e))t[s]={clientCert:G(n.clientCert,r),clientKey:G(n.clientKey,r),caCert:G(n.caCert,r)};return t}function G(e,r){if(e)try{if(!(e.includes("-----BEGIN")&&e.includes("-----END"))){let s=Te.resolve(r,e);return T.accessSync(s,T.constants.R_OK),T.readFileSync(s,"utf-8")}return Xe(e)}catch(t){throw new Error(`Failed to read certificate: ${t.message}`)}}function Xe(e){let r=e.match(/^(-----BEGIN[^-]+-----)\r?\n([A-Za-z0-9+/=\r\n\t ]+)\r?\n(-----END[^-]+-----)/);if(!r)throw new Error("Invalid certificate format");let[,t,s,n]=r,o=s.replace(/\s+/g,"").match(/.{1,64}/g)?.join(`
17
17
  `)||"";return`${t}
18
18
  ${o}
19
- ${n}`}async function Vt({argv:e,config:r,version:t,collectSpecData:s}){let n,o;try{let{run:i,conditionallyMaskSecrets:a}=await import("./RREAI5RF.js"),c=r.configPath?et(r.configPath):process.cwd();e.mtls&&(n=Le(e.mtls,c));let f=fe(n);e["har-output"]&&(o=le({version:t}),f=K(f,{har:o}));let p=new Y({http:{headers:r.resolve?.http?.headers??[],customFetch:f}}),u={files:e.files,input:e.input,server:e.server,workflow:e.workflow,skip:e.skip,verbose:e.verbose,config:r,version:t,collectSpecData:s,severity:e.severity,maxSteps:e["max-steps"],maxFetchTimeout:e["max-fetch-timeout"],executionTimeout:e["execution-timeout"],requestFileLoader:{getFileBody:async y=>{if(!Qe(y))throw new Error(`File ${y} doesn't exist or isn't readable.`);let b=Ye(y);return new File([b],tt(y))}},envVariables:ce(c)||{},logger:k,fetch:f,externalRefResolver:p,noSecretsMasking:e["no-secrets-masking"]};if(u.skip&&u.workflow)throw new Error("Cannot use both --skip and --workflow flags at the same time.");if(e["har-output"]&&!e["har-output"].endsWith(".har"))throw new Error("File for HAR logs should be in .har format");if(e["json-output"]&&!e["json-output"].endsWith(".json"))throw new Error("File for JSON logs should be in .json format");if(u.files.length>1&&e["har-output"])throw new Error("Currently only a single file can be run with --har-output. Please run a single file at a time.");let m=performance.now(),l=await i(u);k.printNewLine(),ue(l,k),k.printNewLine();let d=l.some(y=>y.hasProblems),L=l.some(y=>y.hasWarnings);if(e["json-output"]){let y={files:Ee(l),status:d?"error":L?"warn":"success",totalTime:performance.now()-m};Ae(e["json-output"],N(y,2),"utf-8"),k.output(I(k.indent(`JSON logs saved in ${S(e["json-output"])}`,2))),k.printNewLine(),k.printNewLine()}if(e["har-output"])for(let y of l){let b=a({value:o,noSecretsMasking:y.ctx.noSecretsMasking,secretsSet:y.ctx.secretsSet||new Set});Ae(e["har-output"],N(b,2),"utf-8"),k.output(I(`Har logs saved in ${S(e["har-output"])}`)),k.printNewLine(),k.printNewLine()}if(d)throw new Error(" Tests exited with error ")}catch(i){throw new te(i?.message??i)}}export{Vt as handleRespect};
19
+ ${n}`}async function Vt({argv:e,config:r,version:t,collectSpecData:s}){let n,o;try{let{run:i,conditionallyMaskSecrets:a}=await import("./MSKEZAFV.js"),c=r.configPath?et(r.configPath):process.cwd();e.mtls&&(n=Le(e.mtls,c));let f=fe(n);e["har-output"]&&(o=le({version:t}),f=K(f,{har:o}));let p=new Y({http:{headers:r.resolve?.http?.headers??[],customFetch:f}}),u={files:e.files,input:e.input,server:e.server,workflow:e.workflow,skip:e.skip,verbose:e.verbose,config:r,version:t,collectSpecData:s,severity:e.severity,maxSteps:e["max-steps"],maxFetchTimeout:e["max-fetch-timeout"],executionTimeout:e["execution-timeout"],requestFileLoader:{getFileBody:async y=>{if(!Qe(y))throw new Error(`File ${y} doesn't exist or isn't readable.`);let b=Ye(y);return new File([b],tt(y))}},envVariables:ce(c)||{},logger:k,fetch:f,externalRefResolver:p,noSecretsMasking:e["no-secrets-masking"]};if(u.skip&&u.workflow)throw new Error("Cannot use both --skip and --workflow flags at the same time.");if(e["har-output"]&&!e["har-output"].endsWith(".har"))throw new Error("File for HAR logs should be in .har format");if(e["json-output"]&&!e["json-output"].endsWith(".json"))throw new Error("File for JSON logs should be in .json format");if(u.files.length>1&&e["har-output"])throw new Error("Currently only a single file can be run with --har-output. Please run a single file at a time.");let m=performance.now(),l=await i(u);k.printNewLine(),ue(l,k),k.printNewLine();let d=l.some(y=>y.hasProblems),L=l.some(y=>y.hasWarnings);if(e["json-output"]){let y={files:Ee(l),status:d?"error":L?"warn":"success",totalTime:performance.now()-m};Ae(e["json-output"],N(y,2),"utf-8"),k.output(I(k.indent(`JSON logs saved in ${S(e["json-output"])}`,2))),k.printNewLine(),k.printNewLine()}if(e["har-output"])for(let y of l){let b=a({value:o,noSecretsMasking:y.ctx.noSecretsMasking,secretsSet:y.ctx.secretsSet||new Set});Ae(e["har-output"],N(b,2),"utf-8"),k.output(I(`Har logs saved in ${S(e["har-output"])}`)),k.printNewLine(),k.printNewLine()}if(d)throw new Error(" Tests exited with error ")}catch(i){throw new te(i?.message??i)}}export{Vt as handleRespect};
20
20
  /*! Bundled license information:
21
21
 
22
22
  cookie/index.js:
@@ -4,10 +4,10 @@ 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 l,b as O,c as v,d as U,e as F}from"./U5DIFWGH.js";import{b as R}from"./N6VRECSO.js";import{$ as k,aa as $,c as G,ea as S,ga as b,l as P,ma as g}from"./MT5H2R3P.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{readFileSync as z}from"node:fs";import{mkdir as H,writeFile as B}from"node:fs/promises";import{basename as T,dirname as A,extname as I,isAbsolute as N,relative as j,resolve as f}from"node:path";var V=/^[a-z][a-z0-9+.-]+:/i;function L(e,n){let{setup:o}=e;if(typeof o!="string")return e;if(V.test(o))throw new g(`
7
+ import{a as l,b as O,c as v,d as U,e as F}from"./U5DIFWGH.js";import{b as R}from"./ZIIE7LXR.js";import{$ as k,aa as $,c as G,ea as S,ga as b,l as P,ma as g}from"./JD3HIQIK.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{readFileSync as z}from"node:fs";import{mkdir as H,writeFile as B}from"node:fs/promises";import{basename as T,dirname as A,extname as I,isAbsolute as N,relative as j,resolve as f}from"node:path";var V=/^[a-z][a-z0-9+.-]+:/i;function L(e,n){let{setup:o}=e;if(typeof o!="string")return e;if(V.test(o))throw new g(`
8
8
  \u274C \`client.setup\` must be a local file path \u2014 remote setup modules are not supported.
9
9
  Got: ${o}
10
- `);return N(o)?e:{...e,setup:f(n,o)}}function q(e){return`${e.replace(/[\\/]/g,"_")}.client.ts`}function D(e){if(e.startsWith("//"))return!1;if(e.startsWith("/"))return!0;try{let n=new URL(e);return n.protocol==="http:"||n.protocol==="https:"}catch{return!1}}async function ie({argv:e,config:n}){let{AUTHORING_HELPER_NAMES:o,generateClient:c,mergeConfig:m}=await import("./SXYE4UNQ.js"),t=n.configPath?A(n.configPath):process.cwd(),s={serverUrl:e["server-url"],outputMode:e["output-mode"],runtime:e.runtime,importExt:e["import-ext"],goPackage:e["go-package"],argsStyle:e["args-style"],errorMode:e["error-mode"],dateType:e["date-type"],mockData:e["mock-data"],mockSeed:e["mock-seed"],docs:e.docs,generators:e.generator?.map(a=>a.startsWith(".")?f(a):a),setup:e.setup===void 0?void 0:L({setup:e.setup},process.cwd()).setup},r=n.resolvedConfig.apis??{},i=Object.keys(r).filter(a=>G(r[a].client)||r[a].clientOutput!==void 0);if(e.api===void 0){if(e.output)throw new g("\n\u274C --output can't target multiple APIs. Set `clientOutput` under each api in redocly.yaml, or pass a single <api>.\n");if(i.length===0)throw new g("\n\u274C No API to generate. Add a `client` block or `clientOutput` under an `apis:` entry, or pass <api> (a file/URL or an `apis:` alias).\n")}let u=await R(e.api===void 0?i:[e.api],n),p={config:n,configDir:t,cliFlags:s,outputFlag:e.output,toolkit:{generateClient:c,mergeConfig:m,helperNames:o},seenOutputs:new Set,composable:[]};for(let a of u)await J(a,p);let y=G(n.resolvedConfig.client)?n.resolvedConfig.client:{};y.cliOutput!==void 0&&e.api===void 0&&p.composable.length>0&&await K(y.cliOutput,p)}async function J(e,{config:n,configDir:o,cliFlags:c,outputFlag:m,toolkit:t,seenOutputs:s,composable:r}){let{path:i,alias:u}=e,p=u??T(i,I(i)),y=n.forAlias(u),{client:a,clientOutput:E}=y.resolvedConfig,W=L(G(a)?a:{},o),h=t.mergeConfig(W,c);Q(h.generators??[],t.helperNames,o);let C=m!==void 0?f(m):E!==void 0?f(o,E):f(o,q(p));if(!C.endsWith(".ts"))throw new g(`
10
+ `);return N(o)?e:{...e,setup:f(n,o)}}function q(e){return`${e.replace(/[\\/]/g,"_")}.client.ts`}function D(e){if(e.startsWith("//"))return!1;if(e.startsWith("/"))return!0;try{let n=new URL(e);return n.protocol==="http:"||n.protocol==="https:"}catch{return!1}}async function ie({argv:e,config:n}){let{AUTHORING_HELPER_NAMES:o,generateClient:c,mergeConfig:m}=await import("./TGAC4ILD.js"),t=n.configPath?A(n.configPath):process.cwd(),s={serverUrl:e["server-url"],outputMode:e["output-mode"],runtime:e.runtime,importExt:e["import-ext"],goPackage:e["go-package"],argsStyle:e["args-style"],errorMode:e["error-mode"],dateType:e["date-type"],mockData:e["mock-data"],mockSeed:e["mock-seed"],docs:e.docs,generators:e.generator?.map(a=>a.startsWith(".")?f(a):a),setup:e.setup===void 0?void 0:L({setup:e.setup},process.cwd()).setup},r=n.resolvedConfig.apis??{},i=Object.keys(r).filter(a=>G(r[a].client)||r[a].clientOutput!==void 0);if(e.api===void 0){if(e.output)throw new g("\n\u274C --output can't target multiple APIs. Set `clientOutput` under each api in redocly.yaml, or pass a single <api>.\n");if(i.length===0)throw new g("\n\u274C No API to generate. Add a `client` block or `clientOutput` under an `apis:` entry, or pass <api> (a file/URL or an `apis:` alias).\n")}let u=await R(e.api===void 0?i:[e.api],n),p={config:n,configDir:t,cliFlags:s,outputFlag:e.output,toolkit:{generateClient:c,mergeConfig:m,helperNames:o},seenOutputs:new Set,composable:[]};for(let a of u)await J(a,p);let y=G(n.resolvedConfig.client)?n.resolvedConfig.client:{};y.cliOutput!==void 0&&e.api===void 0&&p.composable.length>0&&await K(y.cliOutput,p)}async function J(e,{config:n,configDir:o,cliFlags:c,outputFlag:m,toolkit:t,seenOutputs:s,composable:r}){let{path:i,alias:u}=e,p=u??T(i,I(i)),y=n.forAlias(u),{client:a,clientOutput:E}=y.resolvedConfig,W=L(G(a)?a:{},o),h=t.mergeConfig(W,c);Q(h.generators??[],t.helperNames,o);let C=m!==void 0?f(m):E!==void 0?f(o,E):f(o,q(p));if(!C.endsWith(".ts"))throw new g(`
11
11
  \u274C output must point at a TypeScript file (ending in .ts).
12
12
  Got: ${C}
13
13
  `);if(s.has(C))throw new g(`
@@ -23,7 +23,7 @@ import{a as l,b as O,c as v,d as U,e as F}from"./U5DIFWGH.js";import{b as R}from
23
23
  `)}catch(d){let w=d instanceof Error?d.message:String(d);throw l.generate_client_error_category=F(w),new g(`
24
24
  \u274C Failed to generate client for ${p}.
25
25
  ${w}
26
- `)}}async function K(e,{configDir:n,seenOutputs:o,composable:c}){let{renderComposedCliEntry:m}=await import("./7HX6H6PZ.js"),t=f(n,e);if(!t.endsWith(".ts"))throw new g(`
26
+ `)}}async function K(e,{configDir:n,seenOutputs:o,composable:c}){let{renderComposedCliEntry:m}=await import("./NX3RWANU.js"),t=f(n,e);if(!t.endsWith(".ts"))throw new g(`
27
27
  \u274C client.cliOutput must point at a TypeScript file (ending in .ts).
28
28
  Got: ${t}
29
29
  `);if(o.has(t))throw new g(`
@@ -8,4 +8,4 @@ import{a as f,m as u}from"./UW4UC7ZI.js";function m(e,t){let n=t??{},i=e.specNam
8
8
  `))e.line(c);e.line("```"),e.blank()}let a=[...t.pathParams,...t.queryParams,...t.headerParams];a.length>0&&T(e,a),t.requestBody!==void 0&&e.line(`Body: \`${t.requestBody.contentType}\`${t.requestBody.required?", required":", optional"}, of type ${o(t.requestBody.schema)}.`);let r=t.successResponses[0];e.line(r===void 0?"Returns no content.":`Returns \`${r.contentType}\`, of type ${o(r.schema)}.`),(n.paginated!==void 0?n.paginated.has(t.name):m(t,n.pagination)!==void 0)&&e.line("This operation is paginated, so the SDK gives it page and item iterators."),t.successResponses.some(c=>c.contentType==="text/event-stream")&&e.line("This operation streams server-sent events, so the SDK iterates the events."),P(t)&&e.line("This operation returns binary content."),e.blank()}function v(e,t){let n=new f;if(t.frontmatter&&(n.line("---"),n.line(`title: ${t.title}`),n.line("---"),n.blank()),n.line(`# ${t.title}`),n.blank(),n.line(`Generated reference for the ${t.language.label} SDK, produced from the API description by \`redocly generate-client\`.`),n.line("Re-run generation to update it \u2014 this file is not hand-edited."),n.blank(),n.line(t.language.requires),n.blank(),n.line("## Authentication"),n.blank(),e.securitySchemes.length===0)n.line("The description declares no security schemes.");else{n.line("The description declares these schemes, which you pass to the client:"),n.blank(),n.line("| Scheme | Kind | Sent as |"),n.line("| ------ | ---- | ------- |");for(let r of e.securitySchemes){let s=r.kind==="bearer"?"`Authorization: Bearer <token>`":r.kind==="basic"?"`Authorization: Basic <base64>`":r.kind==="apiKeyHeader"?`the \`${r.headerName}\` header`:r.kind==="apiKeyQuery"?`the \`${r.paramName}\` query parameter`:`the \`${r.cookieName}\` cookie`;n.line(`| \`${r.key}\` | ${r.kind} | ${s} |`)}}n.blank();let i=e.services.flatMap(r=>r.operations),a=[...new Set(i.map(r=>r.tags[0]))];for(let r of a){n.line(r===void 0?"## Operations":`## ${r}`),n.blank();for(let s of i.filter(c=>c.tags[0]===r))C(n,s,t)}return n.toString().replace(/\n{3,}/g,`
9
9
 
10
10
  `).trimEnd()+`
11
- `}var ee=["Printer","casing","identifierFor","uniqueIdentifiers","RESERVED_WORDS","flattenAllOf","deref","discriminatorCases","jsonSuccessSchema","sseResponse","isMultipartBody","isBinaryContentType","serverUrlParts","securityRequirements","paginationItemSchema","isNullable","unwrapNullable","enumValues","docText","headerCoerceType","schemaAtPointer","paginationRuleFor","renderReferencePage","NotSupportedError"];function E(e){return e}function w(e){return e.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).join("-")}function A(e){return e.replace(/[^A-Za-z0-9]+/g,"_").replace(/([a-z0-9])([A-Z])/g,"$1_$2").toUpperCase()}function q(e,t){let n={...e};for(let[i,a]of Object.entries(t))a!==void 0&&(n[i]=a);return n}function de(e){return e}async function ke(e){return(await import("./PWVCTNVT.js")).generateClient(e)}export{m as a,h as b,x as c,k as d,d as e,b as f,S as g,$ as h,v as i,ee as j,E as k,w as l,A as m,q as n,de as o,ke as p};
11
+ `}var ee=["Printer","casing","identifierFor","uniqueIdentifiers","RESERVED_WORDS","flattenAllOf","deref","discriminatorCases","jsonSuccessSchema","sseResponse","isMultipartBody","isBinaryContentType","serverUrlParts","securityRequirements","paginationItemSchema","isNullable","unwrapNullable","enumValues","docText","headerCoerceType","schemaAtPointer","paginationRuleFor","renderReferencePage","NotSupportedError"];function E(e){return e}function w(e){return e.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).join("-")}function A(e){return e.replace(/[^A-Za-z0-9]+/g,"_").replace(/([a-z0-9])([A-Z])/g,"$1_$2").toUpperCase()}function q(e,t){let n={...e};for(let[i,a]of Object.entries(t))a!==void 0&&(n[i]=a);return n}function de(e){return e}async function ke(e){return(await import("./6NXEK35A.js")).generateClient(e)}export{m as a,h as b,x as c,k as d,d as e,b as f,S as g,$ as h,v as i,ee as j,E as k,w as l,A as m,q as n,de as o,ke as p};
@@ -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 $,b as a,c,d as i,e as m,f}from"./3TNSVCBC.js";import{k as l}from"./LD5MEXEL.js";import{join as p}from"node:path";function k(t,n){let e=$(t,"swr");if(e.length===0)return"";let s=e.some(a),o=e.some(r=>!a(r));return[...s?['import useSWR from "swr";']:[],...o?['import useSWRMutation from "swr/mutation";']:[],f(e,n.sdkModule,s),...e.flatMap(r=>a(r)?g(r):[S(r)])].join(`
7
+ import{a as $,b as a,c,d as i,e as m,f}from"./7HGHXQBL.js";import{k as l}from"./LD5MEXEL.js";import{join as p}from"node:path";function k(t,n){let e=$(t,"swr");if(e.length===0)return"";let s=e.some(a),o=e.some(r=>!a(r));return[...s?['import useSWR from "swr";']:[],...o?['import useSWRMutation from "swr/mutation";']:[],f(e,n.sdkModule,s),...e.flatMap(r=>a(r)?g(r):[S(r)])].join(`
8
8
 
9
9
  `)}function y(t,n,e){return`export function use${l(t.name)}(${n}) {
10
10
  return ${e};
@@ -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{b as xe,f as Pe}from"./N6VRECSO.js";import{$ as j,T as le,U as he,X as b,Z as fe,_ as de,ba as ye,c as L,ca as U,da as A,f as ie,ga as k,ha as Se,ia as ge,ja as Q,ka as K,ma as Ce,pa as be,q as ae,r as pe,s as ce,u as me,v as ue}from"./MT5H2R3P.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{performance as mt}from"perf_hooks";var D={thresholds:{maxParamsGood:5,maxDepthGood:4,maxPolymorphismGood:2,maxDependencyDepthGood:3,maxAmbiguousGood:0,maxOperationsForDiscoverability:1e3},weights:{parameterSimplicity:.1,schemaSimplicity:.1,documentationQuality:.18,constraintClarity:.12,exampleCoverage:.18,errorClarity:.12,dependencyClarity:.1,identifierClarity:.05,polymorphismClarity:.05,anyOfPenaltyMultiplier:2,discoverabilityWeight:.1},hotspotLimit:10},Oe=new Set(["id","name","type","value","data","key","status","state","code","result","item","object","resource","entity","input","output","payload","body","content","info"]);function B(e){if(e.length===0)return 0;let r=[...e].sort((o,n)=>o-n),t=Math.floor(r.length/2);return r.length%2!==0?r[t]:(r[t-1]+r[t])/2}function He(e,r,t=D){let{thresholds:o,weights:n}=t,s=x(1-e.parameterCount/(o.maxParamsGood*2)),a=Math.max(e.maxRequestSchemaDepth,e.maxResponseSchemaDepth)/(o.maxDepthGood*2),c=De(e,n.anyOfPenaltyMultiplier)/(o.maxPolymorphismGood*3),h=x(1-a-c),u=(e.operationDescriptionPresent?1:0)+e.paramsWithDescription+e.schemaPropertiesWithDescription,f=1+e.parameterCount+e.totalSchemaProperties,$=f>0?x(u/f):1,O=e.totalSchemaProperties>0?x(e.constraintCount/e.totalSchemaProperties):1,y=(e.requestExamplePresent?1:0)+(e.responseExamplePresent?1:0),g=(e.requestBodyPresent?1:0)+1,M=x(y/g),T=e.totalErrorResponses>0?x(e.structuredErrorResponseCount/e.totalErrorResponses):1,I=x(1-r/(o.maxDependencyDepthGood*2)),l=x(1-e.ambiguousIdentifierCount/Math.max(o.maxAmbiguousGood+3,1)),m=De(e,n.anyOfPenaltyMultiplier),d=m===0?1:e.hasDiscriminator?x(1-m/(o.maxPolymorphismGood*4)):x(1-m/(o.maxPolymorphismGood*2));return{parameterSimplicity:s,schemaSimplicity:h,documentationQuality:$,constraintClarity:O,exampleCoverage:M,errorClarity:T,dependencyClarity:I,identifierClarity:l,polymorphismClarity:d}}function ze(e,r=D){let t=r.weights,o=e.parameterSimplicity*t.parameterSimplicity+e.schemaSimplicity*t.schemaSimplicity+e.documentationQuality*t.documentationQuality+e.constraintClarity*t.constraintClarity+e.exampleCoverage*t.exampleCoverage+e.errorClarity*t.errorClarity+e.dependencyClarity*t.dependencyClarity+e.identifierClarity*t.identifierClarity+e.polymorphismClarity*t.polymorphismClarity;return $e(x(o)*100)}function Re(e,r,t=D){let o=new Map;for(let[n,s]of e.operations){let i=r.get(n)??0,a=He(s,i,t);o.set(n,{agentReadiness:ze(a,t),subscores:a})}return o}function Me(e,r=D){return x(1-e/r.thresholds.maxOperationsForDiscoverability)}function ve(e,r,t=D){if(e.size===0)return{agentReadiness:100};let o=[];for(let i of e.values())o.push(i.agentReadiness);let n=t.weights.discoverabilityWeight,s=r*100;return{agentReadiness:$e(B(o)*(1-n)+s*n)}}function J(e,r,t){return e-r+r*t}function De(e,r){return J(e.polymorphismCount,e.anyOfCount,r)}function x(e){return Math.max(0,Math.min(1,e))}function Ee(e){let r=e.size||1,t={parameterSimplicity:0,schemaSimplicity:0,documentationQuality:0,constraintClarity:0,exampleCoverage:0,errorClarity:0,dependencyClarity:0,identifierClarity:0,polymorphismClarity:0};for(let o of e.values())t.parameterSimplicity+=o.subscores.parameterSimplicity,t.schemaSimplicity+=o.subscores.schemaSimplicity,t.documentationQuality+=o.subscores.documentationQuality,t.constraintClarity+=o.subscores.constraintClarity,t.exampleCoverage+=o.subscores.exampleCoverage,t.errorClarity+=o.subscores.errorClarity,t.dependencyClarity+=o.subscores.dependencyClarity,t.identifierClarity+=o.subscores.identifierClarity,t.polymorphismClarity+=o.subscores.polymorphismClarity;return t.parameterSimplicity/=r,t.schemaSimplicity/=r,t.documentationQuality/=r,t.constraintClarity/=r,t.exampleCoverage/=r,t.errorClarity/=r,t.dependencyClarity/=r,t.identifierClarity/=r,t.polymorphismClarity/=r,t}function $e(e){return Math.round(e*10)/10}function we(e,r,t){let o=Math.max(1,e);return r/o+t/o}function Qe(e,r){return r.totalSchemaProperties>e.totalSchemaProperties?!0:r.totalSchemaProperties<e.totalSchemaProperties?!1:we(r.totalSchemaProperties,r.schemaPropertiesWithDescription,r.constraintCount)>we(e.totalSchemaProperties,e.schemaPropertiesWithDescription,e.constraintCount)}var Ke=["enum","const","format","pattern","minimum","maximum","minLength","maxLength","minItems","maxItems","minProperties","maxProperties","multipleOf","exclusiveMinimum","exclusiveMaximum","uniqueItems"];function Y(){return{depth:-1,maxDepth:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,hasPropertyExamples:!1,writableTopLevelFields:0,refsUsed:[],debugEntries:null,pendingRef:null}}function Ie(e){Object.assign(e,Y())}function Le(e){return{ref:{enter(r){typeof r?.$ref=="string"&&(e.refsUsed.push(r.$ref),e.pendingRef=r.$ref)}},Schema:{enter(r,t){e.depth++,e.maxDepth=Math.max(e.maxDepth,e.depth);let o=0;for(let i of Ke)r[i]!==void 0&&(e.constraintCount++,o++);r.discriminator?.propertyName&&(e.hasDiscriminator=!0);let n={};for(let i of["oneOf","anyOf","allOf"]){let a=r[i];Array.isArray(a)&&(e.polymorphismCount+=a.length,i==="anyOf"&&(e.anyOfCount+=a.length),n[i]=a.length)}let s=[];if(L(r.properties)){let i=Object.entries(r.properties);e.totalSchemaProperties+=i.length;for(let[a,c]of i){s.push(a);let h=c&&"$ref"in c&&c.$ref?t.resolve(c)?.node??c:c;h?.description&&e.schemaPropertiesWithDescription++,(h?.example!==void 0||h?.examples)&&(e.hasPropertyExamples=!0),h?.readOnly||e.writableTopLevelFields++}}e.debugEntries!==null&&e.debugEntries.push({ref:e.pendingRef,depth:e.depth,propertyNames:s,polymorphism:Object.keys(n).length>0?n:{},constraintCount:o}),e.pendingRef=null},leave(){e.depth--}}}}function qe(e,r,t){return{operations:new Map,currentPath:"",pathLevelParams:[],current:null,walkSchema:e,anyOfPenaltyMultiplier:r,debugOperationId:t,debugLogs:[]}}function Je(e,r,t){return{path:e,method:r,operationId:t.operationId,operationDescriptionPresent:!!t.description,parameterCount:0,requiredParameterCount:0,paramsWithDescription:0,ambiguousIdentifierCount:0,maxRequestSchemaDepth:0,maxResponseSchemaDepth:0,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,topLevelWritableFieldCount:0,requestBodyPresent:!1,requestExamplePresent:!1,responseExamplePresent:!1,structuredErrorResponseCount:0,totalErrorResponses:0,inRequestBody:!1,inResponse:!1,currentResponseCode:"",errorStructuredCounted:!1,maxEffectivePolymorphism:-1,refsUsed:new Set}}function Ye(e){let{inRequestBody:r,inResponse:t,currentResponseCode:o,errorStructuredCounted:n,maxEffectivePolymorphism:s,...i}=e;return i}function We(e){return{RequestBody:{enter(){e.current&&(e.current.requestBodyPresent=!0,e.current.inRequestBody=!0)},leave(){e.current&&(e.current.inRequestBody=!1)}},Response:{enter(r,t){let o=e.current;if(!o)return;let n=String(t.key);o.inResponse=!0,o.currentResponseCode=n,o.errorStructuredCounted=!1,Te(n)&&(o.totalErrorResponses++,!r.content&&r.description&&(o.structuredErrorResponseCount++,o.errorStructuredCounted=!0))},leave(){e.current&&(e.current.inResponse=!1)}},MediaType:{enter(r){let t=e.current;if(t&&(Ze(r)&&(t.inRequestBody&&(t.requestExamplePresent=!0),t.inResponse&&(t.responseExamplePresent=!0)),t.inResponse&&Te(t.currentResponseCode)&&!t.errorStructuredCounted&&(t.structuredErrorResponseCount++,t.errorStructuredCounted=!0),r.schema)){let o=!!e.debugOperationId&&(t.operationId===e.debugOperationId||`${t.method.toUpperCase()} ${t.path}`===e.debugOperationId),n=e.walkSchema(r.schema,o);Qe(t,n)&&(t.totalSchemaProperties=n.totalSchemaProperties,t.schemaPropertiesWithDescription=n.schemaPropertiesWithDescription,t.constraintCount=n.constraintCount);let s=J(n.polymorphismCount,n.anyOfCount,e.anyOfPenaltyMultiplier);s>t.maxEffectivePolymorphism&&(t.maxEffectivePolymorphism=s,t.polymorphismCount=n.polymorphismCount,t.anyOfCount=n.anyOfCount),n.hasDiscriminator&&(t.hasDiscriminator=!0);for(let i of n.refsUsed)t.refsUsed.add(i);if(n.hasPropertyExamples&&(t.inRequestBody&&(t.requestExamplePresent=!0),t.inResponse&&(t.responseExamplePresent=!0)),t.inRequestBody&&(t.maxRequestSchemaDepth=Math.max(t.maxRequestSchemaDepth,n.maxDepth),t.topLevelWritableFieldCount=Math.max(t.topLevelWritableFieldCount,n.writableTopLevelFields)),t.inResponse&&(t.maxResponseSchemaDepth=Math.max(t.maxResponseSchemaDepth,n.maxDepth)),o&&n.debugEntries){let i=t.inRequestBody?"REQUEST BODY":`RESPONSE ${t.currentResponseCode}`;e.debugLogs.push({context:i,entries:n.debugEntries,totalProperties:n.totalSchemaProperties,totalPolymorphism:n.polymorphismCount,totalConstraints:n.constraintCount,maxDepth:n.maxDepth})}}}},Paths:{PathItem:{enter(r,t){e.currentPath=String(t.key),e.pathLevelParams=r.parameters??[]},Operation:{enter(r,t){let o=String(t.key),n=Je(e.currentPath,o,r);e.current=n;let s=Xe(e.pathLevelParams,r.parameters??[],t.resolve);for(let i of s.values())n.parameterCount++,i.required&&n.requiredParameterCount++,i.description&&n.paramsWithDescription++,et(i)&&n.ambiguousIdentifierCount++},leave(r){let t=e.current;if(!t)return;let o=r.operationId??`${t.method.toUpperCase()} ${t.path}`;e.operations.set(o,Ye(t)),e.current=null}}}}}}function Ue(e){return{operationCount:e.operations.size,operations:e.operations}}function Ae(e,r){return r(e).node}function Xe(e,r,t){let o=new Map;for(let n of e){let s=Ae(n,t);s?.name&&s.in&&o.set(`${s.in}:${s.name}`,s)}for(let n of r){let s=Ae(n,t);s?.name&&s.in&&o.set(`${s.in}:${s.name}`,s)}return o}function Ze(e){return e.example!==void 0||ie(e.examples)}function et(e){if(e.description)return!1;let r=(e.name??"").toLowerCase();return Oe.has(r)}function Te(e){if(e==="default"||/^4xx$/i.test(e)||/^5xx$/i.test(e))return!0;let r=parseInt(e,10);return r>=400&&r<600}function tt(e,r){if(!r.startsWith("#/"))return;let t=e;for(let o of r.slice(2).split("/"))t=t?.[ce(o)];return t}function ke({document:e,types:r,resolvedRefMap:t,ctx:o,debugOperationId:n,scoringConstants:s}){let i=s?.weights.anyOfPenaltyMultiplier??D.weights.anyOfPenaltyMultiplier,a=Y(),c=Le(a),h=Q([{severity:"warn",ruleId:"score-schema",visitor:c}],r),u=(l,m)=>{Ie(a),m&&(a.debugEntries=[]),K({document:{...e,parsed:l},rootType:r.Schema,normalizedVisitors:h,resolvedRefMap:t,ctx:o});let{depth:d,pendingRef:w,debugEntries:_,...N}=a;return{...N,refsUsed:[...a.refsUsed],debugEntries:m?a.debugEntries??void 0:void 0}},f=new Map,$=new WeakSet,O={maxDepth:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,hasPropertyExamples:!1,writableTopLevelFields:0,refsUsed:[]};function y(l,m){return{maxDepth:Math.max(l.maxDepth,m.maxDepth),polymorphismCount:l.polymorphismCount+m.polymorphismCount,anyOfCount:l.anyOfCount+m.anyOfCount,hasDiscriminator:l.hasDiscriminator||m.hasDiscriminator,totalSchemaProperties:l.totalSchemaProperties+m.totalSchemaProperties,schemaPropertiesWithDescription:l.schemaPropertiesWithDescription+m.schemaPropertiesWithDescription,constraintCount:l.constraintCount+m.constraintCount,hasPropertyExamples:l.hasPropertyExamples||m.hasPropertyExamples,writableTopLevelFields:l.writableTopLevelFields+m.writableTopLevelFields,refsUsed:[...l.refsUsed,...m.refsUsed],debugEntries:l.debugEntries||m.debugEntries?[...l.debugEntries??[],...m.debugEntries??[]]:void 0}}let g=(l,m=!1)=>{let d=l,w=pe(l)?l.$ref:void 0;if(w){if(!m){let S=f.get(w);if(S)return S}d=tt(e.parsed,w)??l}if(L(d)&&$.has(d))return{...O};L(d)&&$.add(d);let _=d?.oneOf,N=d?.anyOf,Z=Array.isArray(_)&&_.length>1,ee=Array.isArray(N)&&N.length>1,G=Z||ee,te=Array.isArray(d?.allOf)&&d.allOf.length>0,V=d?.discriminator,q=!G&&L(V?.mapping)?Object.values(V.mapping).filter(S=>typeof S=="string"&&me(S)).map(S=>({$ref:S})):null,re=Array.isArray(q)&&q.length>0,C;if(G||te||re){let S={...d},F=null,oe=P=>{F=F?y(F,P):P},ne=(P,v)=>{let E=g(v[0],m);for(let z=1;z<v.length;z++){let se=g(v[z],m);se.totalSchemaProperties>E.totalSchemaProperties&&(E=se)}return{...E,polymorphismCount:E.polymorphismCount+v.length,anyOfCount:E.anyOfCount+(P==="anyOf"?v.length:0),hasDiscriminator:E.hasDiscriminator||!!V}};G&&delete S.discriminator,Z&&(delete S.oneOf,oe(ne("oneOf",_))),ee&&(delete S.anyOf,oe(ne("anyOf",N)));let H=null;if(re){delete S.discriminator;let P=g(q[0],m);for(let v=1;v<q.length;v++){let E=g(q[v],m);E.totalSchemaProperties>P.totalSchemaProperties&&(P=E)}H={...P,polymorphismCount:P.polymorphismCount+q.length,hasDiscriminator:!0}}let W=null;if(te){delete S.allOf,W={...O};for(let P of d.allOf)W=y(W,g(P,m));W.polymorphismCount+=d.allOf.length}C=u(S,m),W&&(C=y(C,W)),F&&(C=y(C,F)),H&&(C=y(C,H)),w&&(C={...C,refsUsed:[w,...C.refsUsed]})}else C=u(l,m);return L(d)&&$.delete(d),w&&!m&&f.set(w,C),C},M=qe(g,i,n),T=We(M),I=Q([{severity:"warn",ruleId:"score",visitor:T}],r);return K({document:e,rootType:r.Root,normalizedVisitors:I,resolvedRefMap:t,ctx:o}),{metrics:Ue(M),debugLogs:M.debugLogs}}function Ne(e){let r=new Map;for(let[n,s]of e)for(let i of s.refsUsed){let a=r.get(i);a||(a=new Set,r.set(i,a)),a.add(n)}let t=new Map;for(let n of e.keys())t.set(n,new Set);for(let n of r.values()){if(n.size<2)continue;let s=Array.from(n);for(let i=0;i<s.length;i++)for(let a=i+1;a<s.length;a++)t.get(s[i]).add(s[a]),t.get(s[a]).add(s[i])}let o=new Map;for(let n of e.keys()){let s=rt(n,t);o.set(n,s)}return o}function rt(e,r){let t=new Set([e]),o=[e],n=0;for(;o.length>0;){let s=[];for(let i of o)for(let a of r.get(i)??[])t.has(a)||(t.add(a),s.push(a));s.length>0&&n++,o=s}return n}function Fe(e){let r={agentReadiness:e.agentReadiness,discoverability:Math.round(e.discoverability*100),subscores:e.subscores,rawMetrics:{operationCount:e.rawMetrics.operationCount,operations:Object.fromEntries(Array.from(e.rawMetrics.operations.entries()).map(([t,o])=>{let{refsUsed:n,...s}=o;return[t,s]}))},operationScores:Object.fromEntries(e.operationScores),dependencyDepths:Object.fromEntries(e.dependencyDepths),hotspots:e.hotspots};k.output(JSON.stringify(r,null,2))}function je(e,r=!1){ot(e),nt(e),it(e),r&&at(e),pt(e)}function _e(e){return e>=80?de:e>=50?j:fe}function Be(e){return _e(e)(b(e.toFixed(1)))}function p(e){k.output(e+`
7
+ import{b as xe,f as Pe}from"./ZIIE7LXR.js";import{$ as j,T as le,U as he,X as b,Z as fe,_ as de,ba as ye,c as L,ca as U,da as A,f as ie,ga as k,ha as Se,ia as ge,ja as Q,ka as K,ma as Ce,pa as be,q as ae,r as pe,s as ce,u as me,v as ue}from"./JD3HIQIK.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{performance as mt}from"perf_hooks";var D={thresholds:{maxParamsGood:5,maxDepthGood:4,maxPolymorphismGood:2,maxDependencyDepthGood:3,maxAmbiguousGood:0,maxOperationsForDiscoverability:1e3},weights:{parameterSimplicity:.1,schemaSimplicity:.1,documentationQuality:.18,constraintClarity:.12,exampleCoverage:.18,errorClarity:.12,dependencyClarity:.1,identifierClarity:.05,polymorphismClarity:.05,anyOfPenaltyMultiplier:2,discoverabilityWeight:.1},hotspotLimit:10},Oe=new Set(["id","name","type","value","data","key","status","state","code","result","item","object","resource","entity","input","output","payload","body","content","info"]);function B(e){if(e.length===0)return 0;let r=[...e].sort((o,n)=>o-n),t=Math.floor(r.length/2);return r.length%2!==0?r[t]:(r[t-1]+r[t])/2}function He(e,r,t=D){let{thresholds:o,weights:n}=t,s=x(1-e.parameterCount/(o.maxParamsGood*2)),a=Math.max(e.maxRequestSchemaDepth,e.maxResponseSchemaDepth)/(o.maxDepthGood*2),c=De(e,n.anyOfPenaltyMultiplier)/(o.maxPolymorphismGood*3),h=x(1-a-c),u=(e.operationDescriptionPresent?1:0)+e.paramsWithDescription+e.schemaPropertiesWithDescription,f=1+e.parameterCount+e.totalSchemaProperties,$=f>0?x(u/f):1,O=e.totalSchemaProperties>0?x(e.constraintCount/e.totalSchemaProperties):1,y=(e.requestExamplePresent?1:0)+(e.responseExamplePresent?1:0),g=(e.requestBodyPresent?1:0)+1,M=x(y/g),T=e.totalErrorResponses>0?x(e.structuredErrorResponseCount/e.totalErrorResponses):1,I=x(1-r/(o.maxDependencyDepthGood*2)),l=x(1-e.ambiguousIdentifierCount/Math.max(o.maxAmbiguousGood+3,1)),m=De(e,n.anyOfPenaltyMultiplier),d=m===0?1:e.hasDiscriminator?x(1-m/(o.maxPolymorphismGood*4)):x(1-m/(o.maxPolymorphismGood*2));return{parameterSimplicity:s,schemaSimplicity:h,documentationQuality:$,constraintClarity:O,exampleCoverage:M,errorClarity:T,dependencyClarity:I,identifierClarity:l,polymorphismClarity:d}}function ze(e,r=D){let t=r.weights,o=e.parameterSimplicity*t.parameterSimplicity+e.schemaSimplicity*t.schemaSimplicity+e.documentationQuality*t.documentationQuality+e.constraintClarity*t.constraintClarity+e.exampleCoverage*t.exampleCoverage+e.errorClarity*t.errorClarity+e.dependencyClarity*t.dependencyClarity+e.identifierClarity*t.identifierClarity+e.polymorphismClarity*t.polymorphismClarity;return $e(x(o)*100)}function Re(e,r,t=D){let o=new Map;for(let[n,s]of e.operations){let i=r.get(n)??0,a=He(s,i,t);o.set(n,{agentReadiness:ze(a,t),subscores:a})}return o}function Me(e,r=D){return x(1-e/r.thresholds.maxOperationsForDiscoverability)}function ve(e,r,t=D){if(e.size===0)return{agentReadiness:100};let o=[];for(let i of e.values())o.push(i.agentReadiness);let n=t.weights.discoverabilityWeight,s=r*100;return{agentReadiness:$e(B(o)*(1-n)+s*n)}}function J(e,r,t){return e-r+r*t}function De(e,r){return J(e.polymorphismCount,e.anyOfCount,r)}function x(e){return Math.max(0,Math.min(1,e))}function Ee(e){let r=e.size||1,t={parameterSimplicity:0,schemaSimplicity:0,documentationQuality:0,constraintClarity:0,exampleCoverage:0,errorClarity:0,dependencyClarity:0,identifierClarity:0,polymorphismClarity:0};for(let o of e.values())t.parameterSimplicity+=o.subscores.parameterSimplicity,t.schemaSimplicity+=o.subscores.schemaSimplicity,t.documentationQuality+=o.subscores.documentationQuality,t.constraintClarity+=o.subscores.constraintClarity,t.exampleCoverage+=o.subscores.exampleCoverage,t.errorClarity+=o.subscores.errorClarity,t.dependencyClarity+=o.subscores.dependencyClarity,t.identifierClarity+=o.subscores.identifierClarity,t.polymorphismClarity+=o.subscores.polymorphismClarity;return t.parameterSimplicity/=r,t.schemaSimplicity/=r,t.documentationQuality/=r,t.constraintClarity/=r,t.exampleCoverage/=r,t.errorClarity/=r,t.dependencyClarity/=r,t.identifierClarity/=r,t.polymorphismClarity/=r,t}function $e(e){return Math.round(e*10)/10}function we(e,r,t){let o=Math.max(1,e);return r/o+t/o}function Qe(e,r){return r.totalSchemaProperties>e.totalSchemaProperties?!0:r.totalSchemaProperties<e.totalSchemaProperties?!1:we(r.totalSchemaProperties,r.schemaPropertiesWithDescription,r.constraintCount)>we(e.totalSchemaProperties,e.schemaPropertiesWithDescription,e.constraintCount)}var Ke=["enum","const","format","pattern","minimum","maximum","minLength","maxLength","minItems","maxItems","minProperties","maxProperties","multipleOf","exclusiveMinimum","exclusiveMaximum","uniqueItems"];function Y(){return{depth:-1,maxDepth:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,hasPropertyExamples:!1,writableTopLevelFields:0,refsUsed:[],debugEntries:null,pendingRef:null}}function Ie(e){Object.assign(e,Y())}function Le(e){return{ref:{enter(r){typeof r?.$ref=="string"&&(e.refsUsed.push(r.$ref),e.pendingRef=r.$ref)}},Schema:{enter(r,t){e.depth++,e.maxDepth=Math.max(e.maxDepth,e.depth);let o=0;for(let i of Ke)r[i]!==void 0&&(e.constraintCount++,o++);r.discriminator?.propertyName&&(e.hasDiscriminator=!0);let n={};for(let i of["oneOf","anyOf","allOf"]){let a=r[i];Array.isArray(a)&&(e.polymorphismCount+=a.length,i==="anyOf"&&(e.anyOfCount+=a.length),n[i]=a.length)}let s=[];if(L(r.properties)){let i=Object.entries(r.properties);e.totalSchemaProperties+=i.length;for(let[a,c]of i){s.push(a);let h=c&&"$ref"in c&&c.$ref?t.resolve(c)?.node??c:c;h?.description&&e.schemaPropertiesWithDescription++,(h?.example!==void 0||h?.examples)&&(e.hasPropertyExamples=!0),h?.readOnly||e.writableTopLevelFields++}}e.debugEntries!==null&&e.debugEntries.push({ref:e.pendingRef,depth:e.depth,propertyNames:s,polymorphism:Object.keys(n).length>0?n:{},constraintCount:o}),e.pendingRef=null},leave(){e.depth--}}}}function qe(e,r,t){return{operations:new Map,currentPath:"",pathLevelParams:[],current:null,walkSchema:e,anyOfPenaltyMultiplier:r,debugOperationId:t,debugLogs:[]}}function Je(e,r,t){return{path:e,method:r,operationId:t.operationId,operationDescriptionPresent:!!t.description,parameterCount:0,requiredParameterCount:0,paramsWithDescription:0,ambiguousIdentifierCount:0,maxRequestSchemaDepth:0,maxResponseSchemaDepth:0,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,topLevelWritableFieldCount:0,requestBodyPresent:!1,requestExamplePresent:!1,responseExamplePresent:!1,structuredErrorResponseCount:0,totalErrorResponses:0,inRequestBody:!1,inResponse:!1,currentResponseCode:"",errorStructuredCounted:!1,maxEffectivePolymorphism:-1,refsUsed:new Set}}function Ye(e){let{inRequestBody:r,inResponse:t,currentResponseCode:o,errorStructuredCounted:n,maxEffectivePolymorphism:s,...i}=e;return i}function We(e){return{RequestBody:{enter(){e.current&&(e.current.requestBodyPresent=!0,e.current.inRequestBody=!0)},leave(){e.current&&(e.current.inRequestBody=!1)}},Response:{enter(r,t){let o=e.current;if(!o)return;let n=String(t.key);o.inResponse=!0,o.currentResponseCode=n,o.errorStructuredCounted=!1,Te(n)&&(o.totalErrorResponses++,!r.content&&r.description&&(o.structuredErrorResponseCount++,o.errorStructuredCounted=!0))},leave(){e.current&&(e.current.inResponse=!1)}},MediaType:{enter(r){let t=e.current;if(t&&(Ze(r)&&(t.inRequestBody&&(t.requestExamplePresent=!0),t.inResponse&&(t.responseExamplePresent=!0)),t.inResponse&&Te(t.currentResponseCode)&&!t.errorStructuredCounted&&(t.structuredErrorResponseCount++,t.errorStructuredCounted=!0),r.schema)){let o=!!e.debugOperationId&&(t.operationId===e.debugOperationId||`${t.method.toUpperCase()} ${t.path}`===e.debugOperationId),n=e.walkSchema(r.schema,o);Qe(t,n)&&(t.totalSchemaProperties=n.totalSchemaProperties,t.schemaPropertiesWithDescription=n.schemaPropertiesWithDescription,t.constraintCount=n.constraintCount);let s=J(n.polymorphismCount,n.anyOfCount,e.anyOfPenaltyMultiplier);s>t.maxEffectivePolymorphism&&(t.maxEffectivePolymorphism=s,t.polymorphismCount=n.polymorphismCount,t.anyOfCount=n.anyOfCount),n.hasDiscriminator&&(t.hasDiscriminator=!0);for(let i of n.refsUsed)t.refsUsed.add(i);if(n.hasPropertyExamples&&(t.inRequestBody&&(t.requestExamplePresent=!0),t.inResponse&&(t.responseExamplePresent=!0)),t.inRequestBody&&(t.maxRequestSchemaDepth=Math.max(t.maxRequestSchemaDepth,n.maxDepth),t.topLevelWritableFieldCount=Math.max(t.topLevelWritableFieldCount,n.writableTopLevelFields)),t.inResponse&&(t.maxResponseSchemaDepth=Math.max(t.maxResponseSchemaDepth,n.maxDepth)),o&&n.debugEntries){let i=t.inRequestBody?"REQUEST BODY":`RESPONSE ${t.currentResponseCode}`;e.debugLogs.push({context:i,entries:n.debugEntries,totalProperties:n.totalSchemaProperties,totalPolymorphism:n.polymorphismCount,totalConstraints:n.constraintCount,maxDepth:n.maxDepth})}}}},Paths:{PathItem:{enter(r,t){e.currentPath=String(t.key),e.pathLevelParams=r.parameters??[]},Operation:{enter(r,t){let o=String(t.key),n=Je(e.currentPath,o,r);e.current=n;let s=Xe(e.pathLevelParams,r.parameters??[],t.resolve);for(let i of s.values())n.parameterCount++,i.required&&n.requiredParameterCount++,i.description&&n.paramsWithDescription++,et(i)&&n.ambiguousIdentifierCount++},leave(r){let t=e.current;if(!t)return;let o=r.operationId??`${t.method.toUpperCase()} ${t.path}`;e.operations.set(o,Ye(t)),e.current=null}}}}}}function Ue(e){return{operationCount:e.operations.size,operations:e.operations}}function Ae(e,r){return r(e).node}function Xe(e,r,t){let o=new Map;for(let n of e){let s=Ae(n,t);s?.name&&s.in&&o.set(`${s.in}:${s.name}`,s)}for(let n of r){let s=Ae(n,t);s?.name&&s.in&&o.set(`${s.in}:${s.name}`,s)}return o}function Ze(e){return e.example!==void 0||ie(e.examples)}function et(e){if(e.description)return!1;let r=(e.name??"").toLowerCase();return Oe.has(r)}function Te(e){if(e==="default"||/^4xx$/i.test(e)||/^5xx$/i.test(e))return!0;let r=parseInt(e,10);return r>=400&&r<600}function tt(e,r){if(!r.startsWith("#/"))return;let t=e;for(let o of r.slice(2).split("/"))t=t?.[ce(o)];return t}function ke({document:e,types:r,resolvedRefMap:t,ctx:o,debugOperationId:n,scoringConstants:s}){let i=s?.weights.anyOfPenaltyMultiplier??D.weights.anyOfPenaltyMultiplier,a=Y(),c=Le(a),h=Q([{severity:"warn",ruleId:"score-schema",visitor:c}],r),u=(l,m)=>{Ie(a),m&&(a.debugEntries=[]),K({document:{...e,parsed:l},rootType:r.Schema,normalizedVisitors:h,resolvedRefMap:t,ctx:o});let{depth:d,pendingRef:w,debugEntries:_,...N}=a;return{...N,refsUsed:[...a.refsUsed],debugEntries:m?a.debugEntries??void 0:void 0}},f=new Map,$=new WeakSet,O={maxDepth:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,hasPropertyExamples:!1,writableTopLevelFields:0,refsUsed:[]};function y(l,m){return{maxDepth:Math.max(l.maxDepth,m.maxDepth),polymorphismCount:l.polymorphismCount+m.polymorphismCount,anyOfCount:l.anyOfCount+m.anyOfCount,hasDiscriminator:l.hasDiscriminator||m.hasDiscriminator,totalSchemaProperties:l.totalSchemaProperties+m.totalSchemaProperties,schemaPropertiesWithDescription:l.schemaPropertiesWithDescription+m.schemaPropertiesWithDescription,constraintCount:l.constraintCount+m.constraintCount,hasPropertyExamples:l.hasPropertyExamples||m.hasPropertyExamples,writableTopLevelFields:l.writableTopLevelFields+m.writableTopLevelFields,refsUsed:[...l.refsUsed,...m.refsUsed],debugEntries:l.debugEntries||m.debugEntries?[...l.debugEntries??[],...m.debugEntries??[]]:void 0}}let g=(l,m=!1)=>{let d=l,w=pe(l)?l.$ref:void 0;if(w){if(!m){let S=f.get(w);if(S)return S}d=tt(e.parsed,w)??l}if(L(d)&&$.has(d))return{...O};L(d)&&$.add(d);let _=d?.oneOf,N=d?.anyOf,Z=Array.isArray(_)&&_.length>1,ee=Array.isArray(N)&&N.length>1,G=Z||ee,te=Array.isArray(d?.allOf)&&d.allOf.length>0,V=d?.discriminator,q=!G&&L(V?.mapping)?Object.values(V.mapping).filter(S=>typeof S=="string"&&me(S)).map(S=>({$ref:S})):null,re=Array.isArray(q)&&q.length>0,C;if(G||te||re){let S={...d},F=null,oe=P=>{F=F?y(F,P):P},ne=(P,v)=>{let E=g(v[0],m);for(let z=1;z<v.length;z++){let se=g(v[z],m);se.totalSchemaProperties>E.totalSchemaProperties&&(E=se)}return{...E,polymorphismCount:E.polymorphismCount+v.length,anyOfCount:E.anyOfCount+(P==="anyOf"?v.length:0),hasDiscriminator:E.hasDiscriminator||!!V}};G&&delete S.discriminator,Z&&(delete S.oneOf,oe(ne("oneOf",_))),ee&&(delete S.anyOf,oe(ne("anyOf",N)));let H=null;if(re){delete S.discriminator;let P=g(q[0],m);for(let v=1;v<q.length;v++){let E=g(q[v],m);E.totalSchemaProperties>P.totalSchemaProperties&&(P=E)}H={...P,polymorphismCount:P.polymorphismCount+q.length,hasDiscriminator:!0}}let W=null;if(te){delete S.allOf,W={...O};for(let P of d.allOf)W=y(W,g(P,m));W.polymorphismCount+=d.allOf.length}C=u(S,m),W&&(C=y(C,W)),F&&(C=y(C,F)),H&&(C=y(C,H)),w&&(C={...C,refsUsed:[w,...C.refsUsed]})}else C=u(l,m);return L(d)&&$.delete(d),w&&!m&&f.set(w,C),C},M=qe(g,i,n),T=We(M),I=Q([{severity:"warn",ruleId:"score",visitor:T}],r);return K({document:e,rootType:r.Root,normalizedVisitors:I,resolvedRefMap:t,ctx:o}),{metrics:Ue(M),debugLogs:M.debugLogs}}function Ne(e){let r=new Map;for(let[n,s]of e)for(let i of s.refsUsed){let a=r.get(i);a||(a=new Set,r.set(i,a)),a.add(n)}let t=new Map;for(let n of e.keys())t.set(n,new Set);for(let n of r.values()){if(n.size<2)continue;let s=Array.from(n);for(let i=0;i<s.length;i++)for(let a=i+1;a<s.length;a++)t.get(s[i]).add(s[a]),t.get(s[a]).add(s[i])}let o=new Map;for(let n of e.keys()){let s=rt(n,t);o.set(n,s)}return o}function rt(e,r){let t=new Set([e]),o=[e],n=0;for(;o.length>0;){let s=[];for(let i of o)for(let a of r.get(i)??[])t.has(a)||(t.add(a),s.push(a));s.length>0&&n++,o=s}return n}function Fe(e){let r={agentReadiness:e.agentReadiness,discoverability:Math.round(e.discoverability*100),subscores:e.subscores,rawMetrics:{operationCount:e.rawMetrics.operationCount,operations:Object.fromEntries(Array.from(e.rawMetrics.operations.entries()).map(([t,o])=>{let{refsUsed:n,...s}=o;return[t,s]}))},operationScores:Object.fromEntries(e.operationScores),dependencyDepths:Object.fromEntries(e.dependencyDepths),hotspots:e.hotspots};k.output(JSON.stringify(r,null,2))}function je(e,r=!1){ot(e),nt(e),it(e),r&&at(e),pt(e)}function _e(e){return e>=80?de:e>=50?j:fe}function Be(e){return _e(e)(b(e.toFixed(1)))}function p(e){k.output(e+`
8
8
  `)}function ot(e){p(""),p(b(A(" Scores"))),p(""),p(` Agent Readiness: ${Be(e.agentReadiness)}/100`),p("")}function nt(e){p(b(A(" Subscores"))),p("");let r=e.subscores;R("Parameter Simplicity",r.parameterSimplicity),R("Schema Simplicity",r.schemaSimplicity),R("Documentation Quality",r.documentationQuality),R("Constraint Clarity",r.constraintClarity),R("Example Coverage",r.exampleCoverage),R("Error Clarity",r.errorClarity),R("Dependency Clarity",r.dependencyClarity),R("Identifier Clarity",r.identifierClarity),R("Polymorphism Clarity",r.polymorphismClarity),R("Discoverability",e.discoverability),p("")}function R(e,r){let t=Math.round(r*100),o=st(r);p(` ${e.padEnd(24)} ${o} ${_e(t)(t+"%")}`)}function st(e){let t=Math.round(e*20);return U("["+"\u2588".repeat(t)+"\u2591".repeat(20-t)+"]")}function it(e){if(p(b(A(" Raw Metrics Summary"))),p(""),p(` Total operations: ${e.rawMetrics.operationCount}`),e.rawMetrics.operationCount===0){p("");return}let r=[],t=[],o=[],n=[],s=0,i=0,a=0;for(let u of e.rawMetrics.operations.values())r.push(u.parameterCount),t.push(Math.max(u.maxRequestSchemaDepth,u.maxResponseSchemaDepth)),o.push(u.polymorphismCount),n.push(u.totalSchemaProperties),u.requestExamplePresent&&s++,u.responseExamplePresent&&i++,u.operationDescriptionPresent&&a++;let c=e.rawMetrics.operationCount;function h(u,f){let O=(f.reduce((T,I)=>T+I,0)/c).toFixed(1),y=B(f).toFixed(1),g=Math.min(...f),M=Math.max(...f);p(` ${u.padEnd(26)} avg ${O.padStart(6)} median ${y.padStart(6)} min ${String(g).padStart(5)} max ${String(M).padStart(5)}`)}h("Parameters/operation:",r),h("Schema depth:",t),h("Polymorphism/operation:",o),h("Properties/operation:",n),p(` Operations with request examples: ${s}/${c} (${X(s,c)})`),p(` Operations with response examples: ${i}/${c} (${X(i,c)})`),p(` Operations with description: ${a}/${c} (${X(a,c)})`),p("")}function X(e,r){return r>0?`${Math.round(e/r*100)}%`:"N/A"}function at(e){p(b(A(" Per-Operation Metrics"))),p("");let r=" "+"Operation".padEnd(50)+"Props".padStart(7)+"Poly".padStart(7)+"Depth".padStart(7)+"Params".padStart(8)+"Constr".padStart(8);p(U(r)),p(U(" "+"\u2500".repeat(r.length-2)));let t=[...e.rawMetrics.operations.entries()].sort(([,o],[,n])=>n.totalSchemaProperties-o.totalSchemaProperties);for(let[,o]of t){let n=(o.operationId??`${o.method.toUpperCase()} ${o.path}`).slice(0,48),s=Math.max(o.maxRequestSchemaDepth,o.maxResponseSchemaDepth),i=" "+n.padEnd(50)+String(o.totalSchemaProperties).padStart(7)+String(o.polymorphismCount).padStart(7)+String(s).padStart(7)+String(o.parameterCount).padStart(8)+String(o.constraintCount).padStart(8);p(i)}p("")}function Ge(e,r){if(p(""),p(b(A(` Debug: ${e} schema breakdown`))),p(""),r.length===0){p(j(` No schemas found for operation "${e}".`)),p(j(' Make sure the value matches an operationId or "METHOD /path" exactly.')),p("");return}for(let t of r){p(b(U(` ${t.context}`))),p(U(" "+"\u2500".repeat(70)));let o=new Map;for(let s of t.entries){let i=s.ref??`(inline depth ${s.depth})`,a=o.get(i);if(a){a.count++,a.totalProps+=s.propertyNames.length;for(let c of s.propertyNames)a.propNames.includes(c)||a.propNames.push(c)}else o.set(i,{count:1,totalProps:s.propertyNames.length,propNames:[...s.propertyNames]})}for(let s of t.entries){let i=s.ref??"(inline)",a=" ".repeat(Math.min(s.depth,6)),c=s.propertyNames.length,h=` ${a}${i}`;c>0&&(h+=` (${c} properties)`);let u=[];if(s.polymorphism.oneOf&&u.push(`oneOf:${s.polymorphism.oneOf}`),s.polymorphism.anyOf&&u.push(`anyOf:${s.polymorphism.anyOf}`),s.polymorphism.allOf&&u.push(`allOf:${s.polymorphism.allOf}`),u.length>0&&(h+=` [${u.join(", ")}]`),s.constraintCount>0&&(h+=` {${s.constraintCount} constraints}`),p(h),c>0&&c<=20)p(` ${a} properties: ${s.propertyNames.join(", ")}`);else if(c>20){let f=s.propertyNames.slice(0,15).join(", ");p(` ${a} properties: ${f}, ... +${c-15} more`)}}p(""),p(` Totals: ${t.totalProperties} properties, ${t.totalPolymorphism} polymorphism items, ${t.totalConstraints} constraints, max depth ${t.maxDepth}`);let n=[...o.entries()].filter(([,s])=>s.totalProps>0).sort(([,s],[,i])=>i.totalProps-s.totalProps).slice(0,10);if(n.length>0){p(""),p(b(" Top schemas by property count:"));for(let[s,i]of n)p(` ${s}: ${i.totalProps} properties`)}p("")}}function pt(e){if(e.hotspots.length===0){p(b(A(" No hotspot operations found."))),p("");return}p(b(A(` Top ${e.hotspots.length} Hotspot Operations`))),p("");for(let r of e.hotspots){let t=r.operationId?`${r.method.toUpperCase()} ${r.path} (${r.operationId})`:`${r.method.toUpperCase()} ${r.path}`;p(b(` ${t}`)),p(` Agent Readiness: ${Be(r.agentReadinessScore)}`);for(let o of r.reasons)p(j(` - ${o}`));p("")}}function Ve(e,r,t,o=D){let n=[];for(let[s,i]of r){let a=e.operations.get(s);if(!a)continue;let c=ct(a,t.get(s)??0,o);c.length!==0&&n.push({path:a.path,method:a.method,operationId:a.operationId,agentReadinessScore:i.agentReadiness,reasons:c})}return n.sort((s,i)=>s.reasons.length!==i.reasons.length?i.reasons.length-s.reasons.length:s.agentReadinessScore-i.agentReadinessScore),n.slice(0,o.hotspotLimit)}function ct(e,r,t){let{thresholds:o}=t,n=[];e.parameterCount>o.maxParamsGood&&n.push(`High parameter count (${e.parameterCount})`);let s=Math.max(e.maxRequestSchemaDepth,e.maxResponseSchemaDepth);s>o.maxDepthGood&&n.push(`Deep schema nesting (depth ${s})`),e.anyOfCount>0&&!e.hasDiscriminator?n.push(`Polymorphism (anyOf) without discriminator (${e.anyOfCount} anyOf)`):e.polymorphismCount>o.maxPolymorphismGood&&n.push(`High polymorphism count (${e.polymorphismCount})`);let i=e.requestBodyPresent&&!e.requestExamplePresent,a=!e.responseExamplePresent;return i&&a?n.push("Missing request and response examples"):i?n.push("Missing request body examples"):a&&n.push("Missing response examples"),e.totalErrorResponses>0&&e.structuredErrorResponseCount===0&&n.push("No structured error responses (4xx/5xx)"),e.operationDescriptionPresent||n.push("Missing operation description"),e.parameterCount>0&&e.paramsWithDescription===0&&n.push("No parameter descriptions"),r>o.maxDependencyDepthGood&&n.push(`High dependency depth (${r})`),e.ambiguousIdentifierCount>o.maxAmbiguousGood&&n.push(`Ambiguous identifiers (${e.ambiguousIdentifierCount})`),n}async function Vt({argv:e,config:r,collectSpecData:t}){let[{path:o}]=await xe(e.api?[e.api]:[],r),n=new le(r.resolve),{bundle:s}=await be({config:r,ref:o});t?.(s);let i=ge(s.parsed);if(Se(i)!=="oas3")throw new Ce(`The score command currently supports only OpenAPI 3.x. Detected: ${i}`);let a=mt.now(),c=ae(r.extendTypes(ue(i),i),r),h=await he({rootDocument:s,rootType:c.Root,externalRefResolver:n}),u=e["debug-operation-id"],{metrics:f,debugLogs:$}=ke({document:s,types:c,resolvedRefMap:h,ctx:{problems:[],specVersion:i,config:r,visitorsData:{}},debugOperationId:u}),O=Ne(f.operations),y=Re(f,O),g=Me(f.operationCount),{agentReadiness:M}=ve(y,g),T=Ve(f,y,O),I={agentReadiness:M,discoverability:g,subscores:Ee(y),rawMetrics:f,hotspots:T,operationScores:y,dependencyDepths:O};ut(I,o,a,e.format,!!e["operation-details"],u?{operationId:u,logs:$}:void 0)}function ut(e,r,t,o,n,s){k.info(`Document: ${ye(r)} score:
9
9
  `),o==="json"?Fe(e):je(e,n),s&&Ge(s.operationId,s.logs),Pe("score",t,r)}export{Vt as handleScore};