@redocly/openapi-docs 3.10.0-next.1 → 3.10.0-next.3

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.addMarkdownItems=addMarkdownItems;const markdoc_1=require("@markdoc/markdoc"),theme_1=require("@redocly/theme"),models_1=require("../../models"),utils_1=require("../../utils"),simplifyAstStructure_1=require("../../utils/simplifyAstStructure");function addMarkdownItems(t,e,i){const r=(0,theme_1.isString)(t)?(0,simplifyAstStructure_1.simplifyAstStructure)((0,markdoc_1.parse)(t)):markdoc_1.Ast.fromJSON(JSON.stringify(null==t?void 0:t.result)),s=[];let n;const l=(t,e,i=s,r,n)=>{let l;t=(0,utils_1.unescapeHTMLChars)(t),r.attributes.id?l=r.attributes.id:(l=n?`${n}/${(0,utils_1.safeSlugify)(t)}`:`section/${(0,utils_1.safeSlugify)(t)}`,r.attributes.id=l);const o={id:l.toLowerCase(),name:t,level:e,items:[],ast:[r]};return i.push(o),o},o=(t,e)=>{var i,r;null===(r=null===(i=t[t.length-1])||void 0===i?void 0:i.ast)||void 0===r||r.push(e)},u=t=>{var e;const i=getMarkdownContent(t)||"";"heading"===t.type&&1===t.attributes.level?n=l(i,t.attributes.level,void 0,t):t.attributes.level?l(i,t.attributes.level,null==n?void 0:n.items,t,null==n?void 0:n.id):(null===(e=null==n?void 0:n.items)||void 0===e?void 0:e.length)?o(null==n?void 0:n.items,t):(null==s?void 0:s.length)&&o(s,t)};if(Array.isArray(r))for(const t of r)u(t);else u(r);return mapHeadingsDeep(e,s,i)}function mapHeadingsDeep(t,e,i=1){return e.map((e=>{const r=(0,models_1.getTagOrGroup)("section",e,t);return r.depth=i,e.items&&(r.items=mapHeadingsDeep(r,e.items,i+1)),r}))}function getMarkdownContent(t){var e,i;return"string"==typeof(null===(e=null==t?void 0:t.attributes)||void 0===e?void 0:e.content)?null===(i=t.attributes)||void 0===i?void 0:i.content:(null==t?void 0:t.children)?getMarkdownContent(t.children[0]):void 0}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.addMarkdownItems=addMarkdownItems;const markdoc_1=require("@markdoc/markdoc"),theme_1=require("@redocly/theme"),models_1=require("../../models"),utils_1=require("../../utils"),simplifyAstStructure_1=require("../../utils/simplifyAstStructure");function addMarkdownItems(t,e,i){const r=(0,theme_1.isString)(t)?(0,simplifyAstStructure_1.simplifyAstStructure)((0,markdoc_1.parse)(t)):markdoc_1.Ast.fromJSON(JSON.stringify(null==t?void 0:t.result)),s=[];let l;const n=(t,e,i=s,r,l)=>{let n;t=(0,utils_1.unescapeHTMLChars)(t),r.attributes.id?n=r.attributes.id:(n=l?`${l}/${(0,utils_1.safeSlugify)(t)}`:`section/${(0,utils_1.safeSlugify)(t)}`,r.attributes.id=n);const o={id:n.toLowerCase(),name:t,level:e,items:[],ast:[r]};return i.push(o),o},o=(t,e)=>{var i,r;null===(r=null===(i=t[t.length-1])||void 0===i?void 0:i.ast)||void 0===r||r.push(e)},u=t=>{var i,r;const u=getMarkdownContent(t)||"",d=e&&"tag"===e.type?e.id:void 0;"heading"===t.type&&1===t.attributes.level?l=n(u,t.attributes.level,void 0,t,d):t.attributes.level?n(u,t.attributes.level,null==l?void 0:l.items,t,null!==(i=null==l?void 0:l.id)&&void 0!==i?i:d):(null===(r=null==l?void 0:l.items)||void 0===r?void 0:r.length)?o(null==l?void 0:l.items,t):(null==s?void 0:s.length)&&o(s,t)};if(Array.isArray(r))for(const t of r)u(t);else u(r);return mapHeadingsDeep(e,s,i)}function mapHeadingsDeep(t,e,i=1){return e.map((e=>{const r=(0,models_1.getTagOrGroup)("section",e,t);return r.depth=i,e.items&&(r.items=mapHeadingsDeep(r,e.items,i+1)),r}))}function getMarkdownContent(t){var e,i;return"string"==typeof(null===(e=null==t?void 0:t.attributes)||void 0===e?void 0:e.content)?null===(i=t.attributes)||void 0===i?void 0:i.content:(null==t?void 0:t.children)?getMarkdownContent(t.children[0]):void 0}
2
2
  //# sourceMappingURL=markdown.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getValueFromMdParsedExtension=exports.normalizeText=exports.dottedString=exports.isMergeableObject=exports.deleteEmptyArrayItem=exports.isArrayOfObjects=void 0,exports.mapWithLast=mapWithLast,exports.mapValues=mapValues,exports.flattenByProp=flattenByProp,exports.stripTrailingSlash=stripTrailingSlash,exports.isNumeric=isNumeric,exports.appendToMdHeading=appendToMdHeading,exports.isAbsoluteUrl=isAbsoluteUrl,exports.resolveUrl=resolveUrl,exports.titleize=titleize,exports.removeQueryStringAndHash=removeQueryStringAndHash,exports.escapeHTMLAttrChars=escapeHTMLAttrChars,exports.unescapeHTMLChars=unescapeHTMLChars,exports.sanitizeItemId=sanitizeItemId,exports.useSchemaTitle=useSchemaTitle,exports.get=get,exports.joinStringFactory=joinStringFactory,exports.getWindowReferenceOptions=getWindowReferenceOptions,exports.getJsUrl=getJsUrl,exports.isLastInArray=isLastInArray,exports.isLastProperty=isLastProperty;const url_1=require("url"),theme_1=require("@redocly/theme"),openapi_1=require("./openapi"),JsonPointer_1=require("./JsonPointer");function mapWithLast(e,t){const r=[];for(let n=0;n<e.length-1;n++)r.push(t(e[n],!1));return 0!==e.length&&r.push(t(e[e.length-1],!0)),r}function mapValues(e,t){const r={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=t(e[n],n,e));return r}function flattenByProp(e,t){const r=[],n=e=>{for(const s of e)r.push(s),s[t]&&n(s[t])};return n(e),r}function stripTrailingSlash(e){return e.endsWith("/")?e.substring(0,e.length-1):e}function isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}function appendToMdHeading(e,t,r){const n=new RegExp(`(^|\\n)#\\s?${t}\\s*\\n`,"i"),s=new RegExp(`((\\n|^)#\\s*${t}\\s*(\\n|$)(?:.|\\n)*?)(\\n#|$)`,"i");if(n.test(e))return e.replace(s,`$1\n\n${r}\n$4`);{const n=""===e||e.endsWith("\n\n")?"":e.endsWith("\n")?"\n":"\n\n";return`${e}${n}# ${t}\n\n${r}`}}const isArrayOfObjects=e=>Array.isArray(e)&&e.some((e=>(0,theme_1.isObject)(e)));exports.isArrayOfObjects=isArrayOfObjects;const deleteEmptyArrayItem=e=>e.filter((e=>!!e));exports.deleteEmptyArrayItem=deleteEmptyArrayItem;const isMergeableObject=e=>(0,theme_1.isObject)(e)&&!Array.isArray(e);function isAbsoluteUrl(e){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(e)}function resolveUrl(e,t){let r;if(t.startsWith("//")){const{protocol:n}=(0,url_1.parse)(e);r=`${n||"https:"}${t}`}else if(isAbsoluteUrl(t))r=t;else if(t.startsWith("/")){const n=(0,url_1.parse)(e);r=(0,url_1.format)(Object.assign(Object.assign({},n),{pathname:t}))}else r=stripTrailingSlash(e)+"/"+t;return stripTrailingSlash(r)}function titleize(e){return e.charAt(0).toUpperCase()+e.slice(1)}function removeQueryStringAndHash(e){try{const t=parseURL(e);return t.search="",t.hash="",t.toString()}catch(t){return e}}function parseURL(e){return"undefined"==typeof URL?new(require("url").URL)(e):new URL(e)}function escapeHTMLAttrChars(e){return e.replace(/["\\]/g,"\\$&")}function unescapeHTMLChars(e){return e.replace(/&#(\d+);/g,((e,t)=>String.fromCharCode(parseInt(t,10)))).replace(/&amp;/g,"&").replace(/&quot;/g,'"')}function sanitizeItemId(e){return e&&e.replace(/#/g,"_").toLowerCase()}function useSchemaTitle(e,t){return t||(0,openapi_1.isNamedDefinition)(e)&&JsonPointer_1.JsonPointer.baseName(e)||""}function get(e={},t,r){return"string"==typeof t&&(t=t.split(".")),t.reduce(((e,t)=>e&&e[t]?e[t]:r),e)}function joinStringFactory(e){return(...t)=>t.filter(Boolean).join(e)}function getWindowReferenceOptions(e){var t;return theme_1.IS_BROWSER?null===(t=null===window||void 0===window?void 0:window.REFERENCE_DOCS_OPTIONS)||void 0===t?void 0:t[e]:null}function getJsUrl(){var e;if(!theme_1.IS_BROWSER)return"";const t=+new Date+Math.random();try{return document.currentScript&&(document.currentScript.async||document.currentScript.defer)||document.write(`<script id="dummy${t}"><\/script>`),(null===(e=document.getElementById("dummy"+t))||void 0===e?void 0:e.previousSibling).src}catch(e){return""}}exports.isMergeableObject=isMergeableObject,exports.dottedString=joinStringFactory(".");const normalizeText=e=>(0,theme_1.isString)(e)?e:null==e?void 0:e.raw;exports.normalizeText=normalizeText;const getValueFromMdParsedExtension=(e,t)=>{const r=(null==e?void 0:e[`x-parsed-md-${t}`])||(null==e?void 0:e[t]);if(!(null==e?void 0:e[`x-parsed-md-${t}`]))return null==e?void 0:e[t];if("x-enumDescriptions"!==t)return normalizeMarkdownValue(e,t);let n={};for(const e in r)e.startsWith("x-parsed-md")||(n[e]=(null==r?void 0:r[`x-parsed-md-${e}`])||(null==r?void 0:r[e]));return Object.keys(n).length?n:r};function normalizeMarkdownValue(e,t){var r;const n=(null==e?void 0:e[`x-parsed-md-${t}`])||(null==e?void 0:e[t]);return(null==n?void 0:n.raw)?n:{result:(null==n?void 0:n.result)||(null===(r=null==e?void 0:e[t])||void 0===r?void 0:r.result)||(null==e?void 0:e[t]),raw:null==e?void 0:e[t]}}function isLastInArray(e,t){return t===e.length-1}function isLastProperty(e,t){const r=Object.keys(e);return r.indexOf(t)===r.length-1}exports.getValueFromMdParsedExtension=getValueFromMdParsedExtension;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getValueFromMdParsedExtension=exports.normalizeText=exports.dottedString=exports.isMergeableObject=exports.deleteEmptyArrayItem=exports.isArrayOfObjects=void 0,exports.mapWithLast=mapWithLast,exports.mapValues=mapValues,exports.flattenByProp=flattenByProp,exports.stripTrailingSlash=stripTrailingSlash,exports.isNumeric=isNumeric,exports.appendToMdHeading=appendToMdHeading,exports.isAbsoluteUrl=isAbsoluteUrl,exports.resolveUrl=resolveUrl,exports.titleize=titleize,exports.removeQueryStringAndHash=removeQueryStringAndHash,exports.escapeHTMLAttrChars=escapeHTMLAttrChars,exports.unescapeHTMLChars=unescapeHTMLChars,exports.sanitizeItemId=sanitizeItemId,exports.useSchemaTitle=useSchemaTitle,exports.get=get,exports.joinStringFactory=joinStringFactory,exports.getWindowReferenceOptions=getWindowReferenceOptions,exports.getJsUrl=getJsUrl,exports.isLastInArray=isLastInArray,exports.isLastProperty=isLastProperty;const url_1=require("url"),theme_1=require("@redocly/theme"),openapi_1=require("./openapi"),JsonPointer_1=require("./JsonPointer");function mapWithLast(e,t){const r=[];for(let n=0;n<e.length-1;n++)r.push(t(e[n],!1));return 0!==e.length&&r.push(t(e[e.length-1],!0)),r}function mapValues(e,t){const r={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=t(e[n],n,e));return r}function flattenByProp(e,t){const r=[],n=e=>{for(const s of e)r.push(s),s[t]&&n(s[t])};return n(e),r}function stripTrailingSlash(e){return e.endsWith("/")?e.substring(0,e.length-1):e}function isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}function appendToMdHeading(e,t,r){const n=new RegExp(`(^|\\n)#\\s?${t}\\s*\\n`,"i"),s=new RegExp(`((\\n|^)#\\s*${t}\\s*(\\n|$)(?:.|\\n)*?)(\\n#|$)`,"i");if(n.test(e))return e.replace(s,`$1\n\n${r}\n$4`);{const n=""===e||e.endsWith("\n\n")?"":e.endsWith("\n")?"\n":"\n\n";return`${e}${n}# ${t}\n\n${r}`}}const isArrayOfObjects=e=>Array.isArray(e)&&e.some((e=>(0,theme_1.isObject)(e)));exports.isArrayOfObjects=isArrayOfObjects;const deleteEmptyArrayItem=e=>e.filter((e=>!!e));exports.deleteEmptyArrayItem=deleteEmptyArrayItem;const isMergeableObject=e=>(0,theme_1.isObject)(e)&&!Array.isArray(e);function isAbsoluteUrl(e){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(e)}function resolveUrl(e,t){let r;if(t.startsWith("//")){const{protocol:n}=(0,url_1.parse)(e);r=`${n||"https:"}${t}`}else if(isAbsoluteUrl(t))r=t;else if(t.startsWith("/")){const n=(0,url_1.parse)(e);r=(0,url_1.format)(Object.assign(Object.assign({},n),{pathname:t}))}else r=stripTrailingSlash(e)+"/"+t;return stripTrailingSlash(r)}function titleize(e){return e.charAt(0).toUpperCase()+e.slice(1)}function removeQueryStringAndHash(e){try{const t=parseURL(e);return t.search="",t.hash="",t.toString()}catch(t){return e}}function parseURL(e){return"undefined"==typeof URL?new(require("url").URL)(e):new URL(e)}function escapeHTMLAttrChars(e){return e.replace(/["\\]/g,"\\$&")}function unescapeHTMLChars(e){return e.replace(/&#(\d+);/g,((e,t)=>String.fromCharCode(parseInt(t,10)))).replace(/&amp;/g,"&").replace(/&quot;/g,'"')}function sanitizeItemId(e){return e&&e.replace(/#/g,"_").toLowerCase()}function useSchemaTitle(e,t){return t||(0,openapi_1.isNamedDefinition)(e)&&JsonPointer_1.JsonPointer.baseName(e)||""}function get(e={},t,r){return"string"==typeof t&&(t=t.split(".")),t.reduce(((e,t)=>e&&e[t]?e[t]:r),e)}function joinStringFactory(e){return(...t)=>t.filter(Boolean).join(e)}function getWindowReferenceOptions(e){var t;return theme_1.IS_BROWSER?null===(t=null===window||void 0===window?void 0:window.REFERENCE_DOCS_OPTIONS)||void 0===t?void 0:t[e]:null}function getJsUrl(){var e;if(!theme_1.IS_BROWSER)return"";const t=+new Date+Math.random();try{return document.currentScript&&(document.currentScript.async||document.currentScript.defer)||document.write(`<script id="dummy${t}"><\/script>`),(null===(e=document.getElementById("dummy"+t))||void 0===e?void 0:e.previousSibling).src}catch(e){return""}}exports.isMergeableObject=isMergeableObject,exports.dottedString=joinStringFactory(".");const normalizeText=e=>(0,theme_1.isString)(e)?e:null==e?void 0:e.raw;exports.normalizeText=normalizeText;const getValueFromMdParsedExtension=(e,t)=>{const r=(null==e?void 0:e[`x-parsed-md-${t}`])||(null==e?void 0:e[t]);if(!r)return;if(!(null==e?void 0:e[`x-parsed-md-${t}`])&&"x-enumDescriptions"!==t)return null==e?void 0:e[t];if("x-enumDescriptions"!==t)return normalizeMarkdownValue(e,t);let n={};for(const e in r)e.startsWith("x-parsed-md")||(n[e]=(null==r?void 0:r[`x-parsed-md-${e}`])||(null==r?void 0:r[e]));return Object.keys(n).length?n:r};function normalizeMarkdownValue(e,t){var r;const n=(null==e?void 0:e[`x-parsed-md-${t}`])||(null==e?void 0:e[t]);return(null==n?void 0:n.raw)?n:{result:(null==n?void 0:n.result)||(null===(r=null==e?void 0:e[t])||void 0===r?void 0:r.result)||(null==e?void 0:e[t]),raw:null==e?void 0:e[t]}}function isLastInArray(e,t){return t===e.length-1}function isLastProperty(e,t){const r=Object.keys(e);return r.indexOf(t)===r.length-1}exports.getValueFromMdParsedExtension=getValueFromMdParsedExtension;
