@storyblok/vue 8.2.0 → 8.2.2

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
@@ -35,7 +35,7 @@
35
35
 
36
36
  ## Kickstart a new project
37
37
 
38
- Are you eager to dive into coding? **[Follow these steps to kickstart a new project with Storyblok and Vue](https://www.storyblok.com/technologies#vue?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue)**, and get started in just a few minutes!
38
+ Are you eager to dive into coding? **[Follow these steps to kickstart a new project with Storyblok and Vue](https://www.storyblok.com/technologies?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue#vue)**, and get started in just a few minutes!
39
39
 
40
40
  ## 5-minute Tutorial
41
41
 
@@ -53,7 +53,7 @@ npm install @storyblok/vue
53
53
  > **Warning**
54
54
  > This SDK uses the Fetch API under the hood. If your environment doesn't support it, you need to install a polyfill like [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch). More info on [storyblok-js-client docs](https://github.com/storyblok/storyblok-js-client#fetch-use-polyfill-if-needed---version-5).
55
55
 
56
- Register the plugin on your application (usually in `main.js`), add the `apiPlugin` and add the [access token](https://www.storyblok.com/docs/api/content-delivery#topics/authentication?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue) of your Storyblok space:
56
+ Register the plugin on your application (usually in `main.js`), add the `apiPlugin` and add the [access token](https://www.storyblok.com/docs/api/content-delivery/v2/getting-started/authentication?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue) of your Storyblok space:
57
57
 
58
58
  ```js
59
59
  import { createApp } from "vue";
@@ -68,7 +68,7 @@ app.use(StoryblokVue, {
68
68
  });
69
69
  ```
70
70
 
71
- That's it! All the features are enabled for you: the _Api Client_ for interacting with [Storyblok CDN API](https://www.storyblok.com/docs/api/content-delivery#topics/introduction?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue), and _Storyblok Bridge_ for [real-time visual editing experience](https://www.storyblok.com/docs/guide/essentials/visual-editor?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue).
71
+ That's it! All the features are enabled for you: the _Api Client_ for interacting with [Storyblok CDN API](https://www.storyblok.com/docs/api/content-delivery/v2/getting-started/introduction?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue), and _Storyblok Bridge_ for [real-time visual editing experience](https://www.storyblok.com/docs/guide/essentials/visual-editor?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue).
72
72
 
73
73
  > **Note**
74
74
  > You can enable/disable some of these features if you don't need them, so you save some KB. Please read the "Features and API" section.
@@ -126,7 +126,7 @@ The simplest way is by using the `useStoryblok` one-liner composable. Where you
126
126
  </template>
127
127
  ```
128
128
 
129
- Check the available [apiOptions](https://www.storyblok.com/docs/api/content-delivery/v2#core-resources/stories/retrieve-one-story?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue) in our API docs and [bridgeOptions](https://www.storyblok.com/docs/Guides/storyblok-latest-js?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue) passed to the Storyblok Bridge.
129
+ Check the available [apiOptions](https://www.storyblok.com/docs/api/content-delivery/v2/stories/retrieve-a-single-story?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue) in our API docs and [bridgeOptions](https://www.storyblok.com/docs/Guides/storyblok-latest-js?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue) passed to the Storyblok Bridge.
130
130
 
131
131
  ### Long Form
132
132
 
@@ -247,7 +247,7 @@ Is equivalent to the following, using `useStoryblokBridge` and `useStoryblokApi`
247
247
  </script>
248
248
  ```
249
249
 
250
- Check the available [apiOptions](https://www.storyblok.com/docs/api/content-delivery/v2#core-resources/stories/retrieve-one-story?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue) (passed to `storyblok-js-client`) and [bridgeOptions](https://www.storyblok.com/docs/Guides/storyblok-latest-js?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue) (passed to the Storyblok Bridge).
250
+ Check the available [apiOptions](https://www.storyblok.com/docs/api/content-delivery/v2/stories/retrieve-a-single-story?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue) (passed to `storyblok-js-client`) and [bridgeOptions](https://www.storyblok.com/docs/Guides/storyblok-latest-js?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue) (passed to the Storyblok Bridge).
251
251
 
252
252
  ### Storyblok API
253
253
 
@@ -534,5 +534,5 @@ This plugin is for Vue 3. Thus, it supports the [same browsers as Vue 3](https:/
534
534
 
535
535
  ## Contributing
536
536
 
537
- Please see our [contributing guidelines](https://github.com/storyblok/.github/blob/master/contributing.md) and our [code of conduct](https://www.storyblok.com/trust-center#code-of-conduct?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue).
537
+ Please see our [contributing guidelines](https://github.com/storyblok/.github/blob/master/contributing.md) and our [code of conduct](https://www.storyblok.com/trust-center?utm_source=github.com&utm_medium=readme&utm_campaign=storyblok-vue#code-of-conduct).
538
538
  This project use [semantic-release](https://semantic-release.gitbook.io/semantic-release/) for generate new versions by using commit messages and we use the Angular Convention to naming the commits. Check [this question](https://semantic-release.gitbook.io/semantic-release/support/faq#how-can-i-change-the-type-of-commits-that-trigger-a-release) about it in semantic-release FAQ.
@@ -4,7 +4,7 @@
4
4
  * description: SDK to integrate Storyblok into your project using Vue.
5
5
  * author: Storyblok
6
6
  */
7
- (function(b,g){typeof exports=="object"&&typeof module<"u"?g(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],g):(b=typeof globalThis<"u"?globalThis:b||self,g(b.storyblokVue={},b.Vue))})(this,function(b,g){"use strict";let F=!1;const V=[],re=s=>new Promise((e,t)=>{if(typeof window>"u"||(window.storyblokRegisterEvent=o=>{if(window.location===window.parent.location){console.warn("You are not in Draft Mode or in the Visual Editor.");return}F?o():V.push(o)},document.getElementById("storyblok-javascript-bridge")))return;const r=document.createElement("script");r.async=!0,r.src=s,r.id="storyblok-javascript-bridge",r.onerror=o=>t(o),r.onload=o=>{V.forEach(n=>n()),F=!0,e(o)},document.getElementsByTagName("head")[0].appendChild(r)});var se=Object.defineProperty,oe=(s,e,t)=>e in s?se(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,m=(s,e,t)=>oe(s,typeof e!="symbol"?e+"":e,t);class ne extends Error{constructor(e){super(e),this.name="AbortError"}}function ae(s,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 r=[];let o=[],n=0,a=!1;const l=async()=>{n++;const h=r.shift();if(h)try{const p=await s(...h.args);h.resolve(p)}catch(p){h.reject(p)}const d=setTimeout(()=>{n--,r.length>0&&l(),o=o.filter(p=>p!==d)},t);o.includes(d)||o.push(d)},i=(...h)=>a?Promise.reject(new Error("Throttled function is already aborted and not accepting new promises")):new Promise((d,p)=>{r.push({resolve:d,reject:p,args:h}),n<e&&l()});return i.abort=()=>{a=!0,o.forEach(clearTimeout),o=[],r.forEach(h=>h.reject(()=>new ne("Throttle function aborted"))),r.length=0},i}class x{constructor(){m(this,"isCDNUrl",(e="")=>e.includes("/cdn/")),m(this,"getOptionsPage",(e,t=25,r=1)=>({...e,per_page:t,page:r})),m(this,"delay",e=>new Promise(t=>setTimeout(t,e))),m(this,"arrayFrom",(e=0,t)=>Array.from({length:e},t)),m(this,"range",(e=0,t=e)=>{const r=Math.abs(t-e)||0,o=e<t?1:-1;return this.arrayFrom(r,(n,a)=>a*o+e)}),m(this,"asyncMap",async(e,t)=>Promise.all(e.map(t))),m(this,"flatMap",(e=[],t)=>e.map(t).reduce((r,o)=>[...r,...o],[])),m(this,"escapeHTML",function(e){const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},r=/[&<>"']/g,o=new RegExp(r.source);return e&&o.test(e)?e.replace(r,n=>t[n]):e})}stringify(e,t,r){const o=[];for(const n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;const a=e[n],l=r?"":encodeURIComponent(n);let i;typeof a=="object"?i=this.stringify(a,t?t+encodeURIComponent(`[${l}]`):l,Array.isArray(a)):i=`${t?t+encodeURIComponent(`[${l}]`):l}=${encodeURIComponent(a)}`,o.push(i)}return o.join("&")}getRegionURL(e){const t="api.storyblok.com",r="api-us.storyblok.com",o="app.storyblokchina.cn",n="api-ap.storyblok.com",a="api-ca.storyblok.com";switch(e){case"us":return r;case"cn":return o;case"ap":return n;case"ca":return a;default:return t}}}const ie=function(s,e){const t={};for(const r in s){const o=s[r];e.includes(r)&&o!==null&&(t[r]=o)}return t},le=s=>s==="email",ce=()=>({singleTag:"hr"}),he=()=>({tag:"blockquote"}),ue=()=>({tag:"ul"}),de=s=>({tag:["pre",{tag:"code",attrs:s.attrs}]}),pe=()=>({singleTag:"br"}),ge=s=>({tag:`h${s.attrs.level}`}),me=s=>({singleTag:[{tag:"img",attrs:ie(s.attrs,["src","alt","title"])}]}),fe=()=>({tag:"li"}),ye=()=>({tag:"ol"}),be=()=>({tag:"p"}),ke=s=>({tag:[{tag:"span",attrs:{"data-type":"emoji","data-name":s.attrs.name,emoji:s.attrs.emoji}}]}),ve=()=>({tag:"b"}),$e=()=>({tag:"s"}),Te=()=>({tag:"u"}),we=()=>({tag:"strong"}),_e=()=>({tag:"code"}),Re=()=>({tag:"i"}),Se=s=>{if(!s.attrs)return{tag:""};const e=new x().escapeHTML,t={...s.attrs},{linktype:r="url"}=s.attrs;if(delete t.linktype,t.href&&(t.href=e(s.attrs.href||"")),le(r)&&(t.href=`mailto:${t.href}`),t.anchor&&(t.href=`${t.href}#${t.anchor}`,delete t.anchor),t.custom){for(const o in t.custom)t[o]=t.custom[o];delete t.custom}return{tag:[{tag:"a",attrs:t}]}},Ee=s=>({tag:[{tag:"span",attrs:s.attrs}]}),je=()=>({tag:"sub"}),Ce=()=>({tag:"sup"}),Ae=s=>({tag:[{tag:"span",attrs:s.attrs}]}),Ie=s=>{var e;return(e=s.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`background-color:${s.attrs.color};`}}]}:{tag:""}},Oe=s=>{var e;return(e=s.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`color:${s.attrs.color}`}}]}:{tag:""}},q={nodes:{horizontal_rule:ce,blockquote:he,bullet_list:ue,code_block:de,hard_break:pe,heading:ge,image:me,list_item:fe,ordered_list:ye,paragraph:be,emoji:ke},marks:{bold:ve,strike:$e,underline:Te,strong:we,code:_e,italic:Re,link:Se,styled:Ee,subscript:je,superscript:Ce,anchor:Ae,highlight:Ie,textStyle:Oe}},Le=function(s){const e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},t=/[&<>"']/g,r=new RegExp(t.source);return s&&r.test(s)?s.replace(t,o=>e[o]):s};let G=!1;class A{constructor(e){m(this,"marks"),m(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},r=!0){if(!G&&r&&(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 o="";return e.content.forEach(n=>{o+=this.renderNode(n)}),t.optimizeImages?this.optimizeImages(o,t.optimizeImages):o}return console.warn(`The render method must receive an Object with a "content" field.
7
+ (function(b,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],m):(b=typeof globalThis<"u"?globalThis:b||self,m(b.storyblokVue={},b.Vue))})(this,function(b,m){"use strict";let F=!1;const V=[],se=r=>new Promise((e,t)=>{if(typeof window>"u"||(window.storyblokRegisterEvent=o=>{if(window.location===window.parent.location){console.warn("You are not in Draft Mode or in the Visual Editor.");return}F?o():V.push(o)},document.getElementById("storyblok-javascript-bridge")))return;const s=document.createElement("script");s.async=!0,s.src=r,s.id="storyblok-javascript-bridge",s.onerror=o=>t(o),s.onload=o=>{V.forEach(n=>n()),F=!0,e(o)},document.getElementsByTagName("head")[0].appendChild(s)});var oe=Object.defineProperty,ne=(r,e,t)=>e in r?oe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,y=(r,e,t)=>ne(r,typeof e!="symbol"?e+"":e,t);class ae extends Error{constructor(e){super(e),this.name="AbortError"}}function ie(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 s=[];let o=[],n=0,a=!1;const i=async()=>{n++;const h=s.shift();if(h)try{const p=await r(...h.args);h.resolve(p)}catch(p){h.reject(p)}const u=setTimeout(()=>{n--,s.length>0&&i(),o=o.filter(p=>p!==u)},t);o.includes(u)||o.push(u)},l=(...h)=>a?Promise.reject(new Error("Throttled function is already aborted and not accepting new promises")):new Promise((u,p)=>{s.push({resolve:u,reject:p,args:h}),n<e&&i()});return l.abort=()=>{a=!0,o.forEach(clearTimeout),o=[],s.forEach(h=>h.reject(()=>new ae("Throttle function aborted"))),s.length=0},l}class L{constructor(){y(this,"isCDNUrl",(e="")=>e.includes("/cdn/")),y(this,"getOptionsPage",(e,t=25,s=1)=>({...e,per_page:t,page:s})),y(this,"delay",e=>new Promise(t=>setTimeout(t,e))),y(this,"arrayFrom",(e=0,t)=>Array.from({length:e},t)),y(this,"range",(e=0,t=e)=>{const s=Math.abs(t-e)||0,o=e<t?1:-1;return this.arrayFrom(s,(n,a)=>a*o+e)}),y(this,"asyncMap",async(e,t)=>Promise.all(e.map(t))),y(this,"flatMap",(e=[],t)=>e.map(t).reduce((s,o)=>[...s,...o],[])),y(this,"escapeHTML",function(e){const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},s=/[&<>"']/g,o=new RegExp(s.source);return e&&o.test(e)?e.replace(s,n=>t[n]):e})}stringify(e,t,s){const o=[];for(const n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;const a=e[n];if(a==null)continue;const i=s?"":encodeURIComponent(n);let l;typeof a=="object"?l=this.stringify(a,t?t+encodeURIComponent(`[${i}]`):i,Array.isArray(a)):l=`${t?t+encodeURIComponent(`[${i}]`):i}=${encodeURIComponent(a)}`,o.push(l)}return o.join("&")}getRegionURL(e){const t="api.storyblok.com",s="api-us.storyblok.com",o="app.storyblokchina.cn",n="api-ap.storyblok.com",a="api-ca.storyblok.com";switch(e){case"us":return s;case"cn":return o;case"ap":return n;case"ca":return a;default:return t}}}const le=function(r,e){const t={};for(const s in r){const o=r[s];e.includes(s)&&o!==null&&(t[s]=o)}return t},ce=r=>r==="email",he=()=>({singleTag:"hr"}),ue=()=>({tag:"blockquote"}),de=()=>({tag:"ul"}),pe=r=>({tag:["pre",{tag:"code",attrs:r.attrs}]}),ge=()=>({singleTag:"br"}),fe=r=>({tag:`h${r.attrs.level}`}),me=r=>({singleTag:[{tag:"img",attrs:le(r.attrs,["src","alt","title"])}]}),ye=()=>({tag:"li"}),be=()=>({tag:"ol"}),ke=()=>({tag:"p"}),ve=r=>({tag:[{tag:"span",attrs:{"data-type":"emoji","data-name":r.attrs.name,emoji:r.attrs.emoji}}]}),Te=()=>({tag:"b"}),$e=()=>({tag:"s"}),we=()=>({tag:"u"}),_e=()=>({tag:"strong"}),Re=()=>({tag:"code"}),Se=()=>({tag:"i"}),Ee=r=>{if(!r.attrs)return{tag:""};const e=new L().escapeHTML,t={...r.attrs},{linktype:s="url"}=r.attrs;if(delete t.linktype,t.href&&(t.href=e(r.attrs.href||"")),ce(s)&&(t.href=`mailto:${t.href}`),t.anchor&&(t.href=`${t.href}#${t.anchor}`,delete t.anchor),t.custom){for(const o in t.custom)t[o]=t.custom[o];delete t.custom}return{tag:[{tag:"a",attrs:t}]}},je=r=>({tag:[{tag:"span",attrs:r.attrs}]}),Ce=()=>({tag:"sub"}),Ae=()=>({tag:"sup"}),Ie=r=>({tag:[{tag:"span",attrs:r.attrs}]}),xe=r=>{var e;return(e=r.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`background-color:${r.attrs.color};`}}]}:{tag:""}},Oe=r=>{var e;return(e=r.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`color:${r.attrs.color}`}}]}:{tag:""}},q={nodes:{horizontal_rule:he,blockquote:ue,bullet_list:de,code_block:pe,hard_break:ge,heading:fe,image:me,list_item:ye,ordered_list:be,paragraph:ke,emoji:ve},marks:{bold:Te,strike:$e,underline:we,strong:_e,code:Re,italic:Se,link:Ee,styled:je,subscript:Ce,superscript:Ae,anchor:Ie,highlight:xe,textStyle:Oe}},Le=function(r){const e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},t=/[&<>"']/g,s=new RegExp(t.source);return r&&s.test(r)?r.replace(t,o=>e[o]):r};let G=!1,I=class{constructor(r){y(this,"marks"),y(this,"nodes"),r||(r=q),this.marks=r.marks||[],this.nodes=r.nodes||[]}addNode(r,e){this.nodes[r]=e}addMark(r,e){this.marks[r]=e}render(r,e={optimizeImages:!1},t=!0){if(!G&&t&&(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),r&&r.content&&Array.isArray(r.content)){let s="";return r.content.forEach(o=>{s+=this.renderNode(o)}),e.optimizeImages?this.optimizeImages(s,e.optimizeImages):s}return console.warn(`The render method must receive an Object with a "content" field.
8
8
  The "content" field must be an array of nodes as the type ISbRichtext.
9
9
  ISbRichtext:
10
10
  content?: ISbRichtext[]
@@ -27,5 +27,5 @@
27
27
  }
28
28
  ],
29
29
  type: 'doc'
30
- }`),""}optimizeImages(e,t){let r=0,o=0,n="",a="";typeof t!="boolean"&&(typeof t.width=="number"&&t.width>0&&(n+=`width="${t.width}" `,r=t.width),typeof t.height=="number"&&t.height>0&&(n+=`height="${t.height}" `,o=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&&(a+=`:blur(${t.filters.blur})`),typeof t.filters.brightness=="number"&&t.filters.brightness>=-100&&t.filters.brightness<=100&&(a+=`:brightness(${t.filters.brightness})`),t.filters.fill&&(t.filters.fill.match(/[0-9A-F]{6}/gi)||t.filters.fill==="transparent")&&(a+=`:fill(${t.filters.fill})`),t.filters.format&&["webp","png","jpeg"].includes(t.filters.format)&&(a+=`:format(${t.filters.format})`),typeof t.filters.grayscale=="boolean"&&t.filters.grayscale&&(a+=":grayscale()"),typeof t.filters.quality=="number"&&t.filters.quality>=0&&t.filters.quality<=100&&(a+=`:quality(${t.filters.quality})`),t.filters.rotate&&[90,180,270].includes(t.filters.rotate)&&(a+=`:rotate(${t.filters.rotate})`),a.length>0&&(a=`/filters${a}`))),n.length>0&&(e=e.replace(/<img/g,`<img ${n.trim()}`));const l=r>0||o>0||a.length>0?`${r}x${o}${a}`:"";return e=e.replace(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g,`a.storyblok.com/f/$1/$2.$3/m/${l}`),typeof t!="boolean"&&(t.sizes||t.srcset)&&(e=e.replace(/<img.*?src=["|'](.*?)["|']/g,i=>{var h,d;const p=i.match(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g);if(p&&p.length>0){const $={srcset:(h=t.srcset)==null?void 0:h.map(_=>{if(typeof _=="number")return`//${p}/m/${_}x0${a} ${_}w`;if(typeof _=="object"&&_.length===2){let C=0,L=0;return typeof _[0]=="number"&&(C=_[0]),typeof _[1]=="number"&&(L=_[1]),`//${p}/m/${C}x${L}${a} ${C}w`}return""}).join(", "),sizes:(d=t.sizes)==null?void 0:d.map(_=>_).join(", ")};let T="";return $.srcset&&(T+=`srcset="${$.srcset}" `),$.sizes&&(T+=`sizes="${$.sizes}" `),i.replace(/<img/g,`<img ${T.trim()}`)}return i})),e}renderNode(e){const t=[];e.marks&&e.marks.forEach(o=>{const n=this.getMatchingMark(o);n&&n.tag!==""&&t.push(this.renderOpeningTag(n.tag))});const r=this.getMatchingNode(e);return r&&r.tag&&t.push(this.renderOpeningTag(r.tag)),e.content?e.content.forEach(o=>{t.push(this.renderNode(o))}):e.text?t.push(Le(e.text)):r&&r.singleTag?t.push(this.renderTag(r.singleTag," /")):r&&r.html?t.push(r.html):e.type==="emoji"&&t.push(this.renderEmoji(e)),r&&r.tag&&t.push(this.renderClosingTag(r.tag)),e.marks&&e.marks.slice(0).reverse().forEach(o=>{const n=this.getMatchingMark(o);n&&n.tag!==""&&t.push(this.renderClosingTag(n.tag))}),t.join("")}renderTag(e,t){return e.constructor===String?`<${e}${t}>`:e.map(r=>{if(r.constructor===String)return`<${r}${t}>`;{let o=`<${r.tag}`;if(r.attrs){for(const n in r.attrs)if(Object.prototype.hasOwnProperty.call(r.attrs,n)){const a=r.attrs[n];a!==null&&(o+=` ${n}="${a}"`)}}return`${o}${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," /")}}class xe{constructor(e){m(this,"baseURL"),m(this,"timeout"),m(this,"headers"),m(this,"responseInterceptor"),m(this,"fetch"),m(this,"ejectInterceptor"),m(this,"url"),m(this,"parameters"),m(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=[],r={data:{},headers:{},status:0,statusText:""};e.status!==204&&await e.json().then(o=>{r.data=o});for(const o of e.headers.entries())t[o[0]]=o[1];return r.headers={...t},r.status=e.status,r.statusText=e.statusText,r}async _methodHandler(e){let t=`${this.baseURL}${this.url}`,r=null;if(e==="get"){const i=new x;t=`${this.baseURL}${this.url}?${i.stringify(this.parameters)}`}else r=JSON.stringify(this.parameters);const o=new URL(t),n=new AbortController,{signal:a}=n;let l;this.timeout&&(l=setTimeout(()=>n.abort(),this.timeout));try{const i=await this.fetch(`${o}`,{method:e,headers:this.headers,body:r,signal:a,...this.fetchOptions});this.timeout&&clearTimeout(l);const h=await this._responseHandler(i);return this.responseInterceptor&&!this.ejectInterceptor?this._statusHandler(this.responseInterceptor(h)):this._statusHandler(h)}catch(i){return{message:i}}}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((r,o)=>{if(t.test(`${e.status}`))return r(e);const n={message:e.statusText,status:e.status,response:Array.isArray(e.data)?e.data[0]:e.data.error||e.data.slug};o(n)})}}const J="SB-Agent",D={defaultAgentName:"SB-JS-CLIENT",defaultAgentVersion:"SB-Agent-Version",packageVersion:"6.0.0"};let P={};const j={};class Pe{constructor(e,t){m(this,"client"),m(this,"maxRetries"),m(this,"retriesDelay"),m(this,"throttle"),m(this,"accessToken"),m(this,"cache"),m(this,"helpers"),m(this,"resolveCounter"),m(this,"relations"),m(this,"links"),m(this,"richTextResolver"),m(this,"resolveNestedRelations"),m(this,"stringifiedStoriesCache");let r=e.endpoint||t;if(!r){const a=new x().getRegionURL,l=e.https===!1?"http":"https";e.oauthToken?r=`${l}://${a(e.region)}/v1`:r=`${l}://${a(e.region)}/v2`}const o=new Headers;o.set("Content-Type","application/json"),o.set("Accept","application/json"),e.headers&&(e.headers.constructor.name==="Headers"?e.headers.entries().toArray():Object.entries(e.headers)).forEach(([a,l])=>{o.set(a,l)}),o.has(J)||(o.set(J,D.defaultAgentName),o.set(D.defaultAgentVersion,D.packageVersion));let n=5;e.oauthToken&&(o.set("Authorization",e.oauthToken),n=3),e.rateLimit&&(n=e.rateLimit),e.richTextSchema?this.richTextResolver=new A(e.richTextSchema):this.richTextResolver=new A,e.componentResolver&&this.setComponentResolver(e.componentResolver),this.maxRetries=e.maxRetries||10,this.retriesDelay=300,this.throttle=ae(this.throttledRequest.bind(this),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 xe({baseURL:r,timeout:e.timeout||0,headers:o,responseInterceptor:e.responseInterceptor,fetch:e.fetch})}setComponentResolver(e){this.richTextResolver.addNode("blok",t=>{let r="";return t.attrs.body&&t.attrs.body.forEach(o=>{r+=e(o.component,o)}),{html:r}})}parseParams(e){return e.token||(e.token=this.getToken()),e.cv||(e.cv=j[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,r,o,n){const a=this.factoryParamOptions(e,this.helpers.getOptionsPage(t,r,o));return this.cacheResponse(e,a,void 0,n)}get(e,t,r){t||(t={});const o=`/${e}`,n=this.factoryParamOptions(o,t);return this.cacheResponse(o,n,void 0,r)}async getAll(e,t,r,o){const n=(t==null?void 0:t.per_page)||25,a=`/${e}`.replace(/\/$/,""),l=r??a.substring(a.lastIndexOf("/")+1),i=1,h=await this.makeRequest(a,t,n,i,o),d=h.total?Math.ceil(h.total/n):1,p=await this.helpers.asyncMap(this.helpers.range(i,d),$=>this.makeRequest(a,t,n,$+1,o));return this.helpers.flatMap([h,...p],$=>Object.values($.data[l]))}post(e,t,r){const o=`/${e}`;return Promise.resolve(this.throttle("post",o,t,r))}put(e,t,r){const o=`/${e}`;return Promise.resolve(this.throttle("put",o,t,r))}delete(e,t,r){t||(t={});const o=`/${e}`;return Promise.resolve(this.throttle("delete",o,t,r))}getStories(e,t){return this._addResolveLevel(e),this.get("cdn/stories",e,t)}getStory(e,t,r){return this._addResolveLevel(t),this.get(`cdn/stories/${e}`,t,r)}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,r){const o=e[t];o&&o.fieldtype==="multilink"&&o.linktype==="story"&&typeof o.id=="string"&&this.links[r][o.id]?o.story=this._cleanCopy(this.links[r][o.id]):o&&o.linktype==="story"&&typeof o.uuid=="string"&&this.links[r][o.uuid]&&(o.story=this._cleanCopy(this.links[r][o.uuid]))}getStoryReference(e,t){return this.relations[e][t]?JSON.parse(this.stringifiedStoriesCache[t]||JSON.stringify(this.relations[e][t])):t}_resolveField(e,t,r){const o=e[t];typeof o=="string"?e[t]=this.getStoryReference(r,o):Array.isArray(o)&&(e[t]=o.map(n=>this.getStoryReference(r,n)).filter(Boolean))}_insertRelations(e,t,r,o){if(Array.isArray(r)?r.find(a=>a.endsWith(`.${t}`)):r.endsWith(`.${t}`)){this._resolveField(e,t,o);return}const n=e.component?`${e.component}.${t}`:t;(Array.isArray(r)?r.includes(n):r===n)&&this._resolveField(e,t,o)}iterateTree(e,t,r){const o=(n,a="")=>{if(!(!n||n._stopResolving)){if(Array.isArray(n))n.forEach((l,i)=>o(l,`${a}[${i}]`));else if(typeof n=="object")for(const l in n){const i=a?`${a}.${l}`:l;(n.component&&n._uid||n.type==="link")&&(this._insertRelations(n,l,t,r),this._insertLinks(n,l,r)),o(n[l],i)}}};o(e.content)}async resolveLinks(e,t,r){let o=[];if(e.link_uuids){const n=e.link_uuids.length,a=[],l=50;for(let i=0;i<n;i+=l){const h=Math.min(n,i+l);a.push(e.link_uuids.slice(i,h))}for(let i=0;i<a.length;i++)(await this.getStories({per_page:l,language:t.language,version:t.version,starts_with:t.starts_with,by_uuids:a[i].join(",")})).data.stories.forEach(h=>{o.push(h)})}else o=e.links;o.forEach(n=>{this.links[r][n.uuid]={...n,_stopResolving:!0}})}async resolveRelations(e,t,r){let o=[];if(e.rel_uuids){const n=e.rel_uuids.length,a=[],l=50;for(let i=0;i<n;i+=l){const h=Math.min(n,i+l);a.push(e.rel_uuids.slice(i,h))}for(let i=0;i<a.length;i++)(await this.getStories({per_page:l,language:t.language,version:t.version,starts_with:t.starts_with,by_uuids:a[i].join(","),excluding_fields:t.excluding_fields})).data.stories.forEach(h=>{o.push(h)})}else o=e.rels;o&&o.length>0&&o.forEach(n=>{this.relations[r][n.uuid]={...n,_stopResolving:!0}})}async resolveStories(e,t,r){var o,n;let a=[];if(this.links[r]={},this.relations[r]={},typeof t.resolve_relations<"u"&&t.resolve_relations.length>0&&(typeof t.resolve_relations=="string"&&(a=t.resolve_relations.split(",")),await this.resolveRelations(e,t,r)),t.resolve_links&&["1","story","url","link"].includes(t.resolve_links)&&((o=e.links)!=null&&o.length||(n=e.link_uuids)!=null&&n.length)&&await this.resolveLinks(e,t,r),this.resolveNestedRelations)for(const l in this.relations[r])this.iterateTree(this.relations[r][l],a,r);e.story?this.iterateTree(e.story,a,r):e.stories.forEach(l=>{this.iterateTree(l,a,r)}),this.stringifiedStoriesCache={},delete this.links[r],delete this.relations[r]}async cacheResponse(e,t,r,o){const n=this.helpers.stringify({url:e,params:t}),a=this.cacheProvider();if(t.version==="published"&&e!=="/cdn/spaces/me"){const l=await a.get(n);if(l)return Promise.resolve(l)}return new Promise(async(l,i)=>{var h;try{const d=await this.throttle("get",e,t,o);if(d.status!==200)return i(d);let p={data:d.data,headers:d.headers};if((h=d.headers)!=null&&h["per-page"]&&(p=Object.assign({},p,{perPage:d.headers["per-page"]?Number.parseInt(d.headers["per-page"]):0,total:d.headers["per-page"]?Number.parseInt(d.headers.total):0})),p.data.story||p.data.stories){const T=this.resolveCounter=++this.resolveCounter%1e3;await this.resolveStories(p.data,t,`${T}`)}t.version==="published"&&e!=="/cdn/spaces/me"&&await a.set(n,p);const $=this.cache.clear==="onpreview"&&t.version==="draft"||this.cache.clear==="auto";return t.token&&p.data.cv&&($&&j[t.token]&&j[t.token]!==p.data.cv&&await this.flushCache(),j[t.token]=p.data.cv),l(p)}catch(d){if(d.response&&d.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 this.helpers.delay(this.retriesDelay),this.cacheResponse(e,t,r).then(l).catch(i);i(d)}})}throttledRequest(e,t,r,o){return this.client.setFetchOptions(o),this.client[e](t,r)}cacheVersions(){return j}cacheVersion(){return j[this.accessToken]}setCacheVersion(e){this.accessToken&&(j[this.accessToken]=e)}clearCacheVersion(){this.accessToken&&(j[this.accessToken]=0)}cacheProvider(){switch(this.cache.type){case"memory":return{get(e){return Promise.resolve(P[e])},getAll(){return Promise.resolve(P)},set(e,t){return P[e]=t,Promise.resolve(void 0)},flush(){return P={},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 Ne=(s={})=>{const{apiOptions:e}=s;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 Pe(e)}},Me=s=>{if(typeof s!="object"||typeof s._editable>"u")return{};try{const e=JSON.parse(s._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return e?{"data-blok-c":JSON.stringify(e),"data-blok-uid":`${e.id}-${e.uid}`}:{}}catch{return{}}};function De(s,e){if(!e)return{src:s,attrs:{}};let t=0,r=0;const o={},n=[];function a(i,h,d,p,$){typeof i!="number"||i<=h||i>=d?console.warn(`[StoryblokRichText] - ${p.charAt(0).toUpperCase()+p.slice(1)} value must be a number between ${h} and ${d} (inclusive)`):$.push(`${p}(${i})`)}if(typeof e=="object"){if(typeof e.width=="number"&&e.width>0?(o.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?(o.height=e.height,r=e.height):console.warn("[StoryblokRichText] - Height value must be a number greater than 0"),e.loading&&["lazy","eager"].includes(e.loading)&&(o.loading=e.loading),e.class&&(o.class=e.class),e.filters){const{filters:i}=e||{},{blur:h,brightness:d,fill:p,format:$,grayscale:T,quality:_,rotate:C}=i||{};h&&a(h,0,100,"blur",n),_&&a(_,0,100,"quality",n),d&&a(d,0,100,"brightness",n),p&&n.push(`fill(${p})`),T&&n.push("grayscale()"),C&&[0,90,180,270].includes(e.filters.rotate||0)&&n.push(`rotate(${C})`),$&&["webp","png","jpeg"].includes($)&&n.push(`format(${$})`)}e.srcset&&(o.srcset=e.srcset.map(i=>{if(typeof i=="number")return`${s}/m/${i}x0/${n.length>0?`filters:${n.join(":")}`:""} ${i}w`;if(Array.isArray(i)&&i.length===2){const[h,d]=i;return`${s}/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&&(o.sizes=e.sizes.join(", "))}let l=`${s}/m/`;return t>0&&r>0&&(l=`${l}${t}x${r}/`),n.length>0&&(l=`${l}filters:${n.join(":")}`),{src:l,attrs:o}}var v=(s=>(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))(v||{}),E=(s=>(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))(E||{}),H=(s=>(s.TEXT="text",s))(H||{}),I=(s=>(s.URL="url",s.STORY="story",s.ASSET="asset",s.EMAIL="email",s))(I||{});const He=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Be=(s={})=>Object.keys(s).map(e=>`${e}="${s[e]}"`).join(" "),Ue=(s={})=>Object.keys(s).map(e=>`${e}: ${s[e]}`).join("; ");function ze(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}const N=s=>Object.fromEntries(Object.entries(s).filter(([e,t])=>t!==void 0));function K(s,e={},t){const r=Be(e),o=r?`${s} ${r}`:s,n=Array.isArray(t)?t.join(""):t||"";if(s){if(He.includes(s))return`<${o}>`}else return n;return`<${o}>${n}</${s}>`}function Y(s={}){let e=0;const{renderFn:t=K,textFn:r=ze,resolvers:o={},optimizeImages:n=!1,keyedResolvers:a=!1}=s,l=t!==K,i=c=>u=>{const f=u.attrs||{};return a&&(f.key=`${c}-${e}`),t(c,f,u.children||null)},h=c=>{const{src:u,alt:f,title:k,srcset:S,sizes:w}=c.attrs||{};let y=u,R={};if(n){const{src:it,attrs:lt}=De(u,n);y=it,R=lt}a&&(R={...R,key:`img-${e}`});const at={src:y,alt:f,title:k,srcset:S,sizes:w,...R};return t("img",N(at))},d=c=>{const{level:u,...f}=c.attrs||{},k={...f};return a&&(k.key=`h${u}-${e}`),t(`h${u}`,k,c.children)},p=c=>{var u,f,k,S;const w=t("img",{src:(u=c.attrs)==null?void 0:u.fallbackImage,alt:(f=c.attrs)==null?void 0:f.alt,style:"width: 1.25em; height: 1.25em; vertical-align: text-top",draggable:"false",loading:"lazy"}),y={"data-type":"emoji","data-name":(k=c.attrs)==null?void 0:k.name,"data-emoji":(S=c.attrs)==null?void 0:S.emoji};return a&&(y.key=`emoji-${e}`),t("span",y,w)},$=c=>t("pre",{...c.attrs,key:`code-${e}`},t("code",{key:`code-${e}`},c.children||"")),T=(c,u=!1)=>({text:f,attrs:k})=>{const{class:S,id:w,...y}=k||{},R=u?{class:S,id:w,style:Ue(y)||void 0}:k||{};return a&&(R.key=`${c}-${e}`),t(c,N(R),f)},_=c=>z(c),C=c=>{const{marks:u,...f}=c;return"text"in c?u?u.reduce((k,S)=>_({...S,text:k}),_({...f,children:f.children})):r(f.text):""},L=c=>{const{linktype:u,href:f,anchor:k,...S}=c.attrs||{};let w="";switch(u){case I.ASSET:case I.URL:w=f;break;case I.EMAIL:w=`mailto:${f}`;break;case I.STORY:w=f,k&&(w=`${w}#${k}`);break;default:w=f;break}const y={...S};return w&&(y.href=w),a&&(y.key=`a-${e}`),t("a",y,c.text)},et=c=>{var u,f;return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),t("span",{blok:(u=c==null?void 0:c.attrs)==null?void 0:u.body[0],id:(f=c.attrs)==null?void 0:f.id,key:`component-${e}`,style:"display: none"})},tt=c=>{const u={};return a&&(u.key=`table-${e}`),t("table",u,c.children)},rt=c=>{const u={};return a&&(u.key=`tr-${e}`),t("tr",u,c.children)},st=c=>{const{colspan:u,rowspan:f,colwidth:k,backgroundColor:S,...w}=c.attrs||{},y={...w};u>1&&(y.colspan=u),f>1&&(y.rowspan=f);const R=[];return k&&R.push(`width: ${k}px;`),S&&R.push(`background-color: ${S};`),R.length>0&&(y.style=R.join(" ")),a&&(y.key=`td-${e}`),t("td",N(y),c.children)},ot=c=>{const{colspan:u,rowspan:f,colwidth:k,backgroundColor:S,...w}=c.attrs||{},y={...w};u>1&&(y.colspan=u),f>1&&(y.rowspan=f);const R=[];return k&&R.push(`width: ${k}px;`),S&&R.push(`background-color: ${S};`),R.length>0&&(y.style=R.join(" ")),a&&(y.key=`th-${e}`),t("th",N(y),c.children)},nt=new Map([[v.DOCUMENT,i("")],[v.HEADING,d],[v.PARAGRAPH,i("p")],[v.UL_LIST,i("ul")],[v.OL_LIST,i("ol")],[v.LIST_ITEM,i("li")],[v.IMAGE,h],[v.EMOJI,p],[v.CODE_BLOCK,$],[v.HR,i("hr")],[v.BR,i("br")],[v.QUOTE,i("blockquote")],[v.COMPONENT,et],[H.TEXT,C],[E.LINK,L],[E.ANCHOR,L],[E.STYLED,T("span",!0)],[E.BOLD,T("strong")],[E.TEXT_STYLE,T("span",!0)],[E.ITALIC,T("em")],[E.UNDERLINE,T("u")],[E.STRIKE,T("s")],[E.CODE,T("code")],[E.SUPERSCRIPT,T("sup")],[E.SUBSCRIPT,T("sub")],[E.HIGHLIGHT,T("mark")],[v.TABLE,tt],[v.TABLE_ROW,rt],[v.TABLE_CELL,st],[v.TABLE_HEADER,ot],...Object.entries(o).map(([c,u])=>[c,u])]);function M(c){e+=1;const u=nt.get(c.type);if(!u)return console.error("<Storyblok>",`No resolver found for node type ${c.type}`),"";if(c.type==="text")return u(c);const f=c.content?c.content.map(z):void 0;return u({...c,children:f})}function z(c){return c.type==="doc"?l?c.content.map(M):c.content.map(M).join(""):Array.isArray(c)?c.map(M):M(c)}return{render:z}}let B,W="https://app.storyblok.com/f/storyblok-v2-latest.js";const X=(s,e,t={})=>{var r;const o=!(typeof window>"u")&&typeof window.storyblokRegisterEvent<"u",n=new URL((r=window.location)==null?void 0:r.href).searchParams.get("_storyblok"),a=n!==null&&+n===s;if(!(!o||!a)){if(!s){console.warn("Story ID is not defined. Please provide a valid ID.");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(t).on(["input","published","change"],l=>{var i;l&&(l.action==="input"&&((i=l.story)==null?void 0:i.id)===s?e(l.story):(l.action==="change"||l.action==="published")&&l.storyId===s&&window.location.reload())})})}},Q=(s,e)=>{s.addNode("blok",t=>{let r="";return t.attrs.body.forEach(o=>{r+=e(o.component,o)}),{html:r}})},Fe=(s={})=>{var e,t;const{bridge:r,accessToken:o,use:n=[],apiOptions:a={},richText:l={},bridgeUrl:i}=s;a.accessToken=a.accessToken||o;const h={bridge:r,apiOptions:a};let d={};n.forEach($=>{d={...d,...$(h)}}),i&&(W=i);const p=!(typeof window>"u")&&((t=(e=window.location)==null?void 0:e.search)==null?void 0:t.includes("_storyblok_tk"));return r!==!1&&p&&re(W),B=new A(l.schema),l.resolver&&Q(B,l.resolver),d},Ve=s=>{var e;return!s||!((e=s==null?void 0:s.content)!=null&&e.some(t=>t.content||t.type==="blok"||t.type==="horizontal_rule"))},qe=(s,e,t)=>{let r=t||B;if(!r){console.error("Please initialize the Storyblok SDK before calling the renderRichText function");return}return Ve(s)?"":(e&&(r=new A(e.schema),e.resolver&&Q(r,e.resolver)),r.render(s,{},!1))},U=g.defineComponent({__name:"StoryblokComponent",props:{blok:{}},setup(s,{expose:e}){const t=s,r=g.ref();e({value:r});const o=typeof g.resolveDynamicComponent(t.blok.component)!="string",n=g.inject("VueSDKOptions"),a=g.ref(t.blok.component);return!o&&n&&(n.enableFallbackComponent?(a.value=n.customFallbackComponent??"FallbackComponent",typeof g.resolveDynamicComponent(a.value)=="string"&&console.error(`Is the Fallback component "${a.value}" registered properly?`)):console.error(`Component could not be found for blok "${t.blok.component}"! Is it defined in main.ts as "app.component("${t.blok.component}", ${t.blok.component});"?`)),(l,i)=>(g.openBlock(),g.createBlock(g.resolveDynamicComponent(a.value),g.mergeProps({ref_key:"blokRef",ref:r},{...l.$props,...l.$attrs}),null,16))}}),Ge=s=>{var e,t;return g.h(U,{blok:(e=s==null?void 0:s.attrs)==null?void 0:e.body[0],id:(t=s.attrs)==null?void 0:t.id},s.children)};function Z(s){const e={renderFn:g.h,textFn:g.createTextVNode,keyedResolvers:!0,resolvers:{[v.COMPONENT]:Ge,...s.resolvers}};return Y(e)}const ee=g.defineComponent({__name:"StoryblokRichText",props:{doc:{},resolvers:{}},setup(s){const e=s,t=g.ref(),r=()=>t.value;return g.watch([()=>e.doc,()=>e.resolvers],([o,n])=>{const{render:a}=Z({resolvers:n??{}});t.value=a(o)},{immediate:!0,deep:!0}),(o,n)=>(g.openBlock(),g.createBlock(r))}}),Je={beforeMount(s,e){if(e.value){const t=Me(e.value);Object.keys(t).length>0&&(s.setAttribute("data-blok-c",t["data-blok-c"]),s.setAttribute("data-blok-uid",t["data-blok-uid"]),s.classList.add("storyblok__outline"))}}},te=s=>{console.error(`You can't use ${s} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
31
- `)};let O=null;const Ke=()=>(O||te("useStoryblokApi"),O),Ye=async(s,e={},t={})=>{const r=g.ref(null);if(t.resolveRelations=t.resolveRelations??e.resolve_relations,t.resolveLinks=t.resolveLinks??e.resolve_links,g.onMounted(()=>{r.value&&r.value.id&&X(r.value.id,o=>r.value=o,t)}),O){const{data:o}=await O.get(`cdn/stories/${s}`,e);r.value=o.story}else te("useStoryblok");return r},We={install(s,e={}){s.directive("editable",Je),s.component("StoryblokComponent",U),s.component("StoryblokRichText",ee),e.enableFallbackComponent&&!e.customFallbackComponent&&s.component("FallbackComponent",g.defineAsyncComponent(()=>Promise.resolve().then(()=>Ze)));const{storyblokApi:t}=Fe(e);O=t||null,s.provide("VueSDKOptions",e)}},Xe={class:"fallback-component"},Qe={class:"component"},Ze=Object.freeze(Object.defineProperty({__proto__:null,default:((s,e)=>{const t=s.__vccOpts||s;for(const[r,o]of e)t[r]=o;return t})(g.defineComponent({__name:"FallbackComponent",props:{blok:{}},setup(s){return(e,t)=>(g.openBlock(),g.createElementBlock("div",Xe,[g.createElementVNode("p",null,[t[0]||(t[0]=g.createTextVNode(" Component could not be found for blok ")),g.createElementVNode("span",Qe,g.toDisplayString(e.blok.component),1),t[1]||(t[1]=g.createTextVNode("! Is it configured correctly? "))])]))}}),[["__scopeId","data-v-9abcd1f2"]])},Symbol.toStringTag,{value:"Module"}));b.BlockTypes=v,b.MarkTypes=E,b.RichTextResolver=A,b.RichTextSchema=q,b.StoryblokComponent=U,b.StoryblokRichText=ee,b.StoryblokVue=We,b.TextTypes=H,b.apiPlugin=Ne,b.renderRichText=qe,b.richTextResolver=Y,b.useStoryblok=Ye,b.useStoryblokApi=Ke,b.useStoryblokBridge=X,b.useStoryblokRichText=Z,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
30
+ }`),""}optimizeImages(r,e){let t=0,s=0,o="",n="";typeof e!="boolean"&&(typeof e.width=="number"&&e.width>0&&(o+=`width="${e.width}" `,t=e.width),typeof e.height=="number"&&e.height>0&&(o+=`height="${e.height}" `,s=e.height),(e.loading==="lazy"||e.loading==="eager")&&(o+=`loading="${e.loading}" `),typeof e.class=="string"&&e.class.length>0&&(o+=`class="${e.class}" `),e.filters&&(typeof e.filters.blur=="number"&&e.filters.blur>=0&&e.filters.blur<=100&&(n+=`:blur(${e.filters.blur})`),typeof e.filters.brightness=="number"&&e.filters.brightness>=-100&&e.filters.brightness<=100&&(n+=`:brightness(${e.filters.brightness})`),e.filters.fill&&(e.filters.fill.match(/[0-9A-F]{6}/gi)||e.filters.fill==="transparent")&&(n+=`:fill(${e.filters.fill})`),e.filters.format&&["webp","png","jpeg"].includes(e.filters.format)&&(n+=`:format(${e.filters.format})`),typeof e.filters.grayscale=="boolean"&&e.filters.grayscale&&(n+=":grayscale()"),typeof e.filters.quality=="number"&&e.filters.quality>=0&&e.filters.quality<=100&&(n+=`:quality(${e.filters.quality})`),e.filters.rotate&&[90,180,270].includes(e.filters.rotate)&&(n+=`:rotate(${e.filters.rotate})`),n.length>0&&(n=`/filters${n}`))),o.length>0&&(r=r.replace(/<img/g,`<img ${o.trim()}`));const a=t>0||s>0||n.length>0?`${t}x${s}${n}`:"";return r=r.replace(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g,`a.storyblok.com/f/$1/$2.$3/m/${a}`),typeof e!="boolean"&&(e.sizes||e.srcset)&&(r=r.replace(/<img.*?src=["|'](.*?)["|']/g,i=>{var l,h;const u=i.match(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g);if(u&&u.length>0){const p={srcset:(l=e.srcset)==null?void 0:l.map(w=>{if(typeof w=="number")return`//${u}/m/${w}x0${n} ${w}w`;if(typeof w=="object"&&w.length===2){let _=0,A=0;return typeof w[0]=="number"&&(_=w[0]),typeof w[1]=="number"&&(A=w[1]),`//${u}/m/${_}x${A}${n} ${_}w`}return""}).join(", "),sizes:(h=e.sizes)==null?void 0:h.map(w=>w).join(", ")};let T="";return p.srcset&&(T+=`srcset="${p.srcset}" `),p.sizes&&(T+=`sizes="${p.sizes}" `),i.replace(/<img/g,`<img ${T.trim()}`)}return i})),r}renderNode(r){const e=[];r.marks&&r.marks.forEach(s=>{const o=this.getMatchingMark(s);o&&o.tag!==""&&e.push(this.renderOpeningTag(o.tag))});const t=this.getMatchingNode(r);return t&&t.tag&&e.push(this.renderOpeningTag(t.tag)),r.content?r.content.forEach(s=>{e.push(this.renderNode(s))}):r.text?e.push(Le(r.text)):t&&t.singleTag?e.push(this.renderTag(t.singleTag," /")):t&&t.html?e.push(t.html):r.type==="emoji"&&e.push(this.renderEmoji(r)),t&&t.tag&&e.push(this.renderClosingTag(t.tag)),r.marks&&r.marks.slice(0).reverse().forEach(s=>{const o=this.getMatchingMark(s);o&&o.tag!==""&&e.push(this.renderClosingTag(o.tag))}),e.join("")}renderTag(r,e){return r.constructor===String?`<${r}${e}>`:r.map(t=>{if(t.constructor===String)return`<${t}${e}>`;{let s=`<${t.tag}`;if(t.attrs){for(const o in t.attrs)if(Object.prototype.hasOwnProperty.call(t.attrs,o)){const n=t.attrs[o];n!==null&&(s+=` ${o}="${n}"`)}}return`${s}${e}>`}}).join("")}renderOpeningTag(r){return this.renderTag(r,"")}renderClosingTag(r){return r.constructor===String?`</${r}>`:r.slice(0).reverse().map(e=>e.constructor===String?`</${e}>`:`</${e.tag}>`).join("")}getMatchingNode(r){const e=this.nodes[r.type];if(typeof e=="function")return e(r)}getMatchingMark(r){const e=this.marks[r.type];if(typeof e=="function")return e(r)}renderEmoji(r){if(r.attrs.emoji)return r.attrs.emoji;const e=[{tag:"img",attrs:{src:r.attrs.fallbackImage,draggable:"false",loading:"lazy",align:"absmiddle"}}];return this.renderTag(e," /")}};class Pe{constructor(e){y(this,"baseURL"),y(this,"timeout"),y(this,"headers"),y(this,"responseInterceptor"),y(this,"fetch"),y(this,"ejectInterceptor"),y(this,"url"),y(this,"parameters"),y(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(o=>{s.data=o});for(const o of e.headers.entries())t[o[0]]=o[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 l=new L;t=`${this.baseURL}${this.url}?${l.stringify(this.parameters)}`}else s=JSON.stringify(this.parameters);const o=new URL(t),n=new AbortController,{signal:a}=n;let i;this.timeout&&(i=setTimeout(()=>n.abort(),this.timeout));try{const l=await this.fetch(`${o}`,{method:e,headers:this.headers,body:s,signal:a,...this.fetchOptions});this.timeout&&clearTimeout(i);const h=await this._responseHandler(l);return this.responseInterceptor&&!this.ejectInterceptor?this._statusHandler(this.responseInterceptor(h)):this._statusHandler(h)}catch(l){return{message:l}}}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,o)=>{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};o(n)})}}const K="SB-Agent",D={defaultAgentName:"SB-JS-CLIENT",defaultAgentVersion:"SB-Agent-Version",packageVersion:"6.0.0"};let P={};const C={};class Ne{constructor(e,t){y(this,"client"),y(this,"maxRetries"),y(this,"retriesDelay"),y(this,"throttle"),y(this,"accessToken"),y(this,"cache"),y(this,"helpers"),y(this,"resolveCounter"),y(this,"relations"),y(this,"links"),y(this,"richTextResolver"),y(this,"resolveNestedRelations"),y(this,"stringifiedStoriesCache");let s=e.endpoint||t;if(!s){const a=new L().getRegionURL,i=e.https===!1?"http":"https";e.oauthToken?s=`${i}://${a(e.region)}/v1`:s=`${i}://${a(e.region)}/v2`}const o=new Headers;o.set("Content-Type","application/json"),o.set("Accept","application/json"),e.headers&&(e.headers.constructor.name==="Headers"?e.headers.entries().toArray():Object.entries(e.headers)).forEach(([a,i])=>{o.set(a,i)}),o.has(K)||(o.set(K,D.defaultAgentName),o.set(D.defaultAgentVersion,D.packageVersion));let n=5;e.oauthToken&&(o.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=ie(this.throttledRequest.bind(this),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 Pe({baseURL:s,timeout:e.timeout||0,headers:o,responseInterceptor:e.responseInterceptor,fetch:e.fetch})}setComponentResolver(e){this.richTextResolver.addNode("blok",t=>{let s="";return t.attrs.body&&t.attrs.body.forEach(o=>{s+=e(o.component,o)}),{html:s}})}parseParams(e){return e.token||(e.token=this.getToken()),e.cv||(e.cv=C[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,o,n){const a=this.factoryParamOptions(e,this.helpers.getOptionsPage(t,s,o));return this.cacheResponse(e,a,void 0,n)}get(e,t,s){t||(t={});const o=`/${e}`,n=this.factoryParamOptions(o,t);return this.cacheResponse(o,n,void 0,s)}async getAll(e,t,s,o){const n=(t==null?void 0:t.per_page)||25,a=`/${e}`.replace(/\/$/,""),i=s??a.substring(a.lastIndexOf("/")+1),l=1,h=await this.makeRequest(a,t,n,l,o),u=h.total?Math.ceil(h.total/n):1,p=await this.helpers.asyncMap(this.helpers.range(l,u),T=>this.makeRequest(a,t,n,T+1,o));return this.helpers.flatMap([h,...p],T=>Object.values(T.data[i]))}post(e,t,s){const o=`/${e}`;return Promise.resolve(this.throttle("post",o,t,s))}put(e,t,s){const o=`/${e}`;return Promise.resolve(this.throttle("put",o,t,s))}delete(e,t,s){t||(t={});const o=`/${e}`;return Promise.resolve(this.throttle("delete",o,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 o=e[t];o&&o.fieldtype==="multilink"&&o.linktype==="story"&&typeof o.id=="string"&&this.links[s][o.id]?o.story=this._cleanCopy(this.links[s][o.id]):o&&o.linktype==="story"&&typeof o.uuid=="string"&&this.links[s][o.uuid]&&(o.story=this._cleanCopy(this.links[s][o.uuid]))}getStoryReference(e,t){return this.relations[e][t]?JSON.parse(this.stringifiedStoriesCache[t]||JSON.stringify(this.relations[e][t])):t}_resolveField(e,t,s){const o=e[t];typeof o=="string"?e[t]=this.getStoryReference(s,o):Array.isArray(o)&&(e[t]=o.map(n=>this.getStoryReference(s,n)).filter(Boolean))}_insertRelations(e,t,s,o){if(Array.isArray(s)?s.find(a=>a.endsWith(`.${t}`)):s.endsWith(`.${t}`)){this._resolveField(e,t,o);return}const n=e.component?`${e.component}.${t}`:t;(Array.isArray(s)?s.includes(n):s===n)&&this._resolveField(e,t,o)}iterateTree(e,t,s){const o=(n,a="")=>{if(!(!n||n._stopResolving)){if(Array.isArray(n))n.forEach((i,l)=>o(i,`${a}[${l}]`));else if(typeof n=="object")for(const i in n){const l=a?`${a}.${i}`:i;(n.component&&n._uid||n.type==="link")&&(this._insertRelations(n,i,t,s),this._insertLinks(n,i,s)),o(n[i],l)}}};o(e.content)}async resolveLinks(e,t,s){let o=[];if(e.link_uuids){const n=e.link_uuids.length,a=[],i=50;for(let l=0;l<n;l+=i){const h=Math.min(n,l+i);a.push(e.link_uuids.slice(l,h))}for(let l=0;l<a.length;l++)(await this.getStories({per_page:i,language:t.language,version:t.version,starts_with:t.starts_with,by_uuids:a[l].join(",")})).data.stories.forEach(h=>{o.push(h)})}else o=e.links;o.forEach(n=>{this.links[s][n.uuid]={...n,_stopResolving:!0}})}async resolveRelations(e,t,s){let o=[];if(e.rel_uuids){const n=e.rel_uuids.length,a=[],i=50;for(let l=0;l<n;l+=i){const h=Math.min(n,l+i);a.push(e.rel_uuids.slice(l,h))}for(let l=0;l<a.length;l++)(await this.getStories({per_page:i,language:t.language,version:t.version,starts_with:t.starts_with,by_uuids:a[l].join(","),excluding_fields:t.excluding_fields})).data.stories.forEach(h=>{o.push(h)})}else o=e.rels;o&&o.length>0&&o.forEach(n=>{this.relations[s][n.uuid]={...n,_stopResolving:!0}})}async resolveStories(e,t,s){var o,n;let a=[];if(this.links[s]={},this.relations[s]={},typeof t.resolve_relations<"u"&&t.resolve_relations.length>0&&(typeof t.resolve_relations=="string"&&(a=t.resolve_relations.split(",")),await this.resolveRelations(e,t,s)),t.resolve_links&&["1","story","url","link"].includes(t.resolve_links)&&((o=e.links)!=null&&o.length||(n=e.link_uuids)!=null&&n.length)&&await this.resolveLinks(e,t,s),this.resolveNestedRelations)for(const i in this.relations[s])this.iterateTree(this.relations[s][i],a,s);e.story?this.iterateTree(e.story,a,s):e.stories.forEach(i=>{this.iterateTree(i,a,s)}),this.stringifiedStoriesCache={},delete this.links[s],delete this.relations[s]}async cacheResponse(e,t,s,o){const n=this.helpers.stringify({url:e,params:t}),a=this.cacheProvider();if(t.version==="published"&&e!=="/cdn/spaces/me"){const i=await a.get(n);if(i)return Promise.resolve(i)}return new Promise(async(i,l)=>{var h;try{const u=await this.throttle("get",e,t,o);if(u.status!==200)return l(u);let p={data:u.data,headers:u.headers};if((h=u.headers)!=null&&h["per-page"]&&(p=Object.assign({},p,{perPage:u.headers["per-page"]?Number.parseInt(u.headers["per-page"]):0,total:u.headers["per-page"]?Number.parseInt(u.headers.total):0})),p.data.story||p.data.stories){const w=this.resolveCounter=++this.resolveCounter%1e3;await this.resolveStories(p.data,t,`${w}`)}t.version==="published"&&e!=="/cdn/spaces/me"&&await a.set(n,p);const T=this.cache.clear==="onpreview"&&t.version==="draft"||this.cache.clear==="auto";return t.token&&p.data.cv&&(T&&C[t.token]&&C[t.token]!==p.data.cv&&await this.flushCache(),C[t.token]=p.data.cv),i(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(i).catch(l);l(u)}})}throttledRequest(e,t,s,o){return this.client.setFetchOptions(o),this.client[e](t,s)}cacheVersions(){return C}cacheVersion(){return C[this.accessToken]}setCacheVersion(e){this.accessToken&&(C[this.accessToken]=e)}clearCacheVersion(){this.accessToken&&(C[this.accessToken]=0)}cacheProvider(){switch(this.cache.type){case"memory":return{get(e){return Promise.resolve(P[e])},getAll(){return Promise.resolve(P)},set(e,t){return P[e]=t,Promise.resolve(void 0)},flush(){return P={},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 Me=(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 Ne(e)}},De=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{}}};function He(r,e){if(!e)return{src:r,attrs:{}};let t=0,s=0;const o={},n=[];function a(l,h,u,p,T){typeof l!="number"||l<=h||l>=u?console.warn(`[StoryblokRichText] - ${p.charAt(0).toUpperCase()+p.slice(1)} value must be a number between ${h} and ${u} (inclusive)`):T.push(`${p}(${l})`)}if(typeof e=="object"){if(typeof e.width=="number"&&e.width>0?(o.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?(o.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)&&(o.loading=e.loading),e.class&&(o.class=e.class),e.filters){const{filters:l}=e||{},{blur:h,brightness:u,fill:p,format:T,grayscale:w,quality:_,rotate:A}=l||{};h&&a(h,0,100,"blur",n),_&&a(_,0,100,"quality",n),u&&a(u,0,100,"brightness",n),p&&n.push(`fill(${p})`),w&&n.push("grayscale()"),A&&[0,90,180,270].includes(e.filters.rotate||0)&&n.push(`rotate(${A})`),T&&["webp","png","jpeg"].includes(T)&&n.push(`format(${T})`)}e.srcset&&(o.srcset=e.srcset.map(l=>{if(typeof l=="number")return`${r}/m/${l}x0/${n.length>0?`filters:${n.join(":")}`:""} ${l}w`;if(Array.isArray(l)&&l.length===2){const[h,u]=l;return`${r}/m/${h}x${u}/${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&&(o.sizes=e.sizes.join(", "))}let i=`${r}/m/`;return t>0&&s>0&&(i=`${i}${t}x${s}/`),n.length>0&&(i=`${i}filters:${n.join(":")}`),{src:i,attrs:o}}var k=(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))(k||{}),E=(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))(E||{}),H=(r=>(r.TEXT="text",r))(H||{}),x=(r=>(r.URL="url",r.STORY="story",r.ASSET="asset",r.EMAIL="email",r))(x||{});const Be=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Ue=(r={})=>Object.keys(r).map(e=>`${e}="${r[e]}"`).join(" "),ze=(r={})=>Object.keys(r).map(e=>`${e}: ${r[e]}`).join("; ");function Fe(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}const N=r=>Object.fromEntries(Object.entries(r).filter(([e,t])=>t!==void 0));function J(r,e={},t){const s=Ue(e),o=s?`${r} ${s}`:r,n=Array.isArray(t)?t.join(""):t||"";if(r){if(Be.includes(r))return`<${o}>`}else return n;return`<${o}>${n}</${r}>`}function Y(r={}){const e=new Map,{renderFn:t=J,textFn:s=Fe,resolvers:o={},optimizeImages:n=!1,keyedResolvers:a=!1}=r,i=t!==J,l=()=>({render:(c,d={},g)=>{if(a&&c){const f=e.get(c)||0;e.set(c,f+1),d.key=`${c}-${f}`}return t(c,d,g)}}),h=c=>(d,g)=>{const f=d.attrs||{};return g.render(c,f,d.children||null)},u=(c,d)=>{const{src:g,alt:f,title:v,srcset:S,sizes:$}=c.attrs||{};let R=g,j={};if(n){const{src:ct,attrs:ht}=He(g,n);R=ct,j=ht}const lt={src:R,alt:f,title:v,srcset:S,sizes:$,...j};return d.render("img",N(lt))},p=(c,d)=>{const{level:g,...f}=c.attrs||{};return d.render(`h${g}`,f,c.children)},T=(c,d)=>{var g,f,v,S;const $=d.render("img",{src:(g=c.attrs)==null?void 0:g.fallbackImage,alt:(f=c.attrs)==null?void 0:f.alt,style:"width: 1.25em; height: 1.25em; vertical-align: text-top",draggable:"false",loading:"lazy"});return d.render("span",{"data-type":"emoji","data-name":(v=c.attrs)==null?void 0:v.name,"data-emoji":(S=c.attrs)==null?void 0:S.emoji},$)},w=(c,d)=>d.render("pre",c.attrs||{},d.render("code",{},c.children||"")),_=(c,d=!1)=>({text:g,attrs:f},v)=>{const{class:S,id:$,...R}=f||{},j=d?{class:S,id:$,style:ze(R)||void 0}:f||{};return v.render(c,N(j),g)},A=c=>z(c),tt=c=>{const{marks:d,...g}=c;if("text"in c){if(d)return d.reduce((v,S)=>A({...S,text:v}),A({...g,children:g.children}));const f=c.attrs||{};if(a){const v=e.get("txt")||0;e.set("txt",v+1),f.key=`txt-${v}`}return s(g.text,f)}return""},re=(c,d)=>{const{linktype:g,href:f,anchor:v,...S}=c.attrs||{};let $="";switch(g){case x.ASSET:case x.URL:$=f;break;case x.EMAIL:$=`mailto:${f}`;break;case x.STORY:$=f,v&&($=`${$}#${v}`);break;default:$=f;break}const R={...S};return $&&(R.href=$),d.render("a",R,c.text)},rt=(c,d)=>{var g,f;return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),d.render("span",{blok:(g=c==null?void 0:c.attrs)==null?void 0:g.body[0],id:(f=c.attrs)==null?void 0:f.id,style:"display: none"})},st=(c,d)=>{const g={},f=d.render("tbody",{},c.children);return d.render("table",g,f)},ot=(c,d)=>{const g={};return d.render("tr",g,c.children)},nt=(c,d)=>{const{colspan:g,rowspan:f,colwidth:v,backgroundColor:S,...$}=c.attrs||{},R={...$};g>1&&(R.colspan=g),f>1&&(R.rowspan=f);const j=[];return v&&j.push(`width: ${v}px;`),S&&j.push(`background-color: ${S};`),j.length>0&&(R.style=j.join(" ")),d.render("td",N(R),c.children)},at=(c,d)=>{const{colspan:g,rowspan:f,colwidth:v,backgroundColor:S,...$}=c.attrs||{},R={...$};g>1&&(R.colspan=g),f>1&&(R.rowspan=f);const j=[];return v&&j.push(`width: ${v}px;`),S&&j.push(`background-color: ${S};`),j.length>0&&(R.style=j.join(" ")),d.render("th",N(R),c.children)},it=new Map([[k.DOCUMENT,h("")],[k.HEADING,p],[k.PARAGRAPH,h("p")],[k.UL_LIST,h("ul")],[k.OL_LIST,h("ol")],[k.LIST_ITEM,h("li")],[k.IMAGE,u],[k.EMOJI,T],[k.CODE_BLOCK,w],[k.HR,h("hr")],[k.BR,h("br")],[k.QUOTE,h("blockquote")],[k.COMPONENT,rt],[H.TEXT,tt],[E.LINK,re],[E.ANCHOR,re],[E.STYLED,_("span",!0)],[E.BOLD,_("strong")],[E.TEXT_STYLE,_("span",!0)],[E.ITALIC,_("em")],[E.UNDERLINE,_("u")],[E.STRIKE,_("s")],[E.CODE,_("code")],[E.SUPERSCRIPT,_("sup")],[E.SUBSCRIPT,_("sub")],[E.HIGHLIGHT,_("mark")],[k.TABLE,st],[k.TABLE_ROW,ot],[k.TABLE_CELL,nt],[k.TABLE_HEADER,at],...Object.entries(o).map(([c,d])=>[c,d])]);function M(c){const d=it.get(c.type);if(!d)return console.error("<Storyblok>",`No resolver found for node type ${c.type}`),"";const g=l();if(c.type==="text")return d(c,g);const f=c.content?c.content.map(z):void 0;return d({...c,children:f},g)}function z(c){return c.type==="doc"?i?c.content.map(M):c.content.map(M).join(""):Array.isArray(c)?c.map(M):M(c)}return{render:z}}let B,W="https://app.storyblok.com/f/storyblok-v2-latest.js";const X=(r,e,t={})=>{var s;const o=!(typeof window>"u")&&typeof window.storyblokRegisterEvent<"u",n=new URL((s=window.location)==null?void 0:s.href).searchParams.get("_storyblok"),a=n!==null&&+n===r;if(!(!o||!a)){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"],i=>{var l;i&&(i.action==="input"&&((l=i.story)==null?void 0:l.id)===r?e(i.story):(i.action==="change"||i.action==="published")&&i.storyId===r&&window.location.reload())})})}},Q=(r,e)=>{r.addNode("blok",t=>{let s="";return t.attrs.body.forEach(o=>{s+=e(o.component,o)}),{html:s}})},Ve=(r={})=>{var e,t;const{bridge:s,accessToken:o,use:n=[],apiOptions:a={},richText:i={},bridgeUrl:l}=r;a.accessToken=a.accessToken||o;const h={bridge:s,apiOptions:a};let u={};n.forEach(T=>{u={...u,...T(h)}}),l&&(W=l);const p=!(typeof window>"u")&&((t=(e=window.location)==null?void 0:e.search)==null?void 0:t.includes("_storyblok_tk"));return s!==!1&&p&&se(W),B=new I(i.schema),i.resolver&&Q(B,i.resolver),u},qe=r=>{var e;return!r||!((e=r==null?void 0:r.content)!=null&&e.some(t=>t.content||t.type==="blok"||t.type==="horizontal_rule"))},Ge=(r,e,t)=>{let s=t||B;if(!s){console.error("Please initialize the Storyblok SDK before calling the renderRichText function");return}return qe(r)?"":(e&&(s=new I(e.schema),e.resolver&&Q(s,e.resolver)),s.render(r,{},!1))},U=m.defineComponent({__name:"StoryblokComponent",props:{blok:{}},setup(r,{expose:e}){const t=r,s=m.ref();e({value:s});const o=typeof m.resolveDynamicComponent(t.blok.component)!="string",n=m.inject("VueSDKOptions"),a=m.ref(t.blok.component);return!o&&n&&(n.enableFallbackComponent?(a.value=n.customFallbackComponent??"FallbackComponent",typeof m.resolveDynamicComponent(a.value)=="string"&&console.error(`Is the Fallback component "${a.value}" registered properly?`)):console.error(`Component could not be found for blok "${t.blok.component}"! Is it defined in main.ts as "app.component("${t.blok.component}", ${t.blok.component});"?`)),(i,l)=>(m.openBlock(),m.createBlock(m.resolveDynamicComponent(a.value),m.mergeProps({ref_key:"blokRef",ref:s},{...i.$props,...i.$attrs}),null,16))}}),Ke=r=>{var e,t;return m.h(U,{blok:(e=r==null?void 0:r.attrs)==null?void 0:e.body[0],id:(t=r.attrs)==null?void 0:t.id},r.children)};function Z(r){const e={renderFn:m.h,textFn:m.createTextVNode,keyedResolvers:!0,resolvers:{[k.COMPONENT]:Ke,...r.resolvers}};return Y(e)}const ee=m.defineComponent({__name:"StoryblokRichText",props:{doc:{},resolvers:{}},setup(r){const e=r,t=m.ref(),s=()=>t.value;return m.watch([()=>e.doc,()=>e.resolvers],([o,n])=>{const{render:a}=Z({resolvers:n??{}});t.value=a(o)},{immediate:!0,deep:!0}),(o,n)=>(m.openBlock(),m.createBlock(s))}}),Je={beforeMount(r,e){if(e.value){const t=De(e.value);Object.keys(t).length>0&&(r.setAttribute("data-blok-c",t["data-blok-c"]),r.setAttribute("data-blok-uid",t["data-blok-uid"]),r.classList.add("storyblok__outline"))}}},te=r=>{console.error(`You can't use ${r} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
31
+ `)};let O=null;const Ye=()=>(O||te("useStoryblokApi"),O),We=async(r,e={},t={})=>{const s=m.ref(null);if(t.resolveRelations=t.resolveRelations??e.resolve_relations,t.resolveLinks=t.resolveLinks??e.resolve_links,m.onMounted(()=>{s.value&&s.value.id&&X(s.value.id,o=>s.value=o,t)}),O){const{data:o}=await O.get(`cdn/stories/${r}`,e);s.value=o.story}else te("useStoryblok");return s},Xe={install(r,e={}){r.directive("editable",Je),r.component("StoryblokComponent",U),r.component("StoryblokRichText",ee),e.enableFallbackComponent&&!e.customFallbackComponent&&r.component("FallbackComponent",m.defineAsyncComponent(()=>Promise.resolve().then(()=>et)));const{storyblokApi:t}=Ve(e);O=t||null,r.provide("VueSDKOptions",e)}},Qe={class:"fallback-component"},Ze={class:"component"},et=Object.freeze(Object.defineProperty({__proto__:null,default:((r,e)=>{const t=r.__vccOpts||r;for(const[s,o]of e)t[s]=o;return t})(m.defineComponent({__name:"FallbackComponent",props:{blok:{}},setup(r){return(e,t)=>(m.openBlock(),m.createElementBlock("div",Qe,[m.createElementVNode("p",null,[t[0]||(t[0]=m.createTextVNode(" Component could not be found for blok ")),m.createElementVNode("span",Ze,m.toDisplayString(e.blok.component),1),t[1]||(t[1]=m.createTextVNode("! Is it configured correctly? "))])]))}}),[["__scopeId","data-v-9abcd1f2"]])},Symbol.toStringTag,{value:"Module"}));b.BlockTypes=k,b.MarkTypes=E,b.RichTextResolver=I,b.RichTextSchema=q,b.StoryblokComponent=U,b.StoryblokRichText=ee,b.StoryblokVue=Xe,b.TextTypes=H,b.apiPlugin=Me,b.renderRichText=Ge,b.richTextResolver=Y,b.useStoryblok=We,b.useStoryblokApi=Ye,b.useStoryblokBridge=X,b.useStoryblokRichText=Z,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});