@storyblok/js 3.1.6 → 3.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- (function(y,E){typeof exports=="object"&&typeof module<"u"?E(exports):typeof define=="function"&&define.amd?define(["exports"],E):(y=typeof globalThis<"u"?globalThis:y||self,E(y.storyblok={}))})(this,function(y){"use strict";let E=!1;const H=[],U=i=>new Promise((e,t)=>{if(typeof window>"u"||(window.storyblokRegisterEvent=r=>{if(window.location===window.parent.location){console.warn("You are not in Draft Mode or in the Visual Editor.");return}E?r():H.push(r)},document.getElementById("storyblok-javascript-bridge")))return;const s=document.createElement("script");s.async=!0,s.src=i,s.id="storyblok-javascript-bridge",s.onerror=r=>t(r),s.onload=r=>{H.forEach(n=>n()),E=!0,e(r)},document.getElementsByTagName("head")[0].appendChild(s)});var K=Object.defineProperty,Y=(i,e,t)=>e in i?K(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,p=(i,e,t)=>Y(i,typeof e!="symbol"?e+"":e,t);function B(i){return!(i!==i||i===1/0||i===-1/0)}function X(i,e,t){if(!B(e))throw new TypeError("Expected `limit` to be a finite number");if(!B(t))throw new TypeError("Expected `interval` to be a finite number");const s=[];let r=[],n=0;const o=function(){n++;const a=setTimeout(function(){n--,s.length>0&&o(),r=r.filter(function(d){return d!==a})},t);r.indexOf(a)<0&&r.push(a);const h=s.shift();h.resolve(i.apply(h.self,h.args))},l=function(...a){const h=this;return new Promise(function(d,u){s.push({resolve:d,reject:u,args:a,self:h}),n<e&&o()})};return l.abort=function(){r.forEach(clearTimeout),r=[],s.forEach(function(a){a.reject(function(){Error.call(this,"Throttled function aborted"),this.name="AbortError"})}),s.length=0},l}class O{constructor(){p(this,"isCDNUrl",(e="")=>e.indexOf("/cdn/")>-1),p(this,"getOptionsPage",(e,t=25,s=1)=>({...e,per_page:t,page:s})),p(this,"delay",e=>new Promise(t=>setTimeout(t,e))),p(this,"arrayFrom",(e=0,t)=>[...Array(e)].map(t)),p(this,"range",(e=0,t=e)=>{const s=Math.abs(t-e)||0,r=e<t?1:-1;return this.arrayFrom(s,(n,o)=>o*r+e)}),p(this,"asyncMap",async(e,t)=>Promise.all(e.map(t))),p(this,"flatMap",(e=[],t)=>e.map(t).reduce((s,r)=>[...s,...r],[])),p(this,"escapeHTML",function(e){const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},s=/[&<>"']/g,r=RegExp(s.source);return e&&r.test(e)?e.replace(s,n=>t[n]):e})}stringify(e,t,s){const r=[];for(const n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;const o=e[n],l=s?"":encodeURIComponent(n);let a;typeof o=="object"?a=this.stringify(o,t?t+encodeURIComponent("["+l+"]"):l,Array.isArray(o)):a=(t?t+encodeURIComponent("["+l+"]"):l)+"="+encodeURIComponent(o),r.push(a)}return r.join("&")}getRegionURL(e){const t="api.storyblok.com",s="api-us.storyblok.com",r="app.storyblokchina.cn",n="api-ap.storyblok.com",o="api-ca.storyblok.com";switch(e){case"us":return s;case"cn":return r;case"ap":return n;case"ca":return o;default:return t}}}const W=function(i,e){const t={};for(const s in i){const r=i[s];e.indexOf(s)>-1&&r!==null&&(t[s]=r)}return t},Q=i=>i==="email",Z=()=>({singleTag:"hr"}),ee=()=>({tag:"blockquote"}),te=()=>({tag:"ul"}),se=i=>({tag:["pre",{tag:"code",attrs:i.attrs}]}),re=()=>({singleTag:"br"}),ie=i=>({tag:`h${i.attrs.level}`}),ne=i=>({singleTag:[{tag:"img",attrs:W(i.attrs,["src","alt","title"])}]}),oe=()=>({tag:"li"}),ae=()=>({tag:"ol"}),le=()=>({tag:"p"}),ce=i=>({tag:[{tag:"span",attrs:{"data-type":"emoji","data-name":i.attrs.name,emoji:i.attrs.emoji}}]}),he=()=>({tag:"b"}),ue=()=>({tag:"s"}),de=()=>({tag:"u"}),pe=()=>({tag:"strong"}),ge=()=>({tag:"code"}),fe=()=>({tag:"i"}),me=i=>{if(!i.attrs)return{tag:""};const e=new O().escapeHTML,t={...i.attrs},{linktype:s="url"}=i.attrs;if(delete t.linktype,t.href&&(t.href=e(i.attrs.href||"")),Q(s)&&(t.href=`mailto:${t.href}`),t.anchor&&(t.href=`${t.href}#${t.anchor}`,delete t.anchor),t.custom){for(const r in t.custom)t[r]=t.custom[r];delete t.custom}return{tag:[{tag:"a",attrs:t}]}},ye=i=>({tag:[{tag:"span",attrs:i.attrs}]}),be=()=>({tag:"sub"}),ke=()=>({tag:"sup"}),ve=i=>({tag:[{tag:"span",attrs:i.attrs}]}),$e=i=>{var e;return(e=i.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`background-color:${i.attrs.color};`}}]}:{tag:""}},Te=i=>{var e;return(e=i.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`color:${i.attrs.color}`}}]}:{tag:""}},D={nodes:{horizontal_rule:Z,blockquote:ee,bullet_list:te,code_block:se,hard_break:re,heading:ie,image:ne,list_item:oe,ordered_list:ae,paragraph:le,emoji:ce},marks:{bold:he,strike:ue,underline:de,strong:pe,code:ge,italic:fe,link:me,styled:ye,subscript:be,superscript:ke,anchor:ve,highlight:$e,textStyle:Te}},Re=function(i){const e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},t=/[&<>"']/g,s=RegExp(t.source);return i&&s.test(i)?i.replace(t,r=>e[r]):i};let z=!1;class we{constructor(e){p(this,"marks"),p(this,"nodes"),e||(e=D),this.marks=e.marks||[],this.nodes=e.nodes||[]}addNode(e,t){this.nodes[e]=t}addMark(e,t){this.marks[e]=t}render(e,t={optimizeImages:!1},s=!0){if(!z&&s&&(console.warn("Warning ⚠️: The RichTextResolver class is deprecated and will be removed in the next major release. Please use the `@storyblok/richtext` package instead. https://github.com/storyblok/richtext/"),z=!0),e&&e.content&&Array.isArray(e.content)){let r="";return e.content.forEach(n=>{r+=this.renderNode(n)}),t.optimizeImages?this.optimizeImages(r,t.optimizeImages):r}return console.warn(`The render method must receive an Object with a "content" field.
1
+ (function(y,j){typeof exports=="object"&&typeof module<"u"?j(exports):typeof define=="function"&&define.amd?define(["exports"],j):(y=typeof globalThis<"u"?globalThis:y||self,j(y.storyblok={}))})(this,function(y){"use strict";let j=!1;const z=[],B=i=>new Promise((e,t)=>{if(typeof window>"u"||(window.storyblokRegisterEvent=r=>{if(window.location===window.parent.location){console.warn("You are not in Draft Mode or in the Visual Editor.");return}j?r():z.push(r)},document.getElementById("storyblok-javascript-bridge")))return;const s=document.createElement("script");s.async=!0,s.src=i,s.id="storyblok-javascript-bridge",s.onerror=r=>t(r),s.onload=r=>{z.forEach(n=>n()),j=!0,e(r)},document.getElementsByTagName("head")[0].appendChild(s)});var W=Object.defineProperty,Q=(i,e,t)=>e in i?W(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,d=(i,e,t)=>Q(i,typeof e!="symbol"?e+"":e,t);function D(i){return!(i!==i||i===1/0||i===-1/0)}function Z(i,e,t){if(!D(e))throw new TypeError("Expected `limit` to be a finite number");if(!D(t))throw new TypeError("Expected `interval` to be a finite number");const s=[];let r=[],n=0;const o=function(){n++;const a=setTimeout(function(){n--,s.length>0&&o(),r=r.filter(function(u){return u!==a})},t);r.indexOf(a)<0&&r.push(a);const c=s.shift();c.resolve(i.apply(c.self,c.args))},l=function(...a){const c=this;return new Promise(function(u,p){s.push({resolve:u,reject:p,args:a,self:c}),n<e&&o()})};return l.abort=function(){r.forEach(clearTimeout),r=[],s.forEach(function(a){a.reject(function(){Error.call(this,"Throttled function aborted"),this.name="AbortError"})}),s.length=0},l}let L=class{constructor(){d(this,"isCDNUrl",(e="")=>e.indexOf("/cdn/")>-1),d(this,"getOptionsPage",(e,t=25,s=1)=>({...e,per_page:t,page:s})),d(this,"delay",e=>new Promise(t=>setTimeout(t,e))),d(this,"arrayFrom",(e=0,t)=>[...Array(e)].map(t)),d(this,"range",(e=0,t=e)=>{const s=Math.abs(t-e)||0,r=e<t?1:-1;return this.arrayFrom(s,(n,o)=>o*r+e)}),d(this,"asyncMap",async(e,t)=>Promise.all(e.map(t))),d(this,"flatMap",(e=[],t)=>e.map(t).reduce((s,r)=>[...s,...r],[])),d(this,"escapeHTML",function(e){const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},s=/[&<>"']/g,r=RegExp(s.source);return e&&r.test(e)?e.replace(s,n=>t[n]):e})}stringify(e,t,s){const r=[];for(const n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;const o=e[n],l=s?"":encodeURIComponent(n);let a;typeof o=="object"?a=this.stringify(o,t?t+encodeURIComponent("["+l+"]"):l,Array.isArray(o)):a=(t?t+encodeURIComponent("["+l+"]"):l)+"="+encodeURIComponent(o),r.push(a)}return r.join("&")}getRegionURL(e){const t="api.storyblok.com",s="api-us.storyblok.com",r="app.storyblokchina.cn",n="api-ap.storyblok.com",o="api-ca.storyblok.com";switch(e){case"us":return s;case"cn":return r;case"ap":return n;case"ca":return o;default:return t}}};const ee=function(i,e){const t={};for(const s in i){const r=i[s];e.indexOf(s)>-1&&r!==null&&(t[s]=r)}return t},te=i=>i==="email",se=()=>({singleTag:"hr"}),re=()=>({tag:"blockquote"}),ie=()=>({tag:"ul"}),ne=i=>({tag:["pre",{tag:"code",attrs:i.attrs}]}),oe=()=>({singleTag:"br"}),ae=i=>({tag:`h${i.attrs.level}`}),le=i=>({singleTag:[{tag:"img",attrs:ee(i.attrs,["src","alt","title"])}]}),ce=()=>({tag:"li"}),he=()=>({tag:"ol"}),ue=()=>({tag:"p"}),de=i=>({tag:[{tag:"span",attrs:{"data-type":"emoji","data-name":i.attrs.name,emoji:i.attrs.emoji}}]}),pe=()=>({tag:"b"}),ge=()=>({tag:"s"}),fe=()=>({tag:"u"}),me=()=>({tag:"strong"}),ye=()=>({tag:"code"}),be=()=>({tag:"i"}),ke=i=>{if(!i.attrs)return{tag:""};const e=new L().escapeHTML,t={...i.attrs},{linktype:s="url"}=i.attrs;if(delete t.linktype,t.href&&(t.href=e(i.attrs.href||"")),te(s)&&(t.href=`mailto:${t.href}`),t.anchor&&(t.href=`${t.href}#${t.anchor}`,delete t.anchor),t.custom){for(const r in t.custom)t[r]=t.custom[r];delete t.custom}return{tag:[{tag:"a",attrs:t}]}},ve=i=>({tag:[{tag:"span",attrs:i.attrs}]}),$e=()=>({tag:"sub"}),Te=()=>({tag:"sup"}),Re=i=>({tag:[{tag:"span",attrs:i.attrs}]}),we=i=>{var e;return(e=i.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`background-color:${i.attrs.color};`}}]}:{tag:""}},Se=i=>{var e;return(e=i.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`color:${i.attrs.color}`}}]}:{tag:""}},q={nodes:{horizontal_rule:se,blockquote:re,bullet_list:ie,code_block:ne,hard_break:oe,heading:ae,image:le,list_item:ce,ordered_list:he,paragraph:ue,emoji:de},marks:{bold:pe,strike:ge,underline:fe,strong:me,code:ye,italic:be,link:ke,styled:ve,subscript:$e,superscript:Te,anchor:Re,highlight:we,textStyle:Se}},_e=function(i){const e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},t=/[&<>"']/g,s=RegExp(t.source);return i&&s.test(i)?i.replace(t,r=>e[r]):i};let G=!1;class Ee{constructor(e){d(this,"marks"),d(this,"nodes"),e||(e=q),this.marks=e.marks||[],this.nodes=e.nodes||[]}addNode(e,t){this.nodes[e]=t}addMark(e,t){this.marks[e]=t}render(e,t={optimizeImages:!1},s=!0){if(!G&&s&&(console.warn("Warning ⚠️: The RichTextResolver class is deprecated and will be removed in the next major release. Please use the `@storyblok/richtext` package instead. https://github.com/storyblok/richtext/"),G=!0),e&&e.content&&Array.isArray(e.content)){let r="";return e.content.forEach(n=>{r+=this.renderNode(n)}),t.optimizeImages?this.optimizeImages(r,t.optimizeImages):r}return console.warn(`The render method must receive an Object with a "content" field.
2
2
  The "content" field must be an array of nodes as the type ISbRichtext.
3
3
  ISbRichtext:
4
4
  content?: ISbRichtext[]
@@ -21,4 +21,4 @@
21
21
  }
22
22
  ],
23
23
  type: 'doc'
24
- }`),""}optimizeImages(e,t){let s=0,r=0,n="",o="";typeof t!="boolean"&&(typeof t.width=="number"&&t.width>0&&(n+=`width="${t.width}" `,s=t.width),typeof t.height=="number"&&t.height>0&&(n+=`height="${t.height}" `,r=t.height),(t.loading==="lazy"||t.loading==="eager")&&(n+=`loading="${t.loading}" `),typeof t.class=="string"&&t.class.length>0&&(n+=`class="${t.class}" `),t.filters&&(typeof t.filters.blur=="number"&&t.filters.blur>=0&&t.filters.blur<=100&&(o+=`:blur(${t.filters.blur})`),typeof t.filters.brightness=="number"&&t.filters.brightness>=-100&&t.filters.brightness<=100&&(o+=`:brightness(${t.filters.brightness})`),t.filters.fill&&(t.filters.fill.match(/[0-9A-Fa-f]{6}/g)||t.filters.fill==="transparent")&&(o+=`:fill(${t.filters.fill})`),t.filters.format&&["webp","png","jpeg"].includes(t.filters.format)&&(o+=`:format(${t.filters.format})`),typeof t.filters.grayscale=="boolean"&&t.filters.grayscale&&(o+=":grayscale()"),typeof t.filters.quality=="number"&&t.filters.quality>=0&&t.filters.quality<=100&&(o+=`:quality(${t.filters.quality})`),t.filters.rotate&&[90,180,270].includes(t.filters.rotate)&&(o+=`:rotate(${t.filters.rotate})`),o.length>0&&(o="/filters"+o))),n.length>0&&(e=e.replace(/<img/g,`<img ${n.trim()}`));const l=s>0||r>0||o.length>0?`${s}x${r}${o}`:"";return e=e.replace(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g,`a.storyblok.com/f/$1/$2.$3/m/${l}`),typeof t!="boolean"&&(t.sizes||t.srcset)&&(e=e.replace(/<img.*?src=["|'](.*?)["|']/g,a=>{var h,d;const u=a.match(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g);if(u&&u.length>0){const m={srcset:(h=t.srcset)==null?void 0:h.map(b=>{if(typeof b=="number")return`//${u}/m/${b}x0${o} ${b}w`;if(typeof b=="object"&&b.length===2){let S=0,L=0;return typeof b[0]=="number"&&(S=b[0]),typeof b[1]=="number"&&(L=b[1]),`//${u}/m/${S}x${L}${o} ${S}w`}}).join(", "),sizes:(d=t.sizes)==null?void 0:d.map(b=>b).join(", ")};let $="";return m.srcset&&($+=`srcset="${m.srcset}" `),m.sizes&&($+=`sizes="${m.sizes}" `),a.replace(/<img/g,`<img ${$.trim()}`)}return a})),e}renderNode(e){const t=[];e.marks&&e.marks.forEach(r=>{const n=this.getMatchingMark(r);n&&n.tag!==""&&t.push(this.renderOpeningTag(n.tag))});const s=this.getMatchingNode(e);return s&&s.tag&&t.push(this.renderOpeningTag(s.tag)),e.content?e.content.forEach(r=>{t.push(this.renderNode(r))}):e.text?t.push(Re(e.text)):s&&s.singleTag?t.push(this.renderTag(s.singleTag," /")):s&&s.html?t.push(s.html):e.type==="emoji"&&t.push(this.renderEmoji(e)),s&&s.tag&&t.push(this.renderClosingTag(s.tag)),e.marks&&e.marks.slice(0).reverse().forEach(r=>{const n=this.getMatchingMark(r);n&&n.tag!==""&&t.push(this.renderClosingTag(n.tag))}),t.join("")}renderTag(e,t){return e.constructor===String?`<${e}${t}>`:e.map(s=>{if(s.constructor===String)return`<${s}${t}>`;{let r=`<${s.tag}`;if(s.attrs){for(const n in s.attrs)if(Object.prototype.hasOwnProperty.call(s.attrs,n)){const o=s.attrs[n];o!==null&&(r+=` ${n}="${o}"`)}}return`${r}${t}>`}}).join("")}renderOpeningTag(e){return this.renderTag(e,"")}renderClosingTag(e){return e.constructor===String?`</${e}>`:e.slice(0).reverse().map(t=>t.constructor===String?`</${t}>`:`</${t.tag}>`).join("")}getMatchingNode(e){const t=this.nodes[e.type];if(typeof t=="function")return t(e)}getMatchingMark(e){const t=this.marks[e.type];if(typeof t=="function")return t(e)}renderEmoji(e){if(e.attrs.emoji)return e.attrs.emoji;const t=[{tag:"img",attrs:{src:e.attrs.fallbackImage,draggable:"false",loading:"lazy",align:"absmiddle"}}];return this.renderTag(t," /")}}const I=we;class Se{constructor(e){p(this,"baseURL"),p(this,"timeout"),p(this,"headers"),p(this,"responseInterceptor"),p(this,"fetch"),p(this,"ejectInterceptor"),p(this,"url"),p(this,"parameters"),p(this,"fetchOptions"),this.baseURL=e.baseURL,this.headers=e.headers||new Headers,this.timeout=e!=null&&e.timeout?e.timeout*1e3:0,this.responseInterceptor=e.responseInterceptor,this.fetch=(...t)=>e.fetch?e.fetch(...t):fetch(...t),this.ejectInterceptor=!1,this.url="",this.parameters={},this.fetchOptions={}}get(e,t){return this.url=e,this.parameters=t,this._methodHandler("get")}post(e,t){return this.url=e,this.parameters=t,this._methodHandler("post")}put(e,t){return this.url=e,this.parameters=t,this._methodHandler("put")}delete(e,t){return this.url=e,this.parameters=t,this._methodHandler("delete")}async _responseHandler(e){const t=[],s={data:{},headers:{},status:0,statusText:""};e.status!==204&&await e.json().then(r=>{s.data=r});for(const r of e.headers.entries())t[r[0]]=r[1];return s.headers={...t},s.status=e.status,s.statusText=e.statusText,s}async _methodHandler(e){let t=`${this.baseURL}${this.url}`,s=null;if(e==="get"){const a=new O;t=`${this.baseURL}${this.url}?${a.stringify(this.parameters)}`}else s=JSON.stringify(this.parameters);const r=new URL(t),n=new AbortController,{signal:o}=n;let l;this.timeout&&(l=setTimeout(()=>n.abort(),this.timeout));try{const a=await this.fetch(`${r}`,{method:e,headers:this.headers,body:s,signal:o,...this.fetchOptions});this.timeout&&clearTimeout(l);const h=await this._responseHandler(a);return this.responseInterceptor&&!this.ejectInterceptor?this._statusHandler(this.responseInterceptor(h)):this._statusHandler(h)}catch(a){return{message:a}}}setFetchOptions(e={}){Object.keys(e).length>0&&"method"in e&&delete e.method,this.fetchOptions={...e}}eject(){this.ejectInterceptor=!0}_statusHandler(e){const t=/20[0-6]/g;return new Promise((s,r)=>{if(t.test(`${e.status}`))return s(e);const n={message:e.statusText,status:e.status,response:Array.isArray(e.data)?e.data[0]:e.data.error||e.data.slug};r(n)})}}const _e=Se,q="SB-Agent",A={defaultAgentName:"SB-JS-CLIENT",defaultAgentVersion:"SB-Agent-Version",packageVersion:"6.0.0"};let x={};const _={};class Ee{constructor(e,t){p(this,"client"),p(this,"maxRetries"),p(this,"retriesDelay"),p(this,"throttle"),p(this,"accessToken"),p(this,"cache"),p(this,"helpers"),p(this,"resolveCounter"),p(this,"relations"),p(this,"links"),p(this,"richTextResolver"),p(this,"resolveNestedRelations"),p(this,"stringifiedStoriesCache");let s=e.endpoint||t;if(!s){const o=new O().getRegionURL,l=e.https===!1?"http":"https";e.oauthToken?s=`${l}://${o(e.region)}/v1`:s=`${l}://${o(e.region)}/v2`}const r=new Headers;r.set("Content-Type","application/json"),r.set("Accept","application/json"),e.headers&&(e.headers.constructor.name==="Headers"?e.headers.entries().toArray():Object.entries(e.headers)).forEach(([o,l])=>{r.set(o,l)}),r.has(q)||(r.set(q,A.defaultAgentName),r.set(A.defaultAgentVersion,A.packageVersion));let n=5;e.oauthToken&&(r.set("Authorization",e.oauthToken),n=3),e.rateLimit&&(n=e.rateLimit),e.richTextSchema?this.richTextResolver=new I(e.richTextSchema):this.richTextResolver=new I,e.componentResolver&&this.setComponentResolver(e.componentResolver),this.maxRetries=e.maxRetries||10,this.retriesDelay=300,this.throttle=X(this.throttledRequest,n,1e3),this.accessToken=e.accessToken||"",this.relations={},this.links={},this.cache=e.cache||{clear:"manual"},this.helpers=new O,this.resolveCounter=0,this.resolveNestedRelations=e.resolveNestedRelations||!0,this.stringifiedStoriesCache={},this.client=new _e({baseURL:s,timeout:e.timeout||0,headers:r,responseInterceptor:e.responseInterceptor,fetch:e.fetch})}setComponentResolver(e){this.richTextResolver.addNode("blok",t=>{let s="";return t.attrs.body&&t.attrs.body.forEach(r=>{s+=e(r.component,r)}),{html:s}})}parseParams(e){return e.token||(e.token=this.getToken()),e.cv||(e.cv=_[e.token]),Array.isArray(e.resolve_relations)&&(e.resolve_relations=e.resolve_relations.join(",")),typeof e.resolve_relations<"u"&&(e.resolve_level=2),e}factoryParamOptions(e,t){return this.helpers.isCDNUrl(e)?this.parseParams(t):t}makeRequest(e,t,s,r,n){const o=this.factoryParamOptions(e,this.helpers.getOptionsPage(t,s,r));return this.cacheResponse(e,o,void 0,n)}get(e,t,s){t||(t={});const r=`/${e}`,n=this.factoryParamOptions(r,t);return this.cacheResponse(r,n,void 0,s)}async getAll(e,t,s,r){const n=(t==null?void 0:t.per_page)||25,o=`/${e}`,l=o.split("/"),a=s||l[l.length-1],h=1,d=await this.makeRequest(o,t,n,h,r),u=d.total?Math.ceil(d.total/n):1,m=await this.helpers.asyncMap(this.helpers.range(h,u),$=>this.makeRequest(o,t,n,$+1,r));return this.helpers.flatMap([d,...m],$=>Object.values($.data[a]))}post(e,t,s){const r=`/${e}`;return Promise.resolve(this.throttle("post",r,t,s))}put(e,t,s){const r=`/${e}`;return Promise.resolve(this.throttle("put",r,t,s))}delete(e,t,s){const r=`/${e}`;return Promise.resolve(this.throttle("delete",r,t,s))}getStories(e,t){return this._addResolveLevel(e),this.get("cdn/stories",e,t)}getStory(e,t,s){return this._addResolveLevel(t),this.get(`cdn/stories/${e}`,t,s)}getToken(){return this.accessToken}ejectInterceptor(){this.client.eject()}_addResolveLevel(e){typeof e.resolve_relations<"u"&&(e.resolve_level=2)}_cleanCopy(e){return JSON.parse(JSON.stringify(e))}_insertLinks(e,t,s){const r=e[t];r&&r.fieldtype=="multilink"&&r.linktype=="story"&&typeof r.id=="string"&&this.links[s][r.id]?r.story=this._cleanCopy(this.links[s][r.id]):r&&r.linktype==="story"&&typeof r.uuid=="string"&&this.links[s][r.uuid]&&(r.story=this._cleanCopy(this.links[s][r.uuid]))}getStoryReference(e,t){return this.relations[e][t]?(this.stringifiedStoriesCache[t]||(this.stringifiedStoriesCache[t]=JSON.stringify(this.relations[e][t])),JSON.parse(this.stringifiedStoriesCache[t])):t}_insertRelations(e,t,s,r){s.indexOf(`${e.component}.${t}`)>-1&&(typeof e[t]=="string"?e[t]=this.getStoryReference(r,e[t]):Array.isArray(e[t])&&(e[t]=e[t].map(n=>this.getStoryReference(r,n)).filter(Boolean)))}iterateTree(e,t,s){const r=n=>{if(n!=null){if(n.constructor===Array)for(let o=0;o<n.length;o++)r(n[o]);else if(n.constructor===Object){if(n._stopResolving)return;for(const o in n)(n.component&&n._uid||n.type==="link")&&(this._insertRelations(n,o,t,s),this._insertLinks(n,o,s)),r(n[o])}}};r(e.content)}async resolveLinks(e,t,s){let r=[];if(e.link_uuids){const n=e.link_uuids.length,o=[],l=50;for(let a=0;a<n;a+=l){const h=Math.min(n,a+l);o.push(e.link_uuids.slice(a,h))}for(let a=0;a<o.length;a++)(await this.getStories({per_page:l,language:t.language,version:t.version,by_uuids:o[a].join(",")})).data.stories.forEach(h=>{r.push(h)})}else r=e.links;r.forEach(n=>{this.links[s][n.uuid]={...n,_stopResolving:!0}})}async resolveRelations(e,t,s){let r=[];if(e.rel_uuids){const n=e.rel_uuids.length,o=[],l=50;for(let a=0;a<n;a+=l){const h=Math.min(n,a+l);o.push(e.rel_uuids.slice(a,h))}for(let a=0;a<o.length;a++)(await this.getStories({per_page:l,language:t.language,version:t.version,by_uuids:o[a].join(","),excluding_fields:t.excluding_fields})).data.stories.forEach(h=>{r.push(h)})}else r=e.rels;r&&r.length>0&&r.forEach(n=>{this.relations[s][n.uuid]={...n,_stopResolving:!0}})}async resolveStories(e,t,s){var r,n;let o=[];if(this.links[s]={},this.relations[s]={},typeof t.resolve_relations<"u"&&t.resolve_relations.length>0&&(typeof t.resolve_relations=="string"&&(o=t.resolve_relations.split(",")),await this.resolveRelations(e,t,s)),t.resolve_links&&["1","story","url","link"].indexOf(t.resolve_links)>-1&&((r=e.links)!=null&&r.length||(n=e.link_uuids)!=null&&n.length)&&await this.resolveLinks(e,t,s),this.resolveNestedRelations)for(const l in this.relations[s])this.iterateTree(this.relations[s][l],o,s);e.story?this.iterateTree(e.story,o,s):e.stories.forEach(l=>{this.iterateTree(l,o,s)}),this.stringifiedStoriesCache={},delete this.links[s],delete this.relations[s]}async cacheResponse(e,t,s,r){const n=this.helpers.stringify({url:e,params:t}),o=this.cacheProvider();if(this.cache.clear==="auto"&&t.version==="draft"&&await this.flushCache(),t.version==="published"&&e!="/cdn/spaces/me"){const l=await o.get(n);if(l)return Promise.resolve(l)}return new Promise(async(l,a)=>{var h;try{const d=await this.throttle("get",e,t,r);if(d.status!==200)return a(d);let u={data:d.data,headers:d.headers};if((h=d.headers)!=null&&h["per-page"]&&(u=Object.assign({},u,{perPage:d.headers["per-page"]?parseInt(d.headers["per-page"]):0,total:d.headers["per-page"]?parseInt(d.headers.total):0})),u.data.story||u.data.stories){const m=this.resolveCounter=++this.resolveCounter%1e3;await this.resolveStories(u.data,t,`${m}`)}return t.version==="published"&&e!="/cdn/spaces/me"&&await o.set(n,u),u.data.cv&&t.token&&_[t.token]!=u.data.cv&&(await this.flushCache(),_[t.token]=u.data.cv),l(u)}catch(d){if(d.response&&d.status===429&&(s=typeof s>"u"?0:s+1,s<this.maxRetries))return console.log(`Hit rate limit. Retrying in ${this.retriesDelay/1e3} seconds.`),await this.helpers.delay(this.retriesDelay),this.cacheResponse(e,t,s).then(l).catch(a);a(d)}})}throttledRequest(e,t,s,r){return this.client.setFetchOptions(r),this.client[e](t,s)}cacheVersions(){return _}cacheVersion(){return _[this.accessToken]}setCacheVersion(e){this.accessToken&&(_[this.accessToken]=e)}clearCacheVersion(){this.accessToken&&(_[this.accessToken]=0)}cacheProvider(){switch(this.cache.type){case"memory":return{get(e){return Promise.resolve(x[e])},getAll(){return Promise.resolve(x)},set(e,t){return x[e]=t,Promise.resolve(void 0)},flush(){return x={},Promise.resolve(void 0)}};case"custom":if(this.cache.custom)return this.cache.custom;default:return{get(){return Promise.resolve()},getAll(){return Promise.resolve(void 0)},set(){return Promise.resolve(void 0)},flush(){return Promise.resolve(void 0)}}}}async flushCache(){return await this.cacheProvider().flush(),this.clearCacheVersion(),this}}const Ie=(i={})=>{const{apiOptions:e}=i;if(!e.accessToken){console.error("You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication");return}return{storyblokApi:new Ee(e)}},je=i=>{if(typeof i!="object"||typeof i._editable>"u")return{};try{const e=JSON.parse(i._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return e?{"data-blok-c":JSON.stringify(e),"data-blok-uid":e.id+"-"+e.uid}:{}}catch{return{}}};var k=(i=>(i.DOCUMENT="doc",i.HEADING="heading",i.PARAGRAPH="paragraph",i.QUOTE="blockquote",i.OL_LIST="ordered_list",i.UL_LIST="bullet_list",i.LIST_ITEM="list_item",i.CODE_BLOCK="code_block",i.HR="horizontal_rule",i.BR="hard_break",i.IMAGE="image",i.EMOJI="emoji",i.COMPONENT="blok",i))(k||{}),v=(i=>(i.BOLD="bold",i.STRONG="strong",i.STRIKE="strike",i.UNDERLINE="underline",i.ITALIC="italic",i.CODE="code",i.LINK="link",i.ANCHOR="anchor",i.STYLED="styled",i.SUPERSCRIPT="superscript",i.SUBSCRIPT="subscript",i.TEXT_STYLE="textStyle",i.HIGHLIGHT="highlight",i))(v||{}),C=(i=>(i.TEXT="text",i))(C||{}),j=(i=>(i.URL="url",i.STORY="story",i.ASSET="asset",i.EMAIL="email",i))(j||{});function Oe(i,e){if(!e)return{src:i,attrs:{}};let t=0,s=0;const r={},n=[];function o(a,h,d,u,m){typeof a!="number"||a<=h||a>=d?console.warn(`[StoryblokRichText] - ${u.charAt(0).toUpperCase()+u.slice(1)} value must be a number between ${h} and ${d} (inclusive)`):m.push(`${u}(${a})`)}if(typeof e=="object"){if(typeof e.width=="number"&&e.width>0?(r.width=e.width,t=e.width):console.warn("[StoryblokRichText] - Width value must be a number greater than 0"),e.height&&typeof e.height=="number"&&e.height>0?(r.height=e.height,s=e.height):console.warn("[StoryblokRichText] - Height value must be a number greater than 0"),e.loading&&["lazy","eager"].includes(e.loading)&&(r.loading=e.loading),e.class&&(r.class=e.class),e.filters){const{filters:a}=e||{},{blur:h,brightness:d,fill:u,format:m,grayscale:$,quality:b,rotate:S}=a||{};h&&o(h,0,100,"blur",n),b&&o(b,0,100,"quality",n),d&&o(d,0,100,"brightness",n),u&&n.push(`fill(${u})`),$&&n.push("grayscale()"),S&&[0,90,180,270].includes(e.filters.rotate||0)&&n.push(`rotate(${S})`),m&&["webp","png","jpeg"].includes(m)&&n.push(`format(${m})`)}e.srcset&&(r.srcset=e.srcset.map(a=>{if(typeof a=="number")return`${i}/m/${a}x0/${n.length>0?"filters:"+n.join(":"):""} ${a}w`;if(Array.isArray(a)&&a.length===2){const[h,d]=a;return`${i}/m/${h}x${d}/${n.length>0?"filters:"+n.join(":"):""} ${h}w`}}).join(", ")),e.sizes&&(r.sizes=e.sizes.join(", "))}let l=`${i}/m/`;return t>0&&s>0&&(l=`${l}${t}x${s}/`),n.length>0&&(l=`${l}filters:${n.join(":")}`),{src:l,attrs:r}}const xe=(i={})=>Object.keys(i).map(e=>`${e}="${i[e]}"`).join(" "),Le=(i={})=>Object.keys(i).map(e=>`${e}: ${i[e]}`).join("; ");function Ae(i){return i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Ce(i,e={},t){const s=xe(e);return`<${s?`${i} ${s}`:i}>${Array.isArray(t)?t.join(""):t||""}</${i}>`}function Pe(i={}){let e=0;const{renderFn:t=Ce,textFn:s=Ae,resolvers:r={},optimizeImages:n=!1}=i,o=c=>g=>t(c,{...g.attrs,key:`${c}-${e}`},g.children||null),l=c=>{const{src:g,alt:f,...T}=c.attrs||{};let R=g,w={};if(n){const{src:Be,attrs:De}=Oe(g,n);R=Be,w=De}const Ue={src:R,alt:f||"",key:`img-${e}`,...T,...w};return t("img",Ue,"")},a=c=>{const{level:g,...f}=c.attrs||{};return t(`h${g}`,{...f,key:`h${g}-${e}`},c.children)},h=c=>{var g,f,T,R;return t("span",{"data-type":"emoji","data-name":(g=c.attrs)==null?void 0:g.name,emoji:(f=c.attrs)==null?void 0:f.emoji,key:`emoji-${e}`},t("img",{src:(T=c.attrs)==null?void 0:T.fallbackImage,alt:(R=c.attrs)==null?void 0:R.alt,style:"width: 1.25em; height: 1.25em; vertical-align: text-top",draggable:"false",loading:"lazy"},""))},d=c=>t("pre",{...c.attrs,key:`code-${e}`},t("code",{key:`code-${e}`},c.children||"")),u=(c,g=!1)=>({text:f,attrs:T})=>t(c,g?{style:Le(T),key:`${c}-${e}`}:{...T,key:`${c}-${e}`},f),m=c=>M(c),$=c=>{const{marks:g,...f}=c;return"text"in c?g?g.reduce((T,R)=>m({...R,text:T}),m({...f,children:f.children})):s(f.text):""},b=c=>{const{linktype:g,href:f,anchor:T,...R}=c.attrs||{};let w="";switch(g){case j.ASSET:case j.URL:w=f;break;case j.EMAIL:w=`mailto:${f}`;break;case j.STORY:w=f;break}return T&&(w=`${w}#${T}`),t("a",{...R,href:w,key:`a-${e}`},c.text)},S=c=>{var g,f;return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),t("span",{blok:(g=c==null?void 0:c.attrs)==null?void 0:g.body[0],id:(f=c.attrs)==null?void 0:f.id,key:`component-${e}`,style:"display: none"},"")},L=new Map([[k.DOCUMENT,o("div")],[k.HEADING,a],[k.PARAGRAPH,o("p")],[k.UL_LIST,o("ul")],[k.OL_LIST,o("ol")],[k.LIST_ITEM,o("li")],[k.IMAGE,l],[k.EMOJI,h],[k.CODE_BLOCK,d],[k.HR,o("hr")],[k.BR,o("br")],[k.QUOTE,o("blockquote")],[k.COMPONENT,S],[C.TEXT,$],[v.LINK,b],[v.ANCHOR,b],[v.STYLED,u("span",!0)],[v.BOLD,u("strong")],[v.TEXT_STYLE,u("span",!0)],[v.ITALIC,u("em")],[v.UNDERLINE,u("u")],[v.STRIKE,u("s")],[v.CODE,u("code")],[v.SUPERSCRIPT,u("sup")],[v.SUBSCRIPT,u("sub")],[v.HIGHLIGHT,u("mark")],...Object.entries(r).map(([c,g])=>[c,g])]);function F(c){e+=1;const g=L.get(c.type);if(!g)return console.error("<Storyblok>",`No resolver found for node type ${c.type}`),"";if(c.type==="text")return g(c);const f=c.content?c.content.map(M):void 0;return g({...c,children:f})}function M(c){return Array.isArray(c)?c.map(F):F(c)}return{render:M}}let P,N="https://app.storyblok.com/f/storyblok-v2-latest.js";const G=(i,e,t={})=>{var l;const r=!(typeof window>"u")&&typeof window.storyblokRegisterEvent<"u",o=+new URL((l=window.location)==null?void 0:l.href).searchParams.get("_storyblok")===i;if(!(!r||!o)){if(!i){console.warn("Story ID is not defined. Please provide a valid ID.");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(t).on(["input","published","change"],h=>{h.action==="input"&&h.story.id===i?e(h.story):(h.action==="change"||h.action==="published")&&h.storyId===i&&window.location.reload()})})}},Ne=(i={})=>{var u,m;const{bridge:e,accessToken:t,use:s=[],apiOptions:r={},richText:n={},bridgeUrl:o}=i;r.accessToken=r.accessToken||t;const l={bridge:e,apiOptions:r};let a={};s.forEach($=>{a={...a,...$(l)}}),o&&(N=o);const d=!(typeof window>"u")&&((m=(u=window.location)==null?void 0:u.search)==null?void 0:m.includes("_storyblok_tk"));return e!==!1&&d&&U(N),P=new I(n.schema),n.resolver&&V(P,n.resolver),a},V=(i,e)=>{i.addNode("blok",t=>{let s="";return t.attrs.body.forEach(r=>{s+=e(r.component,r)}),{html:s}})},J=i=>!i||!(i!=null&&i.content.some(e=>e.content||e.type==="blok"||e.type==="horizontal_rule")),Me=(i,e,t)=>{let s=t||P;if(!s){console.error("Please initialize the Storyblok SDK before calling the renderRichText function");return}return J(i)?"":(e&&(s=new I(e.schema),e.resolver&&V(s,e.resolver)),s.render(i,{},!1))},He=()=>U(N);y.BlockTypes=k,y.MarkTypes=v,y.RichTextResolver=I,y.RichTextSchema=D,y.TextTypes=C,y.apiPlugin=Ie,y.isRichTextEmpty=J,y.loadStoryblokBridge=He,y.registerStoryblokBridge=G,y.renderRichText=Me,y.richTextResolver=Pe,y.storyblokEditable=je,y.storyblokInit=Ne,y.useStoryblokBridge=G,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
24
+ }`),""}optimizeImages(e,t){let s=0,r=0,n="",o="";typeof t!="boolean"&&(typeof t.width=="number"&&t.width>0&&(n+=`width="${t.width}" `,s=t.width),typeof t.height=="number"&&t.height>0&&(n+=`height="${t.height}" `,r=t.height),(t.loading==="lazy"||t.loading==="eager")&&(n+=`loading="${t.loading}" `),typeof t.class=="string"&&t.class.length>0&&(n+=`class="${t.class}" `),t.filters&&(typeof t.filters.blur=="number"&&t.filters.blur>=0&&t.filters.blur<=100&&(o+=`:blur(${t.filters.blur})`),typeof t.filters.brightness=="number"&&t.filters.brightness>=-100&&t.filters.brightness<=100&&(o+=`:brightness(${t.filters.brightness})`),t.filters.fill&&(t.filters.fill.match(/[0-9A-Fa-f]{6}/g)||t.filters.fill==="transparent")&&(o+=`:fill(${t.filters.fill})`),t.filters.format&&["webp","png","jpeg"].includes(t.filters.format)&&(o+=`:format(${t.filters.format})`),typeof t.filters.grayscale=="boolean"&&t.filters.grayscale&&(o+=":grayscale()"),typeof t.filters.quality=="number"&&t.filters.quality>=0&&t.filters.quality<=100&&(o+=`:quality(${t.filters.quality})`),t.filters.rotate&&[90,180,270].includes(t.filters.rotate)&&(o+=`:rotate(${t.filters.rotate})`),o.length>0&&(o="/filters"+o))),n.length>0&&(e=e.replace(/<img/g,`<img ${n.trim()}`));const l=s>0||r>0||o.length>0?`${s}x${r}${o}`:"";return e=e.replace(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g,`a.storyblok.com/f/$1/$2.$3/m/${l}`),typeof t!="boolean"&&(t.sizes||t.srcset)&&(e=e.replace(/<img.*?src=["|'](.*?)["|']/g,a=>{var c,u;const p=a.match(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g);if(p&&p.length>0){const g={srcset:(c=t.srcset)==null?void 0:c.map(b=>{if(typeof b=="number")return`//${p}/m/${b}x0${o} ${b}w`;if(typeof b=="object"&&b.length===2){let S=0,C=0;return typeof b[0]=="number"&&(S=b[0]),typeof b[1]=="number"&&(C=b[1]),`//${p}/m/${S}x${C}${o} ${S}w`}}).join(", "),sizes:(u=t.sizes)==null?void 0:u.map(b=>b).join(", ")};let T="";return g.srcset&&(T+=`srcset="${g.srcset}" `),g.sizes&&(T+=`sizes="${g.sizes}" `),a.replace(/<img/g,`<img ${T.trim()}`)}return a})),e}renderNode(e){const t=[];e.marks&&e.marks.forEach(r=>{const n=this.getMatchingMark(r);n&&n.tag!==""&&t.push(this.renderOpeningTag(n.tag))});const s=this.getMatchingNode(e);return s&&s.tag&&t.push(this.renderOpeningTag(s.tag)),e.content?e.content.forEach(r=>{t.push(this.renderNode(r))}):e.text?t.push(_e(e.text)):s&&s.singleTag?t.push(this.renderTag(s.singleTag," /")):s&&s.html?t.push(s.html):e.type==="emoji"&&t.push(this.renderEmoji(e)),s&&s.tag&&t.push(this.renderClosingTag(s.tag)),e.marks&&e.marks.slice(0).reverse().forEach(r=>{const n=this.getMatchingMark(r);n&&n.tag!==""&&t.push(this.renderClosingTag(n.tag))}),t.join("")}renderTag(e,t){return e.constructor===String?`<${e}${t}>`:e.map(s=>{if(s.constructor===String)return`<${s}${t}>`;{let r=`<${s.tag}`;if(s.attrs){for(const n in s.attrs)if(Object.prototype.hasOwnProperty.call(s.attrs,n)){const o=s.attrs[n];o!==null&&(r+=` ${n}="${o}"`)}}return`${r}${t}>`}}).join("")}renderOpeningTag(e){return this.renderTag(e,"")}renderClosingTag(e){return e.constructor===String?`</${e}>`:e.slice(0).reverse().map(t=>t.constructor===String?`</${t}>`:`</${t.tag}>`).join("")}getMatchingNode(e){const t=this.nodes[e.type];if(typeof t=="function")return t(e)}getMatchingMark(e){const t=this.marks[e.type];if(typeof t=="function")return t(e)}renderEmoji(e){if(e.attrs.emoji)return e.attrs.emoji;const t=[{tag:"img",attrs:{src:e.attrs.fallbackImage,draggable:"false",loading:"lazy",align:"absmiddle"}}];return this.renderTag(t," /")}}const O=Ee;class Ie{constructor(e){d(this,"baseURL"),d(this,"timeout"),d(this,"headers"),d(this,"responseInterceptor"),d(this,"fetch"),d(this,"ejectInterceptor"),d(this,"url"),d(this,"parameters"),d(this,"fetchOptions"),this.baseURL=e.baseURL,this.headers=e.headers||new Headers,this.timeout=e!=null&&e.timeout?e.timeout*1e3:0,this.responseInterceptor=e.responseInterceptor,this.fetch=(...t)=>e.fetch?e.fetch(...t):fetch(...t),this.ejectInterceptor=!1,this.url="",this.parameters={},this.fetchOptions={}}get(e,t){return this.url=e,this.parameters=t,this._methodHandler("get")}post(e,t){return this.url=e,this.parameters=t,this._methodHandler("post")}put(e,t){return this.url=e,this.parameters=t,this._methodHandler("put")}delete(e,t){return this.url=e,this.parameters=t,this._methodHandler("delete")}async _responseHandler(e){const t=[],s={data:{},headers:{},status:0,statusText:""};e.status!==204&&await e.json().then(r=>{s.data=r});for(const r of e.headers.entries())t[r[0]]=r[1];return s.headers={...t},s.status=e.status,s.statusText=e.statusText,s}async _methodHandler(e){let t=`${this.baseURL}${this.url}`,s=null;if(e==="get"){const a=new L;t=`${this.baseURL}${this.url}?${a.stringify(this.parameters)}`}else s=JSON.stringify(this.parameters);const r=new URL(t),n=new AbortController,{signal:o}=n;let l;this.timeout&&(l=setTimeout(()=>n.abort(),this.timeout));try{const a=await this.fetch(`${r}`,{method:e,headers:this.headers,body:s,signal:o,...this.fetchOptions});this.timeout&&clearTimeout(l);const c=await this._responseHandler(a);return this.responseInterceptor&&!this.ejectInterceptor?this._statusHandler(this.responseInterceptor(c)):this._statusHandler(c)}catch(a){return{message:a}}}setFetchOptions(e={}){Object.keys(e).length>0&&"method"in e&&delete e.method,this.fetchOptions={...e}}eject(){this.ejectInterceptor=!0}_statusHandler(e){const t=/20[0-6]/g;return new Promise((s,r)=>{if(t.test(`${e.status}`))return s(e);const n={message:e.statusText,status:e.status,response:Array.isArray(e.data)?e.data[0]:e.data.error||e.data.slug};r(n)})}}const je=Ie,V="SB-Agent",P={defaultAgentName:"SB-JS-CLIENT",defaultAgentVersion:"SB-Agent-Version",packageVersion:"6.0.0"};let A={};const _={};class Oe{constructor(e,t){d(this,"client"),d(this,"maxRetries"),d(this,"retriesDelay"),d(this,"throttle"),d(this,"accessToken"),d(this,"cache"),d(this,"helpers"),d(this,"resolveCounter"),d(this,"relations"),d(this,"links"),d(this,"richTextResolver"),d(this,"resolveNestedRelations"),d(this,"stringifiedStoriesCache");let s=e.endpoint||t;if(!s){const o=new L().getRegionURL,l=e.https===!1?"http":"https";e.oauthToken?s=`${l}://${o(e.region)}/v1`:s=`${l}://${o(e.region)}/v2`}const r=new Headers;r.set("Content-Type","application/json"),r.set("Accept","application/json"),e.headers&&(e.headers.constructor.name==="Headers"?e.headers.entries().toArray():Object.entries(e.headers)).forEach(([o,l])=>{r.set(o,l)}),r.has(V)||(r.set(V,P.defaultAgentName),r.set(P.defaultAgentVersion,P.packageVersion));let n=5;e.oauthToken&&(r.set("Authorization",e.oauthToken),n=3),e.rateLimit&&(n=e.rateLimit),e.richTextSchema?this.richTextResolver=new O(e.richTextSchema):this.richTextResolver=new O,e.componentResolver&&this.setComponentResolver(e.componentResolver),this.maxRetries=e.maxRetries||10,this.retriesDelay=300,this.throttle=Z(this.throttledRequest,n,1e3),this.accessToken=e.accessToken||"",this.relations={},this.links={},this.cache=e.cache||{clear:"manual"},this.helpers=new L,this.resolveCounter=0,this.resolveNestedRelations=e.resolveNestedRelations||!0,this.stringifiedStoriesCache={},this.client=new je({baseURL:s,timeout:e.timeout||0,headers:r,responseInterceptor:e.responseInterceptor,fetch:e.fetch})}setComponentResolver(e){this.richTextResolver.addNode("blok",t=>{let s="";return t.attrs.body&&t.attrs.body.forEach(r=>{s+=e(r.component,r)}),{html:s}})}parseParams(e){return e.token||(e.token=this.getToken()),e.cv||(e.cv=_[e.token]),Array.isArray(e.resolve_relations)&&(e.resolve_relations=e.resolve_relations.join(",")),typeof e.resolve_relations<"u"&&(e.resolve_level=2),e}factoryParamOptions(e,t){return this.helpers.isCDNUrl(e)?this.parseParams(t):t}makeRequest(e,t,s,r,n){const o=this.factoryParamOptions(e,this.helpers.getOptionsPage(t,s,r));return this.cacheResponse(e,o,void 0,n)}get(e,t,s){t||(t={});const r=`/${e}`,n=this.factoryParamOptions(r,t);return this.cacheResponse(r,n,void 0,s)}async getAll(e,t,s,r){const n=(t==null?void 0:t.per_page)||25,o=`/${e}`,l=o.split("/"),a=s||l[l.length-1],c=1,u=await this.makeRequest(o,t,n,c,r),p=u.total?Math.ceil(u.total/n):1,g=await this.helpers.asyncMap(this.helpers.range(c,p),T=>this.makeRequest(o,t,n,T+1,r));return this.helpers.flatMap([u,...g],T=>Object.values(T.data[a]))}post(e,t,s){const r=`/${e}`;return Promise.resolve(this.throttle("post",r,t,s))}put(e,t,s){const r=`/${e}`;return Promise.resolve(this.throttle("put",r,t,s))}delete(e,t,s){const r=`/${e}`;return Promise.resolve(this.throttle("delete",r,t,s))}getStories(e,t){return this._addResolveLevel(e),this.get("cdn/stories",e,t)}getStory(e,t,s){return this._addResolveLevel(t),this.get(`cdn/stories/${e}`,t,s)}getToken(){return this.accessToken}ejectInterceptor(){this.client.eject()}_addResolveLevel(e){typeof e.resolve_relations<"u"&&(e.resolve_level=2)}_cleanCopy(e){return JSON.parse(JSON.stringify(e))}_insertLinks(e,t,s){const r=e[t];r&&r.fieldtype=="multilink"&&r.linktype=="story"&&typeof r.id=="string"&&this.links[s][r.id]?r.story=this._cleanCopy(this.links[s][r.id]):r&&r.linktype==="story"&&typeof r.uuid=="string"&&this.links[s][r.uuid]&&(r.story=this._cleanCopy(this.links[s][r.uuid]))}getStoryReference(e,t){return this.relations[e][t]?(this.stringifiedStoriesCache[t]||(this.stringifiedStoriesCache[t]=JSON.stringify(this.relations[e][t])),JSON.parse(this.stringifiedStoriesCache[t])):t}_insertRelations(e,t,s,r){s.indexOf(`${e.component}.${t}`)>-1&&(typeof e[t]=="string"?e[t]=this.getStoryReference(r,e[t]):Array.isArray(e[t])&&(e[t]=e[t].map(n=>this.getStoryReference(r,n)).filter(Boolean)))}iterateTree(e,t,s){const r=n=>{if(n!=null){if(n.constructor===Array)for(let o=0;o<n.length;o++)r(n[o]);else if(n.constructor===Object){if(n._stopResolving)return;for(const o in n)(n.component&&n._uid||n.type==="link")&&(this._insertRelations(n,o,t,s),this._insertLinks(n,o,s)),r(n[o])}}};r(e.content)}async resolveLinks(e,t,s){let r=[];if(e.link_uuids){const n=e.link_uuids.length,o=[],l=50;for(let a=0;a<n;a+=l){const c=Math.min(n,a+l);o.push(e.link_uuids.slice(a,c))}for(let a=0;a<o.length;a++)(await this.getStories({per_page:l,language:t.language,version:t.version,by_uuids:o[a].join(",")})).data.stories.forEach(c=>{r.push(c)})}else r=e.links;r.forEach(n=>{this.links[s][n.uuid]={...n,_stopResolving:!0}})}async resolveRelations(e,t,s){let r=[];if(e.rel_uuids){const n=e.rel_uuids.length,o=[],l=50;for(let a=0;a<n;a+=l){const c=Math.min(n,a+l);o.push(e.rel_uuids.slice(a,c))}for(let a=0;a<o.length;a++)(await this.getStories({per_page:l,language:t.language,version:t.version,by_uuids:o[a].join(","),excluding_fields:t.excluding_fields})).data.stories.forEach(c=>{r.push(c)})}else r=e.rels;r&&r.length>0&&r.forEach(n=>{this.relations[s][n.uuid]={...n,_stopResolving:!0}})}async resolveStories(e,t,s){var r,n;let o=[];if(this.links[s]={},this.relations[s]={},typeof t.resolve_relations<"u"&&t.resolve_relations.length>0&&(typeof t.resolve_relations=="string"&&(o=t.resolve_relations.split(",")),await this.resolveRelations(e,t,s)),t.resolve_links&&["1","story","url","link"].indexOf(t.resolve_links)>-1&&((r=e.links)!=null&&r.length||(n=e.link_uuids)!=null&&n.length)&&await this.resolveLinks(e,t,s),this.resolveNestedRelations)for(const l in this.relations[s])this.iterateTree(this.relations[s][l],o,s);e.story?this.iterateTree(e.story,o,s):e.stories.forEach(l=>{this.iterateTree(l,o,s)}),this.stringifiedStoriesCache={},delete this.links[s],delete this.relations[s]}async cacheResponse(e,t,s,r){const n=this.helpers.stringify({url:e,params:t}),o=this.cacheProvider();if(this.cache.clear==="auto"&&t.version==="draft"&&await this.flushCache(),t.version==="published"&&e!="/cdn/spaces/me"){const l=await o.get(n);if(l)return Promise.resolve(l)}return new Promise(async(l,a)=>{var c;try{const u=await this.throttle("get",e,t,r);if(u.status!==200)return a(u);let p={data:u.data,headers:u.headers};if((c=u.headers)!=null&&c["per-page"]&&(p=Object.assign({},p,{perPage:u.headers["per-page"]?parseInt(u.headers["per-page"]):0,total:u.headers["per-page"]?parseInt(u.headers.total):0})),p.data.story||p.data.stories){const g=this.resolveCounter=++this.resolveCounter%1e3;await this.resolveStories(p.data,t,`${g}`)}return t.version==="published"&&e!="/cdn/spaces/me"&&await o.set(n,p),p.data.cv&&t.token&&_[t.token]!=p.data.cv&&(await this.flushCache(),_[t.token]=p.data.cv),l(p)}catch(u){if(u.response&&u.status===429&&(s=typeof s>"u"?0:s+1,s<this.maxRetries))return console.log(`Hit rate limit. Retrying in ${this.retriesDelay/1e3} seconds.`),await this.helpers.delay(this.retriesDelay),this.cacheResponse(e,t,s).then(l).catch(a);a(u)}})}throttledRequest(e,t,s,r){return this.client.setFetchOptions(r),this.client[e](t,s)}cacheVersions(){return _}cacheVersion(){return _[this.accessToken]}setCacheVersion(e){this.accessToken&&(_[this.accessToken]=e)}clearCacheVersion(){this.accessToken&&(_[this.accessToken]=0)}cacheProvider(){switch(this.cache.type){case"memory":return{get(e){return Promise.resolve(A[e])},getAll(){return Promise.resolve(A)},set(e,t){return A[e]=t,Promise.resolve(void 0)},flush(){return A={},Promise.resolve(void 0)}};case"custom":if(this.cache.custom)return this.cache.custom;default:return{get(){return Promise.resolve()},getAll(){return Promise.resolve(void 0)},set(){return Promise.resolve(void 0)},flush(){return Promise.resolve(void 0)}}}}async flushCache(){return await this.cacheProvider().flush(),this.clearCacheVersion(),this}}const xe=(i={})=>{const{apiOptions:e}=i;if(!e.accessToken){console.error("You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication");return}return{storyblokApi:new Oe(e)}},Le=i=>{if(typeof i!="object"||typeof i._editable>"u")return{};try{const e=JSON.parse(i._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return e?{"data-blok-c":JSON.stringify(e),"data-blok-uid":e.id+"-"+e.uid}:{}}catch{return{}}};function Ae(i,e){if(!e)return{src:i,attrs:{}};let t=0,s=0;const r={},n=[];function o(a,c,u,p,g){typeof a!="number"||a<=c||a>=u?console.warn(`[StoryblokRichText] - ${p.charAt(0).toUpperCase()+p.slice(1)} value must be a number between ${c} and ${u} (inclusive)`):g.push(`${p}(${a})`)}if(typeof e=="object"){if(typeof e.width=="number"&&e.width>0?(r.width=e.width,t=e.width):console.warn("[StoryblokRichText] - Width value must be a number greater than 0"),e.height&&typeof e.height=="number"&&e.height>0?(r.height=e.height,s=e.height):console.warn("[StoryblokRichText] - Height value must be a number greater than 0"),e.loading&&["lazy","eager"].includes(e.loading)&&(r.loading=e.loading),e.class&&(r.class=e.class),e.filters){const{filters:a}=e||{},{blur:c,brightness:u,fill:p,format:g,grayscale:T,quality:b,rotate:S}=a||{};c&&o(c,0,100,"blur",n),b&&o(b,0,100,"quality",n),u&&o(u,0,100,"brightness",n),p&&n.push(`fill(${p})`),T&&n.push("grayscale()"),S&&[0,90,180,270].includes(e.filters.rotate||0)&&n.push(`rotate(${S})`),g&&["webp","png","jpeg"].includes(g)&&n.push(`format(${g})`)}e.srcset&&(r.srcset=e.srcset.map(a=>{if(typeof a=="number")return`${i}/m/${a}x0/${n.length>0?`filters:${n.join(":")}`:""} ${a}w`;if(Array.isArray(a)&&a.length===2){const[c,u]=a;return`${i}/m/${c}x${u}/${n.length>0?`filters:${n.join(":")}`:""} ${c}w`}else{console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");return}}).join(", ")),e.sizes&&(r.sizes=e.sizes.join(", "))}let l=`${i}/m/`;return t>0&&s>0&&(l=`${l}${t}x${s}/`),n.length>0&&(l=`${l}filters:${n.join(":")}`),{src:l,attrs:r}}var k=(i=>(i.DOCUMENT="doc",i.HEADING="heading",i.PARAGRAPH="paragraph",i.QUOTE="blockquote",i.OL_LIST="ordered_list",i.UL_LIST="bullet_list",i.LIST_ITEM="list_item",i.CODE_BLOCK="code_block",i.HR="horizontal_rule",i.BR="hard_break",i.IMAGE="image",i.EMOJI="emoji",i.COMPONENT="blok",i))(k||{}),$=(i=>(i.BOLD="bold",i.STRONG="strong",i.STRIKE="strike",i.UNDERLINE="underline",i.ITALIC="italic",i.CODE="code",i.LINK="link",i.ANCHOR="anchor",i.STYLED="styled",i.SUPERSCRIPT="superscript",i.SUBSCRIPT="subscript",i.TEXT_STYLE="textStyle",i.HIGHLIGHT="highlight",i))($||{}),N=(i=>(i.TEXT="text",i))(N||{}),x=(i=>(i.URL="url",i.STORY="story",i.ASSET="asset",i.EMAIL="email",i))(x||{});const Ce=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Pe=(i={})=>Object.keys(i).map(e=>`${e}="${i[e]}"`).join(" "),Ne=(i={})=>Object.keys(i).map(e=>`${e}: ${i[e]}`).join("; ");function Me(i){return i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}const J=i=>Object.fromEntries(Object.entries(i).filter(([e,t])=>t!==void 0));function He(i,e={},t){const s=Pe(e),r=s?`${i} ${s}`:i;return Ce.includes(i)?`<${r}>`:`<${r}>${Array.isArray(t)?t.join(""):t||""}</${i}>`}function Ue(i={}){let e=0;const{renderFn:t=He,textFn:s=Me,resolvers:r={},optimizeImages:n=!1,keyedResolvers:o=!1}=i,l=h=>f=>{const m=f.attrs||{};return o&&(m.key=`${h}-${e}`),t(h,m,f.children||null)},a=h=>{const{src:f,alt:m,title:v,srcset:w,sizes:R}=h.attrs||{};let E=f,I={};if(n){const{src:Ve,attrs:Je}=Ae(f,n);E=Ve,I=Je}o&&(I={...I,key:`img-${e}`});const Ge={src:E,alt:m,title:v,srcset:w,sizes:R,...I};return t("img",J(Ge))},c=h=>{const{level:f,...m}=h.attrs||{},v={...m};return o&&(v.key=`h${f}-${e}`),t(`h${f}`,v,h.children)},u=h=>{var f,m,v,w;const R=t("img",{src:(f=h.attrs)==null?void 0:f.fallbackImage,alt:(m=h.attrs)==null?void 0:m.alt,style:"width: 1.25em; height: 1.25em; vertical-align: text-top",draggable:"false",loading:"lazy"}),E={"data-type":"emoji","data-name":(v=h.attrs)==null?void 0:v.name,"data-emoji":(w=h.attrs)==null?void 0:w.emoji};return o&&(E.key=`emoji-${e}`),t("span",E,R)},p=h=>t("pre",{...h.attrs,key:`code-${e}`},t("code",{key:`code-${e}`},h.children||"")),g=(h,f=!1)=>({text:m,attrs:v})=>{const{class:w,id:R,...E}=v||{},I=f?{class:w,id:R,style:Ne(E)||void 0}:v||{};return o&&(I.key=`${h}-${e}`),t(h,J(I),m)},T=h=>U(h),b=h=>{const{marks:f,...m}=h;return"text"in h?f?f.reduce((v,w)=>T({...w,text:v}),T({...m,children:m.children})):s(m.text):""},S=h=>{const{linktype:f,href:m,anchor:v,...w}=h.attrs||{};let R="";switch(f){case x.ASSET:case x.URL:R=m;break;case x.EMAIL:R=`mailto:${m}`;break;case x.STORY:R=m;break}return v&&(R=`${R}#${v}`),t("a",{...w,href:R,key:`a-${e}`},h.text)},C=h=>{var f,m;return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),t("span",{blok:(f=h==null?void 0:h.attrs)==null?void 0:f.body[0],id:(m=h.attrs)==null?void 0:m.id,key:`component-${e}`,style:"display: none"})},qe=new Map([[k.DOCUMENT,l("div")],[k.HEADING,c],[k.PARAGRAPH,l("p")],[k.UL_LIST,l("ul")],[k.OL_LIST,l("ol")],[k.LIST_ITEM,l("li")],[k.IMAGE,a],[k.EMOJI,u],[k.CODE_BLOCK,p],[k.HR,l("hr")],[k.BR,l("br")],[k.QUOTE,l("blockquote")],[k.COMPONENT,C],[N.TEXT,b],[$.LINK,S],[$.ANCHOR,S],[$.STYLED,g("span",!0)],[$.BOLD,g("strong")],[$.TEXT_STYLE,g("span",!0)],[$.ITALIC,g("em")],[$.UNDERLINE,g("u")],[$.STRIKE,g("s")],[$.CODE,g("code")],[$.SUPERSCRIPT,g("sup")],[$.SUBSCRIPT,g("sub")],[$.HIGHLIGHT,g("mark")],...Object.entries(r).map(([h,f])=>[h,f])]);function X(h){e+=1;const f=qe.get(h.type);if(!f)return console.error("<Storyblok>",`No resolver found for node type ${h.type}`),"";if(h.type==="text")return f(h);const m=h.content?h.content.map(U):void 0;return f({...h,children:m})}function U(h){return Array.isArray(h)?h.map(X):X(h)}return{render:U}}let M,H="https://app.storyblok.com/f/storyblok-v2-latest.js";const F=(i,e,t={})=>{var l;const r=!(typeof window>"u")&&typeof window.storyblokRegisterEvent<"u",o=+new URL((l=window.location)==null?void 0:l.href).searchParams.get("_storyblok")===i;if(!(!r||!o)){if(!i){console.warn("Story ID is not defined. Please provide a valid ID.");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(t).on(["input","published","change"],c=>{c.action==="input"&&c.story.id===i?e(c.story):(c.action==="change"||c.action==="published")&&c.storyId===i&&window.location.reload()})})}},ze=(i={})=>{var p,g;const{bridge:e,accessToken:t,use:s=[],apiOptions:r={},richText:n={},bridgeUrl:o}=i;r.accessToken=r.accessToken||t;const l={bridge:e,apiOptions:r};let a={};s.forEach(T=>{a={...a,...T(l)}}),o&&(H=o);const u=!(typeof window>"u")&&((g=(p=window.location)==null?void 0:p.search)==null?void 0:g.includes("_storyblok_tk"));return e!==!1&&u&&B(H),M=new O(n.schema),n.resolver&&K(M,n.resolver),a},K=(i,e)=>{i.addNode("blok",t=>{let s="";return t.attrs.body.forEach(r=>{s+=e(r.component,r)}),{html:s}})},Y=i=>!i||!(i!=null&&i.content.some(e=>e.content||e.type==="blok"||e.type==="horizontal_rule")),Be=(i,e,t)=>{let s=t||M;if(!s){console.error("Please initialize the Storyblok SDK before calling the renderRichText function");return}return Y(i)?"":(e&&(s=new O(e.schema),e.resolver&&K(s,e.resolver)),s.render(i,{},!1))},De=()=>B(H);y.BlockTypes=k,y.MarkTypes=$,y.RichTextResolver=O,y.RichTextSchema=q,y.TextTypes=N,y.apiPlugin=xe,y.isRichTextEmpty=Y,y.loadStoryblokBridge=De,y.registerStoryblokBridge=F,y.renderRichText=Be,y.richTextResolver=Ue,y.storyblokEditable=Le,y.storyblokInit=ze,y.useStoryblokBridge=F,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
@@ -1,46 +1,46 @@
1
- let N = !1;
2
- const M = [], z = (i) => new Promise((e, t) => {
1
+ let H = !1;
2
+ const U = [], G = (i) => new Promise((e, t) => {
3
3
  if (typeof window > "u" || (window.storyblokRegisterEvent = (r) => {
4
4
  if (window.location === window.parent.location) {
5
5
  console.warn("You are not in Draft Mode or in the Visual Editor.");
6
6
  return;
7
7
  }
8
- N ? r() : M.push(r);
8
+ H ? r() : U.push(r);
9
9
  }, document.getElementById("storyblok-javascript-bridge"))) return;
10
10
  const s = document.createElement("script");
11
11
  s.async = !0, s.src = i, s.id = "storyblok-javascript-bridge", s.onerror = (r) => t(r), s.onload = (r) => {
12
- M.forEach((n) => n()), N = !0, e(r);
12
+ U.forEach((n) => n()), H = !0, e(r);
13
13
  }, document.getElementsByTagName("head")[0].appendChild(s);
14
14
  });
15
- var F = Object.defineProperty, K = (i, e, t) => e in i ? F(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, p = (i, e, t) => K(i, typeof e != "symbol" ? e + "" : e, t);
16
- function H(i) {
15
+ var W = Object.defineProperty, Q = (i, e, t) => e in i ? W(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, d = (i, e, t) => Q(i, typeof e != "symbol" ? e + "" : e, t);
16
+ function z(i) {
17
17
  return !(i !== i || i === 1 / 0 || i === -1 / 0);
18
18
  }
19
- function Y(i, e, t) {
20
- if (!H(e))
19
+ function Z(i, e, t) {
20
+ if (!z(e))
21
21
  throw new TypeError("Expected `limit` to be a finite number");
22
- if (!H(t))
22
+ if (!z(t))
23
23
  throw new TypeError("Expected `interval` to be a finite number");
24
24
  const s = [];
25
25
  let r = [], n = 0;
26
26
  const o = function() {
27
27
  n++;
28
28
  const a = setTimeout(function() {
29
- n--, s.length > 0 && o(), r = r.filter(function(d) {
30
- return d !== a;
29
+ n--, s.length > 0 && o(), r = r.filter(function(u) {
30
+ return u !== a;
31
31
  });
32
32
  }, t);
33
33
  r.indexOf(a) < 0 && r.push(a);
34
- const h = s.shift();
35
- h.resolve(i.apply(h.self, h.args));
34
+ const c = s.shift();
35
+ c.resolve(i.apply(c.self, c.args));
36
36
  }, l = function(...a) {
37
- const h = this;
38
- return new Promise(function(d, u) {
37
+ const c = this;
38
+ return new Promise(function(u, p) {
39
39
  s.push({
40
- resolve: d,
41
- reject: u,
40
+ resolve: u,
41
+ reject: p,
42
42
  args: a,
43
- self: h
43
+ self: c
44
44
  }), n < e && o();
45
45
  });
46
46
  };
@@ -52,16 +52,16 @@ function Y(i, e, t) {
52
52
  }), s.length = 0;
53
53
  }, l;
54
54
  }
55
- class x {
55
+ let O = class {
56
56
  constructor() {
57
- p(this, "isCDNUrl", (e = "") => e.indexOf("/cdn/") > -1), p(this, "getOptionsPage", (e, t = 25, s = 1) => ({
57
+ d(this, "isCDNUrl", (e = "") => e.indexOf("/cdn/") > -1), d(this, "getOptionsPage", (e, t = 25, s = 1) => ({
58
58
  ...e,
59
59
  per_page: t,
60
60
  page: s
61
- })), p(this, "delay", (e) => new Promise((t) => setTimeout(t, e))), p(this, "arrayFrom", (e = 0, t) => [...Array(e)].map(t)), p(this, "range", (e = 0, t = e) => {
61
+ })), d(this, "delay", (e) => new Promise((t) => setTimeout(t, e))), d(this, "arrayFrom", (e = 0, t) => [...Array(e)].map(t)), d(this, "range", (e = 0, t = e) => {
62
62
  const s = Math.abs(t - e) || 0, r = e < t ? 1 : -1;
63
63
  return this.arrayFrom(s, (n, o) => o * r + e);
64
- }), p(this, "asyncMap", async (e, t) => Promise.all(e.map(t))), p(this, "flatMap", (e = [], t) => e.map(t).reduce((s, r) => [...s, ...r], [])), p(this, "escapeHTML", function(e) {
64
+ }), d(this, "asyncMap", async (e, t) => Promise.all(e.map(t))), d(this, "flatMap", (e = [], t) => e.map(t).reduce((s, r) => [...s, ...r], [])), d(this, "escapeHTML", function(e) {
65
65
  const t = {
66
66
  "&": "&amp;",
67
67
  "<": "&lt;",
@@ -114,21 +114,21 @@ class x {
114
114
  return t;
115
115
  }
116
116
  }
117
- }
118
- const X = function(i, e) {
117
+ };
118
+ const ee = function(i, e) {
119
119
  const t = {};
120
120
  for (const s in i) {
121
121
  const r = i[s];
122
122
  e.indexOf(s) > -1 && r !== null && (t[s] = r);
123
123
  }
124
124
  return t;
125
- }, W = (i) => i === "email", Q = () => ({
125
+ }, te = (i) => i === "email", se = () => ({
126
126
  singleTag: "hr"
127
- }), Z = () => ({
127
+ }), re = () => ({
128
128
  tag: "blockquote"
129
- }), ee = () => ({
129
+ }), ie = () => ({
130
130
  tag: "ul"
131
- }), te = (i) => ({
131
+ }), ne = (i) => ({
132
132
  tag: [
133
133
  "pre",
134
134
  {
@@ -136,24 +136,24 @@ const X = function(i, e) {
136
136
  attrs: i.attrs
137
137
  }
138
138
  ]
139
- }), se = () => ({
139
+ }), oe = () => ({
140
140
  singleTag: "br"
141
- }), re = (i) => ({
141
+ }), ae = (i) => ({
142
142
  tag: `h${i.attrs.level}`
143
- }), ie = (i) => ({
143
+ }), le = (i) => ({
144
144
  singleTag: [
145
145
  {
146
146
  tag: "img",
147
- attrs: X(i.attrs, ["src", "alt", "title"])
147
+ attrs: ee(i.attrs, ["src", "alt", "title"])
148
148
  }
149
149
  ]
150
- }), ne = () => ({
150
+ }), ce = () => ({
151
151
  tag: "li"
152
- }), oe = () => ({
152
+ }), he = () => ({
153
153
  tag: "ol"
154
- }), ae = () => ({
154
+ }), ue = () => ({
155
155
  tag: "p"
156
- }), le = (i) => ({
156
+ }), de = (i) => ({
157
157
  tag: [
158
158
  {
159
159
  tag: "span",
@@ -164,25 +164,25 @@ const X = function(i, e) {
164
164
  }
165
165
  }
166
166
  ]
167
- }), ce = () => ({
167
+ }), pe = () => ({
168
168
  tag: "b"
169
- }), he = () => ({
169
+ }), ge = () => ({
170
170
  tag: "s"
171
- }), ue = () => ({
171
+ }), fe = () => ({
172
172
  tag: "u"
173
- }), de = () => ({
173
+ }), me = () => ({
174
174
  tag: "strong"
175
- }), pe = () => ({
175
+ }), ye = () => ({
176
176
  tag: "code"
177
- }), ge = () => ({
177
+ }), be = () => ({
178
178
  tag: "i"
179
- }), fe = (i) => {
179
+ }), ke = (i) => {
180
180
  if (!i.attrs)
181
181
  return {
182
182
  tag: ""
183
183
  };
184
- const e = new x().escapeHTML, t = { ...i.attrs }, { linktype: s = "url" } = i.attrs;
185
- if (delete t.linktype, t.href && (t.href = e(i.attrs.href || "")), W(s) && (t.href = `mailto:${t.href}`), t.anchor && (t.href = `${t.href}#${t.anchor}`, delete t.anchor), t.custom) {
184
+ const e = new O().escapeHTML, t = { ...i.attrs }, { linktype: s = "url" } = i.attrs;
185
+ if (delete t.linktype, t.href && (t.href = e(i.attrs.href || "")), te(s) && (t.href = `mailto:${t.href}`), t.anchor && (t.href = `${t.href}#${t.anchor}`, delete t.anchor), t.custom) {
186
186
  for (const r in t.custom)
187
187
  t[r] = t.custom[r];
188
188
  delete t.custom;
@@ -195,25 +195,25 @@ const X = function(i, e) {
195
195
  }
196
196
  ]
197
197
  };
198
- }, me = (i) => ({
198
+ }, ve = (i) => ({
199
199
  tag: [
200
200
  {
201
201
  tag: "span",
202
202
  attrs: i.attrs
203
203
  }
204
204
  ]
205
- }), ye = () => ({
205
+ }), $e = () => ({
206
206
  tag: "sub"
207
- }), be = () => ({
207
+ }), Te = () => ({
208
208
  tag: "sup"
209
- }), ke = (i) => ({
209
+ }), Re = (i) => ({
210
210
  tag: [
211
211
  {
212
212
  tag: "span",
213
213
  attrs: i.attrs
214
214
  }
215
215
  ]
216
- }), ve = (i) => {
216
+ }), we = (i) => {
217
217
  var e;
218
218
  return (e = i.attrs) != null && e.color ? {
219
219
  tag: [
@@ -227,7 +227,7 @@ const X = function(i, e) {
227
227
  } : {
228
228
  tag: ""
229
229
  };
230
- }, $e = (i) => {
230
+ }, Se = (i) => {
231
231
  var e;
232
232
  return (e = i.attrs) != null && e.color ? {
233
233
  tag: [
@@ -241,36 +241,36 @@ const X = function(i, e) {
241
241
  } : {
242
242
  tag: ""
243
243
  };
244
- }, Te = {
244
+ }, _e = {
245
245
  nodes: {
246
- horizontal_rule: Q,
247
- blockquote: Z,
248
- bullet_list: ee,
249
- code_block: te,
250
- hard_break: se,
251
- heading: re,
252
- image: ie,
253
- list_item: ne,
254
- ordered_list: oe,
255
- paragraph: ae,
256
- emoji: le
246
+ horizontal_rule: se,
247
+ blockquote: re,
248
+ bullet_list: ie,
249
+ code_block: ne,
250
+ hard_break: oe,
251
+ heading: ae,
252
+ image: le,
253
+ list_item: ce,
254
+ ordered_list: he,
255
+ paragraph: ue,
256
+ emoji: de
257
257
  },
258
258
  marks: {
259
- bold: ce,
260
- strike: he,
261
- underline: ue,
262
- strong: de,
263
- code: pe,
264
- italic: ge,
265
- link: fe,
266
- styled: me,
267
- subscript: ye,
268
- superscript: be,
269
- anchor: ke,
270
- highlight: ve,
271
- textStyle: $e
272
- }
273
- }, Re = function(i) {
259
+ bold: pe,
260
+ strike: ge,
261
+ underline: fe,
262
+ strong: me,
263
+ code: ye,
264
+ italic: be,
265
+ link: ke,
266
+ styled: ve,
267
+ subscript: $e,
268
+ superscript: Te,
269
+ anchor: Re,
270
+ highlight: we,
271
+ textStyle: Se
272
+ }
273
+ }, Ee = function(i) {
274
274
  const e = {
275
275
  "&": "&amp;",
276
276
  "<": "&lt;",
@@ -280,10 +280,10 @@ const X = function(i, e) {
280
280
  }, t = /[&<>"']/g, s = RegExp(t.source);
281
281
  return i && s.test(i) ? i.replace(t, (r) => e[r]) : i;
282
282
  };
283
- let U = !1;
284
- class we {
283
+ let B = !1;
284
+ class Ie {
285
285
  constructor(e) {
286
- p(this, "marks"), p(this, "nodes"), e || (e = Te), this.marks = e.marks || [], this.nodes = e.nodes || [];
286
+ d(this, "marks"), d(this, "nodes"), e || (e = _e), this.marks = e.marks || [], this.nodes = e.nodes || [];
287
287
  }
288
288
  addNode(e, t) {
289
289
  this.nodes[e] = t;
@@ -292,9 +292,9 @@ class we {
292
292
  this.marks[e] = t;
293
293
  }
294
294
  render(e, t = { optimizeImages: !1 }, s = !0) {
295
- if (!U && s && (console.warn(
295
+ if (!B && s && (console.warn(
296
296
  "Warning ⚠️: The RichTextResolver class is deprecated and will be removed in the next major release. Please use the `@storyblok/richtext` package instead. https://github.com/storyblok/richtext/"
297
- ), U = !0), e && e.content && Array.isArray(e.content)) {
297
+ ), B = !0), e && e.content && Array.isArray(e.content)) {
298
298
  let r = "";
299
299
  return e.content.forEach((n) => {
300
300
  r += this.renderNode(n);
@@ -335,24 +335,24 @@ class we {
335
335
  /a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g,
336
336
  `a.storyblok.com/f/$1/$2.$3/m/${l}`
337
337
  ), typeof t != "boolean" && (t.sizes || t.srcset) && (e = e.replace(/<img.*?src=["|'](.*?)["|']/g, (a) => {
338
- var h, d;
339
- const u = a.match(
338
+ var c, u;
339
+ const p = a.match(
340
340
  /a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g
341
341
  );
342
- if (u && u.length > 0) {
343
- const m = {
344
- srcset: (h = t.srcset) == null ? void 0 : h.map((y) => {
342
+ if (p && p.length > 0) {
343
+ const g = {
344
+ srcset: (c = t.srcset) == null ? void 0 : c.map((y) => {
345
345
  if (typeof y == "number")
346
- return `//${u}/m/${y}x0${o} ${y}w`;
346
+ return `//${p}/m/${y}x0${o} ${y}w`;
347
347
  if (typeof y == "object" && y.length === 2) {
348
- let w = 0, E = 0;
349
- return typeof y[0] == "number" && (w = y[0]), typeof y[1] == "number" && (E = y[1]), `//${u}/m/${w}x${E}${o} ${w}w`;
348
+ let w = 0, j = 0;
349
+ return typeof y[0] == "number" && (w = y[0]), typeof y[1] == "number" && (j = y[1]), `//${p}/m/${w}x${j}${o} ${w}w`;
350
350
  }
351
351
  }).join(", "),
352
- sizes: (d = t.sizes) == null ? void 0 : d.map((y) => y).join(", ")
352
+ sizes: (u = t.sizes) == null ? void 0 : u.map((y) => y).join(", ")
353
353
  };
354
354
  let k = "";
355
- return m.srcset && (k += `srcset="${m.srcset}" `), m.sizes && (k += `sizes="${m.sizes}" `), a.replace(/<img/g, `<img ${k.trim()}`);
355
+ return g.srcset && (k += `srcset="${g.srcset}" `), g.sizes && (k += `sizes="${g.sizes}" `), a.replace(/<img/g, `<img ${k.trim()}`);
356
356
  }
357
357
  return a;
358
358
  })), e;
@@ -366,7 +366,7 @@ class we {
366
366
  const s = this.getMatchingNode(e);
367
367
  return s && s.tag && t.push(this.renderOpeningTag(s.tag)), e.content ? e.content.forEach((r) => {
368
368
  t.push(this.renderNode(r));
369
- }) : e.text ? t.push(Re(e.text)) : s && s.singleTag ? t.push(this.renderTag(s.singleTag, " /")) : s && s.html ? t.push(s.html) : e.type === "emoji" && t.push(this.renderEmoji(e)), s && s.tag && t.push(this.renderClosingTag(s.tag)), e.marks && e.marks.slice(0).reverse().forEach((r) => {
369
+ }) : e.text ? t.push(Ee(e.text)) : s && s.singleTag ? t.push(this.renderTag(s.singleTag, " /")) : s && s.html ? t.push(s.html) : e.type === "emoji" && t.push(this.renderEmoji(e)), s && s.tag && t.push(this.renderClosingTag(s.tag)), e.marks && e.marks.slice(0).reverse().forEach((r) => {
370
370
  const n = this.getMatchingMark(r);
371
371
  n && n.tag !== "" && t.push(this.renderClosingTag(n.tag));
372
372
  }), t.join("");
@@ -421,10 +421,10 @@ class we {
421
421
  return this.renderTag(t, " /");
422
422
  }
423
423
  }
424
- const j = we;
425
- class Se {
424
+ const L = Ie;
425
+ class je {
426
426
  constructor(e) {
427
- p(this, "baseURL"), p(this, "timeout"), p(this, "headers"), p(this, "responseInterceptor"), p(this, "fetch"), p(this, "ejectInterceptor"), p(this, "url"), p(this, "parameters"), p(this, "fetchOptions"), this.baseURL = e.baseURL, this.headers = e.headers || new Headers(), this.timeout = e != null && e.timeout ? e.timeout * 1e3 : 0, this.responseInterceptor = e.responseInterceptor, this.fetch = (...t) => e.fetch ? e.fetch(...t) : fetch(...t), this.ejectInterceptor = !1, this.url = "", this.parameters = {}, this.fetchOptions = {};
427
+ d(this, "baseURL"), d(this, "timeout"), d(this, "headers"), d(this, "responseInterceptor"), d(this, "fetch"), d(this, "ejectInterceptor"), d(this, "url"), d(this, "parameters"), d(this, "fetchOptions"), this.baseURL = e.baseURL, this.headers = e.headers || new Headers(), this.timeout = e != null && e.timeout ? e.timeout * 1e3 : 0, this.responseInterceptor = e.responseInterceptor, this.fetch = (...t) => e.fetch ? e.fetch(...t) : fetch(...t), this.ejectInterceptor = !1, this.url = "", this.parameters = {}, this.fetchOptions = {};
428
428
  }
429
429
  /**
430
430
  *
@@ -461,7 +461,7 @@ class Se {
461
461
  async _methodHandler(e) {
462
462
  let t = `${this.baseURL}${this.url}`, s = null;
463
463
  if (e === "get") {
464
- const a = new x();
464
+ const a = new O();
465
465
  t = `${this.baseURL}${this.url}?${a.stringify(
466
466
  this.parameters
467
467
  )}`;
@@ -479,10 +479,10 @@ class Se {
479
479
  ...this.fetchOptions
480
480
  });
481
481
  this.timeout && clearTimeout(l);
482
- const h = await this._responseHandler(
482
+ const c = await this._responseHandler(
483
483
  a
484
484
  );
485
- return this.responseInterceptor && !this.ejectInterceptor ? this._statusHandler(this.responseInterceptor(h)) : this._statusHandler(h);
485
+ return this.responseInterceptor && !this.ejectInterceptor ? this._statusHandler(this.responseInterceptor(c)) : this._statusHandler(c);
486
486
  } catch (a) {
487
487
  return {
488
488
  message: a
@@ -509,35 +509,35 @@ class Se {
509
509
  });
510
510
  }
511
511
  }
512
- const _e = Se, D = "SB-Agent", L = {
512
+ const xe = je, D = "SB-Agent", C = {
513
513
  defaultAgentName: "SB-JS-CLIENT",
514
514
  defaultAgentVersion: "SB-Agent-Version",
515
515
  packageVersion: "6.0.0"
516
516
  };
517
- let I = {};
518
- const S = {};
519
- class Ee {
517
+ let x = {};
518
+ const E = {};
519
+ class Oe {
520
520
  /**
521
521
  *
522
522
  * @param config ISbConfig interface
523
523
  * @param endpoint string, optional
524
524
  */
525
525
  constructor(e, t) {
526
- p(this, "client"), p(this, "maxRetries"), p(this, "retriesDelay"), p(this, "throttle"), p(this, "accessToken"), p(this, "cache"), p(this, "helpers"), p(this, "resolveCounter"), p(this, "relations"), p(this, "links"), p(this, "richTextResolver"), p(this, "resolveNestedRelations"), p(this, "stringifiedStoriesCache");
526
+ d(this, "client"), d(this, "maxRetries"), d(this, "retriesDelay"), d(this, "throttle"), d(this, "accessToken"), d(this, "cache"), d(this, "helpers"), d(this, "resolveCounter"), d(this, "relations"), d(this, "links"), d(this, "richTextResolver"), d(this, "resolveNestedRelations"), d(this, "stringifiedStoriesCache");
527
527
  let s = e.endpoint || t;
528
528
  if (!s) {
529
- const o = new x().getRegionURL, l = e.https === !1 ? "http" : "https";
529
+ const o = new O().getRegionURL, l = e.https === !1 ? "http" : "https";
530
530
  e.oauthToken ? s = `${l}://${o(e.region)}/v1` : s = `${l}://${o(e.region)}/v2`;
531
531
  }
532
532
  const r = new Headers();
533
533
  r.set("Content-Type", "application/json"), r.set("Accept", "application/json"), e.headers && (e.headers.constructor.name === "Headers" ? e.headers.entries().toArray() : Object.entries(e.headers)).forEach(([o, l]) => {
534
534
  r.set(o, l);
535
- }), r.has(D) || (r.set(D, L.defaultAgentName), r.set(
536
- L.defaultAgentVersion,
537
- L.packageVersion
535
+ }), r.has(D) || (r.set(D, C.defaultAgentName), r.set(
536
+ C.defaultAgentVersion,
537
+ C.packageVersion
538
538
  ));
539
539
  let n = 5;
540
- e.oauthToken && (r.set("Authorization", e.oauthToken), n = 3), e.rateLimit && (n = e.rateLimit), e.richTextSchema ? this.richTextResolver = new j(e.richTextSchema) : this.richTextResolver = new j(), e.componentResolver && this.setComponentResolver(e.componentResolver), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttle = Y(this.throttledRequest, n, 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.helpers = new x(), this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.client = new _e({
540
+ e.oauthToken && (r.set("Authorization", e.oauthToken), n = 3), e.rateLimit && (n = e.rateLimit), e.richTextSchema ? this.richTextResolver = new L(e.richTextSchema) : this.richTextResolver = new L(), e.componentResolver && this.setComponentResolver(e.componentResolver), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttle = Z(this.throttledRequest, n, 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.helpers = new O(), this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.client = new xe({
541
541
  baseURL: s,
542
542
  timeout: e.timeout || 0,
543
543
  headers: r,
@@ -556,7 +556,7 @@ class Ee {
556
556
  });
557
557
  }
558
558
  parseParams(e) {
559
- return e.token || (e.token = this.getToken()), e.cv || (e.cv = S[e.token]), Array.isArray(e.resolve_relations) && (e.resolve_relations = e.resolve_relations.join(",")), typeof e.resolve_relations < "u" && (e.resolve_level = 2), e;
559
+ return e.token || (e.token = this.getToken()), e.cv || (e.cv = E[e.token]), Array.isArray(e.resolve_relations) && (e.resolve_relations = e.resolve_relations.join(",")), typeof e.resolve_relations < "u" && (e.resolve_level = 2), e;
560
560
  }
561
561
  factoryParamOptions(e, t) {
562
562
  return this.helpers.isCDNUrl(e) ? this.parseParams(t) : t;
@@ -574,18 +574,18 @@ class Ee {
574
574
  return this.cacheResponse(r, n, void 0, s);
575
575
  }
576
576
  async getAll(e, t, s, r) {
577
- const n = (t == null ? void 0 : t.per_page) || 25, o = `/${e}`, l = o.split("/"), a = s || l[l.length - 1], h = 1, d = await this.makeRequest(
577
+ const n = (t == null ? void 0 : t.per_page) || 25, o = `/${e}`, l = o.split("/"), a = s || l[l.length - 1], c = 1, u = await this.makeRequest(
578
578
  o,
579
579
  t,
580
580
  n,
581
- h,
581
+ c,
582
582
  r
583
- ), u = d.total ? Math.ceil(d.total / n) : 1, m = await this.helpers.asyncMap(
584
- this.helpers.range(h, u),
583
+ ), p = u.total ? Math.ceil(u.total / n) : 1, g = await this.helpers.asyncMap(
584
+ this.helpers.range(c, p),
585
585
  (k) => this.makeRequest(o, t, n, k + 1, r)
586
586
  );
587
587
  return this.helpers.flatMap(
588
- [d, ...m],
588
+ [u, ...g],
589
589
  (k) => Object.values(k.data[a])
590
590
  );
591
591
  }
@@ -667,8 +667,8 @@ class Ee {
667
667
  if (e.link_uuids) {
668
668
  const n = e.link_uuids.length, o = [], l = 50;
669
669
  for (let a = 0; a < n; a += l) {
670
- const h = Math.min(n, a + l);
671
- o.push(e.link_uuids.slice(a, h));
670
+ const c = Math.min(n, a + l);
671
+ o.push(e.link_uuids.slice(a, c));
672
672
  }
673
673
  for (let a = 0; a < o.length; a++)
674
674
  (await this.getStories({
@@ -677,8 +677,8 @@ class Ee {
677
677
  version: t.version,
678
678
  by_uuids: o[a].join(",")
679
679
  })).data.stories.forEach(
680
- (h) => {
681
- r.push(h);
680
+ (c) => {
681
+ r.push(c);
682
682
  }
683
683
  );
684
684
  } else
@@ -695,8 +695,8 @@ class Ee {
695
695
  if (e.rel_uuids) {
696
696
  const n = e.rel_uuids.length, o = [], l = 50;
697
697
  for (let a = 0; a < n; a += l) {
698
- const h = Math.min(n, a + l);
699
- o.push(e.rel_uuids.slice(a, h));
698
+ const c = Math.min(n, a + l);
699
+ o.push(e.rel_uuids.slice(a, c));
700
700
  }
701
701
  for (let a = 0; a < o.length; a++)
702
702
  (await this.getStories({
@@ -705,8 +705,8 @@ class Ee {
705
705
  version: t.version,
706
706
  by_uuids: o[a].join(","),
707
707
  excluding_fields: t.excluding_fields
708
- })).data.stories.forEach((h) => {
709
- r.push(h);
708
+ })).data.stories.forEach((c) => {
709
+ r.push(c);
710
710
  });
711
711
  } else
712
712
  r = e.rels;
@@ -748,26 +748,26 @@ class Ee {
748
748
  return Promise.resolve(l);
749
749
  }
750
750
  return new Promise(async (l, a) => {
751
- var h;
751
+ var c;
752
752
  try {
753
- const d = await this.throttle("get", e, t, r);
754
- if (d.status !== 200)
755
- return a(d);
756
- let u = { data: d.data, headers: d.headers };
757
- if ((h = d.headers) != null && h["per-page"] && (u = Object.assign({}, u, {
758
- perPage: d.headers["per-page"] ? parseInt(d.headers["per-page"]) : 0,
759
- total: d.headers["per-page"] ? parseInt(d.headers.total) : 0
760
- })), u.data.story || u.data.stories) {
761
- const m = this.resolveCounter = ++this.resolveCounter % 1e3;
762
- await this.resolveStories(u.data, t, `${m}`);
753
+ const u = await this.throttle("get", e, t, r);
754
+ if (u.status !== 200)
755
+ return a(u);
756
+ let p = { data: u.data, headers: u.headers };
757
+ if ((c = u.headers) != null && c["per-page"] && (p = Object.assign({}, p, {
758
+ perPage: u.headers["per-page"] ? parseInt(u.headers["per-page"]) : 0,
759
+ total: u.headers["per-page"] ? parseInt(u.headers.total) : 0
760
+ })), p.data.story || p.data.stories) {
761
+ const g = this.resolveCounter = ++this.resolveCounter % 1e3;
762
+ await this.resolveStories(p.data, t, `${g}`);
763
763
  }
764
- return t.version === "published" && e != "/cdn/spaces/me" && await o.set(n, u), u.data.cv && t.token && S[t.token] != u.data.cv && (await this.flushCache(), S[t.token] = u.data.cv), l(u);
765
- } catch (d) {
766
- if (d.response && d.status === 429 && (s = typeof s > "u" ? 0 : s + 1, s < this.maxRetries))
764
+ return t.version === "published" && e != "/cdn/spaces/me" && await o.set(n, p), p.data.cv && t.token && E[t.token] != p.data.cv && (await this.flushCache(), E[t.token] = p.data.cv), l(p);
765
+ } catch (u) {
766
+ if (u.response && u.status === 429 && (s = typeof s > "u" ? 0 : s + 1, s < this.maxRetries))
767
767
  return console.log(
768
768
  `Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`
769
769
  ), await this.helpers.delay(this.retriesDelay), this.cacheResponse(e, t, s).then(l).catch(a);
770
- a(d);
770
+ a(u);
771
771
  }
772
772
  });
773
773
  }
@@ -775,32 +775,32 @@ class Ee {
775
775
  return this.client.setFetchOptions(r), this.client[e](t, s);
776
776
  }
777
777
  cacheVersions() {
778
- return S;
778
+ return E;
779
779
  }
780
780
  cacheVersion() {
781
- return S[this.accessToken];
781
+ return E[this.accessToken];
782
782
  }
783
783
  setCacheVersion(e) {
784
- this.accessToken && (S[this.accessToken] = e);
784
+ this.accessToken && (E[this.accessToken] = e);
785
785
  }
786
786
  clearCacheVersion() {
787
- this.accessToken && (S[this.accessToken] = 0);
787
+ this.accessToken && (E[this.accessToken] = 0);
788
788
  }
789
789
  cacheProvider() {
790
790
  switch (this.cache.type) {
791
791
  case "memory":
792
792
  return {
793
793
  get(e) {
794
- return Promise.resolve(I[e]);
794
+ return Promise.resolve(x[e]);
795
795
  },
796
796
  getAll() {
797
- return Promise.resolve(I);
797
+ return Promise.resolve(x);
798
798
  },
799
799
  set(e, t) {
800
- return I[e] = t, Promise.resolve(void 0);
800
+ return x[e] = t, Promise.resolve(void 0);
801
801
  },
802
802
  flush() {
803
- return I = {}, Promise.resolve(void 0);
803
+ return x = {}, Promise.resolve(void 0);
804
804
  }
805
805
  };
806
806
  case "custom":
@@ -826,7 +826,7 @@ class Ee {
826
826
  return await this.cacheProvider().flush(), this.clearCacheVersion(), this;
827
827
  }
828
828
  }
829
- const Ce = (i = {}) => {
829
+ const ze = (i = {}) => {
830
830
  const { apiOptions: e } = i;
831
831
  if (!e.accessToken) {
832
832
  console.error(
@@ -834,8 +834,8 @@ const Ce = (i = {}) => {
834
834
  );
835
835
  return;
836
836
  }
837
- return { storyblokApi: new Ee(e) };
838
- }, Pe = (i) => {
837
+ return { storyblokApi: new Oe(e) };
838
+ }, Be = (i) => {
839
839
  if (typeof i != "object" || typeof i._editable > "u")
840
840
  return {};
841
841
  try {
@@ -850,25 +850,28 @@ const Ce = (i = {}) => {
850
850
  return {};
851
851
  }
852
852
  };
853
- var b = /* @__PURE__ */ ((i) => (i.DOCUMENT = "doc", i.HEADING = "heading", i.PARAGRAPH = "paragraph", i.QUOTE = "blockquote", i.OL_LIST = "ordered_list", i.UL_LIST = "bullet_list", i.LIST_ITEM = "list_item", i.CODE_BLOCK = "code_block", i.HR = "horizontal_rule", i.BR = "hard_break", i.IMAGE = "image", i.EMOJI = "emoji", i.COMPONENT = "blok", i))(b || {}), v = /* @__PURE__ */ ((i) => (i.BOLD = "bold", i.STRONG = "strong", i.STRIKE = "strike", i.UNDERLINE = "underline", i.ITALIC = "italic", i.CODE = "code", i.LINK = "link", i.ANCHOR = "anchor", i.STYLED = "styled", i.SUPERSCRIPT = "superscript", i.SUBSCRIPT = "subscript", i.TEXT_STYLE = "textStyle", i.HIGHLIGHT = "highlight", i))(v || {}), B = /* @__PURE__ */ ((i) => (i.TEXT = "text", i))(B || {}), _ = /* @__PURE__ */ ((i) => (i.URL = "url", i.STORY = "story", i.ASSET = "asset", i.EMAIL = "email", i))(_ || {});
854
- function Ie(i, e) {
855
- if (!e) return { src: i, attrs: {} };
853
+ function Le(i, e) {
854
+ if (!e)
855
+ return { src: i, attrs: {} };
856
856
  let t = 0, s = 0;
857
857
  const r = {}, n = [];
858
- function o(a, h, d, u, m) {
859
- typeof a != "number" || a <= h || a >= d ? console.warn(`[StoryblokRichText] - ${u.charAt(0).toUpperCase() + u.slice(1)} value must be a number between ${h} and ${d} (inclusive)`) : m.push(`${u}(${a})`);
858
+ function o(a, c, u, p, g) {
859
+ typeof a != "number" || a <= c || a >= u ? console.warn(`[StoryblokRichText] - ${p.charAt(0).toUpperCase() + p.slice(1)} value must be a number between ${c} and ${u} (inclusive)`) : g.push(`${p}(${a})`);
860
860
  }
861
861
  if (typeof e == "object") {
862
862
  if (typeof e.width == "number" && e.width > 0 ? (r.width = e.width, t = e.width) : console.warn("[StoryblokRichText] - Width value must be a number greater than 0"), e.height && typeof e.height == "number" && e.height > 0 ? (r.height = e.height, s = e.height) : console.warn("[StoryblokRichText] - Height value must be a number greater than 0"), e.loading && ["lazy", "eager"].includes(e.loading) && (r.loading = e.loading), e.class && (r.class = e.class), e.filters) {
863
- const { filters: a } = e || {}, { blur: h, brightness: d, fill: u, format: m, grayscale: k, quality: y, rotate: w } = a || {};
864
- h && o(h, 0, 100, "blur", n), y && o(y, 0, 100, "quality", n), d && o(d, 0, 100, "brightness", n), u && n.push(`fill(${u})`), k && n.push("grayscale()"), w && [0, 90, 180, 270].includes(e.filters.rotate || 0) && n.push(`rotate(${w})`), m && ["webp", "png", "jpeg"].includes(m) && n.push(`format(${m})`);
863
+ const { filters: a } = e || {}, { blur: c, brightness: u, fill: p, format: g, grayscale: k, quality: y, rotate: w } = a || {};
864
+ c && o(c, 0, 100, "blur", n), y && o(y, 0, 100, "quality", n), u && o(u, 0, 100, "brightness", n), p && n.push(`fill(${p})`), k && n.push("grayscale()"), w && [0, 90, 180, 270].includes(e.filters.rotate || 0) && n.push(`rotate(${w})`), g && ["webp", "png", "jpeg"].includes(g) && n.push(`format(${g})`);
865
865
  }
866
866
  e.srcset && (r.srcset = e.srcset.map((a) => {
867
867
  if (typeof a == "number")
868
- return `${i}/m/${a}x0/${n.length > 0 ? "filters:" + n.join(":") : ""} ${a}w`;
868
+ return `${i}/m/${a}x0/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${a}w`;
869
869
  if (Array.isArray(a) && a.length === 2) {
870
- const [h, d] = a;
871
- return `${i}/m/${h}x${d}/${n.length > 0 ? "filters:" + n.join(":") : ""} ${h}w`;
870
+ const [c, u] = a;
871
+ return `${i}/m/${c}x${u}/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${c}w`;
872
+ } else {
873
+ console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");
874
+ return;
872
875
  }
873
876
  }).join(", ")), e.sizes && (r.sizes = e.sizes.join(", "));
874
877
  }
@@ -878,140 +881,175 @@ function Ie(i, e) {
878
881
  attrs: r
879
882
  };
880
883
  }
881
- const xe = (i = {}) => Object.keys(i).map((e) => `${e}="${i[e]}"`).join(" "), je = (i = {}) => Object.keys(i).map((e) => `${e}: ${i[e]}`).join("; ");
882
- function Oe(i) {
884
+ var v = /* @__PURE__ */ ((i) => (i.DOCUMENT = "doc", i.HEADING = "heading", i.PARAGRAPH = "paragraph", i.QUOTE = "blockquote", i.OL_LIST = "ordered_list", i.UL_LIST = "bullet_list", i.LIST_ITEM = "list_item", i.CODE_BLOCK = "code_block", i.HR = "horizontal_rule", i.BR = "hard_break", i.IMAGE = "image", i.EMOJI = "emoji", i.COMPONENT = "blok", i))(v || {}), $ = /* @__PURE__ */ ((i) => (i.BOLD = "bold", i.STRONG = "strong", i.STRIKE = "strike", i.UNDERLINE = "underline", i.ITALIC = "italic", i.CODE = "code", i.LINK = "link", i.ANCHOR = "anchor", i.STYLED = "styled", i.SUPERSCRIPT = "superscript", i.SUBSCRIPT = "subscript", i.TEXT_STYLE = "textStyle", i.HIGHLIGHT = "highlight", i))($ || {}), V = /* @__PURE__ */ ((i) => (i.TEXT = "text", i))(V || {}), I = /* @__PURE__ */ ((i) => (i.URL = "url", i.STORY = "story", i.ASSET = "asset", i.EMAIL = "email", i))(I || {});
885
+ const Ae = [
886
+ "area",
887
+ "base",
888
+ "br",
889
+ "col",
890
+ "embed",
891
+ "hr",
892
+ "img",
893
+ "input",
894
+ "link",
895
+ "meta",
896
+ "param",
897
+ "source",
898
+ "track",
899
+ "wbr"
900
+ ], Ce = (i = {}) => Object.keys(i).map((e) => `${e}="${i[e]}"`).join(" "), Pe = (i = {}) => Object.keys(i).map((e) => `${e}: ${i[e]}`).join("; ");
901
+ function Ne(i) {
883
902
  return i.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
884
903
  }
885
- function Le(i, e = {}, t) {
886
- const s = xe(e);
887
- return `<${s ? `${i} ${s}` : i}>${Array.isArray(t) ? t.join("") : t || ""}</${i}>`;
904
+ const q = (i) => Object.fromEntries(Object.entries(i).filter(([e, t]) => t !== void 0));
905
+ function Me(i, e = {}, t) {
906
+ const s = Ce(e), r = s ? `${i} ${s}` : i;
907
+ return Ae.includes(i) ? `<${r}>` : `<${r}>${Array.isArray(t) ? t.join("") : t || ""}</${i}>`;
888
908
  }
889
- function Ne(i = {}) {
909
+ function De(i = {}) {
890
910
  let e = 0;
891
911
  const {
892
- renderFn: t = Le,
893
- textFn: s = Oe,
912
+ renderFn: t = Me,
913
+ textFn: s = Ne,
894
914
  resolvers: r = {},
895
- optimizeImages: n = !1
896
- } = i, o = (c) => (g) => t(c, { ...g.attrs, key: `${c}-${e}` }, g.children || null), l = (c) => {
897
- const { src: g, alt: f, ...$ } = c.attrs || {};
898
- let T = g, R = {};
915
+ optimizeImages: n = !1,
916
+ keyedResolvers: o = !1
917
+ } = i, l = (h) => (f) => {
918
+ const m = f.attrs || {};
919
+ return o && (m.key = `${h}-${e}`), t(h, m, f.children || null);
920
+ }, a = (h) => {
921
+ const { src: f, alt: m, title: b, srcset: R, sizes: T } = h.attrs || {};
922
+ let S = f, _ = {};
899
923
  if (n) {
900
- const { src: V, attrs: J } = Ie(g, n);
901
- T = V, R = J;
924
+ const { src: Y, attrs: X } = Le(f, n);
925
+ S = Y, _ = X;
902
926
  }
903
- const G = {
904
- src: T,
905
- alt: f || "",
906
- key: `img-${e}`,
907
- ...$,
908
- ...R
927
+ o && (_ = {
928
+ ..._,
929
+ key: `img-${e}`
930
+ });
931
+ const K = {
932
+ src: S,
933
+ alt: m,
934
+ title: b,
935
+ srcset: R,
936
+ sizes: T,
937
+ ..._
909
938
  };
910
- return t("img", G, "");
911
- }, a = (c) => {
912
- const { level: g, ...f } = c.attrs || {};
913
- return t(`h${g}`, { ...f, key: `h${g}-${e}` }, c.children);
914
- }, h = (c) => {
915
- var g, f, $, T;
916
- return t("span", {
917
- "data-type": "emoji",
918
- "data-name": (g = c.attrs) == null ? void 0 : g.name,
919
- emoji: (f = c.attrs) == null ? void 0 : f.emoji,
920
- key: `emoji-${e}`
921
- }, t("img", {
922
- src: ($ = c.attrs) == null ? void 0 : $.fallbackImage,
923
- alt: (T = c.attrs) == null ? void 0 : T.alt,
939
+ return t("img", q(K));
940
+ }, c = (h) => {
941
+ const { level: f, ...m } = h.attrs || {}, b = {
942
+ ...m
943
+ };
944
+ return o && (b.key = `h${f}-${e}`), t(`h${f}`, b, h.children);
945
+ }, u = (h) => {
946
+ var f, m, b, R;
947
+ const T = t("img", {
948
+ src: (f = h.attrs) == null ? void 0 : f.fallbackImage,
949
+ alt: (m = h.attrs) == null ? void 0 : m.alt,
924
950
  style: "width: 1.25em; height: 1.25em; vertical-align: text-top",
925
951
  draggable: "false",
926
952
  loading: "lazy"
927
- }, ""));
928
- }, d = (c) => t("pre", { ...c.attrs, key: `code-${e}` }, t("code", { key: `code-${e}` }, c.children || "")), u = (c, g = !1) => ({ text: f, attrs: $ }) => t(c, g ? {
929
- style: je($),
930
- key: `${c}-${e}`
931
- } : { ...$, key: `${c}-${e}` }, f), m = (c) => O(c), k = (c) => {
932
- const { marks: g, ...f } = c;
933
- return "text" in c ? g ? g.reduce(
934
- ($, T) => m({ ...T, text: $ }),
953
+ }), S = {
954
+ "data-type": "emoji",
955
+ "data-name": (b = h.attrs) == null ? void 0 : b.name,
956
+ "data-emoji": (R = h.attrs) == null ? void 0 : R.emoji
957
+ };
958
+ return o && (S.key = `emoji-${e}`), t("span", S, T);
959
+ }, p = (h) => t("pre", {
960
+ ...h.attrs,
961
+ key: `code-${e}`
962
+ }, t("code", { key: `code-${e}` }, h.children || "")), g = (h, f = !1) => ({ text: m, attrs: b }) => {
963
+ const { class: R, id: T, ...S } = b || {}, _ = f ? {
964
+ class: R,
965
+ id: T,
966
+ style: Pe(S) || void 0
967
+ } : b || {};
968
+ return o && (_.key = `${h}-${e}`), t(h, q(_), m);
969
+ }, k = (h) => A(h), y = (h) => {
970
+ const { marks: f, ...m } = h;
971
+ return "text" in h ? f ? f.reduce(
972
+ (b, R) => k({ ...R, text: b }),
935
973
  // Fix: Ensure render function returns a string
936
- m({ ...f, children: f.children })
974
+ k({ ...m, children: m.children })
937
975
  // Fix: Cast children to string
938
- ) : s(f.text) : "";
939
- }, y = (c) => {
940
- const { linktype: g, href: f, anchor: $, ...T } = c.attrs || {};
941
- let R = "";
942
- switch (g) {
943
- case _.ASSET:
944
- case _.URL:
945
- R = f;
976
+ ) : s(m.text) : "";
977
+ }, w = (h) => {
978
+ const { linktype: f, href: m, anchor: b, ...R } = h.attrs || {};
979
+ let T = "";
980
+ switch (f) {
981
+ case I.ASSET:
982
+ case I.URL:
983
+ T = m;
946
984
  break;
947
- case _.EMAIL:
948
- R = `mailto:${f}`;
985
+ case I.EMAIL:
986
+ T = `mailto:${m}`;
949
987
  break;
950
- case _.STORY:
951
- R = f;
988
+ case I.STORY:
989
+ T = m;
952
990
  break;
953
991
  }
954
- return $ && (R = `${R}#${$}`), t("a", { ...T, href: R, key: `a-${e}` }, c.text);
955
- }, w = (c) => {
956
- var g, f;
992
+ return b && (T = `${T}#${b}`), t("a", { ...R, href: T, key: `a-${e}` }, h.text);
993
+ }, j = (h) => {
994
+ var f, m;
957
995
  return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), t("span", {
958
- blok: (g = c == null ? void 0 : c.attrs) == null ? void 0 : g.body[0],
959
- id: (f = c.attrs) == null ? void 0 : f.id,
996
+ blok: (f = h == null ? void 0 : h.attrs) == null ? void 0 : f.body[0],
997
+ id: (m = h.attrs) == null ? void 0 : m.id,
960
998
  key: `component-${e}`,
961
999
  style: "display: none"
962
- }, "");
963
- }, E = new Map([
964
- [b.DOCUMENT, o("div")],
965
- [b.HEADING, a],
966
- [b.PARAGRAPH, o("p")],
967
- [b.UL_LIST, o("ul")],
968
- [b.OL_LIST, o("ol")],
969
- [b.LIST_ITEM, o("li")],
970
- [b.IMAGE, l],
971
- [b.EMOJI, h],
972
- [b.CODE_BLOCK, d],
973
- [b.HR, o("hr")],
974
- [b.BR, o("br")],
975
- [b.QUOTE, o("blockquote")],
976
- [b.COMPONENT, w],
977
- [B.TEXT, k],
978
- [v.LINK, y],
979
- [v.ANCHOR, y],
980
- [v.STYLED, u("span", !0)],
981
- [v.BOLD, u("strong")],
982
- [v.TEXT_STYLE, u("span", !0)],
983
- [v.ITALIC, u("em")],
984
- [v.UNDERLINE, u("u")],
985
- [v.STRIKE, u("s")],
986
- [v.CODE, u("code")],
987
- [v.SUPERSCRIPT, u("sup")],
988
- [v.SUBSCRIPT, u("sub")],
989
- [v.HIGHLIGHT, u("mark")],
990
- ...Object.entries(r).map(([c, g]) => [c, g])
1000
+ });
1001
+ }, F = new Map([
1002
+ [v.DOCUMENT, l("div")],
1003
+ [v.HEADING, c],
1004
+ [v.PARAGRAPH, l("p")],
1005
+ [v.UL_LIST, l("ul")],
1006
+ [v.OL_LIST, l("ol")],
1007
+ [v.LIST_ITEM, l("li")],
1008
+ [v.IMAGE, a],
1009
+ [v.EMOJI, u],
1010
+ [v.CODE_BLOCK, p],
1011
+ [v.HR, l("hr")],
1012
+ [v.BR, l("br")],
1013
+ [v.QUOTE, l("blockquote")],
1014
+ [v.COMPONENT, j],
1015
+ [V.TEXT, y],
1016
+ [$.LINK, w],
1017
+ [$.ANCHOR, w],
1018
+ [$.STYLED, g("span", !0)],
1019
+ [$.BOLD, g("strong")],
1020
+ [$.TEXT_STYLE, g("span", !0)],
1021
+ [$.ITALIC, g("em")],
1022
+ [$.UNDERLINE, g("u")],
1023
+ [$.STRIKE, g("s")],
1024
+ [$.CODE, g("code")],
1025
+ [$.SUPERSCRIPT, g("sup")],
1026
+ [$.SUBSCRIPT, g("sub")],
1027
+ [$.HIGHLIGHT, g("mark")],
1028
+ ...Object.entries(r).map(([h, f]) => [h, f])
991
1029
  ]);
992
- function P(c) {
1030
+ function M(h) {
993
1031
  e += 1;
994
- const g = E.get(c.type);
995
- if (!g)
996
- return console.error("<Storyblok>", `No resolver found for node type ${c.type}`), "";
997
- if (c.type === "text")
998
- return g(c);
999
- const f = c.content ? c.content.map(O) : void 0;
1000
- return g({
1001
- ...c,
1002
- children: f
1032
+ const f = F.get(h.type);
1033
+ if (!f)
1034
+ return console.error("<Storyblok>", `No resolver found for node type ${h.type}`), "";
1035
+ if (h.type === "text")
1036
+ return f(h);
1037
+ const m = h.content ? h.content.map(A) : void 0;
1038
+ return f({
1039
+ ...h,
1040
+ children: m
1003
1041
  // Fix: Update the type of 'children' to Node[]
1004
1042
  });
1005
1043
  }
1006
- function O(c) {
1007
- return Array.isArray(c) ? c.map(P) : P(c);
1044
+ function A(h) {
1045
+ return Array.isArray(h) ? h.map(M) : M(h);
1008
1046
  }
1009
1047
  return {
1010
- render: O
1048
+ render: A
1011
1049
  };
1012
1050
  }
1013
- let A, C = "https://app.storyblok.com/f/storyblok-v2-latest.js";
1014
- const Me = (i, e, t = {}) => {
1051
+ let P, N = "https://app.storyblok.com/f/storyblok-v2-latest.js";
1052
+ const qe = (i, e, t = {}) => {
1015
1053
  var l;
1016
1054
  const r = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", o = +new URL((l = window.location) == null ? void 0 : l.href).searchParams.get(
1017
1055
  "_storyblok"
@@ -1022,13 +1060,13 @@ const Me = (i, e, t = {}) => {
1022
1060
  return;
1023
1061
  }
1024
1062
  window.storyblokRegisterEvent(() => {
1025
- new window.StoryblokBridge(t).on(["input", "published", "change"], (h) => {
1026
- h.action === "input" && h.story.id === i ? e(h.story) : (h.action === "change" || h.action === "published") && h.storyId === i && window.location.reload();
1063
+ new window.StoryblokBridge(t).on(["input", "published", "change"], (c) => {
1064
+ c.action === "input" && c.story.id === i ? e(c.story) : (c.action === "change" || c.action === "published") && c.storyId === i && window.location.reload();
1027
1065
  });
1028
1066
  });
1029
1067
  }
1030
- }, He = (i = {}) => {
1031
- var u, m;
1068
+ }, Ge = (i = {}) => {
1069
+ var p, g;
1032
1070
  const {
1033
1071
  bridge: e,
1034
1072
  accessToken: t,
@@ -1042,10 +1080,10 @@ const Me = (i, e, t = {}) => {
1042
1080
  let a = {};
1043
1081
  s.forEach((k) => {
1044
1082
  a = { ...a, ...k(l) };
1045
- }), o && (C = o);
1046
- const d = !(typeof window > "u") && ((m = (u = window.location) == null ? void 0 : u.search) == null ? void 0 : m.includes("_storyblok_tk"));
1047
- return e !== !1 && d && z(C), A = new j(n.schema), n.resolver && q(A, n.resolver), a;
1048
- }, q = (i, e) => {
1083
+ }), o && (N = o);
1084
+ const u = !(typeof window > "u") && ((g = (p = window.location) == null ? void 0 : p.search) == null ? void 0 : g.includes("_storyblok_tk"));
1085
+ return e !== !1 && u && G(N), P = new L(n.schema), n.resolver && J(P, n.resolver), a;
1086
+ }, J = (i, e) => {
1049
1087
  i.addNode("blok", (t) => {
1050
1088
  let s = "";
1051
1089
  return t.attrs.body.forEach((r) => {
@@ -1054,29 +1092,29 @@ const Me = (i, e, t = {}) => {
1054
1092
  html: s
1055
1093
  };
1056
1094
  });
1057
- }, Ae = (i) => !i || !(i != null && i.content.some((e) => e.content || e.type === "blok" || e.type === "horizontal_rule")), Ue = (i, e, t) => {
1058
- let s = t || A;
1095
+ }, He = (i) => !i || !(i != null && i.content.some((e) => e.content || e.type === "blok" || e.type === "horizontal_rule")), Ve = (i, e, t) => {
1096
+ let s = t || P;
1059
1097
  if (!s) {
1060
1098
  console.error(
1061
1099
  "Please initialize the Storyblok SDK before calling the renderRichText function"
1062
1100
  );
1063
1101
  return;
1064
1102
  }
1065
- return Ae(i) ? "" : (e && (s = new j(e.schema), e.resolver && q(s, e.resolver)), s.render(i, {}, !1));
1066
- }, De = () => z(C);
1103
+ return He(i) ? "" : (e && (s = new L(e.schema), e.resolver && J(s, e.resolver)), s.render(i, {}, !1));
1104
+ }, Je = () => G(N);
1067
1105
  export {
1068
- b as BlockTypes,
1069
- v as MarkTypes,
1070
- j as RichTextResolver,
1071
- Te as RichTextSchema,
1072
- B as TextTypes,
1073
- Ce as apiPlugin,
1074
- Ae as isRichTextEmpty,
1075
- De as loadStoryblokBridge,
1076
- Me as registerStoryblokBridge,
1077
- Ue as renderRichText,
1078
- Ne as richTextResolver,
1079
- Pe as storyblokEditable,
1080
- He as storyblokInit,
1081
- Me as useStoryblokBridge
1106
+ v as BlockTypes,
1107
+ $ as MarkTypes,
1108
+ L as RichTextResolver,
1109
+ _e as RichTextSchema,
1110
+ V as TextTypes,
1111
+ ze as apiPlugin,
1112
+ He as isRichTextEmpty,
1113
+ Je as loadStoryblokBridge,
1114
+ qe as registerStoryblokBridge,
1115
+ Ve as renderRichText,
1116
+ De as richTextResolver,
1117
+ Be as storyblokEditable,
1118
+ Ge as storyblokInit,
1119
+ qe as useStoryblokBridge
1082
1120
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storyblok/js",
3
- "version": "3.1.6",
3
+ "version": "3.1.7",
4
4
  "description": "SDK to integrate Storyblok into your project using JavaScript.",
5
5
  "main": "./dist/storyblok-js.js",
6
6
  "module": "./dist/storyblok-js.mjs",
@@ -28,7 +28,7 @@
28
28
  "prepublishOnly": "npm run build && cp ../README.md ./"
29
29
  },
30
30
  "dependencies": {
31
- "@storyblok/richtext": "^2.1.0",
31
+ "@storyblok/richtext": "^3.0.0",
32
32
  "storyblok-js-client": "^6.10.0"
33
33
  },
34
34
  "devDependencies": {
@@ -39,7 +39,7 @@
39
39
  "isomorphic-fetch": "^3.0.0",
40
40
  "start-server-and-test": "^2.0.8",
41
41
  "vite": "^5.4.8",
42
- "vitest": "^2.0.5"
42
+ "vitest": "^2.1.4"
43
43
  },
44
44
  "babel": {
45
45
  "presets": [