2
2
  //# sourceMappingURL=helpers.js.map
@@ -1,2 +1,2 @@
1
- import{parse,Ast}from"@markdoc/markdoc";import{isString}from"@redocly/theme";import{getTagOrGroup}from"../../models";import{safeSlugify,unescapeHTMLChars}from"../../utils";import{simplifyAstStructure}from"../../utils/simplifyAstStructure";export function addMarkdownItems(t,e,i){const r=isString(t)?simplifyAstStructure(parse(t)):Ast.fromJSON(JSON.stringify(null==t?void 0:t.result)),n=[];let o;const s=(t,e,i=n,r,o)=>{let s;t=unescapeHTMLChars(t),r.attributes.id?s=r.attributes.id:(s=o?`${o}/${safeSlugify(t)}`:`section/${safeSlugify(t)}`,r.attributes.id=s);const l={id:s.toLowerCase(),name:t,level:e,items:[],ast:[r]};return i.push(l),l},l=(t,e)=>{var i,r;null===(r=null===(i=t[t.length-1])||void 0===i?void 0:i.ast)||void 0===r||r.push(e)},u=t=>{var e;const i=getMarkdownContent(t)||"";"heading"===t.type&&1===t.attributes.level?o=s(i,t.attributes.level,void 0,t):t.attributes.level?s(i,t.attributes.level,null==o?void 0:o.items,t,null==o?void 0:o.id):(null===(e=null==o?void 0:o.items)||void 0===e?void 0:e.length)?l(null==o?void 0:o.items,t):(null==n?void 0:n.length)&&l(n,t)};if(Array.isArray(r))for(const t of r)u(t);else u(r);return mapHeadingsDeep(e,n,i)}function mapHeadingsDeep(t,e,i=1){return e.map((e=>{const r=getTagOrGroup("section",e,t);return r.depth=i,e.items&&(r.items=mapHeadingsDeep(r,e.items,i+1)),r}))}function getMarkdownContent(t){var e,i;return"string"==typeof(null===(e=null==t?void 0:t.attributes)||void 0===e?void 0:e.content)?null===(i=t.attributes)||void 0===i?void 0:i.content:(null==t?void 0:t.children)?getMarkdownContent(t.children[0]):void 0}
1
+ import{parse,Ast}from"@markdoc/markdoc";import{isString}from"@redocly/theme";import{getTagOrGroup}from"../../models";import{safeSlugify,unescapeHTMLChars}from"../../utils";import{simplifyAstStructure}from"../../utils/simplifyAstStructure";export function addMarkdownItems(t,e,i){const r=isString(t)?simplifyAstStructure(parse(t)):Ast.fromJSON(JSON.stringify(null==t?void 0:t.result)),o=[];let n;const s=(t,e,i=o,r,n)=>{let s;t=unescapeHTMLChars(t),r.attributes.id?s=r.attributes.id:(s=n?`${n}/${safeSlugify(t)}`:`section/${safeSlugify(t)}`,r.attributes.id=s);const l={id:s.toLowerCase(),name:t,level:e,items:[],ast:[r]};return i.push(l),l},l=(t,e)=>{var i,r;null===(r=null===(i=t[t.length-1])||void 0===i?void 0:i.ast)||void 0===r||r.push(e)},u=t=>{var i,r;const u=getMarkdownContent(t)||"",a=e&&"tag"===e.type?e.id:void 0;"heading"===t.type&&1===t.attributes.level?n=s(u,t.attributes.level,void 0,t,a):t.attributes.level?s(u,t.attributes.level,null==n?void 0:n.items,t,null!==(i=null==n?void 0:n.id)&&void 0!==i?i:a):(null===(r=null==n?void 0:n.items)||void 0===r?void 0:r.length)?l(null==n?void 0:n.items,t):(null==o?void 0:o.length)&&l(o,t)};if(Array.isArray(r))for(const t of r)u(t);else u(r);return mapHeadingsDeep(e,o,i)}function mapHeadingsDeep(t,e,i=1){return e.map((e=>{const r=getTagOrGroup("section",e,t);return r.depth=i,e.items&&(r.items=mapHeadingsDeep(r,e.items,i+1)),r}))}function getMarkdownContent(t){var e,i;return"string"==typeof(null===(e=null==t?void 0:t.attributes)||void 0===e?void 0:e.content)?null===(i=t.attributes)||void 0===i?void 0:i.content:(null==t?void 0:t.children)?getMarkdownContent(t.children[0]):void 0}
2
2
  //# sourceMappingURL=markdown.js.map
