@storyblok/js 4.2.1 → 4.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -45,7 +45,7 @@ If you'd like to contribute, please refer to the [contributing guidelines](CONTR
45
45
 
46
46
  For help, discussion about best practices, or any other conversation that would benefit from being searchable:
47
47
 
48
- - [Discuss Storyblok on Github Discussions](https://github.com/storyblok/storyblok/discussions)
48
+ - [Discuss Storyblok on Github Discussions](https://github.com/storyblok/monoblok/discussions)
49
49
 
50
50
  For community support, chatting with other users, please visit:
51
51
 
@@ -53,7 +53,7 @@ For community support, chatting with other users, please visit:
53
53
 
54
54
  ## Support
55
55
 
56
- For bugs or feature requests, please [submit an issue](https://github.com/storyblok/storyblok-js/issues/new/choose).
56
+ For bugs or feature requests, please [submit an issue](https://github.com/storyblok/monoblok/issues/new/choose).
57
57
 
58
58
  > [!IMPORTANT]
59
59
  > Please search existing issues before submitting a new one. Issues without a minimal reproducible example will be closed. [Why reproductions are Required](https://antfu.me/posts/why-reproductions-are-required).
@@ -4,4 +4,4 @@
4
4
  * description: SDK to integrate Storyblok into your project using JavaScript.
5
5
  * author: undefined
6
6
  */
7
- (function(w,S){typeof exports=="object"&&typeof module<"u"?S(exports):typeof define=="function"&&define.amd?define(["exports"],S):(w=typeof globalThis<"u"?globalThis:w||self,S(w.storyblok={}))})(this,function(w){"use strict";function S(r,e){if(!e)return{src:r,attrs:{}};let t=0,o=0;const s={},n=[];function l(a,h,d,y,R){typeof a!="number"||a<=h||a>=d?console.warn(`[StoryblokRichText] - ${y.charAt(0).toUpperCase()+y.slice(1)} value must be a number between ${h} and ${d} (inclusive)`):R.push(`${y}(${a})`)}if(typeof e=="object"){if(typeof e.width=="number"&&e.width>0?(s.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?(s.height=e.height,o=e.height):console.warn("[StoryblokRichText] - Height value must be a number greater than 0"),e.loading&&["lazy","eager"].includes(e.loading)&&(s.loading=e.loading),e.class&&(s.class=e.class),e.filters){const{filters:a}=e||{},{blur:h,brightness:d,fill:y,format:R,grayscale:$,quality:L,rotate:C}=a||{};h&&l(h,0,100,"blur",n),L&&l(L,0,100,"quality",n),d&&l(d,0,100,"brightness",n),y&&n.push(`fill(${y})`),$&&n.push("grayscale()"),C&&[0,90,180,270].includes(e.filters.rotate||0)&&n.push(`rotate(${C})`),R&&["webp","png","jpeg"].includes(R)&&n.push(`format(${R})`)}e.srcset&&(s.srcset=e.srcset.map(a=>{if(typeof a=="number")return`${r}/m/${a}x0/${n.length>0?`filters:${n.join(":")}`:""} ${a}w`;if(Array.isArray(a)&&a.length===2){const[h,d]=a;return`${r}/m/${h}x${d}/${n.length>0?`filters:${n.join(":")}`:""} ${h}w`}else{console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");return}}).join(", ")),e.sizes&&(s.sizes=e.sizes.join(", "))}let c=`${r}/m/`;return t>0&&o>0&&(c=`${c}${t}x${o}/`),n.length>0&&(c=`${c}filters:${n.join(":")}`),{src:c,attrs:s}}var b=(r=>(r.DOCUMENT="doc",r.HEADING="heading",r.PARAGRAPH="paragraph",r.QUOTE="blockquote",r.OL_LIST="ordered_list",r.UL_LIST="bullet_list",r.LIST_ITEM="list_item",r.CODE_BLOCK="code_block",r.HR="horizontal_rule",r.BR="hard_break",r.IMAGE="image",r.EMOJI="emoji",r.COMPONENT="blok",r.TABLE="table",r.TABLE_ROW="tableRow",r.TABLE_CELL="tableCell",r.TABLE_HEADER="tableHeader",r))(b||{}),_=(r=>(r.BOLD="bold",r.STRONG="strong",r.STRIKE="strike",r.UNDERLINE="underline",r.ITALIC="italic",r.CODE="code",r.LINK="link",r.ANCHOR="anchor",r.STYLED="styled",r.SUPERSCRIPT="superscript",r.SUBSCRIPT="subscript",r.TEXT_STYLE="textStyle",r.HIGHLIGHT="highlight",r))(_||{}),N=(r=>(r.TEXT="text",r))(N||{}),I=(r=>(r.URL="url",r.STORY="story",r.ASSET="asset",r.EMAIL="email",r))(I||{});const Q=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Z=(r={})=>Object.keys(r).map(e=>`${e}="${r[e]}"`).join(" "),ee=(r={})=>Object.keys(r).map(e=>`${e}: ${r[e]}`).join("; ");function te(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}const O=r=>Object.fromEntries(Object.entries(r).filter(([e,t])=>t!==void 0));function D(r,e={},t){const o=Z(e),s=o?`${r} ${o}`:r,n=Array.isArray(t)?t.join(""):t||"";if(r){if(Q.includes(r))return`<${s}>`}else return n;return`<${s}>${n}</${r}>`}function M(r={}){const e=new Map,{renderFn:t=D,textFn:o=te,resolvers:s={},optimizeImages:n=!1,keyedResolvers:l=!1}=r,c=t!==D,a=i=>(u,p)=>{const f=u.attrs||{};return p.render(i,f,u.children||null)},h=(i,u)=>{const{src:p,alt:f,title:m,srcset:T,sizes:v}=i.attrs||{};let k=p,E={};if(n){const{src:Ae,attrs:Se}=S(p,n);k=Ae,E=Se}const Ee={src:k,alt:f,title:m,srcset:T,sizes:v,...E};return u.render("img",O(Ee))},d=(i,u)=>{const{level:p,...f}=i.attrs||{};return u.render(`h${p}`,f,i.children)},y=(i,u)=>{var p,f,m,T;const v=u.render("img",{src:(p=i.attrs)==null?void 0:p.fallbackImage,alt:(f=i.attrs)==null?void 0:f.alt,style:"width: 1.25em; height: 1.25em; vertical-align: text-top",draggable:"false",loading:"lazy"});return u.render("span",{"data-type":"emoji","data-name":(m=i.attrs)==null?void 0:m.name,"data-emoji":(T=i.attrs)==null?void 0:T.emoji},v)},R=(i,u)=>u.render("pre",i.attrs||{},u.render("code",{},i.children||"")),$=(i,u=!1)=>({text:p,attrs:f},m)=>{const{class:T,id:v,...k}=f||{},E=u?{class:T,id:v,style:ee(k)||void 0}:f||{};return m.render(i,O(E),p)},L=i=>U(i),C=i=>{const{marks:u,...p}=i;if("text"in i){if(u)return u.reduce((m,T)=>L({...T,text:m}),L({...p,children:p.children}));const f=i.attrs||{};if(l){const m=e.get("txt")||0;e.set("txt",m+1),f.key=`txt-${m}`}return o(p.text,f)}return""},K=(i,u)=>{const{linktype:p,href:f,anchor:m,...T}=i.attrs||{};let v="";switch(p){case I.ASSET:case I.URL:v=f;break;case I.EMAIL:v=`mailto:${f}`;break;case I.STORY:v=f,m&&(v=`${v}#${m}`);break;default:v=f;break}const k={...T};return v&&(k.href=v),u.render("a",k,i.text)},ke=(i,u)=>{var p,f;return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),u.render("span",{blok:(p=i==null?void 0:i.attrs)==null?void 0:p.body[0],id:(f=i.attrs)==null?void 0:f.id,style:"display: none"})},we=(i,u)=>{const p={},f=u.render("tbody",{},i.children);return u.render("table",p,f)},Te=(i,u)=>{const p={};return u.render("tr",p,i.children)},Re=(i,u)=>{const{colspan:p,rowspan:f,colwidth:m,backgroundColor:T,...v}=i.attrs||{},k={...v};p>1&&(k.colspan=p),f>1&&(k.rowspan=f);const E=[];return m&&E.push(`width: ${m}px;`),T&&E.push(`background-color: ${T};`),E.length>0&&(k.style=E.join(" ")),u.render("td",O(k),i.children)},_e=(i,u)=>{const{colspan:p,rowspan:f,colwidth:m,backgroundColor:T,...v}=i.attrs||{},k={...v};p>1&&(k.colspan=p),f>1&&(k.rowspan=f);const E=[];return m&&E.push(`width: ${m}px;`),T&&E.push(`background-color: ${T};`),E.length>0&&(k.style=E.join(" ")),u.render("th",O(k),i.children)},W=new Map([[b.DOCUMENT,a("")],[b.HEADING,d],[b.PARAGRAPH,a("p")],[b.UL_LIST,a("ul")],[b.OL_LIST,a("ol")],[b.LIST_ITEM,a("li")],[b.IMAGE,h],[b.EMOJI,y],[b.CODE_BLOCK,R],[b.HR,a("hr")],[b.BR,a("br")],[b.QUOTE,a("blockquote")],[b.COMPONENT,ke],[N.TEXT,C],[_.LINK,K],[_.ANCHOR,K],[_.STYLED,$("span",!0)],[_.BOLD,$("strong")],[_.TEXT_STYLE,$("span",!0)],[_.ITALIC,$("em")],[_.UNDERLINE,$("u")],[_.STRIKE,$("s")],[_.CODE,$("code")],[_.SUPERSCRIPT,$("sup")],[_.SUBSCRIPT,$("sub")],[_.HIGHLIGHT,$("mark")],[b.TABLE,we],[b.TABLE_ROW,Te],[b.TABLE_CELL,Re],[b.TABLE_HEADER,_e]]),X=new Map([...W,...Object.entries(s).map(([i,u])=>[i,u])]),$e=()=>({render:(i,u={},p)=>{if(l&&i){const f=e.get(i)||0;e.set(i,f+1),u.key=`${i}-${f}`}return t(i,u,p)},originalResolvers:W,mergedResolvers:X});function P(i){const u=X.get(i.type);if(!u)return console.error("<Storyblok>",`No resolver found for node type ${i.type}`),"";const p=$e();if(i.type==="text")return u(i,p);const f=i.content?i.content.map(U):void 0;return u({...i,children:f},p)}function U(i){return i.type==="doc"?c?i.content.map(P):i.content.map(P).join(""):Array.isArray(i)?i.map(P):P(i)}return{render:U}}let z=!1;const G=[],V=r=>new Promise((e,t)=>{if(typeof window>"u"){t(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));return}if(window.storyblokRegisterEvent=s=>{if(!window.location.search.includes("_storyblok")){console.warn("You are not in Draft Mode or in the Visual Editor.");return}z?s():G.push(s)},document.getElementById("storyblok-javascript-bridge")){e(void 0);return}const o=document.createElement("script");o.async=!0,o.src=r,o.id="storyblok-javascript-bridge",o.onerror=s=>t(s),o.onload=s=>{G.forEach(n=>n()),z=!0,e(s)},document.getElementsByTagName("head")[0].appendChild(o)});var se=Object.defineProperty,re=(r,e,t)=>e in r?se(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,g=(r,e,t)=>re(r,typeof e!="symbol"?e+"":e,t);class oe extends Error{constructor(e){super(e),this.name="AbortError"}}function ne(r,e,t){if(!Number.isFinite(e))throw new TypeError("Expected `limit` to be a finite number");if(!Number.isFinite(t))throw new TypeError("Expected `interval` to be a finite number");const o=[];let s=[],n=0,l=!1;const c=async()=>{n++;const h=o.shift();if(h)try{const y=await r(...h.args);h.resolve(y)}catch(y){h.reject(y)}const d=setTimeout(()=>{n--,o.length>0&&c(),s=s.filter(y=>y!==d)},t);s.includes(d)||s.push(d)},a=(...h)=>l?Promise.reject(new Error("Throttled function is already aborted and not accepting new promises")):new Promise((d,y)=>{o.push({resolve:d,reject:y,args:h}),n<e&&c()});return a.abort=()=>{l=!0,s.forEach(clearTimeout),s=[],o.forEach(h=>h.reject(()=>new oe("Throttle function aborted"))),o.length=0},a}const q=(r="")=>r.includes("/cdn/"),ie=(r,e=25,t=1)=>({...r,per_page:e,page:t}),ae=r=>new Promise(e=>setTimeout(e,r)),le=(r=0,e)=>Array.from({length:r},e),ce=(r=0,e=r)=>{const t=Math.abs(e-r)||0,o=r<e?1:-1;return le(t,(s,n)=>n*o+r)},he=async(r,e)=>Promise.all(r.map(e)),ue=(r=[],e)=>r.map(e).reduce((t,o)=>[...t,...o],[]),B=(r,e,t)=>{const o=[];for(const s in r){if(!Object.prototype.hasOwnProperty.call(r,s))continue;const n=r[s];if(n==null)continue;const l=t?"":encodeURIComponent(s);let c;typeof n=="object"?c=B(n,e?e+encodeURIComponent(`[${l}]`):l,Array.isArray(n)):c=`${e?e+encodeURIComponent(`[${l}]`):l}=${encodeURIComponent(n)}`,o.push(c)}return o.join("&")},F=r=>{const e={eu:"api.storyblok.com",us:"api-us.storyblok.com",cn:"app.storyblokchina.cn",ap:"api-ap.storyblok.com",ca:"api-ca.storyblok.com"};return e[r]??e.eu};class de{constructor(e){g(this,"baseURL"),g(this,"timeout"),g(this,"headers"),g(this,"responseInterceptor"),g(this,"fetch"),g(this,"ejectInterceptor"),g(this,"url"),g(this,"parameters"),g(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=[],o={data:{},headers:{},status:0,statusText:""};e.status!==204&&await e.json().then(s=>{o.data=s});for(const s of e.headers.entries())t[s[0]]=s[1];return o.headers={...t},o.status=e.status,o.statusText=e.statusText,o}async _methodHandler(e){let t=`${this.baseURL}${this.url}`,o=null;e==="get"?t=`${this.baseURL}${this.url}?${B(this.parameters)}`:o=JSON.stringify(this.parameters);const s=new URL(t),n=new AbortController,{signal:l}=n;let c;this.timeout&&(c=setTimeout(()=>n.abort(),this.timeout));try{const a=await this.fetch(`${s}`,{method:e,headers:this.headers,body:o,signal:l,...this.fetchOptions});this.timeout&&clearTimeout(c);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}_normalizeErrorMessage(e){if(Array.isArray(e))return e[0]||"Unknown error";if(e&&typeof e=="object"){if(e.error)return e.error;for(const t in e){if(Array.isArray(e[t]))return`${t}: ${e[t][0]}`;if(typeof e[t]=="string")return`${t}: ${e[t]}`}if(e.slug)return e.slug}return"Unknown error"}_statusHandler(e){const t=/20[0-6]/g;return new Promise((o,s)=>{if(t.test(`${e.status}`))return o(e);const n={message:this._normalizeErrorMessage(e.data),status:e.status,response:e};s(n)})}}const J="SB-Agent",H={defaultAgentName:"SB-JS-CLIENT",defaultAgentVersion:"SB-Agent-Version",packageVersion:"7.0.0"},pe={PUBLISHED:"published"};let j={};const A={};class fe{constructor(e,t){g(this,"client"),g(this,"maxRetries"),g(this,"retriesDelay"),g(this,"throttle"),g(this,"accessToken"),g(this,"cache"),g(this,"resolveCounter"),g(this,"relations"),g(this,"links"),g(this,"version"),g(this,"richTextResolver"),g(this,"resolveNestedRelations"),g(this,"stringifiedStoriesCache"),g(this,"inlineAssets");let o=e.endpoint||t;if(!o){const l=e.https===!1?"http":"https";e.oauthToken?o=`${l}://${F(e.region)}/v1`:o=`${l}://${F(e.region)}/v2`}const s=new Headers;s.set("Content-Type","application/json"),s.set("Accept","application/json"),e.headers&&(e.headers.constructor.name==="Headers"?e.headers.entries().toArray():Object.entries(e.headers)).forEach(([l,c])=>{s.set(l,c)}),s.has(J)||(s.set(J,H.defaultAgentName),s.set(H.defaultAgentVersion,H.packageVersion));let n=5;e.oauthToken&&(s.set("Authorization",e.oauthToken),n=3),e.rateLimit&&(n=e.rateLimit),this.maxRetries=e.maxRetries||10,this.retriesDelay=300,this.throttle=ne(this.throttledRequest.bind(this),n,1e3),this.accessToken=e.accessToken||"",this.relations={},this.links={},this.cache=e.cache||{clear:"manual"},this.resolveCounter=0,this.resolveNestedRelations=e.resolveNestedRelations||!0,this.stringifiedStoriesCache={},this.version=e.version||pe.PUBLISHED,this.inlineAssets=e.inlineAssets||!1,this.client=new de({baseURL:o,timeout:e.timeout||0,headers:s,responseInterceptor:e.responseInterceptor,fetch:e.fetch})}parseParams(e){return e.token||(e.token=this.getToken()),e.cv||(e.cv=A[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 q(e)?this.parseParams(t):t}makeRequest(e,t,o,s,n){const l=this.factoryParamOptions(e,ie(t,o,s));return this.cacheResponse(e,l,void 0,n)}get(e,t={},o){t||(t={});const s=`/${e}`;q(s)&&(t.version=t.version||this.version);const n=this.factoryParamOptions(s,t);return this.cacheResponse(s,n,void 0,o)}async getAll(e,t={},o,s){const n=(t==null?void 0:t.per_page)||25,l=`/${e}`.replace(/\/$/,""),c=o??l.substring(l.lastIndexOf("/")+1);t.version=t.version||this.version;const a=1,h=await this.makeRequest(l,t,n,a,s),d=h.total?Math.ceil(h.total/n):1,y=await he(ce(a,d),R=>this.makeRequest(l,t,n,R+1,s));return ue([h,...y],R=>Object.values(R.data[c]))}post(e,t={},o){const s=`/${e}`;return this.throttle("post",s,t,o)}put(e,t={},o){const s=`/${e}`;return this.throttle("put",s,t,o)}delete(e,t={},o){t||(t={});const s=`/${e}`;return this.throttle("delete",s,t,o)}getStories(e={},t){return this._addResolveLevel(e),this.get("cdn/stories",e,t)}getStory(e,t={},o){return this._addResolveLevel(t),this.get(`cdn/stories/${e}`,t,o)}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,o){const s=e[t];s&&s.fieldtype==="multilink"&&s.linktype==="story"&&typeof s.id=="string"&&this.links[o][s.id]?s.story=this._cleanCopy(this.links[o][s.id]):s&&s.linktype==="story"&&typeof s.uuid=="string"&&this.links[o][s.uuid]&&(s.story=this._cleanCopy(this.links[o][s.uuid]))}getStoryReference(e,t){return this.relations[e][t]?JSON.parse(this.stringifiedStoriesCache[t]||JSON.stringify(this.relations[e][t])):t}_resolveField(e,t,o){const s=e[t];typeof s=="string"?e[t]=this.getStoryReference(o,s):Array.isArray(s)&&(e[t]=s.map(n=>this.getStoryReference(o,n)).filter(Boolean))}_insertRelations(e,t,o,s){if(Array.isArray(o)?o.find(l=>l.endsWith(`.${t}`)):o.endsWith(`.${t}`)){this._resolveField(e,t,s);return}const n=e.component?`${e.component}.${t}`:t;(Array.isArray(o)?o.includes(n):o===n)&&this._resolveField(e,t,s)}iterateTree(e,t,o){const s=(n,l="")=>{if(!(!n||n._stopResolving)){if(Array.isArray(n))n.forEach((c,a)=>s(c,`${l}[${a}]`));else if(typeof n=="object")for(const c in n){const a=l?`${l}.${c}`:c;(n.component&&n._uid||n.type==="link")&&(this._insertRelations(n,c,t,o),this._insertLinks(n,c,o)),s(n[c],a)}}};s(e.content)}async resolveLinks(e,t,o){let s=[];if(e.link_uuids){const n=e.link_uuids.length,l=[],c=50;for(let a=0;a<n;a+=c){const h=Math.min(n,a+c);l.push(e.link_uuids.slice(a,h))}for(let a=0;a<l.length;a++)(await this.getStories({per_page:c,language:t.language,version:t.version,starts_with:t.starts_with,by_uuids:l[a].join(",")})).data.stories.forEach(h=>{s.push(h)})}else s=e.links;s.forEach(n=>{this.links[o][n.uuid]={...n,_stopResolving:!0}})}async resolveRelations(e,t,o){let s=[];if(e.rel_uuids){const n=e.rel_uuids.length,l=[],c=50;for(let a=0;a<n;a+=c){const h=Math.min(n,a+c);l.push(e.rel_uuids.slice(a,h))}for(let a=0;a<l.length;a++)(await this.getStories({per_page:c,language:t.language,version:t.version,starts_with:t.starts_with,by_uuids:l[a].join(","),excluding_fields:t.excluding_fields})).data.stories.forEach(h=>{s.push(h)});s.length>0&&(e.rels=s,delete e.rel_uuids)}else s=e.rels;s&&s.length>0&&s.forEach(n=>{this.relations[o][n.uuid]={...n,_stopResolving:!0}})}async resolveStories(e,t,o){var s,n;let l=[];if(this.links[o]={},this.relations[o]={},typeof t.resolve_relations<"u"&&t.resolve_relations.length>0&&(typeof t.resolve_relations=="string"&&(l=t.resolve_relations.split(",")),await this.resolveRelations(e,t,o)),t.resolve_links&&["1","story","url","link"].includes(t.resolve_links)&&((s=e.links)!=null&&s.length||(n=e.link_uuids)!=null&&n.length)&&await this.resolveLinks(e,t,o),this.resolveNestedRelations)for(const c in this.relations[o])this.iterateTree(this.relations[o][c],l,o);e.story?this.iterateTree(e.story,l,o):e.stories.forEach(c=>{this.iterateTree(c,l,o)}),this.stringifiedStoriesCache={},delete this.links[o],delete this.relations[o]}async cacheResponse(e,t,o,s){const n=B({url:e,params:t}),l=this.cacheProvider();if(t.version==="published"&&e!=="/cdn/spaces/me"){const c=await l.get(n);if(c)return Promise.resolve(c)}return new Promise(async(c,a)=>{var h;try{const d=await this.throttle("get",e,t,s);if(d.status!==200)return a(d);let y={data:d.data,headers:d.headers};if((h=d.headers)!=null&&h["per-page"]&&(y=Object.assign({},y,{perPage:d.headers["per-page"]?Number.parseInt(d.headers["per-page"]):0,total:d.headers["per-page"]?Number.parseInt(d.headers.total):0})),y.data.story||y.data.stories){const $=this.resolveCounter=++this.resolveCounter%1e3;await this.resolveStories(y.data,t,`${$}`),y=await this.processInlineAssets(y)}t.version==="published"&&e!=="/cdn/spaces/me"&&await l.set(n,y);const R=this.cache.clear==="onpreview"&&t.version==="draft"||this.cache.clear==="auto";return t.token&&y.data.cv&&(R&&A[t.token]&&A[t.token]!==y.data.cv&&await this.flushCache(),A[t.token]=y.data.cv),c(y)}catch(d){if(d.response&&d.status===429&&(o=typeof o>"u"?0:o+1,o<this.maxRetries))return console.log(`Hit rate limit. Retrying in ${this.retriesDelay/1e3} seconds.`),await ae(this.retriesDelay),this.cacheResponse(e,t,o).then(c).catch(a);a(d)}})}throttledRequest(e,t,o,s){return this.client.setFetchOptions(s),this.client[e](t,o)}cacheVersions(){return A}cacheVersion(){return A[this.accessToken]}setCacheVersion(e){this.accessToken&&(A[this.accessToken]=e)}clearCacheVersion(){this.accessToken&&(A[this.accessToken]=0)}cacheProvider(){switch(this.cache.type){case"memory":return{get(e){return Promise.resolve(j[e])},getAll(){return Promise.resolve(j)},set(e,t){return j[e]=t,Promise.resolve(void 0)},flush(){return j={},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}async processInlineAssets(e){if(!this.inlineAssets)return e;const t=o=>{if(!o||typeof o!="object")return o;if(Array.isArray(o))return o.map(n=>t(n));let s={...o};s.fieldtype==="asset"&&Array.isArray(e.data.assets)&&(s={...s,...e.data.assets.find(n=>n.id===s.id)});for(const n in s)typeof s[n]=="object"&&(s[n]=t(s[n]));return s};return e.data.story&&(e.data.story.content=t(e.data.story.content)),e.data.stories&&(e.data.stories=e.data.stories.map(o=>(o.content=t(o.content),o))),e}}const ye=(r={})=>{const{apiOptions:e}=r;if(!e||!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 fe(e)}},ge=r=>{if(typeof r!="object"||typeof r._editable>"u")return{};try{const e=JSON.parse(r._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return e?{"data-blok-c":JSON.stringify(e),"data-blok-uid":`${e.id}-${e.uid}`}:{}}catch{return{}}};let x="https://app.storyblok.com/f/storyblok-v2-latest.js";const Y=(r,e,t={})=>{var c;const s=!(typeof window>"u")&&typeof window.storyblokRegisterEvent<"u",n=new URL((c=window.location)==null?void 0:c.href).searchParams.get("_storyblok"),l=n!==null&&+n===r;if(!(!s||!l)){if(!r){console.warn("Story ID is not defined. Please provide a valid ID.");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(t).on(["input","published","change"],h=>{var d;h&&(h.action==="input"&&((d=h.story)==null?void 0:d.id)===r?e(h.story):(h.action==="change"||h.action==="published")&&h.storyId===r&&window.location.reload())})})}},me=(r={})=>{var d,y;const{bridge:e,accessToken:t,use:o=[],apiOptions:s={},bridgeUrl:n}=r;s.accessToken=s.accessToken||t;const l={bridge:e,apiOptions:s};let c={};o.forEach(R=>{c={...c,...R(l)}}),n&&(x=n);const h=!(typeof window>"u")&&((y=(d=window.location)==null?void 0:d.search)==null?void 0:y.includes("_storyblok_tk"));return e!==!1&&h&&V(x),c};function be(r,e){return M(e).render(r)}const ve=()=>V(x);w.BlockTypes=b,w.MarkTypes=_,w.TextTypes=N,w.apiPlugin=ye,w.loadStoryblokBridge=ve,w.registerStoryblokBridge=Y,w.renderRichText=be,w.richTextResolver=M,w.storyblokEditable=ge,w.storyblokInit=me,w.useStoryblokBridge=Y,Object.defineProperty(w,Symbol.toStringTag,{value:"Module"})});
7
+ (function(v,S){typeof exports=="object"&&typeof module<"u"?S(exports):typeof define=="function"&&define.amd?define(["exports"],S):(v=typeof globalThis<"u"?globalThis:v||self,S(v.storyblok={}))})(this,function(v){"use strict";const S=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,nt=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/;function I(s){switch(s){case 9:case 32:return!0}return!1}function z(s){if(s>=8192&&s<=8202)return!0;switch(s){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function q(s){return S.test(s)||nt.test(s)}function G(s){switch(s){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function B(s,t,e){this.type=s,this.tag=t,this.attrs=null,this.map=null,this.nesting=e,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}B.prototype.attrIndex=function(t){if(!this.attrs)return-1;const e=this.attrs;for(let r=0,u=e.length;r<u;r++)if(e[r][0]===t)return r;return-1},B.prototype.attrPush=function(t){this.attrs?this.attrs.push(t):this.attrs=[t]},B.prototype.attrSet=function(t,e){const r=this.attrIndex(t),u=[t,e];r<0?this.attrPush(u):this.attrs[r]=u},B.prototype.attrGet=function(t){const e=this.attrIndex(t);let r=null;return e>=0&&(r=this.attrs[e][1]),r},B.prototype.attrJoin=function(t,e){const r=this.attrIndex(t);r<0?this.attrPush([t,e]):this.attrs[r][1]=this.attrs[r][1]+" "+e};function ot(s,t,e){this.src=s,this.env=e,this.tokens=[],this.inlineMode=!1,this.md=t}ot.prototype.Token=B;function w(s,t,e,r){this.src=s,this.md=t,this.env=e,this.tokens=r,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0;const u=this.src;for(let i=0,a=0,o=0,n=0,l=u.length,h=!1;a<l;a++){const D=u.charCodeAt(a);if(!h)if(I(D)){o++,D===9?n+=4-n%4:n++;continue}else h=!0;(D===10||a===l-1)&&(D!==10&&a++,this.bMarks.push(i),this.eMarks.push(a),this.tShift.push(o),this.sCount.push(n),this.bsCount.push(0),h=!1,o=0,n=0,i=a+1)}this.bMarks.push(u.length),this.eMarks.push(u.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}w.prototype.push=function(s,t,e){const r=new B(s,t,e);return r.block=!0,e<0&&this.level--,r.level=this.level,e>0&&this.level++,this.tokens.push(r),r},w.prototype.isEmpty=function(t){return this.bMarks[t]+this.tShift[t]>=this.eMarks[t]},w.prototype.skipEmptyLines=function(t){for(let e=this.lineMax;t<e&&!(this.bMarks[t]+this.tShift[t]<this.eMarks[t]);t++);return t},w.prototype.skipSpaces=function(t){for(let e=this.src.length;t<e;t++){const r=this.src.charCodeAt(t);if(!I(r))break}return t},w.prototype.skipSpacesBack=function(t,e){if(t<=e)return t;for(;t>e;)if(!I(this.src.charCodeAt(--t)))return t+1;return t},w.prototype.skipChars=function(t,e){for(let r=this.src.length;t<r&&this.src.charCodeAt(t)===e;t++);return t},w.prototype.skipCharsBack=function(t,e,r){if(t<=r)return t;for(;t>r;)if(e!==this.src.charCodeAt(--t))return t+1;return t},w.prototype.getLines=function(t,e,r,u){if(t>=e)return"";const i=new Array(e-t);for(let a=0,o=t;o<e;o++,a++){let n=0;const l=this.bMarks[o];let h=l,D;for(o+1<e||u?D=this.eMarks[o]+1:D=this.eMarks[o];h<D&&n<r;){const A=this.src.charCodeAt(h);if(I(A))A===9?n+=4-(n+this.bsCount[o])%4:n++;else if(h-l<this.tShift[o])n++;else break;h++}n>r?i[a]=new Array(n-r+1).join(" ")+this.src.slice(h,D):i[a]=this.src.slice(h,D)}return i.join("")},w.prototype.Token=B;const at=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],lt="[a-zA-Z_:][a-zA-Z0-9:._-]*",ct="(?:"+"[^\"'=<>`\\x00-\\x20]+"+"|"+"'[^']*'"+"|"+'"[^"]*"'+")",ht="<[A-Za-z][A-Za-z0-9\\-]*"+("(?:\\s+"+lt+"(?:\\s*=\\s*"+ct+")?)")+"*\\s*\\/?>",Dt="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",dt=new RegExp("^(?:"+ht+"|"+Dt+")");new RegExp("^</?("+at.join("|")+")(?=(\\s|/?>|$))","i"),new RegExp(dt.source+"\\s*$");function L(s,t,e,r){this.src=s,this.env=e,this.md=t,this.tokens=r,this.tokens_meta=Array(r.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}L.prototype.pushPending=function(){const s=new B("text","",0);return s.content=this.pending,s.level=this.pendingLevel,this.tokens.push(s),this.pending="",s},L.prototype.push=function(s,t,e){this.pending&&this.pushPending();const r=new B(s,t,e);let u=null;return e<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,e>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],u={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(u),r},L.prototype.scanDelims=function(s,t){const e=this.posMax,r=this.src.charCodeAt(s),u=s>0?this.src.charCodeAt(s-1):32;let i=s;for(;i<e&&this.src.charCodeAt(i)===r;)i++;const a=i-s,o=i<e?this.src.charCodeAt(i):32,n=G(u)||q(String.fromCharCode(u)),l=G(o)||q(String.fromCharCode(o)),h=z(u),D=z(o),A=!D&&(!l||h||n),y=!h&&(!n||D||l);return{can_open:A&&(t||!y||n),can_close:y&&(t||!A||l),length:a}},L.prototype.Token=B;const J=[];for(let s=0;s<256;s++)J.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(s){J[s.charCodeAt(0)]=1});let m=function(s){return s.DOCUMENT="doc",s.HEADING="heading",s.PARAGRAPH="paragraph",s.QUOTE="blockquote",s.OL_LIST="ordered_list",s.UL_LIST="bullet_list",s.LIST_ITEM="list_item",s.CODE_BLOCK="code_block",s.HR="horizontal_rule",s.BR="hard_break",s.IMAGE="image",s.EMOJI="emoji",s.COMPONENT="blok",s.TABLE="table",s.TABLE_ROW="tableRow",s.TABLE_CELL="tableCell",s.TABLE_HEADER="tableHeader",s}({}),x=function(s){return s.BOLD="bold",s.STRONG="strong",s.STRIKE="strike",s.UNDERLINE="underline",s.ITALIC="italic",s.CODE="code",s.LINK="link",s.ANCHOR="anchor",s.STYLED="styled",s.SUPERSCRIPT="superscript",s.SUBSCRIPT="subscript",s.TEXT_STYLE="textStyle",s.HIGHLIGHT="highlight",s}({}),V=function(s){return s.TEXT="text",s}({}),O=function(s){return s.URL="url",s.STORY="story",s.ASSET="asset",s.EMAIL="email",s}({});function Ft(s,t){if(!t)return{src:s,attrs:{}};let e=0,r=0;const u={},i=[];function a(n,l,h,D,A){typeof n!="number"||n<=l||n>=h?console.warn(`[StoryblokRichText] - ${D.charAt(0).toUpperCase()+D.slice(1)} value must be a number between ${l} and ${h} (inclusive)`):A.push(`${D}(${n})`)}if(typeof t=="object"){if(typeof t.width=="number"&&t.width>0?(u.width=t.width,e=t.width):console.warn("[StoryblokRichText] - Width value must be a number greater than 0"),t.height&&typeof t.height=="number"&&t.height>0?(u.height=t.height,r=t.height):console.warn("[StoryblokRichText] - Height value must be a number greater than 0"),t.loading&&["lazy","eager"].includes(t.loading)&&(u.loading=t.loading),t.class&&(u.class=t.class),t.filters){const{filters:n}=t||{},{blur:l,brightness:h,fill:D,format:A,grayscale:y,quality:R,rotate:T}=n||{};l&&a(l,0,100,"blur",i),R&&a(R,0,100,"quality",i),h&&a(h,0,100,"brightness",i),D&&i.push(`fill(${D})`),y&&i.push("grayscale()"),T&&[0,90,180,270].includes(t.filters.rotate||0)&&i.push(`rotate(${T})`),A&&["webp","png","jpeg"].includes(A)&&i.push(`format(${A})`)}t.srcset&&(u.srcset=t.srcset.map(n=>{if(typeof n=="number")return`${s}/m/${n}x0/${i.length>0?`filters:${i.join(":")}`:""} ${n}w`;if(Array.isArray(n)&&n.length===2){const[l,h]=n;return`${s}/m/${l}x${h}/${i.length>0?`filters:${i.join(":")}`:""} ${l}w`}else{console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");return}}).join(", ")),t.sizes&&(u.sizes=t.sizes.join(", "))}let o=`${s}/m/`;return e>0&&r>0&&(o=`${o}${e}x${r}/`),i.length>0&&(o=`${o}filters:${i.join(":")}`),{src:o,attrs:u}}const ft=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],pt=(s={})=>Object.keys(s).map(t=>`${t}="${s[t]}"`).join(" "),Et=(s={})=>Object.keys(s).map(t=>`${t}: ${s[t]}`).join("; ");function At(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}const P=s=>Object.fromEntries(Object.entries(s).filter(([t,e])=>e!==void 0));function W(s,t={},e){const r=pt(t),u=r?`${s} ${r}`:s,i=Array.isArray(e)?e.join(""):e||"";if(s){if(ft.includes(s))return`<${u}>`}else return i;return`<${u}>${i}</${s}>`}function Y(s={}){const t=new Map,{renderFn:e=W,textFn:r=At,resolvers:u={},optimizeImages:i=!1,keyedResolvers:a=!1}=s,o=e!==W,n=c=>(F,d)=>{const f=F.attrs||{};return d.render(c,f,F.children||null)},l=(c,F)=>{const{src:d,alt:f,title:E,srcset:C,sizes:g}=c.attrs||{};let b=d,k={};if(i){const{src:qt,attrs:Gt}=Ft(d,i);b=qt,k=Gt}const zt={src:b,alt:f,title:E,srcset:C,sizes:g,...k};return F.render("img",P(zt))},h=(c,F)=>{const{level:d,...f}=c.attrs||{};return F.render(`h${d}`,f,c.children)},D=(c,F)=>{var f,E,C,g;const d=F.render("img",{src:(f=c.attrs)==null?void 0:f.fallbackImage,alt:(E=c.attrs)==null?void 0:E.alt,style:"width: 1.25em; height: 1.25em; vertical-align: text-top",draggable:"false",loading:"lazy"});return F.render("span",{"data-type":"emoji","data-name":(C=c.attrs)==null?void 0:C.name,"data-emoji":(g=c.attrs)==null?void 0:g.emoji},d)},A=(c,F)=>F.render("pre",c.attrs||{},F.render("code",{},c.children||"")),y=(c,F=!1)=>({text:d,attrs:f},E)=>{const{class:C,id:g,...b}=f||{},k=F?{class:C,id:g,style:Et(b)||void 0}:f||{};return E.render(c,P(k),d)},R=c=>U(c),T=c=>{const{marks:F,...d}=c;if("text"in c){if(F)return F.reduce((E,C)=>R({...C,text:E}),R({...d,children:d.children}));const f=c.attrs||{};if(a){const E=t.get("txt")||0;t.set("txt",E+1),f.key=`txt-${E}`}return r(d.text,f)}return""},rt=(c,F)=>{const{linktype:d,href:f,anchor:E,...C}=c.attrs||{};let g="";switch(d){case O.ASSET:case O.URL:g=f;break;case O.EMAIL:g=`mailto:${f}`;break;case O.STORY:g=f,E&&(g=`${g}#${E}`);break;default:g=f;break}const b={...C};return g&&(b.href=g),F.render("a",b,c.text)},jt=(c,F)=>{var d,f;return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),F.render("span",{blok:(d=c==null?void 0:c.attrs)==null?void 0:d.body[0],id:(f=c.attrs)==null?void 0:f.id,style:"display: none"})},$t=(c,F)=>{const d={},f=F.render("tbody",{},c.children);return F.render("table",d,f)},Nt=(c,F)=>{const d={};return F.render("tr",d,c.children)},Ht=(c,F)=>{const{colspan:d,rowspan:f,colwidth:E,backgroundColor:C,...g}=c.attrs||{},b={...g};d>1&&(b.colspan=d),f>1&&(b.rowspan=f);const k=[];return E&&k.push(`width: ${E}px;`),C&&k.push(`background-color: ${C};`),k.length>0&&(b.style=k.join(" ")),F.render("td",P(b),c.children)},Mt=(c,F)=>{const{colspan:d,rowspan:f,colwidth:E,backgroundColor:C,...g}=c.attrs||{},b={...g};d>1&&(b.colspan=d),f>1&&(b.rowspan=f);const k=[];return E&&k.push(`width: ${E}px;`),C&&k.push(`background-color: ${C};`),k.length>0&&(b.style=k.join(" ")),F.render("th",P(b),c.children)},ut=new Map([[m.DOCUMENT,n("")],[m.HEADING,h],[m.PARAGRAPH,n("p")],[m.UL_LIST,n("ul")],[m.OL_LIST,n("ol")],[m.LIST_ITEM,n("li")],[m.IMAGE,l],[m.EMOJI,D],[m.CODE_BLOCK,A],[m.HR,n("hr")],[m.BR,n("br")],[m.QUOTE,n("blockquote")],[m.COMPONENT,jt],[V.TEXT,T],[x.LINK,rt],[x.ANCHOR,rt],[x.STYLED,y("span",!0)],[x.BOLD,y("strong")],[x.TEXT_STYLE,y("span",!0)],[x.ITALIC,y("em")],[x.UNDERLINE,y("u")],[x.STRIKE,y("s")],[x.CODE,y("code")],[x.SUPERSCRIPT,y("sup")],[x.SUBSCRIPT,y("sub")],[x.HIGHLIGHT,y("mark")],[m.TABLE,$t],[m.TABLE_ROW,Nt],[m.TABLE_CELL,Ht],[m.TABLE_HEADER,Mt]]),it=new Map([...ut,...Object.entries(u).map(([c,F])=>[c,F])]),Ut=()=>({render:(d,f={},E)=>{if(a&&d){const C=t.get(d)||0;t.set(d,C+1),f.key=`${d}-${C}`}return e(d,f,E)},originalResolvers:ut,mergedResolvers:it});function $(c){const F=it.get(c.type);if(!F)return console.error("<Storyblok>",`No resolver found for node type ${c.type}`),"";const d=Ut();if(c.type==="text")return F(c,d);const f=c.content?c.content.map(U):void 0;return F({...c,children:f},d)}function U(c){return c.type==="doc"?o?c.content.map($):c.content.map($).join(""):Array.isArray(c)?c.map($):$(c)}return{render:U}}let K=!1;const Z=[],X=s=>new Promise((t,e)=>{if(typeof window>"u"){e(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));return}if(window.storyblokRegisterEvent=u=>{if(!window.location.search.includes("_storyblok")){console.warn("You are not in Draft Mode or in the Visual Editor.");return}K?u():Z.push(u)},document.getElementById("storyblok-javascript-bridge")){t(void 0);return}const r=document.createElement("script");r.async=!0,r.src=s,r.id="storyblok-javascript-bridge",r.onerror=u=>e(u),r.onload=u=>{Z.forEach(i=>i()),K=!0,t(u)},document.getElementsByTagName("head")[0].appendChild(r)});var Ct=Object.defineProperty,gt=(s,t,e)=>t in s?Ct(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,p=(s,t,e)=>gt(s,typeof t!="symbol"?t+"":t,e);class mt extends Error{constructor(t){super(t),this.name="AbortError"}}function yt(s,t,e){if(!Number.isFinite(t))throw new TypeError("Expected `limit` to be a finite number");if(!Number.isFinite(e))throw new TypeError("Expected `interval` to be a finite number");const r=[];let u=[],i=0,a=!1;const o=async()=>{i++;const l=r.shift();if(l)try{const D=await s(...l.args);l.resolve(D)}catch(D){l.reject(D)}const h=setTimeout(()=>{i--,r.length>0&&o(),u=u.filter(D=>D!==h)},e);u.includes(h)||u.push(h)},n=(...l)=>a?Promise.reject(new Error("Throttled function is already aborted and not accepting new promises")):new Promise((h,D)=>{r.push({resolve:h,reject:D,args:l}),i<t&&o()});return n.abort=()=>{a=!0,u.forEach(clearTimeout),u=[],r.forEach(l=>l.reject(()=>new mt("Throttle function aborted"))),r.length=0},n}const Q=(s="")=>s.includes("/cdn/"),bt=(s,t=25,e=1)=>({...s,per_page:t,page:e}),vt=s=>new Promise(t=>setTimeout(t,s)),kt=(s=0,t)=>Array.from({length:s},t),xt=(s=0,t=s)=>{const e=Math.abs(t-s)||0,r=s<t?1:-1;return kt(e,(u,i)=>i*r+s)},Bt=async(s,t)=>Promise.all(s.map(t)),wt=(s=[],t)=>s.map(t).reduce((e,r)=>[...e,...r],[]),N=(s,t,e)=>{const r=[];for(const u in s){if(!Object.prototype.hasOwnProperty.call(s,u))continue;const i=s[u];if(i==null)continue;const a=e?"":encodeURIComponent(u);let o;typeof i=="object"?o=N(i,t?t+encodeURIComponent(`[${a}]`):a,Array.isArray(i)):o=`${t?t+encodeURIComponent(`[${a}]`):a}=${encodeURIComponent(i)}`,r.push(o)}return r.join("&")},tt=s=>{const t={eu:"api.storyblok.com",us:"api-us.storyblok.com",cn:"app.storyblokchina.cn",ap:"api-ap.storyblok.com",ca:"api-ca.storyblok.com"};return t[s]??t.eu};class _t{constructor(t){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=t.baseURL,this.headers=t.headers||new Headers,this.timeout=t!=null&&t.timeout?t.timeout*1e3:0,this.responseInterceptor=t.responseInterceptor,this.fetch=(...e)=>t.fetch?t.fetch(...e):fetch(...e),this.ejectInterceptor=!1,this.url="",this.parameters={},this.fetchOptions={}}get(t,e){return this.url=t,this.parameters=e,this._methodHandler("get")}post(t,e){return this.url=t,this.parameters=e,this._methodHandler("post")}put(t,e){return this.url=t,this.parameters=e,this._methodHandler("put")}delete(t,e){return this.url=t,this.parameters=e??{},this._methodHandler("delete")}async _responseHandler(t){const e=[],r={data:{},headers:{},status:0,statusText:""};t.status!==204&&await t.json().then(u=>{r.data=u});for(const u of t.headers.entries())e[u[0]]=u[1];return r.headers={...e},r.status=t.status,r.statusText=t.statusText,r}async _methodHandler(t){let e=`${this.baseURL}${this.url}`,r=null;t==="get"?e=`${this.baseURL}${this.url}?${N(this.parameters)}`:r=JSON.stringify(this.parameters);const u=new URL(e),i=new AbortController,{signal:a}=i;let o;this.timeout&&(o=setTimeout(()=>i.abort(),this.timeout));try{const n=await this.fetch(`${u}`,{method:t,headers:this.headers,body:r,signal:a,...this.fetchOptions});this.timeout&&clearTimeout(o);const l=await this._responseHandler(n);return this.responseInterceptor&&!this.ejectInterceptor?this._statusHandler(this.responseInterceptor(l)):this._statusHandler(l)}catch(n){return{message:n}}}setFetchOptions(t={}){Object.keys(t).length>0&&"method"in t&&delete t.method,this.fetchOptions={...t}}eject(){this.ejectInterceptor=!0}_normalizeErrorMessage(t){if(Array.isArray(t))return t[0]||"Unknown error";if(t&&typeof t=="object"){if(t.error)return t.error;for(const e in t){if(Array.isArray(t[e]))return`${e}: ${t[e][0]}`;if(typeof t[e]=="string")return`${e}: ${t[e]}`}if(t.slug)return t.slug}return"Unknown error"}_statusHandler(t){const e=/20[0-6]/g;return new Promise((r,u)=>{if(e.test(`${t.status}`))return r(t);const i={message:this._normalizeErrorMessage(t.data),status:t.status,response:t};u(i)})}}const et="SB-Agent",H={defaultAgentName:"SB-JS-CLIENT",defaultAgentVersion:"SB-Agent-Version",packageVersion:"7.0.0"},Rt={PUBLISHED:"published"};let j={};const _={};class St{constructor(t,e){p(this,"client"),p(this,"maxRetries"),p(this,"retriesDelay"),p(this,"throttle"),p(this,"accessToken"),p(this,"cache"),p(this,"resolveCounter"),p(this,"relations"),p(this,"links"),p(this,"version"),p(this,"richTextResolver"),p(this,"resolveNestedRelations"),p(this,"stringifiedStoriesCache"),p(this,"inlineAssets");let r=t.endpoint||e;if(!r){const a=t.https===!1?"http":"https";t.oauthToken?r=`${a}://${tt(t.region)}/v1`:r=`${a}://${tt(t.region)}/v2`}const u=new Headers;u.set("Content-Type","application/json"),u.set("Accept","application/json"),t.headers&&(t.headers.constructor.name==="Headers"?t.headers.entries().toArray():Object.entries(t.headers)).forEach(([a,o])=>{u.set(a,o)}),u.has(et)||(u.set(et,H.defaultAgentName),u.set(H.defaultAgentVersion,H.packageVersion));let i=5;t.oauthToken&&(u.set("Authorization",t.oauthToken),i=3),t.rateLimit&&(i=t.rateLimit),this.maxRetries=t.maxRetries||10,this.retriesDelay=300,this.throttle=yt(this.throttledRequest.bind(this),i,1e3),this.accessToken=t.accessToken||"",this.relations={},this.links={},this.cache=t.cache||{clear:"manual"},this.resolveCounter=0,this.resolveNestedRelations=t.resolveNestedRelations||!0,this.stringifiedStoriesCache={},this.version=t.version||Rt.PUBLISHED,this.inlineAssets=t.inlineAssets||!1,this.client=new _t({baseURL:r,timeout:t.timeout||0,headers:u,responseInterceptor:t.responseInterceptor,fetch:t.fetch})}parseParams(t){return t.token||(t.token=this.getToken()),t.cv||(t.cv=_[t.token]),Array.isArray(t.resolve_relations)&&(t.resolve_relations=t.resolve_relations.join(",")),typeof t.resolve_relations<"u"&&(t.resolve_level=2),t}factoryParamOptions(t,e){return Q(t)?this.parseParams(e):e}makeRequest(t,e,r,u,i){const a=this.factoryParamOptions(t,bt(e,r,u));return this.cacheResponse(t,a,void 0,i)}get(t,e={},r){e||(e={});const u=`/${t}`;Q(u)&&(e.version=e.version||this.version);const i=this.factoryParamOptions(u,e);return this.cacheResponse(u,i,void 0,r)}async getAll(t,e={},r,u){const i=(e==null?void 0:e.per_page)||25,a=`/${t}`.replace(/\/$/,""),o=r??a.substring(a.lastIndexOf("/")+1);e.version=e.version||this.version;const n=1,l=await this.makeRequest(a,e,i,n,u),h=l.total?Math.ceil(l.total/(l.perPage||i)):1,D=await Bt(xt(n,h),A=>this.makeRequest(a,e,i,A+1,u));return wt([l,...D],A=>Object.values(A.data[o]))}post(t,e={},r){const u=`/${t}`;return this.throttle("post",u,e,r)}put(t,e={},r){const u=`/${t}`;return this.throttle("put",u,e,r)}delete(t,e={},r){e||(e={});const u=`/${t}`;return this.throttle("delete",u,e,r)}getStories(t={},e){return this._addResolveLevel(t),this.get("cdn/stories",t,e)}getStory(t,e={},r){return this._addResolveLevel(e),this.get(`cdn/stories/${t}`,e,r)}getToken(){return this.accessToken}ejectInterceptor(){this.client.eject()}_addResolveLevel(t){typeof t.resolve_relations<"u"&&(t.resolve_level=2)}_cleanCopy(t){return JSON.parse(JSON.stringify(t))}_insertLinks(t,e,r){const u=t[e];u&&u.fieldtype==="multilink"&&u.linktype==="story"&&typeof u.id=="string"&&this.links[r][u.id]?u.story=this._cleanCopy(this.links[r][u.id]):u&&u.linktype==="story"&&typeof u.uuid=="string"&&this.links[r][u.uuid]&&(u.story=this._cleanCopy(this.links[r][u.uuid]))}getStoryReference(t,e){return this.relations[t][e]?JSON.parse(this.stringifiedStoriesCache[e]||JSON.stringify(this.relations[t][e])):e}_resolveField(t,e,r){const u=t[e];typeof u=="string"?t[e]=this.getStoryReference(r,u):Array.isArray(u)&&(t[e]=u.map(i=>this.getStoryReference(r,i)).filter(Boolean))}_insertRelations(t,e,r,u){if(Array.isArray(r)?r.find(a=>a.endsWith(`.${e}`)):r.endsWith(`.${e}`)){this._resolveField(t,e,u);return}const i=t.component?`${t.component}.${e}`:e;(Array.isArray(r)?r.includes(i):r===i)&&this._resolveField(t,e,u)}iterateTree(t,e,r){const u=(i,a="")=>{if(!(!i||i._stopResolving)){if(Array.isArray(i))i.forEach((o,n)=>u(o,`${a}[${n}]`));else if(typeof i=="object")for(const o in i){const n=a?`${a}.${o}`:o;(i.component&&i._uid||i.type==="link")&&(this._insertRelations(i,o,e,r),this._insertLinks(i,o,r)),u(i[o],n)}}};u(t.content)}async resolveLinks(t,e,r){let u=[];if(t.link_uuids){const i=t.link_uuids.length,a=[],o=50;for(let n=0;n<i;n+=o){const l=Math.min(i,n+o);a.push(t.link_uuids.slice(n,l))}for(let n=0;n<a.length;n++)(await this.getStories({per_page:o,language:e.language,version:e.version,starts_with:e.starts_with,by_uuids:a[n].join(",")})).data.stories.forEach(l=>{u.push(l)})}else u=t.links;u.forEach(i=>{this.links[r][i.uuid]={...i,_stopResolving:!0}})}async resolveRelations(t,e,r){let u=[];if(t.rel_uuids){const i=t.rel_uuids.length,a=[],o=50;for(let n=0;n<i;n+=o){const l=Math.min(i,n+o);a.push(t.rel_uuids.slice(n,l))}for(let n=0;n<a.length;n++)(await this.getStories({per_page:o,language:e.language,version:e.version,starts_with:e.starts_with,by_uuids:a[n].join(","),excluding_fields:e.excluding_fields})).data.stories.forEach(l=>{u.push(l)});u.length>0&&(t.rels=u,delete t.rel_uuids)}else u=t.rels;u&&u.length>0&&u.forEach(i=>{this.relations[r][i.uuid]={...i,_stopResolving:!0}})}async resolveStories(t,e,r){var u,i;let a=[];if(this.links[r]={},this.relations[r]={},typeof e.resolve_relations<"u"&&e.resolve_relations.length>0&&(typeof e.resolve_relations=="string"&&(a=e.resolve_relations.split(",")),await this.resolveRelations(t,e,r)),e.resolve_links&&["1","story","url","link"].includes(e.resolve_links)&&((u=t.links)!=null&&u.length||(i=t.link_uuids)!=null&&i.length)&&await this.resolveLinks(t,e,r),this.resolveNestedRelations)for(const o in this.relations[r])this.iterateTree(this.relations[r][o],a,r);t.story?this.iterateTree(t.story,a,r):t.stories.forEach(o=>{this.iterateTree(o,a,r)}),this.stringifiedStoriesCache={},delete this.links[r],delete this.relations[r]}async cacheResponse(t,e,r,u){const i=N({url:t,params:e}),a=this.cacheProvider();if(e.version==="published"&&t!=="/cdn/spaces/me"){const o=await a.get(i);if(o)return Promise.resolve(o)}return new Promise(async(o,n)=>{var l;try{const h=await this.throttle("get",t,e,u);if(h.status!==200)return n(h);let D={data:h.data,headers:h.headers};if((l=h.headers)!=null&&l["per-page"]&&(D=Object.assign({},D,{perPage:h.headers["per-page"]?Number.parseInt(h.headers["per-page"]):0,total:h.headers["per-page"]?Number.parseInt(h.headers.total):0})),D.data.story||D.data.stories){const y=this.resolveCounter=++this.resolveCounter%1e3;await this.resolveStories(D.data,e,`${y}`),D=await this.processInlineAssets(D)}e.version==="published"&&t!=="/cdn/spaces/me"&&await a.set(i,D);const A=this.cache.clear==="onpreview"&&e.version==="draft"||this.cache.clear==="auto";return e.token&&D.data.cv&&(A&&_[e.token]&&_[e.token]!==D.data.cv&&await this.flushCache(),_[e.token]=D.data.cv),o(D)}catch(h){if(h.response&&h.status===429&&(r=typeof r>"u"?0:r+1,r<this.maxRetries))return console.log(`Hit rate limit. Retrying in ${this.retriesDelay/1e3} seconds.`),await vt(this.retriesDelay),this.cacheResponse(t,e,r).then(o).catch(n);n(h)}})}throttledRequest(t,e,r,u){return this.client.setFetchOptions(u),this.client[t](e,r)}cacheVersions(){return _}cacheVersion(){return _[this.accessToken]}setCacheVersion(t){this.accessToken&&(_[this.accessToken]=t)}clearCacheVersion(){this.accessToken&&(_[this.accessToken]=0)}cacheProvider(){switch(this.cache.type){case"memory":return{get(t){return Promise.resolve(j[t])},getAll(){return Promise.resolve(j)},set(t,e){return j[t]=e,Promise.resolve(void 0)},flush(){return j={},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}async processInlineAssets(t){if(!this.inlineAssets)return t;const e=r=>{if(!r||typeof r!="object")return r;if(Array.isArray(r))return r.map(i=>e(i));let u={...r};u.fieldtype==="asset"&&Array.isArray(t.data.assets)&&(u={...u,...t.data.assets.find(i=>i.id===u.id)});for(const i in u)typeof u[i]=="object"&&(u[i]=e(u[i]));return u};return t.data.story&&(t.data.story.content=e(t.data.story.content)),t.data.stories&&(t.data.stories=t.data.stories.map(r=>(r.content=e(r.content),r))),t}}const Tt=(s={})=>{const{apiOptions:t}=s;if(!t||!t.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 St(t)}},It=s=>{if(typeof s!="object"||typeof s._editable>"u")return{};try{const t=JSON.parse(s._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return t?{"data-blok-c":JSON.stringify(t),"data-blok-uid":`${t.id}-${t.uid}`}:{}}catch{return{}}};let M="https://app.storyblok.com/f/storyblok-v2-latest.js";const st=(s,t,e={})=>{var o;const u=!(typeof window>"u")&&typeof window.storyblokRegisterEvent<"u",i=new URL((o=window.location)==null?void 0:o.href).searchParams.get("_storyblok"),a=i!==null&&+i===s;if(!(!u||!a)){if(!s){console.warn("Story ID is not defined. Please provide a valid ID.");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(e).on(["input","published","change"],l=>{var h;l&&(l.action==="input"&&((h=l.story)==null?void 0:h.id)===s?t(l.story):(l.action==="change"||l.action==="published")&&l.storyId===s&&window.location.reload())})})}},Lt=(s={})=>{var h,D;const{bridge:t,accessToken:e,use:r=[],apiOptions:u={},bridgeUrl:i}=s;u.accessToken=u.accessToken||e;const a={bridge:t,apiOptions:u};let o={};r.forEach(A=>{o={...o,...A(a)}}),i&&(M=i);const l=!(typeof window>"u")&&((D=(h=window.location)==null?void 0:h.search)==null?void 0:D.includes("_storyblok_tk"));return t!==!1&&l&&X(M),o};function Ot(s,t){return Y(t).render(s)}const Pt=()=>X(M);v.BlockTypes=m,v.MarkTypes=x,v.TextTypes=V,v.apiPlugin=Tt,v.loadStoryblokBridge=Pt,v.registerStoryblokBridge=st,v.renderRichText=Ot,v.richTextResolver=Y,v.storyblokEditable=It,v.storyblokInit=Lt,v.useStoryblokBridge=st,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});