@redocly/cli 0.0.0-snapshot.1793725129 → 0.0.0-snapshot.1793782841
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES +1 -1
- package/lib/chunks/{6DYFEH2L.js → 25E5DG26.js} +1 -1
- package/lib/chunks/26NBHXFM.js +9 -0
- package/lib/chunks/{7FBJPV3U.js → 2W65TZGH.js} +1 -1
- package/lib/chunks/{2GWKXIXU.js → 352DOU3F.js} +2 -2
- package/lib/chunks/{T5STXLLC.js → 36T2XEW3.js} +1 -1
- package/lib/chunks/{RPNYH2MV.js → 3IBDUYFN.js} +1 -1
- package/lib/chunks/{3AAEQ47E.js → 4UD5QBRG.js} +1 -1
- package/lib/chunks/{LPI5BZSQ.js → 566VM37K.js} +1 -1
- package/lib/chunks/{72C62BJU.js → 5VVLGIDA.js} +1 -1
- package/lib/chunks/{GAZ47OAF.js → 5YFTMSJF.js} +1 -1
- package/lib/chunks/{6DSIFHMO.js → 64YG5S4G.js} +1 -1
- package/lib/chunks/{EOEYV32J.js → 6DXLICIO.js} +1 -1
- package/lib/chunks/{LM6OFQTT.js → 6ONEVLGD.js} +1 -1
- package/lib/chunks/{R355IB3Z.js → 72IHXHOE.js} +1 -1
- package/lib/chunks/{ACRS4MQJ.js → 7K6DXC5J.js} +1 -1
- package/lib/chunks/{HJ472QZ7.js → AB7PLYPU.js} +1 -1
- package/lib/chunks/{DMMRXY4P.js → B42GPTSR.js} +1 -1
- package/lib/chunks/{7GZ7DIX3.js → B5YNBSMD.js} +1 -1
- package/lib/chunks/{JEM4VDDG.js → BMFYFSIR.js} +1 -1
- package/lib/chunks/{LLWYJNNL.js → BYMX4IN4.js} +1 -1
- package/lib/chunks/{RFCLFLZM.js → BZHSHCLA.js} +1 -1
- package/lib/chunks/{RAJUOHFP.js → CHUZNHWN.js} +1 -1
- package/lib/chunks/{5S4MKBUC.js → CRSJT2P4.js} +1 -1
- package/lib/chunks/{RFB3N3MR.js → CYANRNZK.js} +2 -2
- package/lib/chunks/{OO4H6QVR.js → DC56UBY4.js} +1 -1
- package/lib/chunks/{OLK5L5DU.js → DK7BNALK.js} +1 -1
- package/lib/chunks/{3YUZT2CX.js → DKUXU5WQ.js} +1 -1
- package/lib/chunks/{PWEWJ4HR.js → DSRHDMCC.js} +2 -2
- package/lib/chunks/{LRVFYNKO.js → DYXWOFZF.js} +1 -1
- package/lib/chunks/{HXETRDUD.js → E2XJ3FU4.js} +1 -1
- package/lib/chunks/{UUDNHYDC.js → EA76FVG5.js} +1 -1
- package/lib/chunks/{K3J66W7K.js → ES22UWOC.js} +1 -1
- package/lib/chunks/{AAJ5KDBD.js → FBPOZVQ2.js} +1 -1
- package/lib/chunks/{OKCT2OPW.js → G6TA7TLM.js} +1 -1
- package/lib/chunks/{I6TI7QZN.js → GPEWLPGL.js} +1 -1
- package/lib/chunks/{D3UITBPJ.js → HB5ELCWE.js} +1 -1
- package/lib/chunks/{4PURYHQB.js → HLDRP3WK.js} +1 -1
- package/lib/chunks/{IUXDZMRR.js → HQSYSDOF.js} +1 -1
- package/lib/chunks/{ZWNQYB55.js → IAAY64YJ.js} +1 -1
- package/lib/chunks/{P2XZMXON.js → IIPKOPGO.js} +1 -1
- package/lib/chunks/{VW4MCIRI.js → IPCQDGPM.js} +93 -93
- package/lib/chunks/{PVK4LTJJ.js → ITFNREVY.js} +1 -1
- package/lib/chunks/{KBBMJCCH.js → JCVTCKJI.js} +1 -1
- package/lib/chunks/{PQA3KABI.js → JH42QN76.js} +1 -1
- package/lib/chunks/{PY6QWKIA.js → JJ7C4SJQ.js} +1 -1
- package/lib/chunks/{6AHLDFQZ.js → JXXGTR22.js} +2 -2
- package/lib/chunks/{GQM5EN54.js → K2MVHTPY.js} +1 -1
- package/lib/chunks/{S2AV4YDF.js → K36HFZXQ.js} +1 -1
- package/lib/chunks/{CCEBYE35.js → KQGP2AZG.js} +1 -1
- package/lib/chunks/{EEWOJWWN.js → LOSVDUNK.js} +1 -1
- package/lib/chunks/{VKTAEULC.js → LPR74CIS.js} +1 -1
- package/lib/chunks/{OJY3LSIH.js → LR2W5CEQ.js} +1 -1
- package/lib/chunks/{YAJIEM55.js → MBAERFFP.js} +1 -1
- package/lib/chunks/{XTOQVRSK.js → MM4AUOQP.js} +2 -2
- package/lib/chunks/{OSPQXBEF.js → MVORYCC7.js} +1 -1
- package/lib/chunks/{BYNU2NTZ.js → N7RFW4SU.js} +1 -1
- package/lib/chunks/{TAXVNFEF.js → OYMGZQWH.js} +1 -1
- package/lib/chunks/{IFFZXZKC.js → PEJPUJ4R.js} +1 -1
- package/lib/chunks/{CHP4JFKV.js → PZ6J4KHX.js} +1 -1
- package/lib/chunks/{LO7TTR3Z.js → R3G2VC2I.js} +1 -1
- package/lib/chunks/{TQFB2YHX.js → R3TWG6EQ.js} +1 -1
- package/lib/chunks/{MN4W7FFU.js → S2YLQBSU.js} +1 -1
- package/lib/chunks/{5E4N5VXC.js → SR7NNZFJ.js} +1 -1
- package/lib/chunks/{YGOZQI6V.js → SRCVTE25.js} +3 -3
- package/lib/chunks/{CRQJMW2O.js → U6O77LIU.js} +1 -1
- package/lib/chunks/{SD5ZZ5QC.js → UATO3PBH.js} +1 -1
- package/lib/chunks/{CRJRRBMV.js → UJ5HQQDZ.js} +1 -1
- package/lib/chunks/{KBZC763H.js → UV2GCRGI.js} +1 -1
- package/lib/chunks/{77MEMON7.js → V4FEYIKY.js} +1 -1
- package/lib/chunks/{E646IT6H.js → VMG34PHB.js} +1 -1
- package/lib/chunks/{VND6NIMG.js → VRCDJEVJ.js} +1 -1
- package/lib/chunks/{5BIIW5MT.js → VZ6I5RYT.js} +1 -1
- package/lib/chunks/{6L24JOOZ.js → WRSWHPY3.js} +1 -1
- package/lib/chunks/{UINHCINN.js → XG6RULSC.js} +1 -1
- package/lib/chunks/{ASEB4DDE.js → XMLLL2WM.js} +1 -1
- package/lib/chunks/{XMWU7UWQ.js → XZBNGB46.js} +1 -1
- package/lib/chunks/{FNWNKPYI.js → ZDUFUIVX.js} +1 -1
- package/lib/chunks/{MPYBTNYY.js → ZESNTFSY.js} +1 -1
- package/lib/eject-assets/generators/cli/docs.ts +1 -1
- package/lib/eject-assets/generators/cli/engine-source.ts +1 -1
- package/lib/eject-assets/generators/cli/index.ts +2 -2
- package/lib/eject-assets/generators/cli/render.ts +1 -1
- package/lib/eject-assets/generators/go/client.ts +1 -1
- package/lib/eject-assets/generators/go/descriptor.ts +1 -1
- package/lib/eject-assets/generators/go/index.ts +2 -2
- package/lib/eject-assets/generators/go/models.ts +1 -1
- package/lib/eject-assets/generators/go/naming.ts +1 -1
- package/lib/eject-assets/generators/go/operations.ts +1 -1
- package/lib/eject-assets/generators/go/pagination.ts +1 -1
- package/lib/eject-assets/generators/go/types.ts +1 -1
- package/lib/eject-assets/generators/java/client.ts +1 -1
- package/lib/eject-assets/generators/java/descriptor.ts +1 -1
- package/lib/eject-assets/generators/java/index.ts +2 -2
- package/lib/eject-assets/generators/java/models.ts +1 -1
- package/lib/eject-assets/generators/java/naming.ts +1 -1
- package/lib/eject-assets/generators/java/operations.ts +1 -1
- package/lib/eject-assets/generators/java/pagination.ts +1 -1
- package/lib/eject-assets/generators/java/types.ts +1 -1
- package/lib/eject-assets/generators/mock/faker.ts +1 -1
- package/lib/eject-assets/generators/mock/index.ts +2 -2
- package/lib/eject-assets/generators/mock/render.ts +1 -1
- package/lib/eject-assets/generators/mock/sample.ts +1 -1
- package/lib/eject-assets/generators/mock/values.ts +1 -1
- package/lib/eject-assets/generators/php/client.ts +1 -1
- package/lib/eject-assets/generators/php/descriptor.ts +1 -1
- package/lib/eject-assets/generators/php/index.ts +2 -2
- package/lib/eject-assets/generators/php/models.ts +1 -1
- package/lib/eject-assets/generators/php/naming.ts +1 -1
- package/lib/eject-assets/generators/php/operations.ts +1 -1
- package/lib/eject-assets/generators/php/pagination.ts +1 -1
- package/lib/eject-assets/generators/php/types.ts +1 -1
- package/lib/eject-assets/generators/python/client.ts +1 -1
- package/lib/eject-assets/generators/python/descriptor.ts +1 -1
- package/lib/eject-assets/generators/python/index.ts +2 -2
- package/lib/eject-assets/generators/python/models.ts +1 -1
- package/lib/eject-assets/generators/python/naming.ts +1 -1
- package/lib/eject-assets/generators/python/operations.ts +1 -1
- package/lib/eject-assets/generators/python/pagination.ts +1 -1
- package/lib/eject-assets/generators/python/types.ts +1 -1
- package/lib/eject-assets/generators/swr/index.ts +2 -2
- package/lib/eject-assets/generators/swr/render.ts +1 -1
- package/lib/eject-assets/generators/tanstack-query/index.ts +2 -2
- package/lib/eject-assets/generators/tanstack-query/render.ts +1 -1
- package/lib/eject-assets/generators/transformers/index.ts +2 -2
- package/lib/eject-assets/generators/transformers/render.ts +1 -1
- package/lib/eject-assets/generators/typescript/banner.ts +1 -1
- package/lib/eject-assets/generators/typescript/client.ts +1 -1
- package/lib/eject-assets/generators/typescript/descriptor.ts +1 -1
- package/lib/eject-assets/generators/typescript/index.ts +2 -2
- package/lib/eject-assets/generators/typescript/inline-runtime.ts +1 -1
- package/lib/eject-assets/generators/typescript/operation-signature.ts +1 -1
- package/lib/eject-assets/generators/typescript/operation-types.ts +1 -1
- package/lib/eject-assets/generators/typescript/operations.ts +1 -1
- package/lib/eject-assets/generators/typescript/response-headers.ts +1 -1
- package/lib/eject-assets/generators/typescript/type-guards.ts +1 -1
- package/lib/eject-assets/generators/typescript/types.ts +1 -1
- package/lib/eject-assets/generators/zod/index.ts +2 -2
- package/lib/eject-assets/generators/zod/schemas.ts +1 -1
- package/lib/index.js +4 -4
- package/package.json +1 -1
- package/lib/chunks/IB7RMED7.js +0 -9
package/THIRD_PARTY_NOTICES
CHANGED
|
@@ -416,7 +416,7 @@ Packages:
|
|
|
416
416
|
@noble/hashes@1.8.0 — Copyright (c) 2022 Paul Miller (https://paulmillr.com)
|
|
417
417
|
@redocly/ajv@8.18.3 — Copyright (c) 2015-2021 Evgeny Poberezkin
|
|
418
418
|
@redocly/cli-otel@0.3.7 — Copyright 2025 Redocly Inc, all rights reserved.
|
|
419
|
-
@redocly/config@0.
|
|
419
|
+
@redocly/config@0.72.0 — Copyright 2024 Redocly Inc.
|
|
420
420
|
ajv-formats@3.0.1 — Copyright (c) 2020 Evgeny Poberezkin
|
|
421
421
|
ajv@8.20.0 — Copyright (c) 2015-2021 Evgeny Poberezkin
|
|
422
422
|
ansi-regex@6.4.0
|
|
@@ -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{Ba as ji,Ca as Ji,Ea as zi,M as Gi,aa as $e,ba as Fi,c as le,ca as $i,da as _r,ea as ee,fa as ra,ga as Ge,ha as be,k as on,ka as sn,la as we,m as ya,ma as Ka,ta as _i,u as Wi,xa as Kr,za as Ki}from"./
|
|
7
|
+
import{Ba as ji,Ca as Ji,Ea as zi,M as Gi,aa as $e,ba as Fi,c as le,ca as $i,da as _r,ea as ee,fa as ra,ga as Ge,ha as be,k as on,ka as sn,la as we,m as ya,ma as Ka,ta as _i,u as Wi,xa as Kr,za as Ki}from"./IPCQDGPM.js";import{a as xa,c as Ce,e as Re}from"./RFWIIJFG.js";var ro=Ce((bf,ao)=>{var wc=Object.prototype.hasOwnProperty,Ac=Object.prototype.toString;ao.exports=function(a,r,t){if(Ac.call(r)!=="[object Function]")throw new TypeError("iterator must be a function");var n=a.length;if(n===+n)for(var i=0;i<n;i++)r.call(t,a[i],i,a);else for(var s in a)wc.call(a,s)&&r.call(t,a[s],s,a)}});var Jr=Ce((kf,to)=>{"use strict";var Tc=ro();to.exports=ke;function ke(e,a,r){if(arguments.length===3)return ke.set(e,a,r);if(arguments.length===2)return ke.get(e,a);var t=ke.bind(ke,e);for(var n in ke)ke.hasOwnProperty(n)&&(t[n]=ke[n].bind(t,e));return t}ke.get=function(a,r){for(var t=Array.isArray(r)?r:ke.parse(r),n=0;n<t.length;++n){var i=t[n];if(!(typeof a=="object"&&i in a))throw new Error("Invalid reference token: "+i);a=a[i]}return a};ke.set=function(a,r,t){var n=Array.isArray(r)?r:ke.parse(r),i=n[0];if(n.length===0)throw Error("Can not set the root object");for(var s=0;s<n.length-1;++s){var u=n[s];typeof u!="string"&&typeof u!="number"&&(u=String(u)),!(u==="__proto__"||u==="constructor"||u==="prototype")&&(u==="-"&&Array.isArray(a)&&(u=a.length),i=n[s+1],u in a||(i.match(/^(\d+|-)$/)?a[u]=[]:a[u]={}),a=a[u])}return i==="-"&&Array.isArray(a)&&(i=a.length),a[i]=t,this};ke.remove=function(e,a){var r=Array.isArray(a)?a:ke.parse(a),t=r[r.length-1];if(t===void 0)throw new Error('Invalid JSON pointer for remove: "'+a+'"');var n=ke.get(e,r.slice(0,-1));if(Array.isArray(n)){var i=+t;if(t===""&&isNaN(i))throw new Error('Invalid array index: "'+t+'"');Array.prototype.splice.call(n,i,1)}else delete n[t]};ke.dict=function(a,r){var t={};return ke.walk(a,function(n,i){t[i]=n},r),t};ke.walk=function(a,r,t){var n=[];t=t||function(i){var s=Object.prototype.toString.call(i);return s==="[object Object]"||s==="[object Array]"},(function i(s){Tc(s,function(u,h){n.push(String(h)),t(u)?i(u):r(u,ke.compile(n)),n.pop()})})(a)};ke.has=function(a,r){try{ke.get(a,r)}catch{return!1}return!0};ke.escape=function(a){return a.toString().replace(/~/g,"~0").replace(/\//g,"~1")};ke.unescape=function(a){return a.replace(/~1/g,"/").replace(/~0/g,"~")};ke.parse=function(a){if(a==="")return[];if(a.charAt(0)!=="/")throw new Error("Invalid JSON pointer: "+a);return a.substring(1).split(/\//).map(ke.unescape)};ke.compile=function(a){return a.length===0?"":"/"+a.map(ke.escape).join("/")}});var xo=Ce((Bo,fn)=>{(function(e){if(typeof Bo=="object"&&typeof fn<"u")fn.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var a;typeof window<"u"?a=window:typeof global<"u"?a=global:typeof self<"u"?a=self:a=this,a.OpenAPISampler=e()}})(function(){var e,a,r;return(function(){function t(n,i,s){function u(g,k){if(!i[g]){if(!n[g]){var B=typeof xa=="function"&&xa;if(!k&&B)return B(g,!0);if(h)return h(g,!0);var P=new Error("Cannot find module '"+g+"'");throw P.code="MODULE_NOT_FOUND",P}var C=i[g]={exports:{}};n[g][0].call(C.exports,function(A){var T=n[g][1][A];return u(T||A)},C,C.exports,t,n,i,s)}return i[g].exports}for(var h=typeof xa=="function"&&xa,m=0;m<s.length;m++)u(s[m]);return u}return t})()({1:[function(t,n,i){(()=>{"use strict";var s={d:(d,o)=>{for(var c in o)s.o(o,c)&&!s.o(d,c)&&Object.defineProperty(d,c,{enumerable:!0,get:o[c]})},o:(d,o)=>Object.prototype.hasOwnProperty.call(d,o),r:d=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(d,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(d,"__esModule",{value:!0})}},u={};s.r(u),s.d(u,{XMLBuilder:()=>Yt,XMLParser:()=>Jt,XMLValidator:()=>qt});let h=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",m=new RegExp("^["+h+"]["+h+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");function g(d,o){let c=[],l=o.exec(d);for(;l;){let f=[];f.startIndex=o.lastIndex-l[0].length;let b=l.length;for(let D=0;D<b;D++)f.push(l[D]);c.push(f),l=o.exec(d)}return c}let k=function(d){return m.exec(d)!=null},B=["hasOwnProperty","toString","valueOf","__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"],P=["__proto__","constructor","prototype"],C={allowBooleanAttributes:!1,unpairedTags:[]};function A(d,o){o=Object.assign({},C,o);let c=[],l=!1,f=!1;d[0]==="\uFEFF"&&(d=d.substr(1));for(let b=0;b<d.length;b++)if(d[b]==="<"&&d[b+1]==="?"){if(b+=2,b=S(d,b),b.err)return b}else{if(d[b]!=="<"){if(T(d[b]))continue;return L("InvalidChar","char '"+d[b]+"' is not expected.",H(d,b))}{let D=b;if(b++,d[b]==="!"){b=w(d,b);continue}{let v=!1;d[b]==="/"&&(v=!0,b++);let I="";for(;b<d.length&&d[b]!==">"&&d[b]!==" "&&d[b]!==" "&&d[b]!==`
|
|
8
8
|
`&&d[b]!=="\r";b++)I+=d[b];if(I=I.trim(),I[I.length-1]==="/"&&(I=I.substring(0,I.length-1),b--),!O(I)){let V;return V=I.trim().length===0?"Invalid space after '<'.":"Tag '"+I+"' is an invalid name.",L("InvalidTag",V,H(d,b))}let N=F(d,b);if(N===!1)return L("InvalidAttr","Attributes for '"+I+"' have open quote.",H(d,b));let G=N.value;if(b=N.index,G[G.length-1]==="/"){let V=b-G.length;G=G.substring(0,G.length-1);let Y=U(G,o);if(Y!==!0)return L(Y.err.code,Y.err.msg,H(d,V+Y.err.line));l=!0}else if(v){if(!N.tagClosed)return L("InvalidTag","Closing tag '"+I+"' doesn't have proper closing.",H(d,b));if(G.trim().length>0)return L("InvalidTag","Closing tag '"+I+"' can't have attributes or invalid starting.",H(d,D));if(c.length===0)return L("InvalidTag","Closing tag '"+I+"' has not been opened.",H(d,D));{let V=c.pop();if(I!==V.tagName){let Y=H(d,V.tagStartPos);return L("InvalidTag","Expected closing tag '"+V.tagName+"' (opened in line "+Y.line+", col "+Y.col+") instead of closing tag '"+I+"'.",H(d,D))}c.length==0&&(f=!0)}}else{let V=U(G,o);if(V!==!0)return L(V.err.code,V.err.msg,H(d,b-G.length+V.err.line));if(f===!0)return L("InvalidXml","Multiple possible root nodes found.",H(d,b));o.unpairedTags.indexOf(I)!==-1||c.push({tagName:I,tagStartPos:D}),l=!0}for(b++;b<d.length;b++)if(d[b]==="<"){if(d[b+1]==="!"){b++,b=w(d,b);continue}if(d[b+1]!=="?")break;if(b=S(d,++b),b.err)return b}else if(d[b]==="&"){let V=R(d,b);if(V==-1)return L("InvalidChar","char '&' is not expected.",H(d,b));b=V}else if(f===!0&&!T(d[b]))return L("InvalidXml","Extra text at the end",H(d,b));d[b]==="<"&&b--}}}return l?c.length==1?L("InvalidTag","Unclosed tag '"+c[0].tagName+"'.",H(d,c[0].tagStartPos)):!(c.length>0)||L("InvalidXml","Invalid '"+JSON.stringify(c.map(b=>b.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):L("InvalidXml","Start tag expected.",1)}function T(d){return d===" "||d===" "||d===`
|
|
9
9
|
`||d==="\r"}function S(d,o){let c=o;for(;o<d.length;o++)if(d[o]=="?"||d[o]==" "){let l=d.substr(c,o-c);if(o>5&&l==="xml")return L("InvalidXml","XML declaration allowed only at the start of the document.",H(d,o));if(d[o]=="?"&&d[o+1]==">"){o++;break}continue}return o}function w(d,o){if(d.length>o+5&&d[o+1]==="-"&&d[o+2]==="-"){for(o+=3;o<d.length;o++)if(d[o]==="-"&&d[o+1]==="-"&&d[o+2]===">"){o+=2;break}}else if(d.length>o+8&&d[o+1]==="D"&&d[o+2]==="O"&&d[o+3]==="C"&&d[o+4]==="T"&&d[o+5]==="Y"&&d[o+6]==="P"&&d[o+7]==="E"){let c=1;for(o+=8;o<d.length;o++)if(d[o]==="<")c++;else if(d[o]===">"&&(c--,c===0))break}else if(d.length>o+9&&d[o+1]==="["&&d[o+2]==="C"&&d[o+3]==="D"&&d[o+4]==="A"&&d[o+5]==="T"&&d[o+6]==="A"&&d[o+7]==="["){for(o+=8;o<d.length;o++)if(d[o]==="]"&&d[o+1]==="]"&&d[o+2]===">"){o+=2;break}}return o}let W='"',K="'";function F(d,o){let c="",l="",f=!1;for(;o<d.length;o++){if(d[o]===W||d[o]===K)l===""?l=d[o]:l!==d[o]||(l="");else if(d[o]===">"&&l===""){f=!0;break}c+=d[o]}return l===""&&{value:c,index:o,tagClosed:f}}let _=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function U(d,o){let c=g(d,_),l={};for(let f=0;f<c.length;f++){if(c[f][1].length===0)return L("InvalidAttr","Attribute '"+c[f][2]+"' has no space in starting.",J(c[f]));if(c[f][3]!==void 0&&c[f][4]===void 0)return L("InvalidAttr","Attribute '"+c[f][2]+"' is without value.",J(c[f]));if(c[f][3]===void 0&&!o.allowBooleanAttributes)return L("InvalidAttr","boolean attribute '"+c[f][2]+"' is not allowed.",J(c[f]));let b=c[f][2];if(!x(b))return L("InvalidAttr","Attribute '"+b+"' is an invalid name.",J(c[f]));if(Object.prototype.hasOwnProperty.call(l,b))return L("InvalidAttr","Attribute '"+b+"' is repeated.",J(c[f]));l[b]=1}return!0}function R(d,o){if(d[++o]===";")return-1;if(d[o]==="#")return(function(l,f){let b=/\d/;for(l[f]==="x"&&(f++,b=/[\da-fA-F]/);f<l.length;f++){if(l[f]===";")return f;if(!l[f].match(b))break}return-1})(d,++o);let c=0;for(;o<d.length;o++,c++)if(!(d[o].match(/\w/)&&c<20)){if(d[o]===";")break;return-1}return o}function L(d,o,c){return{err:{code:d,msg:o,line:c.line||c,col:c.col}}}function x(d){return k(d)}function O(d){return k(d)}function H(d,o){let c=d.substring(0,o).split(/\r?\n/);return{line:c.length,col:c[c.length-1].length+1}}function J(d){return d.startIndex+d[1].length}let re=d=>B.includes(d)?"__"+d:d,oe={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(d,o){return o},attributeValueProcessor:function(d,o){return o},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,entityDecoder:null,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(d,o,c){return d},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:re};function de(d,o){if(typeof d!="string")return;let c=d.toLowerCase();if(B.some(l=>c===l.toLowerCase()))throw new Error(`[SECURITY] Invalid ${o}: "${d}" is a reserved JavaScript keyword that could cause prototype pollution`);if(P.some(l=>c===l.toLowerCase()))throw new Error(`[SECURITY] Invalid ${o}: "${d}" is a reserved JavaScript keyword that could cause prototype pollution`)}function j(d,o){return typeof d=="boolean"?{enabled:d,maxEntitySize:1e4,maxExpansionDepth:1e4,maxTotalExpansions:1/0,maxExpandedLength:1e5,maxEntityCount:1e3,allowedTags:null,tagFilter:null,appliesTo:"all"}:typeof d=="object"&&d!==null?{enabled:d.enabled!==!1,maxEntitySize:Math.max(1,d.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,d.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,d.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,d.maxExpandedLength??1e5),maxEntityCount:Math.max(1,d.maxEntityCount??1e3),allowedTags:d.allowedTags??null,tagFilter:d.tagFilter??null,appliesTo:d.appliesTo??"all"}:j(!0)}let ae=function(d){let o=Object.assign({},oe,d),c=[{value:o.attributeNamePrefix,name:"attributeNamePrefix"},{value:o.attributesGroupName,name:"attributesGroupName"},{value:o.textNodeName,name:"textNodeName"},{value:o.cdataPropName,name:"cdataPropName"},{value:o.commentPropName,name:"commentPropName"}];for(let{value:l,name:f}of c)l&&de(l,f);return o.onDangerousProperty===null&&(o.onDangerousProperty=re),o.processEntities=j(o.processEntities,o.htmlEntities),o.unpairedTagsSet=new Set(o.unpairedTags),o.stopNodes&&Array.isArray(o.stopNodes)&&(o.stopNodes=o.stopNodes.map(l=>typeof l=="string"&&l.startsWith("*.")?".."+l.substring(2):l)),o},ne;ne=typeof Symbol!="function"?"@@xmlMetadata":Symbol("XML Node Metadata");class ce{constructor(o){this.tagname=o,this.child=[],this[":@"]=Object.create(null)}add(o,c){o==="__proto__"&&(o="#__proto__"),this.child.push({[o]:c})}addChild(o,c){o.tagname==="__proto__"&&(o.tagname="#__proto__"),o[":@"]&&Object.keys(o[":@"]).length>0?this.child.push({[o.tagname]:o.child,":@":o[":@"]}):this.child.push({[o.tagname]:o.child}),c!==void 0&&(this.child[this.child.length-1][ne]={startIndex:c})}static getMetaDataSymbol(){return ne}}class ue{constructor(o){this.suppressValidationErr=!o,this.options=o}readDocType(o,c){let l=Object.create(null),f=0;if(o[c+3]!=="O"||o[c+4]!=="C"||o[c+5]!=="T"||o[c+6]!=="Y"||o[c+7]!=="P"||o[c+8]!=="E")throw new Error("Invalid Tag instead of DOCTYPE");{c+=9;let b=1,D=!1,v=!1,I="";for(;c<o.length;c++)if(o[c]!=="<"||v)if(o[c]===">"){if(v?o[c-1]==="-"&&o[c-2]==="-"&&(v=!1,b--):b--,b===0)break}else o[c]==="["?D=!0:I+=o[c];else{if(D&&ve(o,"!ENTITY",c)){let N,G;if(c+=7,[N,G,c]=this.readEntityExp(o,c+1,this.suppressValidationErr),G.indexOf("&")===-1){if(this.options.enabled!==!1&&this.options.maxEntityCount!=null&&f>=this.options.maxEntityCount)throw new Error(`Entity count (${f+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);l[N]=G,f++}}else if(D&&ve(o,"!ELEMENT",c)){c+=8;let{index:N}=this.readElementExp(o,c+1);c=N}else if(D&&ve(o,"!ATTLIST",c))c+=8;else if(D&&ve(o,"!NOTATION",c)){c+=9;let{index:N}=this.readNotationExp(o,c+1,this.suppressValidationErr);c=N}else{if(!ve(o,"!--",c))throw new Error("Invalid DOCTYPE");v=!0}b++,I=""}if(b!==0)throw new Error("Unclosed DOCTYPE")}return{entities:l,i:c}}readEntityExp(o,c){let l=c=se(o,c);for(;c<o.length&&!/\s/.test(o[c])&&o[c]!=='"'&&o[c]!=="'";)c++;let f=o.substring(l,c);if(Se(f),c=se(o,c),!this.suppressValidationErr){if(o.substring(c,c+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(o[c]==="%")throw new Error("Parameter entities are not supported")}let b="";if([c,b]=this.readIdentifierVal(o,c,"entity"),this.options.enabled!==!1&&this.options.maxEntitySize!=null&&b.length>this.options.maxEntitySize)throw new Error(`Entity "${f}" size (${b.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return[f,b,--c]}readNotationExp(o,c){let l=c=se(o,c);for(;c<o.length&&!/\s/.test(o[c]);)c++;let f=o.substring(l,c);!this.suppressValidationErr&&Se(f),c=se(o,c);let b=o.substring(c,c+6).toUpperCase();if(!this.suppressValidationErr&&b!=="SYSTEM"&&b!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${b}"`);c+=b.length,c=se(o,c);let D=null,v=null;if(b==="PUBLIC")[c,D]=this.readIdentifierVal(o,c,"publicIdentifier"),o[c=se(o,c)]!=='"'&&o[c]!=="'"||([c,v]=this.readIdentifierVal(o,c,"systemIdentifier"));else if(b==="SYSTEM"&&([c,v]=this.readIdentifierVal(o,c,"systemIdentifier"),!this.suppressValidationErr&&!v))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:f,publicIdentifier:D,systemIdentifier:v,index:--c}}readIdentifierVal(o,c,l){let f="",b=o[c];if(b!=='"'&&b!=="'")throw new Error(`Expected quoted string, found "${b}"`);let D=++c;for(;c<o.length&&o[c]!==b;)c++;if(f=o.substring(D,c),o[c]!==b)throw new Error(`Unterminated ${l} value`);return[++c,f]}readElementExp(o,c){let l=c=se(o,c);for(;c<o.length&&!/\s/.test(o[c]);)c++;let f=o.substring(l,c);if(!this.suppressValidationErr&&!k(f))throw new Error(`Invalid element name: "${f}"`);let b="";if(o[c=se(o,c)]==="E"&&ve(o,"MPTY",c))c+=4;else if(o[c]==="A"&&ve(o,"NY",c))c+=2;else if(o[c]==="("){let D=++c;for(;c<o.length&&o[c]!==")";)c++;if(b=o.substring(D,c),o[c]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${o[c]}"`);return{elementName:f,contentModel:b.trim(),index:c}}readAttlistExp(o,c){let l=c=se(o,c);for(;c<o.length&&!/\s/.test(o[c]);)c++;let f=o.substring(l,c);for(Se(f),l=c=se(o,c);c<o.length&&!/\s/.test(o[c]);)c++;let b=o.substring(l,c);if(!Se(b))throw new Error(`Invalid attribute name: "${b}"`);c=se(o,c);let D="";if(o.substring(c,c+8).toUpperCase()==="NOTATION"){if(D="NOTATION",o[c=se(o,c+=8)]!=="(")throw new Error(`Expected '(', found "${o[c]}"`);c++;let I=[];for(;c<o.length&&o[c]!==")";){let N=c;for(;c<o.length&&o[c]!=="|"&&o[c]!==")";)c++;let G=o.substring(N,c);if(G=G.trim(),!Se(G))throw new Error(`Invalid notation name: "${G}"`);I.push(G),o[c]==="|"&&(c++,c=se(o,c))}if(o[c]!==")")throw new Error("Unterminated list of notations");c++,D+=" ("+I.join("|")+")"}else{let I=c;for(;c<o.length&&!/\s/.test(o[c]);)c++;D+=o.substring(I,c);let N=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!N.includes(D.toUpperCase()))throw new Error(`Invalid attribute type: "${D}"`)}c=se(o,c);let v="";return o.substring(c,c+8).toUpperCase()==="#REQUIRED"?(v="#REQUIRED",c+=8):o.substring(c,c+7).toUpperCase()==="#IMPLIED"?(v="#IMPLIED",c+=7):[c,v]=this.readIdentifierVal(o,c,"ATTLIST"),{elementName:f,attributeName:b,attributeType:D,defaultValue:v,index:c}}}let se=(d,o)=>{for(;o<d.length&&/\s/.test(d[o]);)o++;return o};function ve(d,o,c){for(let l=0;l<o.length;l++)if(o[l]!==d[c+l+1])return!1;return!0}function Se(d){if(k(d))return d;throw new Error(`Invalid entity name ${d}`)}let Ie=/^[-+]?0x[a-fA-F0-9]+$/,ie=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,Le={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0,infinity:"original"},je=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;class ua{constructor(o){this._matcher=o}get separator(){return this._matcher.separator}getCurrentTag(){let o=this._matcher.path;return o.length>0?o[o.length-1].tag:void 0}getCurrentNamespace(){let o=this._matcher.path;return o.length>0?o[o.length-1].namespace:void 0}getAttrValue(o){let c=this._matcher.path;if(c.length!==0)return c[c.length-1].values?.[o]}hasAttr(o){let c=this._matcher.path;if(c.length===0)return!1;let l=c[c.length-1];return l.values!==void 0&&o in l.values}getPosition(){let o=this._matcher.path;return o.length===0?-1:o[o.length-1].position??0}getCounter(){let o=this._matcher.path;return o.length===0?-1:o[o.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(o,c=!0){return this._matcher.toString(o,c)}toArray(){return this._matcher.path.map(o=>o.tag)}matches(o){return this._matcher.matches(o)}matchesAny(o){return o.matchesAny(this._matcher)}}class ca{constructor(o={}){this.separator=o.separator||".",this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new ua(this)}push(o,c=null,l=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);let f=this.path.length;this.siblingStacks[f]||(this.siblingStacks[f]=new Map);let b=this.siblingStacks[f],D=l?`${l}:${o}`:o,v=b.get(D)||0,I=0;for(let G of b.values())I+=G;b.set(D,v+1);let N={tag:o,position:I,counter:v};l!=null&&(N.namespace=l),c!=null&&(N.values=c),this.path.push(N)}pop(){if(this.path.length===0)return;this._pathStringCache=null;let o=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),o}updateCurrent(o){if(this.path.length>0){let c=this.path[this.path.length-1];o!=null&&(c.values=o)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(o){if(this.path.length!==0)return this.path[this.path.length-1].values?.[o]}hasAttr(o){if(this.path.length===0)return!1;let c=this.path[this.path.length-1];return c.values!==void 0&&o in c.values}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(o,c=!0){let l=o||this.separator;if(l===this.separator&&c===!0){if(this._pathStringCache!==null)return this._pathStringCache;let f=this.path.map(b=>b.namespace?`${b.namespace}:${b.tag}`:b.tag).join(l);return this._pathStringCache=f,f}return this.path.map(f=>c&&f.namespace?`${f.namespace}:${f.tag}`:f.tag).join(l)}toArray(){return this.path.map(o=>o.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[]}matches(o){let c=o.segments;return c.length!==0&&(o.hasDeepWildcard()?this._matchWithDeepWildcard(c):this._matchSimple(c))}_matchSimple(o){if(this.path.length!==o.length)return!1;for(let c=0;c<o.length;c++)if(!this._matchSegment(o[c],this.path[c],c===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(o){let c=this.path.length-1,l=o.length-1;for(;l>=0&&c>=0;){let f=o[l];if(f.type==="deep-wildcard"){if(l--,l<0)return!0;let b=o[l],D=!1;for(let v=c;v>=0;v--)if(this._matchSegment(b,this.path[v],v===this.path.length-1)){c=v-1,l--,D=!0;break}if(!D)return!1}else{if(!this._matchSegment(f,this.path[c],c===this.path.length-1))return!1;c--,l--}}return l<0}_matchSegment(o,c,l){if(o.tag!=="*"&&o.tag!==c.tag||o.namespace!==void 0&&o.namespace!=="*"&&o.namespace!==c.namespace||o.attrName!==void 0&&(!l||!c.values||!(o.attrName in c.values)||o.attrValue!==void 0&&String(c.values[o.attrName])!==String(o.attrValue)))return!1;if(o.position!==void 0){if(!l)return!1;let f=c.counter??0;if(o.position==="first"&&f!==0||o.position==="odd"&&f%2!=1||o.position==="even"&&f%2!=0||o.position==="nth"&&f!==o.positionValue)return!1}return!0}matchesAny(o){return o.matchesAny(this)}snapshot(){return{path:this.path.map(o=>({...o})),siblingStacks:this.siblingStacks.map(o=>new Map(o))}}restore(o){this._pathStringCache=null,this.path=o.path.map(c=>({...c})),this.siblingStacks=o.siblingStacks.map(c=>new Map(c))}readOnly(){return this._view}}class ze{constructor(o,c={},l){this.pattern=o,this.separator=c.separator||".",this.segments=this._parse(o),this.data=l,this._hasDeepWildcard=this.segments.some(f=>f.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(f=>f.attrName!==void 0),this._hasPositionSelector=this.segments.some(f=>f.position!==void 0)}_parse(o){let c=[],l=0,f="";for(;l<o.length;)o[l]===this.separator?l+1<o.length&&o[l+1]===this.separator?(f.trim()&&(c.push(this._parseSegment(f.trim())),f=""),c.push({type:"deep-wildcard"}),l+=2):(f.trim()&&c.push(this._parseSegment(f.trim())),f="",l++):(f+=o[l],l++);return f.trim()&&c.push(this._parseSegment(f.trim())),c}_parseSegment(o){let c={type:"tag"},l=null,f=o,b=o.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(b&&(f=b[1]+b[3],b[2])){let G=b[2].slice(1,-1);G&&(l=G)}let D,v,I=f;if(f.includes("::")){let G=f.indexOf("::");if(D=f.substring(0,G).trim(),I=f.substring(G+2).trim(),!D)throw new Error(`Invalid namespace in pattern: ${o}`)}let N=null;if(I.includes(":")){let G=I.lastIndexOf(":"),V=I.substring(0,G).trim(),Y=I.substring(G+1).trim();["first","last","odd","even"].includes(Y)||/^nth\(\d+\)$/.test(Y)?(v=V,N=Y):v=I}else v=I;if(!v)throw new Error(`Invalid segment pattern: ${o}`);if(c.tag=v,D&&(c.namespace=D),l)if(l.includes("=")){let G=l.indexOf("=");c.attrName=l.substring(0,G).trim(),c.attrValue=l.substring(G+1).trim()}else c.attrName=l.trim();if(N){let G=N.match(/^nth\((\d+)\)$/);G?(c.position="nth",c.positionValue=parseInt(G[1],10)):c.position=N}return c}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}class ir{constructor(){this._byDepthAndTag=new Map,this._wildcardByDepth=new Map,this._deepWildcards=[],this._patterns=new Set,this._sealed=!1}add(o){if(this._sealed)throw new TypeError("ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.");if(this._patterns.has(o.pattern))return this;if(this._patterns.add(o.pattern),o.hasDeepWildcard())return this._deepWildcards.push(o),this;let c=o.length,l=o.segments[o.segments.length-1],f=l?.tag;if(f&&f!=="*"){let b=`${c}:${f}`;this._byDepthAndTag.has(b)||this._byDepthAndTag.set(b,[]),this._byDepthAndTag.get(b).push(o)}else this._wildcardByDepth.has(c)||this._wildcardByDepth.set(c,[]),this._wildcardByDepth.get(c).push(o);return this}addAll(o){for(let c of o)this.add(c);return this}has(o){return this._patterns.has(o.pattern)}get size(){return this._patterns.size}seal(){return this._sealed=!0,this}get isSealed(){return this._sealed}matchesAny(o){return this.findMatch(o)!==null}findMatch(o){let c=o.getDepth(),l=`${c}:${o.getCurrentTag()}`,f=this._byDepthAndTag.get(l);if(f){for(let D=0;D<f.length;D++)if(o.matches(f[D]))return f[D]}let b=this._wildcardByDepth.get(c);if(b){for(let D=0;D<b.length;D++)if(o.matches(b[D]))return b[D]}for(let D=0;D<this._deepWildcards.length;D++)if(o.matches(this._deepWildcards[D]))return this._deepWildcards[D];return null}}let Ga={cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",euro:"\u20AC",dollar:"$",euro:"\u20AC",fnof:"\u0192",inr:"\u20B9",af:"\u060B",birr:"\u1265\u122D",peso:"\u20B1",rub:"\u20BD",won:"\u20A9",yuan:"\xA5",cedil:"\xB8"},Ta={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'},or={nbsp:"\xA0",copy:"\xA9",reg:"\xAE",trade:"\u2122",mdash:"\u2014",ndash:"\u2013",hellip:"\u2026",laquo:"\xAB",raquo:"\xBB",lsquo:"\u2018",rsquo:"\u2019",ldquo:"\u201C",rdquo:"\u201D",bull:"\u2022",para:"\xB6",sect:"\xA7",deg:"\xB0",frac12:"\xBD",frac14:"\xBC",frac34:"\xBE"},da=new Set("!?\\\\/[]$%{}^&*()<>|+");function Ma(d){if(d[0]==="#")throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${d}"`);for(let o of d)if(da.has(o))throw new Error(`[EntityReplacer] Invalid character '${o}' in entity name: "${d}"`);return d}function ha(...d){let o=Object.create(null);for(let c of d)if(c)for(let l of Object.keys(c)){let f=c[l];if(typeof f=="string")o[l]=f;else if(f&&typeof f=="object"&&f.val!==void 0){let b=f.val;typeof b=="string"&&(o[l]=b)}}return o}let Fe="external",Ve="base",ma="all",De=Object.freeze({allow:0,leave:1,remove:2,throw:3}),Mt=new Set([9,10,13]);class Bt{constructor(o={}){var c;this._limit=o.limit||{},this._maxTotalExpansions=this._limit.maxTotalExpansions||0,this._maxExpandedLength=this._limit.maxExpandedLength||0,this._postCheck=typeof o.postCheck=="function"?o.postCheck:f=>f,this._limitTiers=(c=this._limit.applyLimitsTo??Fe)&&c!==Fe?c===ma?new Set([ma]):c===Ve?new Set([Ve]):Array.isArray(c)?new Set(c):new Set([Fe]):new Set([Fe]),this._numericAllowed=o.numericAllowed??!0,this._baseMap=ha(Ta,o.namedEntities||null),this._externalMap=Object.create(null),this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this._removeSet=new Set(o.remove&&Array.isArray(o.remove)?o.remove:[]),this._leaveSet=new Set(o.leave&&Array.isArray(o.leave)?o.leave:[]);let l=(function(f){if(!f)return{xmlVersion:1,onLevel:De.allow,nullLevel:De.remove};let b=f.xmlVersion===1.1?1.1:1,D=De[f.onNCR]??De.allow,v=De[f.nullNCR]??De.remove;return{xmlVersion:b,onLevel:D,nullLevel:Math.max(v,De.remove)}})(o.ncr);this._ncrXmlVersion=l.xmlVersion,this._ncrOnLevel=l.onLevel,this._ncrNullLevel=l.nullLevel}setExternalEntities(o){if(o)for(let c of Object.keys(o))Ma(c);this._externalMap=ha(o)}addExternalEntity(o,c){Ma(o),typeof c=="string"&&c.indexOf("&")===-1&&(this._externalMap[o]=c)}addInputEntities(o){this._totalExpansions=0,this._expandedLength=0,this._inputMap=ha(o)}reset(){return this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this}setXmlVersion(o){this._ncrXmlVersion=o===1.1?1.1:1}decode(o){if(typeof o!="string"||o.length===0)return o;let c=o,l=[],f=o.length,b=0,D=0,v=this._maxTotalExpansions>0,I=this._maxExpandedLength>0,N=v||I;for(;D<f;){if(o.charCodeAt(D)!==38){D++;continue}let V=D+1;for(;V<f&&o.charCodeAt(V)!==59&&V-D<=32;)V++;if(V>=f||o.charCodeAt(V)!==59){D++;continue}let Y=o.slice(D+1,V);if(Y.length===0){D++;continue}let X,te;if(this._removeSet.has(Y))X="",te===void 0&&(te=Fe);else{if(this._leaveSet.has(Y)){D++;continue}if(Y.charCodeAt(0)===35){let z=this._resolveNCR(Y);if(z===void 0){D++;continue}X=z,te=Ve}else{let z=this._resolveName(Y);X=z?.value,te=z?.tier}}if(X!==void 0){if(D>b&&l.push(o.slice(b,D)),l.push(X),b=V+1,D=b,N&&this._tierCounts(te)){if(v&&(this._totalExpansions++,this._totalExpansions>this._maxTotalExpansions))throw new Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);if(I){let z=X.length-(Y.length+2);if(z>0&&(this._expandedLength+=z,this._expandedLength>this._maxExpandedLength))throw new Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`)}}}else D++}b<f&&l.push(o.slice(b));let G=l.length===0?o:l.join("");return this._postCheck(G,c)}_tierCounts(o){return!!this._limitTiers.has(ma)||this._limitTiers.has(o)}_resolveName(o){return o in this._inputMap?{value:this._inputMap[o],tier:Fe}:o in this._externalMap?{value:this._externalMap[o],tier:Fe}:o in this._baseMap?{value:this._baseMap[o],tier:Ve}:void 0}_classifyNCR(o){return o===0?this._ncrNullLevel:o>=55296&&o<=57343||this._ncrXmlVersion===1&&o>=1&&o<=31&&!Mt.has(o)?De.remove:-1}_applyNCRAction(o,c,l){switch(o){case De.allow:return String.fromCodePoint(l);case De.remove:return"";case De.leave:return;case De.throw:throw new Error(`[EntityDecoder] Prohibited numeric character reference &${c}; (U+${l.toString(16).toUpperCase().padStart(4,"0")})`);default:return String.fromCodePoint(l)}}_resolveNCR(o){let c=o.charCodeAt(1),l;if(l=c===120||c===88?parseInt(o.slice(2),16):parseInt(o.slice(1),10),Number.isNaN(l)||l<0||l>1114111)return;let f=this._classifyNCR(l);if(!this._numericAllowed&&f<De.remove)return;let b=f===-1?this._ncrOnLevel:Math.max(this._ncrOnLevel,f);return this._applyNCRAction(b,o,l)}}function xt(d,o){if(!d)return{};let c=o.attributesGroupName?d[o.attributesGroupName]:d;if(!c)return{};let l={};for(let f in c)f.startsWith(o.attributeNamePrefix)?l[f.substring(o.attributeNamePrefix.length)]=c[f]:l[f]=c[f];return l}function Et(d){if(!d||typeof d!="string")return;let o=d.indexOf(":");if(o!==-1&&o>0){let c=d.substring(0,o);if(c!=="xmlns")return c}}class Pt{constructor(o){var c;this.options=o,this.currentNode=null,this.tagsNodeStack=[],this.parseXml=Dt,this.parseTextData=Rt,this.resolveNameSpace=Rr,this.buildAttributesMap=Lt,this.isItStopNode=It,this.replaceEntitiesValue=Ot,this.readStopNodeData=Gt,this.saveTextToParentTag=Ht,this.addChild=Nt,this.ignoreAttributesFn=typeof(c=this.options.ignoreAttributes)=="function"?c:Array.isArray(c)?b=>{for(let D of c)if(typeof D=="string"&&b===D||D instanceof RegExp&&D.test(b))return!0}:()=>!1,this.entityExpansionCount=0,this.currentExpandedLength=0;let l={...Ta};this.options.entityDecoder?this.entityDecoder=this.options.entityDecoder:(typeof this.options.htmlEntities=="object"?l=this.options.htmlEntities:this.options.htmlEntities===!0&&(l={...or,...Ga}),this.entityDecoder=new Bt({namedEntities:l,numericAllowed:this.options.htmlEntities,limit:{maxTotalExpansions:this.options.processEntities.maxTotalExpansions,maxExpandedLength:this.options.processEntities.maxExpandedLength,applyLimitsTo:this.options.processEntities.appliesTo}})),this.matcher=new ca,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.stopNodeExpressionsSet=new ir;let f=this.options.stopNodes;if(f&&f.length>0){for(let b=0;b<f.length;b++){let D=f[b];typeof D=="string"?this.stopNodeExpressionsSet.add(new ze(D)):D instanceof ze&&this.stopNodeExpressionsSet.add(D)}this.stopNodeExpressionsSet.seal()}}}function Rt(d,o,c,l,f,b,D){let v=this.options;if(d!==void 0&&(v.trimValues&&!l&&(d=d.trim()),d.length>0)){D||(d=this.replaceEntitiesValue(d,o,c));let I=v.jPath?c.toString():c,N=v.tagValueProcessor(o,d,I,f,b);return N==null?d:typeof N!=typeof d||N!==d?N:v.trimValues||d.trim()===d?Dr(d,v.parseTagValue,v.numberParseOptions):d}}function Rr(d){if(this.options.removeNSPrefix){let o=d.split(":"),c=d.charAt(0)==="/"?"/":"";if(o[0]==="xmlns")return"";o.length===2&&(d=c+o[1])}return d}let Lr=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Lt(d,o,c,l=!1){let f=this.options;if(l===!0||f.ignoreAttributes!==!0&&typeof d=="string"){let b=g(d,Lr),D=b.length,v={},I=new Array(D),N=!1,G={};for(let X=0;X<D;X++){let te=this.resolveNameSpace(b[X][1]),z=b[X][4];if(te.length&&z!==void 0){let fe=z;f.trimValues&&(fe=fe.trim()),fe=this.replaceEntitiesValue(fe,c,this.readonlyMatcher),I[X]=fe,G[te]=fe,N=!0}}N&&typeof o=="object"&&o.updateCurrent&&o.updateCurrent(G);let V=f.jPath?o.toString():this.readonlyMatcher,Y=!1;for(let X=0;X<D;X++){let te=this.resolveNameSpace(b[X][1]);if(this.ignoreAttributesFn(te,V))continue;let z=f.attributeNamePrefix+te;if(te.length)if(f.transformAttributeName&&(z=f.transformAttributeName(z)),z=fa(z,f),b[X][4]!==void 0){let fe=I[X],Oe=f.attributeValueProcessor(te,fe,V);v[z]=Oe==null?fe:typeof Oe!=typeof fe||Oe!==fe?Oe:Dr(fe,f.parseAttributeValue,f.numberParseOptions),Y=!0}else f.allowBooleanAttributes&&(v[z]=!0,Y=!0)}if(!Y)return;if(f.attributesGroupName){let X={};return X[f.attributesGroupName]=v,X}return v}}let Dt=function(d){d=d.replace(/\r\n?/g,`
|
|
10
10
|
`);let o=new ce("!xml"),c=o,l="";this.matcher.reset(),this.entityDecoder.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;let f=this.options,b=new ue(f.processEntities),D=d.length;for(let v=0;v<D;v++)if(d[v]==="<"){let I=d.charCodeAt(v+1);if(I===47){let N=pa(d,">",v,"Closing Tag is not closed."),G=d.substring(v+2,N).trim();if(f.removeNSPrefix){let Y=G.indexOf(":");Y!==-1&&(G=G.substr(Y+1))}G=lr(f.transformTagName,G,"",f).tagName,c&&(l=this.saveTextToParentTag(l,c,this.readonlyMatcher));let V=this.matcher.getCurrentTag();if(G&&f.unpairedTagsSet.has(G))throw new Error(`Unpaired tag can not be used as closing tag: </${G}>`);V&&f.unpairedTagsSet.has(V)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,c=this.tagsNodeStack.pop(),l="",v=N}else if(I===63){let N=sr(d,v,!1,"?>");if(!N)throw new Error("Pi Tag is not closed.");l=this.saveTextToParentTag(l,c,this.readonlyMatcher);let G=this.buildAttributesMap(N.tagExp,this.matcher,N.tagName,!0);if(G){let V=G[this.options.attributeNamePrefix+"version"];this.entityDecoder.setXmlVersion(Number(V)||1)}if(!(f.ignoreDeclaration&&N.tagName==="?xml"||f.ignorePiTags)){let V=new ce(N.tagName);V.add(f.textNodeName,""),N.tagName!==N.tagExp&&N.attrExpPresent&&f.ignoreAttributes!==!0&&(V[":@"]=G),this.addChild(c,V,this.readonlyMatcher,v)}v=N.closeIndex+1}else if(I===33&&d.charCodeAt(v+2)===45&&d.charCodeAt(v+3)===45){let N=pa(d,"-->",v+4,"Comment is not closed.");if(f.commentPropName){let G=d.substring(v+4,N-2);l=this.saveTextToParentTag(l,c,this.readonlyMatcher),c.add(f.commentPropName,[{[f.textNodeName]:G}])}v=N}else if(I===33&&d.charCodeAt(v+2)===68){let N=b.readDocType(d,v);this.entityDecoder.addInputEntities(N.entities),v=N.i}else if(I===33&&d.charCodeAt(v+2)===91){let N=pa(d,"]]>",v,"CDATA is not closed.")-2,G=d.substring(v+9,N);l=this.saveTextToParentTag(l,c,this.readonlyMatcher);let V=this.parseTextData(G,c.tagname,this.readonlyMatcher,!0,!1,!0,!0);V==null&&(V=""),f.cdataPropName?c.add(f.cdataPropName,[{[f.textNodeName]:G}]):c.add(f.textNodeName,V),v=N+2}else{let N=sr(d,v,f.removeNSPrefix);if(!N){let Pe=d.substring(Math.max(0,v-50),Math.min(D,v+50));throw new Error(`readTagExp returned undefined at position ${v}. Context: "${Pe}"`)}let G=N.tagName,V=N.rawTagName,Y=N.tagExp,X=N.attrExpPresent,te=N.closeIndex;if({tagName:G,tagExp:Y}=lr(f.transformTagName,G,Y,f),f.strictReservedNames&&(G===f.commentPropName||G===f.cdataPropName||G===f.textNodeName||G===f.attributesGroupName))throw new Error(`Invalid tag name: ${G}`);c&&l&&c.tagname!=="!xml"&&(l=this.saveTextToParentTag(l,c,this.readonlyMatcher,!1));let z=c;z&&f.unpairedTagsSet.has(z.tagname)&&(c=this.tagsNodeStack.pop(),this.matcher.pop());let fe=!1;Y.length>0&&Y.lastIndexOf("/")===Y.length-1&&(fe=!0,G[G.length-1]==="/"?(G=G.substr(0,G.length-1),Y=G):Y=Y.substr(0,Y.length-1),X=G!==Y);let Oe,Ee=null,Ue={};Oe=Et(V),G!==o.tagname&&this.matcher.push(G,{},Oe),G!==Y&&X&&(Ee=this.buildAttributesMap(Y,this.matcher,G),Ee&&(Ue=xt(Ee,f))),G!==o.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());let He=v;if(this.isCurrentNodeStopNode){let Pe="";if(fe)v=N.closeIndex;else if(f.unpairedTagsSet.has(G))v=N.closeIndex;else{let hr=this.readStopNodeData(d,V,te+1);if(!hr)throw new Error(`Unexpected end of ${V}`);v=hr.i,Pe=hr.tagContent}let aa=new ce(G);Ee&&(aa[":@"]=Ee),aa.add(f.textNodeName,Pe),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(c,aa,this.readonlyMatcher,He)}else{if(fe){({tagName:G,tagExp:Y}=lr(f.transformTagName,G,Y,f));let Pe=new ce(G);Ee&&(Pe[":@"]=Ee),this.addChild(c,Pe,this.readonlyMatcher,He),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else{if(f.unpairedTagsSet.has(G)){let Pe=new ce(G);Ee&&(Pe[":@"]=Ee),this.addChild(c,Pe,this.readonlyMatcher,He),this.matcher.pop(),this.isCurrentNodeStopNode=!1,v=N.closeIndex;continue}{let Pe=new ce(G);if(this.tagsNodeStack.length>f.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(c),Ee&&(Pe[":@"]=Ee),this.addChild(c,Pe,this.readonlyMatcher,He),c=Pe}}l="",v=te}}}else l+=d[v];return o.child};function Nt(d,o,c,l){this.options.captureMetaData||(l=void 0);let f=this.options.jPath?c.toString():c,b=this.options.updateTag(o.tagname,f,o[":@"]);b===!1||(typeof b=="string"&&(o.tagname=b),d.addChild(o,l))}function Ot(d,o,c){let l=this.options.processEntities;if(!l||!l.enabled)return d;if(l.allowedTags){let f=this.options.jPath?c.toString():c;if(!(Array.isArray(l.allowedTags)?l.allowedTags.includes(o):l.allowedTags(o,f)))return d}if(l.tagFilter){let f=this.options.jPath?c.toString():c;if(!l.tagFilter(o,f))return d}return this.entityDecoder.decode(d)}function Ht(d,o,c,l){return d&&(l===void 0&&(l=o.child.length===0),(d=this.parseTextData(d,o.tagname,c,!1,!!o[":@"]&&Object.keys(o[":@"]).length!==0,l))!==void 0&&d!==""&&o.add(this.options.textNodeName,d),d=""),d}function It(){return this.stopNodeExpressionsSet.size!==0&&this.matcher.matchesAny(this.stopNodeExpressionsSet)}function pa(d,o,c,l){let f=d.indexOf(o,c);if(f===-1)throw new Error(l);return f+o.length-1}function Wt(d,o,c,l){let f=d.indexOf(o,c);if(f===-1)throw new Error(l);return f}function sr(d,o,c,l=">"){let f=(function(V,Y,X=">"){let te=0,z=[],fe=V.length,Oe=X.charCodeAt(0),Ee=X.length>1?X.charCodeAt(1):-1;for(let Ue=Y;Ue<fe;Ue++){let He=V.charCodeAt(Ue);if(te)He===te&&(te=0);else if(He===34||He===39)te=He;else if(He===Oe){if(Ee===-1)return{data:String.fromCharCode(...z),index:Ue};if(V.charCodeAt(Ue+1)===Ee)return{data:String.fromCharCode(...z),index:Ue}}else if(He===9){z.push(32);continue}z.push(He)}})(d,o+1,l);if(!f)return;let b=f.data,D=f.index,v=b.search(/\s/),I=b,N=!0;v!==-1&&(I=b.substring(0,v),b=b.substring(v+1).trimStart());let G=I;if(c){let V=I.indexOf(":");V!==-1&&(I=I.substr(V+1),N=I!==f.data.substr(V+1))}return{tagName:I,tagExp:b,closeIndex:D,attrExpPresent:N,rawTagName:G}}function Gt(d,o,c){let l=c,f=1,b=d.length;for(;c<b;c++)if(d[c]==="<"){let D=d.charCodeAt(c+1);if(D===47){let v=Wt(d,">",c,`${o} is not closed`);if(d.substring(c+2,v).trim()===o&&(f--,f===0))return{tagContent:d.substring(l,c),i:v};c=v}else if(D===63)c=pa(d,"?>",c+1,"StopNode is not closed.");else if(D===33&&d.charCodeAt(c+2)===45&&d.charCodeAt(c+3)===45)c=pa(d,"-->",c+3,"StopNode is not closed.");else if(D===33&&d.charCodeAt(c+2)===91)c=pa(d,"]]>",c,"StopNode is not closed.")-2;else{let v=sr(d,c,">");v&&((v&&v.tagName)===o&&v.tagExp[v.tagExp.length-1]!=="/"&&f++,c=v.closeIndex)}}}function Dr(d,o,c){if(o&&typeof d=="string"){let l=d.trim();return l==="true"||l!=="false"&&(function(f,b={}){if(b=Object.assign({},Le,b),!f||typeof f!="string")return f;let D=f.trim();if(D.length===0||b.skipLike!==void 0&&b.skipLike.test(D))return f;if(D==="0")return 0;if(b.hex&&Ie.test(D))return(function(I){if(parseInt)return parseInt(I,16);if(Number.parseInt)return Number.parseInt(I,16);if(window&&window.parseInt)return window.parseInt(I,16);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")})(D);if(isFinite(D)){if(D.includes("e")||D.includes("E"))return(function(I,N,G){if(!G.eNotation)return I;let V=N.match(je);if(V){let Y=V[1]||"",X=V[3].indexOf("e")===-1?"E":"e",te=V[2],z=Y?I[te.length+1]===X:I[te.length]===X;return te.length>1&&z?I:(te.length!==1||!V[3].startsWith(`.${X}`)&&V[3][0]!==X)&&te.length>0?G.leadingZeros&&!z?(N=(V[1]||"")+V[3],Number(N)):I:Number(N)}return I})(f,D,b);{let I=ie.exec(D);if(I){let N=I[1]||"",G=I[2],V=((v=I[3])&&v.indexOf(".")!==-1&&((v=v.replace(/0+$/,""))==="."?v="0":v[0]==="."?v="0"+v:v[v.length-1]==="."&&(v=v.substring(0,v.length-1))),v),Y=N?f[G.length+1]===".":f[G.length]===".";if(!b.leadingZeros&&(G.length>1||G.length===1&&!Y))return f;{let X=Number(D),te=String(X);if(X===0)return X;if(te.search(/[eE]/)!==-1)return b.eNotation?X:f;if(D.indexOf(".")!==-1)return te==="0"||te===V||te===`${N}${V}`?X:f;let z=G?V:D;return G?z===te||N+z===te?X:f:z===te||z===N+te?X:f}}return f}}var v;return(function(I,N,G){let V=N===1/0;switch(G.infinity.toLowerCase()){case"null":return null;case"infinity":return N;case"string":return V?"Infinity":"-Infinity";default:return I}})(f,Number(D),b)})(d,c)}return d!==void 0?d:""}function lr(d,o,c,l){if(d){let f=d(o);c===o&&(c=f),o=f}return{tagName:o=fa(o,l),tagExp:c}}function fa(d,o){if(P.includes(d))throw new Error(`[SECURITY] Invalid name: "${d}" is a reserved JavaScript keyword that could cause prototype pollution`);return B.includes(d)?o.onDangerousProperty(d):d}let Fa=ce.getMetaDataSymbol();function Ft(d,o){if(!d||typeof d!="object")return{};if(!o)return d;let c={};for(let l in d)l.startsWith(o)?c[l.substring(o.length)]=d[l]:c[l]=d[l];return c}function $t(d,o,c,l){return Nr(d,o,c,l)}function Nr(d,o,c,l){let f,b={};for(let D=0;D<d.length;D++){let v=d[D],I=_t(v);if(I!==void 0&&I!==o.textNodeName){let N=Ft(v[":@"]||{},o.attributeNamePrefix);c.push(I,N)}if(I===o.textNodeName)f===void 0?f=v[I]:f+=""+v[I];else{if(I===void 0)continue;if(v[I]){let N=Nr(v[I],o,c,l),G=jt(N,o);if(v[":@"]?Kt(N,v[":@"],l,o):Object.keys(N).length!==1||N[o.textNodeName]===void 0||o.alwaysCreateTextNode?Object.keys(N).length===0&&(o.alwaysCreateTextNode?N[o.textNodeName]="":N=""):N=N[o.textNodeName],v[Fa]!==void 0&&typeof N=="object"&&N!==null&&(N[Fa]=v[Fa]),b[I]!==void 0&&Object.prototype.hasOwnProperty.call(b,I))Array.isArray(b[I])||(b[I]=[b[I]]),b[I].push(N);else{let V=o.jPath?l.toString():l;o.isArray(I,V,G)?b[I]=[N]:b[I]=N}I!==void 0&&I!==o.textNodeName&&c.pop()}}}return typeof f=="string"?f.length>0&&(b[o.textNodeName]=f):f!==void 0&&(b[o.textNodeName]=f),b}function _t(d){let o=Object.keys(d);for(let c=0;c<o.length;c++){let l=o[c];if(l!==":@")return l}}function Kt(d,o,c,l){if(o){let f=Object.keys(o),b=f.length;for(let D=0;D<b;D++){let v=f[D],I=v.startsWith(l.attributeNamePrefix)?v.substring(l.attributeNamePrefix.length):v,N=l.jPath?c.toString()+"."+I:c;l.isArray(v,N,!0,!0)?d[v]=[o[v]]:d[v]=o[v]}}}function jt(d,o){let{textNodeName:c}=o,l=Object.keys(d).length;return l===0||!(l!==1||!d[c]&&typeof d[c]!="boolean"&&d[c]!==0)}class Jt{constructor(o){this.externalEntities={},this.options=ae(o)}parse(o,c){if(typeof o!="string"&&o.toString)o=o.toString();else if(typeof o!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(c){c===!0&&(c={});let b=A(o,c);if(b!==!0)throw Error(`${b.err.msg}:${b.err.line}:${b.err.col}`)}let l=new Pt(this.options);l.entityDecoder.setExternalEntities(this.externalEntities);let f=l.parseXml(o);return this.options.preserveOrder||f===void 0?f:$t(f,this.options,l.matcher,l.readonlyMatcher)}addEntity(o,c){if(c.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(o.indexOf("&")!==-1||o.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(c==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[o]=c}static getMetaDataSymbol(){return ce.getMetaDataSymbol()}}function zt(d,o){let c="";o.format&&o.indentBy.length>0&&(c=`
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
var __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __pathDirname(__filename);
|
|
7
|
+
import{a as X}from"./KFQC57GK.js";import{Ga as J,j as z,k as O,n as G,o as V,ua as g,za as Y}from"./IPCQDGPM.js";import{e as W}from"./RFWIIJFG.js";var te=W(X(),1);var C=W(X(),1);function Z(){return process.env.HTTPS_PROXY||process.env.HTTP_PROXY||process.env.http_proxy||process.env.https_proxy}function K(o){let t=process.env.NO_PROXY||process.env.no_proxy;if(!t)return!1;let e=t.split(",").map(s=>s.trim().toLowerCase()).filter(Boolean);if(e.length===0)return!1;let r;try{r=new URL(o).hostname.toLowerCase()}catch{return!1}return e.some(s=>!!(s==="*"||r===s||s.startsWith(".")&&r.endsWith(s)||!s.startsWith(".")&&r.endsWith("."+s)))}var Q=async(o,{timeout:t,...e}={})=>{let r=Z(),s=r&&!K(o),n;s?n=new C.ProxyAgent({uri:r}):t&&(n=new C.Agent({connect:{timeout:t}}));try{return await(0,C.fetch)(o,{signal:t?AbortSignal.timeout(t):void 0,...e,dispatcher:n})}catch(i){throw await n?.destroy(),i}};var fe=/^[\x21-\x7e]+( [\x21-\x7e]+)*$/;function ee(){let o=process.env.REDOCLY_ENVIRONMENT?.trim();return o&&fe.test(o)?o:void 0}var u=class extends Error{status;constructor(t,e){super(t),this.status=e}},h=class{command;version;sunsetWarnings=[];constructor(t,e="2.0"){this.command=t,this.version=e}async request(t,e){let r=ee(),s={...e.headers,"user-agent":`redocly-cli/${this.version} ${this.command}${r?` ${r}`:""}`};try{let n=await Q(t,{...e,headers:s});return this.collectSunsetWarning(n),n}catch(n){let i=n.cause??n,a=`Failed to fetch. Caused by ${i.message||i.name}.`;throw typeof i.code=="string"&&(a+=` Code: ${i.code}`),new Error(a)}}collectSunsetWarning(t){let e=this.getSunsetDate(t);if(!e)return;let r=new Date(e);e>Date.now()?this.sunsetWarnings.push({sunsetDate:r,isSunsetExpired:!1}):this.sunsetWarnings.push({sunsetDate:r,isSunsetExpired:!0})}getSunsetDate(t){let{headers:e}=t;if(!e)return;let r=e.get("sunset")||e.get("Sunset");if(r)return Date.parse(r)}},P=class{client;domain;authHeaders;constructor(t,e,r){this.client=t,this.domain=e,this.authHeaders=r}projectUrl(t,e){return`${this.domain}/api/orgs/${encodeURIComponent(t)}/projects/${encodeURIComponent(e)}`}async fetchJson(t,e,r){try{let s=await this.client.request(t,{...e,headers:{"Content-Type":"application/json",...this.authHeaders}});return await this.getParsedResponse(s)}catch(s){let n=`${r}. ${s.message}`;throw s instanceof u?new u(n,s.status):new Error(n)}}async getParsedResponse(t){let e=await t.json();if(t.ok)return e;throw new u(`${e.title||t.statusText||"Unknown error"}.`,t.status)}},k=class extends P{async find(t,e){try{let r=await this.client.request(`${this.domain}/api/orgs/${encodeURIComponent(t)}/projects/${encodeURIComponent(e)}`,{timeout:6e3,method:"GET",headers:{"Content-Type":"application/json",...this.authHeaders}});return r.status===404?void 0:await this.getParsedResponse(r)}catch(r){let s=`Failed to fetch project. ${r.message}`;throw r instanceof u?new u(s,r.status):new Error(s)}}},D=class extends P{async getDefaultBranch(t,e){try{let r=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/sources`,{timeout:6e3,method:"GET",headers:{"Content-Type":"application/json",...this.authHeaders}}),s=await this.getParsedResponse(r),[n]=s.data;if(!n)throw new Error("Project source not found.");return n.branchName}catch(r){let s=`Failed to fetch default branch. ${r.message}`;throw r instanceof u?new u(s,r.status):new Error(s)}}async upsert(t,e,r){try{let s=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/remotes`,{timeout:6e3,method:"POST",headers:{"Content-Type":"application/json",...this.authHeaders},body:JSON.stringify({mountPath:r.mountPath,mountBranchName:r.mountBranchName,type:"CICD",autoMerge:!0})});return await this.getParsedResponse(s)}catch(s){let n=`Failed to upsert remote. ${s.message}`;throw s instanceof u?new u(n,s.status):new Error(n)}}async push(t,e,r,s){let n=new te.FormData;n.append("remoteId",r.remoteId),n.append("commit[message]",r.commit.message),n.append("commit[author][name]",r.commit.author.name),n.append("commit[author][email]",r.commit.author.email),n.append("commit[branchName]",r.commit.branchName),r.commit.url&&n.append("commit[url]",r.commit.url),r.commit.namespace&&n.append("commit[namespaceId]",r.commit.namespace),r.commit.sha&&n.append("commit[sha]",r.commit.sha),r.commit.repository&&n.append("commit[repositoryId]",r.commit.repository),r.commit.createdAt&&n.append("commit[createdAt]",r.commit.createdAt);for(let i of s){let a=Buffer.isBuffer(i.stream)?new Blob([i.stream]):new Blob([await me(i.stream)]);n.append(`files[${i.path}]`,a,i.path)}r.isMainBranch&&n.append("isMainBranch","true"),r.replace&&n.append("replace","true");try{let i=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/pushes`,{method:"POST",headers:{...this.authHeaders},body:n});return await this.getParsedResponse(i)}catch(i){let a=`Failed to push. ${i.message}`;throw i instanceof u?new u(a,i.status):new Error(a)}}async getPush({organizationId:t,projectId:e,pushId:r}){try{let s=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/pushes/${r}`,{timeout:6e3,method:"GET",headers:{"Content-Type":"application/json",...this.authHeaders}});return await this.getParsedResponse(s)}catch(s){let n=`Failed to get push status. ${s.message}`;throw s instanceof u?new u(n,s.status):new Error(n)}}},F=class extends P{create(t,e,r){return this.fetchJson(`${this.projectUrl(t,e)}/pull-requests`,{method:"POST",body:JSON.stringify(r)},"Failed to open a pull request")}async findLatest(t,e,r){let s=new URLSearchParams({branchName:r,limit:"1"}),{data:n}=await this.fetchJson(`${this.projectUrl(t,e)}/pull-requests?${s}`,{method:"GET",timeout:6e3},"Failed to get the pull request");return n[0]}listChecks(t,e,r){return this.fetchJson(`${this.projectUrl(t,e)}/pull-requests/${encodeURIComponent(r)}/checks`,{method:"GET",timeout:6e3},"Failed to get the checks")}},j=class extends P{async findLatestByCommit(t,e,r){let s=new URLSearchParams({limit:"1",filter:`commitHash:${r}`}),{data:n}=await this.fetchJson(`${this.projectUrl(t,e)}/builds?${s}`,{method:"GET",timeout:6e3},"Failed to get the build");return n[0]}},y=class{apiClient;projects;remotes;constructor({domain:t,apiKey:e,command:r,version:s}){this.apiClient=new h(r,s);let n={Authorization:`Bearer ${e}`};this.projects=new k(this.apiClient,t,n),this.remotes=new D(this.apiClient,t,n)}getSunsetWarning(){return re(this.apiClient.sunsetWarnings)}};function re(o){let[t]=[...o].sort((e,r)=>e.isSunsetExpired!==r.isSunsetExpired?e.isSunsetExpired?-1:1:e.sunsetDate>r.sunsetDate?1:-1);return t}async function me(o){let t=[];for await(let e of o)t.push(e);return Buffer.concat(t)}function ge(){if(process.env.REDOCLY_AUTHORIZATION)return process.env.REDOCLY_AUTHORIZATION;throw new Error("No api key provided, please use environment variable REDOCLY_AUTHORIZATION.")}var we=/^http:\/\/(localhost|127\.0\.0\.1)(:\d+)?$/,E={us:"https://app.cloud.redocly.com",eu:"https://app.cloud.eu.redocly.com"};function ye(){return process.env.REDOCLY_DOMAIN||E.us}var ne=ve((o,t)=>{try{let e=t||o?.resolvedConfig.residency;return Te(e)?E[e]:e?new URL(e).origin:o?.resolvedConfig.scorecard?.fromProjectUrl?new URL(o.resolvedConfig.scorecard.fromProjectUrl).origin:E.us}catch{throw new $}});function S(o){try{ne(void 0,o)}catch{return!1}return!0}function ve(o){return(...t)=>{let e=o(...t);if(!e.startsWith("https://")&&!we.test(e))throw new $;return e}}var $=class extends Error{constructor(){super("Invalid Redocly platform URL")}};function Te(o){return typeof o=="string"&&o in E}import{Buffer as L}from"node:buffer";import A from"node:crypto";import{mkdirSync as Re,existsSync as oe,writeFileSync as Ce,readFileSync as Pe,rmSync as xe}from"node:fs";import{homedir as Ue}from"node:os";import ie from"node:path";import*as se from"node:child_process";var v=class{baseUrl;apiClient;clientName="redocly-cli";constructor(t,e){this.baseUrl=t,this.apiClient=new h("login",e)}async run(t){let e=await this.getDeviceCode();t?.({verificationUri:e.verificationUri,verificationUriComplete:e.verificationUriComplete,userCode:e.userCode}),this.openBrowser(e.verificationUriComplete);let r=await this.pollingAccessToken(e.deviceCode,e.interval,e.expiresIn);return this.withResidency(r)}openBrowser(t){if(!/^https?:\/\//.test(t))return;let[e,r]=process.platform==="win32"?["rundll32",["url.dll,FileProtocolHandler",t]]:process.platform==="darwin"?["open",[t]]:["xdg-open",[t]];se.spawn(e,r,{stdio:"ignore",detached:!0}).on("error",()=>{}).unref()}async verifyToken(t){try{return!!(await this.sendRequest("/session","GET",void 0,{Cookie:`accessToken=${t};`})).user}catch{return!1}}async verifyApiKey(t){try{return!!(await this.sendRequest("/api-keys-verify","POST",{apiKey:t})).success}catch{return!1}}async refreshToken(t){let e=await this.sendRequest("/device-rotate-token","POST",{grant_type:"refresh_token",client_name:this.clientName,refresh_token:t});if(!e.access_token)throw new Error("Failed to refresh token");return this.withResidency({access_token:e.access_token,refresh_token:e.refresh_token,expires_in:e.expires_in})}async pollingAccessToken(t,e,r){return new Promise((s,n)=>{let i=setInterval(async()=>{let c=await this.getAccessToken(t);c.access_token&&(clearInterval(i),clearTimeout(a),s(c)),c.error&&c.error!=="authorization_pending"&&(clearInterval(i),clearTimeout(a),n(c.error_description))},e*1e3),a=setTimeout(async()=>{clearInterval(i),clearTimeout(a),n("Authorization has expired. Please try again.")},r*1e3)})}async getAccessToken(t){return await this.sendRequest("/device-token","POST",{client_name:this.clientName,device_code:t,grant_type:"urn:ietf:params:oauth:grant-type:device_code"})}async getDeviceCode(){let{device_code:t,user_code:e,verification_uri:r,verification_uri_complete:s,interval:n=10,expires_in:i=300}=await this.sendRequest("/device-authorize","POST",{client_name:this.clientName});return{deviceCode:t,userCode:e,verificationUri:r,verificationUriComplete:s,interval:n,expiresIn:i}}async sendRequest(t,e="GET",r=void 0,s={}){let n=`${this.baseUrl}/api${t}`,i=await this.apiClient.request(n,{body:r&&JSON.stringify(r),method:e,headers:{"Content-Type":"application/json",...s},timeout:6e3});return i.status===204?{success:!0}:await i.json()}withResidency(t){return{...t,residency:this.baseUrl}}};var Ee="4618dbc9-8aed-4e27-aaf0-225f4603e5a4",ae="aes-256-cbc",H=class{version;credentialsFolderPath;credentialsFilePath;credentialsFileName;key;iv;constructor(t){this.version=t;let e=Ue();this.credentialsFolderPath=ie.join(e,".redocly"),this.credentialsFileName="credentials",this.credentialsFilePath=ie.join(this.credentialsFolderPath,this.credentialsFileName),this.key=A.createHash("sha256").update(`${this.credentialsFolderPath}${Ee}`).digest(),this.iv=A.createHash("md5").update(this.credentialsFolderPath).digest(),Re(this.credentialsFolderPath,{recursive:!0})}async login(t,e){let s=await new v(t,this.version).run(e);if(!s)throw new Error("Failed to login. No credentials received.");await this.saveCredentials(s)}async logout(){try{this.removeCredentials()}catch{}}async isAuthorized(t,e){return e?new v(t,this.version).verifyApiKey(e):!!await this.getAccessToken(t)}getAccessToken=async t=>{let e=new v(t,this.version),r=await this.readCredentials();if(!r||!S(t)||r.residency&&r.residency!==t)return null;if(await e.verifyToken(r.access_token))return r.access_token;try{let n=await e.refreshToken(r.refresh_token);return await this.saveCredentials(n),n.access_token}catch{return null}};async saveCredentials(t){try{let e=this.encryptCredentials(t);Ce(this.credentialsFilePath,e,"utf8")}catch(e){throw new Error(`Failed to save credentials: ${e.message}`)}}async readCredentials(){if(!oe(this.credentialsFilePath))return null;try{let t=Pe(this.credentialsFilePath,"utf8");return this.decryptCredentials(t)}catch{return null}}async removeCredentials(){oe(this.credentialsFilePath)&&xe(this.credentialsFilePath)}encryptCredentials(t){let e=A.createCipheriv(ae,this.key,this.iv);return L.concat([e.update(JSON.stringify(t),"utf8"),e.final()]).toString("hex")}decryptCredentials(t){let e=A.createDecipheriv(ae,this.key,this.iv),r=L.concat([e.update(L.from(t,"hex")),e.final()]);return JSON.parse(r.toString("utf8"))}};var $e=/^(https?:\/\/[^/]+)\/api\/orgs\/([^/]+)\/projects\/([^/]+)\/git\/?$/;function Se(o,t,e){return`${o}/api/orgs/${encodeURIComponent(t)}/projects/${encodeURIComponent(e)}/git`}function _e(o){let[,t,e,r]=o.match($e)??[];if(!(!t||!e||!r||!S(t)))return{reuniteUrl:t,organization:decodeURIComponent(e),project:decodeURIComponent(r)}}async function Ie({branch:o,title:t,description:e,base:r,draft:s,...n}){let{pullRequests:i}=ce(n,"project pr create");return i.create(n.organization,n.project,{branchName:o,title:t,description:e,targetBranchName:r,isDraft:s})}async function Fe({branch:o,...t}){let{pullRequests:e,builds:r}=ce(t,"project pr status"),{organization:s,project:n}=t,i=await e.findLatest(s,n,o);if(!i)return;let[a,c]=await Promise.all([e.listChecks(s,n,i.id),i.headCommitHash?r.findLatestByCommit(s,n,i.headCommitHash):void 0]);return{pullRequest:i,checks:a,previewUrl:c?.deploymentStatus==="SUCCESS"?c.url:void 0}}function ce({reuniteUrl:o,accessToken:t,version:e},r){let s=new h(r,e),n={Cookie:`accessToken=${t}`};return{pullRequests:new F(s,o,n),builds:new j(s,o,n)}}import*as T from"node:fs";import*as p from"node:path";var je=/\/orgs\/([^/]+)\/projects\//,Ae=[401,403];async function x(o,{organization:t,project:e,onSlugDeprecated:r}){let s=await Ne(o,t,e);if(!s)return{organizationId:t,projectId:e};let n={organizationId:Oe(s.uri),projectId:s.id};return(n.organizationId!==t||n.projectId!==e)&&r?.(n),n}async function Ne(o,t,e){try{let r=await o.projects.find(t,e);if(!r)throw new u(`Project "${e}" was not found in organization "${t}". Use the IDs from the organization and project settings in the Redocly platform.`,404);return r}catch(r){if(r instanceof u&&Ae.includes(r.status))return;throw r}}function Oe(o){let t=o.match(je)?.[1];if(!t)throw new Error(`Could not read the organization ID from the project URI "${o}".`);return t}async function ke({domain:o,apiKey:t,organization:e,project:r,mountPath:s,files:n,defaultBranch:i,commit:a,version:c,replace:_,onUploadStart:I,onSunsetWarning:R,onSlugDeprecated:N}){let f=new y({domain:o,apiKey:t,command:"push",version:c});try{let{organizationId:d,projectId:l}=await x(f,{organization:e,project:r,onSlugDeprecated:N}),b=await f.remotes.getDefaultBranch(d,l),m=await f.remotes.upsert(d,l,{mountBranchName:b,mountPath:s});I?.(m);let{id:U}=await f.remotes.push(d,l,{remoteId:m.id,commit:a,isMainBranch:i===a.branchName,replace:_},n.map(M=>({path:G(M.name),stream:T.createReadStream(M.path)})));return{pushId:U,organizationId:d,projectId:l}}finally{let d=f.getSunsetWarning();d&&R?.(d)}}function De(o,t){let e={};for(let s of o)if(T.statSync(s).isDirectory()){let n=s;ue(n,[]).forEach(a=>r(a,n))}else r(s,p.dirname(s));function r(s,n){let i=p.relative(n,s);e[i]&&t?.(e[i],s),e[i]=s}return Object.entries(e).map(([s,n])=>({name:s,path:p.resolve(n)}))}function ue(o,t){let e=T.readdirSync(o);for(let r of e){let s=p.join(o,r);T.statSync(s).isDirectory()?t=ue(s,t):t.push(s)}return t}async function le({operation:o,condition:t,onConditionNotMet:e,startTime:r=Date.now(),retryTimeoutMs:s=6e5,retryIntervalMs:n=5e3}){async function i(){let a=await o();if(t(a))return a;if(Date.now()-r>s)throw new Error("Timeout exceeded.");return await e?.(a),await z(n),i()}return i()}var Le=1200,He=5e3,qe=["pending","running"];async function Be(o){let t=de(o);try{let e=await x(t,o);return await pe(t,e,o.pushId)}finally{he(t,o)}}async function be({buildType:o,maxExecutionTime:t=Le,retryIntervalMs:e=He,startTime:r=Date.now(),onRetry:s,...n}){let i=de(n);try{let a=await x(i,n);return await le({operation:()=>pe(i,a,n.pushId),condition:c=>!qe.includes(c.status[o].deploy.status),onConditionNotMet:s,startTime:r,retryTimeoutMs:t*1e3,retryIntervalMs:e})}finally{he(i,n)}}function de({domain:o,apiKey:t,version:e}){return new y({domain:o,apiKey:t,command:"push-status",version:e})}function he(o,{onSunsetWarning:t}){let e=o.getSunsetWarning();e&&t?.(e)}function pe(o,{organizationId:t,projectId:e},r){return o.remotes.getPush({organizationId:t,projectId:e,pushId:r})}async function Me({projectUrl:o,auth:t,isApiKey:e=!1,onDebug:r}){let s=We(o);if(!s)throw new g(`Invalid project URL format: ${o}`);try{let n=await ze({...s,auth:t,isApiKey:e,onDebug:r}),i=n.config.scorecardClassic||n.config.scorecard;if(!i)throw new Error("No scorecard configuration found.");let a=n.config.pluginsUrl,c=a?await Ge(a,r):void 0;return{scorecard:i,plugins:c,pluginsUrl:a}}catch(n){throw new g(n instanceof Error?n.message:String(n))}}function We(o){let t=new URL(o),e=t.pathname.match(/\/org\/(?<orgSlug>[^/]+)\/project\/(?<projectSlug>[^/]+)/);if(!e?.groups)return;let{orgSlug:r,projectSlug:s}=e.groups;return{residency:t.origin,orgSlug:r,projectSlug:s}}async function ze({residency:o,orgSlug:t,projectSlug:e,auth:r,isApiKey:s,onDebug:n}){let i=new URL(`${o}/api/orgs/${t}/projects/${e}`),a=await fetch(i,{headers:Ve(r,s)});if(n?.(`Project fetch response status: ${a.status}`),a.status===401||a.status===403)throw n?.(`Authentication failed with status ${a.status}.`),n?.("Check that your credentials are valid and have the necessary permissions."),new Error(`Unauthorized access to project: ${e}. Please check your credentials.`);if(a.status!==200)throw new Error(`Failed to fetch project: ${e}. Status: ${a.status}`);return n?.("Successfully received project configuration."),a.json()}async function Ge(o,t){t?.(`Fetching plugins from: ${o}`);try{let e=await fetch(o);if(t?.(`Plugins fetch response status: ${e.status}`),e.status!==200){t?.("Failed to fetch plugins");return}return e.text()}catch(e){t?.(`Error fetching plugins: ${e instanceof Error?e.message:String(e)}`);return}}function Ve(o,t){return t?{Authorization:`Bearer ${o}`}:{Cookie:`accessToken=${o}`}}async function q(o,t,e=[],r=[],s){let n={};for(let i of e){let a={[i.name]:{root:o,rules:t}},c=await Y({apis:a,...i,plugins:r},{configPath:s});n[i.name]=c.forAlias(i.name)}return n}function B(o,t){if(o){for(let e of o)if(Object.entries(e.where?.metadata||{}).every(([s,n])=>Ye(s,n,t)))return e}}function Ye(o,t,e){if(t.match(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}Z)?\/(\d{4}-\d{2}-\d{2})?$/)){if(!e[o])return!1;let[r,s]=t.split("/"),n=new Date(e[o]);return!(n<new Date(r)||s&&n>new Date(s))}else if(t.match(/^\/.*\//)){if(!e[o])return!1;try{return V(t).test(e[o])}catch{throw new g(`Invalid regex in scorecard target "${o}": ${t}`)}}return e[o]===t}import{pathToFileURL as Je}from"node:url";async function Xe(o,t){if(!o)return[];let e=Je(t??process.cwd()).href+"/",r=o.replaceAll("__redocly_dirname",`"${e}"`);return(await import(`data:text/javascript;base64,${btoa(r)}`)).default.map(i=>i())}var Ze=".redocly.com";function Ke(o){try{return new URL(o).hostname.toLowerCase().endsWith(Ze)}catch{return!1}}async function Qe({apiPath:o,document:t,externalRefResolver:e,scorecardConfig:r,configPath:s,plugins:n=[],targetLevel:i,metadata:a={},onDebug:c}){let _=[],I=new Map,R=r.levels||[];if(i&&!R.some(l=>l.name===i))throw new g(`Target level "${i}" not found in the scorecard configuration levels.
|
|
8
|
+
`);let N=B(r.targets,a)?.rules,f=await q(o,N,R,n,s||"");for(let l of R){c?.(`
|
|
9
|
+
Validating level: "${l.name}"`),n.length>0&&c?.(`Using ${n.length} ${O("plugin",n.length)} for this level.`),c?.("Linting document against level rules...");let m=(await J({document:t,externalRefResolver:e,config:f[l.name]})).filter(({ignored:U})=>!U).map(U=>({...U,scorecardLevel:l.name}));c?.(`Found ${m.length} ${O("problem",m.length)} for level "${l.name}".`),I.set(l.name,m),_.push(...m)}let d=et(I,R,i);return{problems:_,achievedLevel:d,targetLevelAchieved:i?d===i:!0}}function et(o,t,e){let r=null;for(let s of t){if((o.get(s.name)||[]).some(a=>a.severity==="error"))return r||"Non Conformant";if(r=s.name,e&&s.name===e)return s.name}return r||"Non Conformant"}export{u as a,h as b,y as c,re as d,ge as e,E as f,ye as g,ne as h,S as i,$ as j,v as k,H as l,Se as m,_e as n,Ie as o,Fe as p,x as q,ke as r,De as s,Be as t,be as u,Me as v,q as w,B as x,Xe as y,Ke as z,Qe as A};
|
|
@@ -4,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"./
|
|
7
|
+
import{a}from"./MVORYCC7.js";import"./CYANRNZK.js";import"./K36HFZXQ.js";import"./DSRHDMCC.js";import"./WZXA5XPB.js";import"./IPCQDGPM.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";export{a as transformersGenerator};
|
|
@@ -4,5 +4,5 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a as C,e as P,g as L,h as v,i as R,k as V}from"./
|
|
8
|
-
`)}import{execSync as ne}from"node:child_process";import*as p from"node:fs";import{existsSync as re,writeFileSync as oe,readFileSync as M}from"node:fs";import*as $ from"node:os";import{tmpdir as U}from"node:os";import{dirname as J,join as A}from"node:path";async function F(e=L){try{let{fetchWithTimeout:t}=await import("./QXBSAWH3.js");return await t(P,{timeout:e}),!0}catch{return!1}}var y="***";function be(e){return process.env.REDOCLY_TELEMETRY!=="off"&&e?.resolvedConfig.telemetry!=="off"}async function Oe({config:e,argv:t,exit_code:n,execution_time:r,spec_version:o,spec_keyword:i,spec_full_version:s,respect_x_security_auth_types:c,respect_source_description_types:f,respect_criterion_object_types:N,lint_rules_with_errors:T,lint_rules_with_warnings:b,lint_rules_with_ignored_problems:O,generate_client:a,eject_generator:l,bundle:G}){try{if(!t||!await F(1e3))return;let{_:[h],$0:pe,...D}=t,{RedoclyOAuthClient:K,getReuniteUrl:H}=await import("./
|
|
7
|
+
import{a as C,e as P,g as L,h as v,i as R,k as V}from"./VRCDJEVJ.js";import{u as S}from"./UJ5HQQDZ.js";import{c as m,ga as u,pa as k,u as I}from"./IPCQDGPM.js";var _=" ",z=" ";function _e(e){let t=Math.max(...e.map(o=>S(o).length)),n=t+z.length*2,r=_+u("\u2551"+" ".repeat(n)+"\u2551");return["",_+u("\u2554"+"\u2550".repeat(n)+"\u2557"),r,...e.map(o=>{let i=" ".repeat(t-S(o).length);return`${_}${u("\u2551")}${z}${o}${i}${z}${u("\u2551")}`}),r,_+u("\u255A"+"\u2550".repeat(n)+"\u255D"),"",""].join(`
|
|
8
|
+
`)}import{execSync as ne}from"node:child_process";import*as p from"node:fs";import{existsSync as re,writeFileSync as oe,readFileSync as M}from"node:fs";import*as $ from"node:os";import{tmpdir as U}from"node:os";import{dirname as J,join as A}from"node:path";async function F(e=L){try{let{fetchWithTimeout:t}=await import("./QXBSAWH3.js");return await t(P,{timeout:e}),!0}catch{return!1}}var y="***";function be(e){return process.env.REDOCLY_TELEMETRY!=="off"&&e?.resolvedConfig.telemetry!=="off"}async function Oe({config:e,argv:t,exit_code:n,execution_time:r,spec_version:o,spec_keyword:i,spec_full_version:s,respect_x_security_auth_types:c,respect_source_description_types:f,respect_criterion_object_types:N,lint_rules_with_errors:T,lint_rules_with_warnings:b,lint_rules_with_ignored_problems:O,generate_client:a,eject_generator:l,bundle:G}){try{if(!t||!await F(1e3))return;let{_:[h],$0:pe,...D}=t,{RedoclyOAuthClient:K,getReuniteUrl:H}=await import("./N7RFW4SU.js"),q=new K(C),Q=H(e,D.residency),Z=await q.isAuthorized(Q),g=de();g||(g=`ann_${V()}`,ue(g));let E=k(o),X=[{id:h,object:"command",uri:`urn:redocly:cli:command:${h}`,logged_in:Z?"yes":"no",command:h,...ae(D,process.argv.slice(2)),node_version:process.version,npm_version:le(),version:C,exit_code:n,execution_time:r,metadata:process.env.REDOCLY_CLI_TELEMETRY_METADATA,environment_ci:process.env.CI,environment:process.env.REDOCLY_ENVIRONMENT,has_config:typeof e?.document?.parsed>"u"?"no":"yes",spec_version:o,spec_keyword:i,spec_full_version:s,respect_x_security_auth_types:E==="arazzo1"&&c?.length?JSON.stringify(c):void 0,respect_source_description_types:E==="arazzo1"&&f?.length?JSON.stringify(f):void 0,respect_criterion_object_types:E==="arazzo1"&&N?.length?JSON.stringify(N):void 0,lint_rules_with_errors:T?.length?JSON.stringify(T):void 0,lint_rules_with_warnings:b?.length?JSON.stringify(b):void 0,lint_rules_with_ignored_problems:O?.length?JSON.stringify(O):void 0,generate_client_builtin_generators:a?.generate_client_builtin_generators?.length?JSON.stringify(a.generate_client_builtin_generators):void 0,generate_client_custom_generators_count:a?.generate_client_custom_generators_count,generate_client_toolkit_imports:a?.generate_client_toolkit_imports?.length?JSON.stringify(a.generate_client_toolkit_imports):void 0,generate_client_error_category:a?.generate_client_error_category,generate_client_ejected_generators:a?.generate_client_ejected_generators?.length?JSON.stringify(a.generate_client_ejected_generators):void 0,generate_client_composed_apis_count:a?.generate_client_composed_apis_count,eject_generator_action:l?.eject_generator_action,eject_generator_name:l?.eject_generator_name,eject_generator_outcome:l?.eject_generator_outcome,eject_generator_conflicts:l?.eject_generator_conflicts,eject_generator_from_version:l?.eject_generator_from_version,eject_generator_to_version:l?.eject_generator_to_version,bundle_overlays_count:G?.bundle_overlays_count}],ee=R.mapToCloudEvent({type:"com.redocly.command.ran",source:"urn:redocly:cli",origin:"redocly-cli",env:"development",osPlatform:$.platform(),actor:{id:g,object:"user",uri:""},category:"product",data:X}),{otelTelemetry:te}=await import("./DYXWOFZF.js");te.send(ee)}catch{}}function De(e,t){for(let n of e.sourceDescriptions??[])n.type&&t.add(n.type)}function Ie(e,t){for(let n of e.workflows??[]){d(n.successActions,t),d(n.failureActions,t);for(let r of n.steps??[])W(r.successCriteria,t),d(r.onSuccess,t),d(r.onFailure,t)}d(Object.values(e.components?.successActions??{}),t),d(Object.values(e.components?.failureActions??{}),t)}function d(e,t){for(let n of e??[])W(n.criteria,t)}function W(e,t){for(let n of e??[]){let r=ie(n);r&&t.add(r)}}function ie(e){let t=e.type;return typeof t=="string"?t:t?.type||(e.condition?"simple":void 0)}function ke(e,t){for(let n of e.workflows??[]){for(let r of n["x-security"]??[]){let o=r.scheme;if(o?.type){let i=o.type==="http"?o.scheme:o.type;i&&t.add(i)}}for(let r of n.steps??[])for(let o of r["x-security"]??[]){let i=o.scheme;if(i?.type){let c=i.type==="http"?i.scheme:i.type;c&&t.add(c)}let s=o.schemeName;s&&t.add(s)}}}function se(e){return p.existsSync(e)&&p.statSync(e).isFile()}function ce(e){return p.existsSync(e)&&p.statSync(e).isDirectory()}function w(e){return e&&(I(e)?e.split("://")[0]+"://url":se(e)?e.replace(/.+\.([^.]+)$/,(t,n)=>"file-"+n):ce(e)?"folder":e)}function j(e,t,n){let r=Array.isArray(t)?t:[t];for(let o of r)o.length>1&&(e=e.replaceAll(o,n));return e}function Y(e,t){let n={};for(let[r,o]of Object.entries(e))t.includes(r)?n[r]=y:m(o)?n[r]=Y(o,t):n[r]=o;return n}function x(e,t,n=[]){if(Array.isArray(e))return e.forEach(r=>x(r,t,n)),n;if(m(e))for(let[r,o]of Object.entries(e))t.includes(r)&&typeof o=="string"?n.push(o):(m(o)||Array.isArray(o))&&x(o,t,n);return n}function ae(e,t){let n=["organization","o","input","i","author","a","clientCert","clientKey","caCert","server","S"],r=t.join(" "),o={};for(let[i,s]of Object.entries(e))if(n.includes(i))o[i]=y,r=j(r,s,y);else if(typeof s=="string"){let c=w(s);o[i]=c,r=j(r,s,c)}else if(Array.isArray(s)){o[i]=s.map(w);for(let c of s){let f=w(c);r.includes(c)&&(r=r.replaceAll(c,f))}}else if(m(s)){let c=x(s,n);for(let f of c)r=j(r,f,y);o[i]=Y(s,n)}else o[i]=s;return{arguments:JSON.stringify(o),raw_input:r}}var fe=process.platform==="win32"?A(J(process.execPath),"node_modules","npm","package.json"):A(J(process.execPath),"..","lib","node_modules","npm","package.json");function le(){try{return JSON.parse(M(fe,"utf8")).version}catch{}try{return ne("npm -v",{stdio:["ignore","pipe","ignore"]}).toString().trim()}catch{return"unknown"}}var ue=e=>{if(!(process.env.CI||!e))try{let n=A(U(),v);oe(n,e)}catch{}},de=()=>{if(!process.env.CI)try{let t=A(U(),v);return re(t)?M(t).toString().trim():void 0}catch{return}};export{_e as a,be as b,Oe as c,De as d,Ie as e,ke as f};
|
|
@@ -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"./
|
|
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"./6ONEVLGD.js";import{c as g}from"./IPCQDGPM.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{a as I,b as O,c as T,d as w}from"./
|
|
7
|
+
import{a as I,b as O,c as T,d as w}from"./OYMGZQWH.js";import{a as E}from"./36T2XEW3.js";import{c as d,d as k}from"./6ONEVLGD.js";import{f as F}from"./UJ5HQQDZ.js";import{$ as g,aa as $,ea as R,fa as S,ga as b,ja as M,oa as s,ua as v,va as A}from"./IPCQDGPM.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";import{mkdir as V,writeFile as W}from"node:fs/promises";import q from"node:path";import{performance as _}from"node:perf_hooks";var P=20;function B(e){return e.total===0?void 0:Math.floor(e.covered/e.total*100)}function z(e){return e===void 0?"n/a":`${e}%`}function J(e,o){let t=e===void 0?0:Math.floor(e/100*P),r=`${"\u2588".repeat(t)}${"\u2591".repeat(P-t)}`;return!o||e===void 0?r:e>=80?S(r):e>=50?b(r):R(r)}function j(e,o){let t=[["operations",e.totals.operations],["parameters",e.totals.parameters],["schema properties",e.totals.properties],["response codes",e.totals.responses]],r=Math.max(...t.map(([,c])=>`${c.covered}/${c.total}`.length)),n="API coverage",a=[o?$(M(n)):n];for(let[c,i]of t){let f=B(i);a.push(` ${c.padEnd(18)} ${J(f,o)} ${z(f).padStart(5)} ${`${i.covered}/${i.total}`.padStart(r+3)}`)}return`${a.join(`
|
|
8
8
|
`)}
|
|
9
9
|
`}function L(e,o){let t={version:1,meta:{...o,exchanges:e.exchanges},totals:e.totals,operations:e.operations};return`${JSON.stringify(t,null,2)}
|
|
10
10
|
`}async function N(e){let o=await k(e.trafficPath);if(o.length===0)throw new Error("No traffic files found in the provided traffic path.");let t=O.create({openApiIndex:e.openApiIndex,matchMode:e.matchMode,ignoreCookies:e.ignoreCookies,ignoreHeaders:e.ignoreHeaders,previewFindingsLimit:e.previewFindingsLimit,activeRules:e.activeRules,server:e.server,minSeverity:e.minSeverity,coverage:e.coverage}),r=0,n=0;for(let a of o){let c=await E(a,e.format);if(!c){s.warn(`Skipping traffic file with unrecognized format: ${a}
|
|
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a,b,c,d,e,f,g}from"./
|
|
7
|
+
import{a,b,c,d,e,f,g}from"./25E5DG26.js";import"./IPCQDGPM.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";export{d as RESET_ESCAPE_CODE,c as calculateTotals,f as conditionallyMaskSecrets,b as generate,e as maskSecrets,a as parseRuntimeExpression,g as run};
|
|
@@ -4,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{ha as e,oa as t}from"./
|
|
7
|
+
import{ha as e,oa as t}from"./IPCQDGPM.js";function r({verificationUri:o,userCode:n}){t.output(`Attempting to automatically open the SSO authorization page in your default browser.
|
|
8
8
|
`),t.output(`If the browser does not open or you wish to use a different device to authorize this request, open the following URL:
|
|
9
9
|
|
|
10
10
|
`),t.output(e(o)),t.output(`
|
|
@@ -4,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 y,c as I}from"./
|
|
7
|
+
import{a as $,b as y,c as I}from"./DC56UBY4.js";import{e as P}from"./UJ5HQQDZ.js";import{Fa as x,oa as h}from"./IPCQDGPM.js";function F(t){let e=t.trim(),n=e.match(/^```(?:ya?ml|json)?\s*\n([\s\S]*?)\n```$/);return n?n[1]:e}async function M(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 v}from"node:child_process";import{mkdtemp as R}from"node:fs/promises";import{tmpdir as S}from"node:os";import L from"node:path";var E=3e5,m=class extends Error{},C;function A(){return C??=R(L.join(S(),"redocly-ai-")),C}async function w(t,e,n,r){let o=await A();return new Promise((s,u)=>{let i=v(t,e,{stdio:["pipe","pipe","pipe"],cwd:o,env:{...process.env,...r}}),l="",f="",g=!1,d=setTimeout(()=>{g=!0,i.kill("SIGKILL")},E);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 m(`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 ${E/1e3} seconds.`));return}s({stdout:l,stderr:f,code:c})}),i.stdin.on("error",()=>{}),i.stdin.end(n)})}async function b(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 _(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 k(t){let e=["-p","--output-format","text","--trust"];t.model&&e.push("--model",t.model);let n=`${t.system}
|
|
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{a as $,g as xt,h as et}from"./
|
|
7
|
+
import{a as $,g as xt,h as et}from"./K2MVHTPY.js";import{a as wt}from"./64G5RPLP.js";import{b as lt,f as ut,m as gt,n as ht,s as yt}from"./UJ5HQQDZ.js";import{A as pt,Ba as ct,Ca as mt,X as Z,b as N,c as M,d as it,ea as D,fa as G,g as at,ga as k,ha as v,i as U,oa as T,q as E,qa as tt,ua as w,wa as ft}from"./IPCQDGPM.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";import*as Nt from"node:path";import{performance as jt}from"node:perf_hooks";import*as Ot from"node:path";function dt(t,e){xt(t,o=>{if(E(o)&&et(o.$ref)){let r=Ot.basename(o.$ref);o.$ref=o.$ref.replace(r,e+"_"+r)}else if(M(o.discriminator)&&M(o.discriminator.mapping)){let{mapping:r}=o.discriminator;for(let i of Object.keys(r)){let c=r[i];typeof c=="string"&&et(c)&&(r[i]=c.split("/").map((O,s,p)=>p.length-1===s&&!O.startsWith(e+"_")?e+"_"+O:O).join("/"))}}})}function j(t,e,o){if(!e)return"";if(!t)throw new w("Info section is not found in specification.");if(!t[e])throw new w(`${k(`prefix-${o}-with-info-prop`)} argument value is not found in info section.`);if(!at(t[e]))throw new w(`${k(`prefix-${o}-with-info-prop`)} argument value should be string.`);if(t[e].length>50)throw new w(`${k(`prefix-${o}-with-info-prop`)} argument value length should not exceed 50 characters.`);return t[e].replaceAll(/\s/g,"_")}function ot(t,e){return e?t?.map(o=>{let r={};for(let[i,c]of Object.entries(o))Object.assign(r,{[e+"_"+i]:c});return r}):t}function C(t,e){return e?e+"_"+t:t}import*as Pt from"node:path";function H(t,e){return t.replace(/"(#\/components\/.*?)"/g,o=>{let r=Pt.basename(o);return o.replace(r,C(r,e))})}function B(t){return t.map(e=>({name:e}))}import*as q from"node:path";function bt(t){return q.basename(t,q.extname(t))}function vt(t){return Object.entries(t).filter(([e,o])=>o.length>1)}function rt(t,e){for(let[o,r]of e)T.warn(`Conflict on ${t} : ${D(o)} in files: ${v(r)}
|
|
8
8
|
`)}function Tt(t){T.info(G(`
|
|
9
9
|
${t} conflict(s) on tags.
|
|
10
10
|
Suggestion: please use ${v("prefix-tags-with-filename")}, ${v("prefix-tags-with-info-prop")} or ${v("without-x-tag-groups")} to prevent naming conflicts.
|
|
@@ -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"./
|
|
7
|
+
import{c as a,d as b}from"./MBAERFFP.js";import"./K36HFZXQ.js";import"./DSRHDMCC.js";import"./WZXA5XPB.js";import"./IPCQDGPM.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";export{b as generateClient,a as runGenerators};
|
|
@@ -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 as p,b as q,c as r,d as s,e as t,f as u,g as v,h as w,i as x,j as y,k as z,l as A,m as D,n as E,o as F,p as H,q as I}from"./
|
|
7
|
+
import{a as p,b as q,c as r,d as s,e as t,f as u,g as v,h as w,i as x,j as y,k as z,l as A,m as D,n as E,o as F,p as H,q as I}from"./CYANRNZK.js";import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o,q as B,w as C,y as G}from"./DSRHDMCC.js";import{a}from"./WZXA5XPB.js";import"./IPCQDGPM.js";import"./6RTITFQA.js";import"./RFWIIJFG.js";export{z as AUTHORING_HELPER_NAMES,G as GENERATOR_VERSION,a as NotSupportedError,b as Printer,d as RESERVED_WORDS,C as WIRING_NAMES,B as allOperations,c as casing,E as constantCase,A as defineClientSetup,H as defineGenerator,g as deref,i as discriminatorCases,m as docText,l as enumValues,h as flattenAllOf,I as generateClient,D as groupSlug,o as headerCoerceType,e as identifierFor,u as isBinaryContentType,s as isMultipartBody,j as isNullable,t as isUntypedMultipartBody,q as jsonSuccessSchema,F as mergeConfig,x as paginationItemSchema,p as paginationRuleFor,y as renderReferencePage,n as resolveSchemaPointer,n as schemaAtPointer,w as securityRequirements,v as serverUrlParts,r as sseResponse,f as uniqueIdentifiers,k as unwrapNullable};
|
|
@@ -4,5 +4,5 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{c,ua as H}from"./
|
|
7
|
+
import{c,ua as H}from"./IPCQDGPM.js";import{existsSync as J}from"node:fs";import{open as L,readdir as T,stat as B}from"node:fs/promises";import x from"node:path";var I=new Set([".yaml",".yml",".json"]);async function V(e){let n=[];async function t(r){let o=await T(r,{withFileTypes:!0});for(let s of o){if(s.name.startsWith("."))continue;let i=x.join(r,s.name);if(s.isDirectory()){await t(i);continue}s.isFile()&&I.has(x.extname(s.name).toLowerCase())&&n.push(i)}}return await t(e),n.sort(),n}async function Q(e,n=4096){let t=await L(e,"r");try{let r=Buffer.allocUnsafe(n),{bytesRead:o}=await t.read(r,0,n,0);return r.toString("utf8",0,o)}finally{await t.close()}}function Z(e){return x.resolve(process.cwd(),e)}async function v(e){if(!J(e))throw new H(`Traffic file or folder not found: ${e}`);let n=await B(e);if(n.isFile())return[e];if(!n.isDirectory())return[];let t=[];async function r(o){let s=await T(o,{withFileTypes:!0});for(let i of s){if(i.name.startsWith("."))continue;let a=x.join(o,i.name);if(i.isDirectory()){await r(a);continue}i.isFile()&&t.push(a)}}return await r(e),t.sort(),t}var z="drift.local",q=`http://${z}`;function l(e){return e===z}var F=new Set(["accept","accept-charset","accept-encoding","accept-language","authorization","baggage","cache-control","cdn-loop","cookie","connection","content-length","content-type","dpr","dnt","downlink","ect","forwarded","host","if-match","if-modified-since","if-none-match","if-range","if-unmodified-since","origin","pragma","priority","range","referer","sec-fetch-dest","sec-fetch-mode","sec-fetch-site","sec-fetch-user","sec-gpc","sentry-trace","te","traceparent","tracestate","upgrade","upgrade-insecure-requests","user-agent","via","x-client-trace-id","x-cloud-trace-context","x-correlation-id","x-http-method-override","x-hub-signature","x-hub-signature-256","x-method-override","x-real-ip","x-request-id","x-forwarded-for","x-forwarded-host","x-forwarded-port","x-forwarded-proto"]),j=["cf-","sec-ch-","sec-fetch-","x-amz-","x-amzn-","x-b3-","x-envoy-","x-forwarded-","x-github-"],C=`
|
|
8
8
|
`;function te(e){return e.split(C)}function S(e,n,t){let r=n.toLowerCase(),o=e[r];if(o===void 0){e[r]=t;return}e[r]=r==="set-cookie"?`${o}${C}${t}`:`${o},${t}`}function w(e){if(!c(e)&&!Array.isArray(e))return{};let n={};if(Array.isArray(e)){for(let t of e){if(!c(t))continue;let{name:r,value:o}=t;typeof r=="string"&&o!==void 0&&S(n,r,String(o))}return n}for(let[t,r]of Object.entries(e))if(r!=null){if(Array.isArray(r)){for(let o of r)S(n,t,String(o));continue}S(n,t,String(r))}return n}function m(e){try{return new URL(e)}catch{return new URL(e,q)}}function N(e){return e.length>1&&e.endsWith("/")?e.slice(0,-1):e}function b(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function re(e){let n=[],t=0,r=e.startsWith("/")?e:`/${e}`,s=N(r).split("/").map(i=>{if(!i)return"";let a=[...i.matchAll(/\{([^}]+)\}/g)],h=n.length,f="",p=0,u=0;for(let[y,d]of a.entries()){let R=i.slice(u,d.index);f+=b(R),p+=R.length,n.push(d[1]),u=d.index+d[0].length;let E=a[y+1];if(!E){f+="([^/]+)";continue}let A=i.slice(u,E.index);f+=A?`((?:(?!${b(A)})[^/])+)`:"([^/])"}let g=i.slice(u);return f+=b(g),p+=g.length,n.length===h?t+=2:p>0&&(t+=1),f}).join("/");return{regex:new RegExp(`^${s||"/"}$`),params:n,score:t}}function k(e,n){if(n&&O(e))try{return JSON.parse(n)}catch{return}}function $(e){return e?e.split(";")[0]?.trim().toLowerCase()??"":""}function O(e){let n=$(e);return n==="application/json"||n.endsWith("+json")}function oe(e,n){let t=$(n);if(!t)return e["application/json"]??e["*/*"];if(e[t]!==void 0)return e[t];let[r,o]=t.split("/");if(r&&o){let s=`${r}/*`;if(e[s]!==void 0)return e[s]}return e["*/*"]}function ie(e){let n=new Set,t=[];for(let r of e){let o=r.trim().toLowerCase();o.length!==0&&(o.endsWith("*")?t.push(o.slice(0,-1)):n.add(o))}return{names:n,prefixes:t}}function se(e,n){let t=e.toLowerCase();return t.startsWith(":")||F.has(t)||j.some(r=>t.startsWith(r))?!0:n?n.names.has(t)||n.prefixes.some(r=>t.startsWith(r)):!1}import{createReadStream as W}from"node:fs";import{readFile as D}from"node:fs/promises";import{createInterface as _}from"node:readline";function M(e){if(e!=null){if(typeof e=="string")return e;if(Buffer.isBuffer(e))return e.toString("utf8");if(c(e)||Array.isArray(e))try{return JSON.stringify(e)}catch{return String(e)}return String(e)}}function ge(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()!==""){let n=Number(e);if(Number.isFinite(n))return n}}function P(e,n){if(e!=null){if(n==="base64"&&typeof e=="string")try{return Buffer.from(e,"base64").toString("utf8")}catch{return e}return M(e)}}function le(e,n,t){let r=e.method?.toUpperCase(),o=e.url;if(!r||!o)return null;let s=w(e.requestHeaders),i=m(o);if(l(i.host)&&s.host)try{i=new URL(`${i.protocol}//${s.host}${i.pathname}${i.search}`)}catch{i=m(o)}let a=e.requestContentType??s["content-type"],h=P(e.requestBody),f={method:r,url:i.toString(),path:i.pathname,query:i.searchParams,protocol:i.protocol,protocolKnown:e.schemeKnown??/^https?:\/\//i.test(o),host:l(i.host)?void 0:i.host||void 0,headers:s,contentType:a,bodyText:h,bodyJson:k(a,h)},p,u=e.responseStatus;if(u!==void 0){let g=w(e.responseHeaders),y=e.responseContentType??g["content-type"],d=P(e.responseBody);p={status:u,statusText:e.responseStatusText,headers:g,contentType:y,bodyText:d,bodyJson:k(y,d)}}return{index:n,source:t,startedAt:e.startedAt,request:f,response:p,raw:e.raw}}async function*me(e){let n=W(e,{encoding:"utf8"}),t=_({input:n,crlfDelay:1/0});for await(let r of t){let o=r.trim();if(o)try{let s=JSON.parse(o);c(s)&&(yield s)}catch{}}}async function*he(e,n){let t=await D(e,"utf8"),r=JSON.parse(t);if(n)for(let o of n.split("."))r=c(r)?r[o]:void 0;if(Array.isArray(r))for(let o of r)c(o)&&(yield o)}function ye(e){return w(e)["content-type"]}function Se(e){return e?.replace(/\/+$/,"")||void 0}function U(e,n){if(!n||n==="/")return e||"/";if(e===n)return"/";if(e.startsWith(`${n}/`))return e.slice(n.length)||"/"}function be(e,n){if(n.startsWith("/"))return U(e.path,n);let t=m(n.includes("://")?n:`http://${n}`);if(!(l(t.host)||e.host!==void 0&&e.host.toLowerCase()!==t.host))return U(e.path,N(t.pathname))}export{V as a,Q as b,Z as c,v as d,l as e,te as f,m as g,N as h,re as i,$ as j,O as k,oe as l,ie as m,se as n,M as o,ge as p,P as q,le as r,me as s,he as t,ye as u,Se as v,be as w};
|
|
@@ -4,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"./CRJRRBMV.js";import{A as ue,X as le,Y as he,aa as b,c as L,ea as fe,f as ie,fa as de,ga as j,ia as ye,ja as U,ka as A,oa as k,p as ae,pa as Se,q as pe,qa as ge,r as ce,ra as Q,sa as K,ua as Ce,v as me,xa as be}from"./VW4MCIRI.js";import"./6RTITFQA.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"./UJ5HQQDZ.js";import{A as ue,X as le,Y as he,aa as b,c as L,ea as fe,f as ie,fa as de,ga as j,ia as ye,ja as U,ka as A,oa as k,p as ae,pa as Se,q as pe,qa as ge,r as ce,ra as Q,sa as K,ua as Ce,v as me,xa as be}from"./IPCQDGPM.js";import"./6RTITFQA.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};
|