@@ -1,2 +1,2 @@
1
- import{format,parse}from"url";import{IS_BROWSER,isObject,isString}from"@redocly/theme";import{isNamedDefinition}from"./openapi";import{JsonPointer}from"./JsonPointer";export function mapWithLast(t,e){const r=[];for(let n=0;n<t.length-1;n++)r.push(e(t[n],!1));return 0!==t.length&&r.push(e(t[t.length-1],!0)),r}export function mapValues(t,e){const r={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=e(t[n],n,t));return r}export function flattenByProp(t,e){const r=[],n=t=>{for(const o of t)r.push(o),o[e]&&n(o[e])};return n(t),r}export function stripTrailingSlash(t){return t.endsWith("/")?t.substring(0,t.length-1):t}export function isNumeric(t){return!isNaN(parseFloat(t))&&isFinite(t)}export function appendToMdHeading(t,e,r){const n=new RegExp(`(^|\\n)#\\s?${e}\\s*\\n`,"i"),o=new RegExp(`((\\n|^)#\\s*${e}\\s*(\\n|$)(?:.|\\n)*?)(\\n#|$)`,"i");if(n.test(t))return t.replace(o,`$1\n\n${r}\n$4`);{const n=""===t||t.endsWith("\n\n")?"":t.endsWith("\n")?"\n":"\n\n";return`${t}${n}# ${e}\n\n${r}`}}export const isArrayOfObjects=t=>Array.isArray(t)&&t.some((t=>isObject(t)));export const deleteEmptyArrayItem=t=>t.filter((t=>!!t));export const isMergeableObject=t=>isObject(t)&&!Array.isArray(t);export function isAbsoluteUrl(t){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(t)}export function resolveUrl(t,e){let r;if(e.startsWith("//")){const{protocol:n}=parse(t);r=`${n||"https:"}${e}`}else if(isAbsoluteUrl(e))r=e;else if(e.startsWith("/")){const n=parse(t);r=format(Object.assign(Object.assign({},n),{pathname:e}))}else r=stripTrailingSlash(t)+"/"+e;return stripTrailingSlash(r)}export function titleize(t){return t.charAt(0).toUpperCase()+t.slice(1)}export function removeQueryStringAndHash(t){try{const e=parseURL(t);return e.search="",e.hash="",e.toString()}catch(e){return t}}function parseURL(t){return"undefined"==typeof URL?new(require("url").URL)(t):new URL(t)}export function escapeHTMLAttrChars(t){return t.replace(/["\\]/g,"\\$&")}export function unescapeHTMLChars(t){return t.replace(/&#(\d+);/g,((t,e)=>String.fromCharCode(parseInt(e,10)))).replace(/&amp;/g,"&").replace(/&quot;/g,'"')}export function sanitizeItemId(t){return t&&t.replace(/#/g,"_").toLowerCase()}export function useSchemaTitle(t,e){return e||isNamedDefinition(t)&&JsonPointer.baseName(t)||""}export function get(t={},e,r){return"string"==typeof e&&(e=e.split(".")),e.reduce(((t,e)=>t&&t[e]?t[e]:r),t)}export function joinStringFactory(t){return(...e)=>e.filter(Boolean).join(t)}export const dottedString=joinStringFactory(".");export function getWindowReferenceOptions(t){var e;return IS_BROWSER?null===(e=null===window||void 0===window?void 0:window.REFERENCE_DOCS_OPTIONS)||void 0===e?void 0:e[t]:null}export function getJsUrl(){var t;if(!IS_BROWSER)return"";const e=+new Date+Math.random();try{return document.currentScript&&(document.currentScript.async||document.currentScript.defer)||document.write(`<script id="dummy${e}"><\/script>`),(null===(t=document.getElementById("dummy"+e))||void 0===t?void 0:t.previousSibling).src}catch(t){return""}}export const normalizeText=t=>isString(t)?t:null==t?void 0:t.raw;export const getValueFromMdParsedExtension=(t,e)=>{const r=(null==t?void 0:t[`x-parsed-md-${e}`])||(null==t?void 0:t[e]);if(!(null==t?void 0:t[`x-parsed-md-${e}`]))return null==t?void 0:t[e];if("x-enumDescriptions"!==e)return normalizeMarkdownValue(t,e);let n={};for(const t in r)t.startsWith("x-parsed-md")||(n[t]=(null==r?void 0:r[`x-parsed-md-${t}`])||(null==r?void 0:r[t]));return Object.keys(n).length?n:r};function normalizeMarkdownValue(t,e){var r;const n=(null==t?void 0:t[`x-parsed-md-${e}`])||(null==t?void 0:t[e]);return(null==n?void 0:n.raw)?n:{result:(null==n?void 0:n.result)||(null===(r=null==t?void 0:t[e])||void 0===r?void 0:r.result)||(null==t?void 0:t[e]),raw:null==t?void 0:t[e]}}export function isLastInArray(t,e){return e===t.length-1}export function isLastProperty(t,e){const r=Object.keys(t);return r.indexOf(e)===r.length-1}
1
+ import{format,parse}from"url";import{IS_BROWSER,isObject,isString}from"@redocly/theme";import{isNamedDefinition}from"./openapi";import{JsonPointer}from"./JsonPointer";export function mapWithLast(t,e){const r=[];for(let n=0;n<t.length-1;n++)r.push(e(t[n],!1));return 0!==t.length&&r.push(e(t[t.length-1],!0)),r}export function mapValues(t,e){const r={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=e(t[n],n,t));return r}export function flattenByProp(t,e){const r=[],n=t=>{for(const o of t)r.push(o),o[e]&&n(o[e])};return n(t),r}export function stripTrailingSlash(t){return t.endsWith("/")?t.substring(0,t.length-1):t}export function isNumeric(t){return!isNaN(parseFloat(t))&&isFinite(t)}export function appendToMdHeading(t,e,r){const n=new RegExp(`(^|\\n)#\\s?${e}\\s*\\n`,"i"),o=new RegExp(`((\\n|^)#\\s*${e}\\s*(\\n|$)(?:.|\\n)*?)(\\n#|$)`,"i");if(n.test(t))return t.replace(o,`$1\n\n${r}\n$4`);{const n=""===t||t.endsWith("\n\n")?"":t.endsWith("\n")?"\n":"\n\n";return`${t}${n}# ${e}\n\n${r}`}}export const isArrayOfObjects=t=>Array.isArray(t)&&t.some((t=>isObject(t)));export const deleteEmptyArrayItem=t=>t.filter((t=>!!t));export const isMergeableObject=t=>isObject(t)&&!Array.isArray(t);export function isAbsoluteUrl(t){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(t)}export function resolveUrl(t,e){let r;if(e.startsWith("//")){const{protocol:n}=parse(t);r=`${n||"https:"}${e}`}else if(isAbsoluteUrl(e))r=e;else if(e.startsWith("/")){const n=parse(t);r=format(Object.assign(Object.assign({},n),{pathname:e}))}else r=stripTrailingSlash(t)+"/"+e;return stripTrailingSlash(r)}export function titleize(t){return t.charAt(0).toUpperCase()+t.slice(1)}export function removeQueryStringAndHash(t){try{const e=parseURL(t);return e.search="",e.hash="",e.toString()}catch(e){return t}}function parseURL(t){return"undefined"==typeof URL?new(require("url").URL)(t):new URL(t)}export function escapeHTMLAttrChars(t){return t.replace(/["\\]/g,"\\$&")}export function unescapeHTMLChars(t){return t.replace(/&#(\d+);/g,((t,e)=>String.fromCharCode(parseInt(e,10)))).replace(/&amp;/g,"&").replace(/&quot;/g,'"')}export function sanitizeItemId(t){return t&&t.replace(/#/g,"_").toLowerCase()}export function useSchemaTitle(t,e){return e||isNamedDefinition(t)&&JsonPointer.baseName(t)||""}export function get(t={},e,r){return"string"==typeof e&&(e=e.split(".")),e.reduce(((t,e)=>t&&t[e]?t[e]:r),t)}export function joinStringFactory(t){return(...e)=>e.filter(Boolean).join(t)}export const dottedString=joinStringFactory(".");export function getWindowReferenceOptions(t){var e;return IS_BROWSER?null===(e=null===window||void 0===window?void 0:window.REFERENCE_DOCS_OPTIONS)||void 0===e?void 0:e[t]:null}export function getJsUrl(){var t;if(!IS_BROWSER)return"";const e=+new Date+Math.random();try{return document.currentScript&&(document.currentScript.async||document.currentScript.defer)||document.write(`<script id="dummy${e}"><\/script>`),(null===(t=document.getElementById("dummy"+e))||void 0===t?void 0:t.previousSibling).src}catch(t){return""}}export const normalizeText=t=>isString(t)?t:null==t?void 0:t.raw;export const getValueFromMdParsedExtension=(t,e)=>{const r=(null==t?void 0:t[`x-parsed-md-${e}`])||(null==t?void 0:t[e]);if(!r)return;if(!(null==t?void 0:t[`x-parsed-md-${e}`])&&"x-enumDescriptions"!==e)return null==t?void 0:t[e];if("x-enumDescriptions"!==e)return normalizeMarkdownValue(t,e);let n={};for(const t in r)t.startsWith("x-parsed-md")||(n[t]=(null==r?void 0:r[`x-parsed-md-${t}`])||(null==r?void 0:r[t]));return Object.keys(n).length?n:r};function normalizeMarkdownValue(t,e){var r;const n=(null==t?void 0:t[`x-parsed-md-${e}`])||(null==t?void 0:t[e]);return(null==n?void 0:n.raw)?n:{result:(null==n?void 0:n.result)||(null===(r=null==t?void 0:t[e])||void 0===r?void 0:r.result)||(null==t?void 0:t[e]),raw:null==t?void 0:t[e]}}export function isLastInArray(t,e){return e===t.length-1}export function isLastProperty(t,e){const r=Object.keys(t);return r.indexOf(e)===r.length-1}
2
2
  //# sourceMappingURL=helpers.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/openapi-docs",
3
- "version": "3.10.0-next.1",
3
+ "version": "3.10.0-next.3",
4
4
  "description": "Redocly OpenAPI Docs",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",
@@ -46,7 +46,7 @@
46
46
  "util": "~0.12.5",
47
47
  "web-vitals": "3.3.1",
48
48
  "@redocly/config": "0.24.1",
49
- "@redocly/replay": "0.13.0-next.1"
49
+ "@redocly/replay": "0.13.0-next.3"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@shikijs/transformers": "1.24.0",
@@ -92,7 +92,7 @@
92
92
  "webpack": "5.94.0",
93
93
  "webpack-cli": "5.1.4",
94
94
  "webpack-dev-server": "5.1.0",
95
- "@redocly/theme": "0.54.0-next.1"
95
+ "@redocly/theme": "0.54.0-next.3"
96
96
  },
97
97
  "scripts": {
98
98
  "start": "npm run copy-highlight-hook && webpack serve --mode=development --hot",