Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@storyblok/vue

Package Overview
Dependencies
Maintainers
0
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storyblok/vue - npm Package Compare versions

Comparing version 8.1.7 to 8.1.8

6

dist/storyblok-vue.js

@@ -7,3 +7,3 @@ /**

*/
(function(b,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],p):(b=typeof globalThis<"u"?globalThis:b||self,p(b.storyblokVue={},b.Vue))})(this,function(b,p){"use strict";let z=!1;const B=[],te=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}z?o():B.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=>{B.forEach(n=>n()),z=!0,e(o)},document.getElementsByTagName("head")[0].appendChild(s)});var re=Object.defineProperty,se=(r,e,t)=>e in r?re(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,g=(r,e,t)=>se(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 s=[];let o=[],n=0,i=!1;const a=async()=>{n++;const h=s.shift();if(h)try{const d=await r(...h.args);h.resolve(d)}catch(d){h.reject(d)}const u=setTimeout(()=>{n--,s.length>0&&a(),o=o.filter(d=>d!==u)},t);o.includes(u)||o.push(u)},l=(...h)=>i?Promise.reject(new Error("Throttled function is already aborted and not accepting new promises")):new Promise((u,d)=>{s.push({resolve:u,reject:d,args:h}),n<e&&a()});return l.abort=()=>{i=!0,o.forEach(clearTimeout),o=[],s.forEach(h=>h.reject(()=>new oe("Throttle function aborted"))),s.length=0},l}let A=class{constructor(){g(this,"isCDNUrl",(r="")=>r.includes("/cdn/")),g(this,"getOptionsPage",(r,e=25,t=1)=>({...r,per_page:e,page:t})),g(this,"delay",r=>new Promise(e=>setTimeout(e,r))),g(this,"arrayFrom",(r=0,e)=>Array.from({length:r},e)),g(this,"range",(r=0,e=r)=>{const t=Math.abs(e-r)||0,s=r<e?1:-1;return this.arrayFrom(t,(o,n)=>n*s+r)}),g(this,"asyncMap",async(r,e)=>Promise.all(r.map(e))),g(this,"flatMap",(r=[],e)=>r.map(e).reduce((t,s)=>[...t,...s],[])),g(this,"escapeHTML",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})}stringify(r,e,t){const s=[];for(const o in r){if(!Object.prototype.hasOwnProperty.call(r,o))continue;const n=r[o],i=t?"":encodeURIComponent(o);let a;typeof n=="object"?a=this.stringify(n,e?e+encodeURIComponent(`[${i}]`):i,Array.isArray(n)):a=`${e?e+encodeURIComponent(`[${i}]`):i}=${encodeURIComponent(n)}`,s.push(a)}return s.join("&")}getRegionURL(r){const e="api.storyblok.com",t="api-us.storyblok.com",s="app.storyblokchina.cn",o="api-ap.storyblok.com",n="api-ca.storyblok.com";switch(r){case"us":return t;case"cn":return s;case"ap":return o;case"ca":return n;default:return e}}};const ie=function(r,e){const t={};for(const s in r){const o=r[s];e.includes(s)&&o!==null&&(t[s]=o)}return t},ae=r=>r==="email",le=()=>({singleTag:"hr"}),ce=()=>({tag:"blockquote"}),he=()=>({tag:"ul"}),ue=r=>({tag:["pre",{tag:"code",attrs:r.attrs}]}),de=()=>({singleTag:"br"}),pe=r=>({tag:`h${r.attrs.level}`}),ge=r=>({singleTag:[{tag:"img",attrs:ie(r.attrs,["src","alt","title"])}]}),me=()=>({tag:"li"}),fe=()=>({tag:"ol"}),ye=()=>({tag:"p"}),be=r=>({tag:[{tag:"span",attrs:{"data-type":"emoji","data-name":r.attrs.name,emoji:r.attrs.emoji}}]}),ke=()=>({tag:"b"}),ve=()=>({tag:"s"}),$e=()=>({tag:"u"}),Te=()=>({tag:"strong"}),we=()=>({tag:"code"}),Re=()=>({tag:"i"}),_e=r=>{if(!r.attrs)return{tag:""};const e=new A().escapeHTML,t={...r.attrs},{linktype:s="url"}=r.attrs;if(delete t.linktype,t.href&&(t.href=e(r.attrs.href||"")),ae(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}]}},Se=r=>({tag:[{tag:"span",attrs:r.attrs}]}),Ee=()=>({tag:"sub"}),je=()=>({tag:"sup"}),Ce=r=>({tag:[{tag:"span",attrs:r.attrs}]}),Ie=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:""}},F={nodes:{horizontal_rule:le,blockquote:ce,bullet_list:he,code_block:ue,hard_break:de,heading:pe,image:ge,list_item:me,ordered_list:fe,paragraph:ye,emoji:be},marks:{bold:ke,strike:ve,underline:$e,strong:Te,code:we,italic:Re,link:_e,styled:Se,subscript:Ee,superscript:je,anchor:Ce,highlight:Ie,textStyle:Oe}},xe=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 V=!1;class Ae{constructor(e){g(this,"marks"),g(this,"nodes"),e||(e=F),this.marks=e.marks||[],this.nodes=e.nodes||[]}addNode(e,t){this.nodes[e]=t}addMark(e,t){this.marks[e]=t}render(e,t={optimizeImages:!1},s=!0){if(!V&&s&&(console.warn("Warning ⚠️: The RichTextResolver class is deprecated and will be removed in the next major release. Please use the `@storyblok/richtext` package instead. https://github.com/storyblok/richtext/"),V=!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.
(function(y,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],p):(y=typeof globalThis<"u"?globalThis:y||self,p(y.storyblokVue={},y.Vue))})(this,function(y,p){"use strict";let F=!1;const B=[],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():B.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=>{B.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,g=(s,e,t)=>oe(s,typeof e!="symbol"?e+"":e,t);class ne extends Error{constructor(e){super(e),this.name="AbortError"}}function ie(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,i=!1;const l=async()=>{n++;const h=r.shift();if(h)try{const d=await s(...h.args);h.resolve(d)}catch(d){h.reject(d)}const u=setTimeout(()=>{n--,r.length>0&&l(),o=o.filter(d=>d!==u)},t);o.includes(u)||o.push(u)},a=(...h)=>i?Promise.reject(new Error("Throttled function is already aborted and not accepting new promises")):new Promise((u,d)=>{r.push({resolve:u,reject:d,args:h}),n<e&&l()});return a.abort=()=>{i=!0,o.forEach(clearTimeout),o=[],r.forEach(h=>h.reject(()=>new ne("Throttle function aborted"))),r.length=0},a}class P{constructor(){g(this,"isCDNUrl",(e="")=>e.includes("/cdn/")),g(this,"getOptionsPage",(e,t=25,r=1)=>({...e,per_page:t,page:r})),g(this,"delay",e=>new Promise(t=>setTimeout(t,e))),g(this,"arrayFrom",(e=0,t)=>Array.from({length:e},t)),g(this,"range",(e=0,t=e)=>{const r=Math.abs(t-e)||0,o=e<t?1:-1;return this.arrayFrom(r,(n,i)=>i*o+e)}),g(this,"asyncMap",async(e,t)=>Promise.all(e.map(t))),g(this,"flatMap",(e=[],t)=>e.map(t).reduce((r,o)=>[...r,...o],[])),g(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 i=e[n],l=r?"":encodeURIComponent(n);let a;typeof i=="object"?a=this.stringify(i,t?t+encodeURIComponent(`[${l}]`):l,Array.isArray(i)):a=`${t?t+encodeURIComponent(`[${l}]`):l}=${encodeURIComponent(i)}`,o.push(a)}return o.join("&")}getRegionURL(e){const t="api.storyblok.com",r="api-us.storyblok.com",o="app.storyblokchina.cn",n="api-ap.storyblok.com",i="api-ca.storyblok.com";switch(e){case"us":return r;case"cn":return o;case"ap":return n;case"ca":return i;default:return t}}}const ae=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:ae(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"}),_e=()=>({tag:"strong"}),we=()=>({tag:"code"}),Re=()=>({tag:"i"}),Se=s=>{if(!s.attrs)return{tag:""};const e=new P().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"}),Ie=()=>({tag:"sup"}),Ce=s=>({tag:[{tag:"span",attrs:s.attrs}]}),Oe=s=>{var e;return(e=s.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`background-color:${s.attrs.color};`}}]}:{tag:""}},Ae=s=>{var e;return(e=s.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`color:${s.attrs.color}`}}]}:{tag:""}},V={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:_e,code:we,italic:Re,link:Se,styled:Ee,subscript:je,superscript:Ie,anchor:Ce,highlight:Oe,textStyle:Ae}},xe=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 q=!1;class Pe{constructor(e){g(this,"marks"),g(this,"nodes"),e||(e=V),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(!q&&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/"),q=!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.
The "content" field must be an array of nodes as the type ISbRichtext.

@@ -31,3 +31,3 @@ ISbRichtext:

type: 'doc'
}`),""}optimizeImages(e,t){let s=0,o=0,n="",i="";typeof t!="boolean"&&(typeof t.width=="number"&&t.width>0&&(n+=`width="${t.width}" `,s=t.width),typeof t.height=="number"&&t.height>0&&(n+=`height="${t.height}" `,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&&(i+=`:blur(${t.filters.blur})`),typeof t.filters.brightness=="number"&&t.filters.brightness>=-100&&t.filters.brightness<=100&&(i+=`:brightness(${t.filters.brightness})`),t.filters.fill&&(t.filters.fill.match(/[0-9A-F]{6}/gi)||t.filters.fill==="transparent")&&(i+=`:fill(${t.filters.fill})`),t.filters.format&&["webp","png","jpeg"].includes(t.filters.format)&&(i+=`:format(${t.filters.format})`),typeof t.filters.grayscale=="boolean"&&t.filters.grayscale&&(i+=":grayscale()"),typeof t.filters.quality=="number"&&t.filters.quality>=0&&t.filters.quality<=100&&(i+=`:quality(${t.filters.quality})`),t.filters.rotate&&[90,180,270].includes(t.filters.rotate)&&(i+=`:rotate(${t.filters.rotate})`),i.length>0&&(i=`/filters${i}`))),n.length>0&&(e=e.replace(/<img/g,`<img ${n.trim()}`));const a=s>0||o>0||i.length>0?`${s}x${o}${i}`:"";return e=e.replace(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g,`a.storyblok.com/f/$1/$2.$3/m/${a}`),typeof t!="boolean"&&(t.sizes||t.srcset)&&(e=e.replace(/<img.*?src=["|'](.*?)["|']/g,l=>{var h,u;const d=l.match(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g);if(d&&d.length>0){const m={srcset:(h=t.srcset)==null?void 0:h.map(v=>{if(typeof v=="number")return`//${d}/m/${v}x0${i} ${v}w`;if(typeof v=="object"&&v.length===2){let _=0,L=0;return typeof v[0]=="number"&&(_=v[0]),typeof v[1]=="number"&&(L=v[1]),`//${d}/m/${_}x${L}${i} ${_}w`}return""}).join(", "),sizes:(u=t.sizes)==null?void 0:u.map(v=>v).join(", ")};let S="";return m.srcset&&(S+=`srcset="${m.srcset}" `),m.sizes&&(S+=`sizes="${m.sizes}" `),l.replace(/<img/g,`<img ${S.trim()}`)}return l})),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 s=this.getMatchingNode(e);return s&&s.tag&&t.push(this.renderOpeningTag(s.tag)),e.content?e.content.forEach(o=>{t.push(this.renderNode(o))}):e.text?t.push(xe(e.text)):s&&s.singleTag?t.push(this.renderTag(s.singleTag," /")):s&&s.html?t.push(s.html):e.type==="emoji"&&t.push(this.renderEmoji(e)),s&&s.tag&&t.push(this.renderClosingTag(s.tag)),e.marks&&e.marks.slice(0).reverse().forEach(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(s=>{if(s.constructor===String)return`<${s}${t}>`;{let o=`<${s.tag}`;if(s.attrs){for(const n in s.attrs)if(Object.prototype.hasOwnProperty.call(s.attrs,n)){const i=s.attrs[n];i!==null&&(o+=` ${n}="${i}"`)}}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," /")}}const I=Ae;class Pe{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=[],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 A;t=`${this.baseURL}${this.url}?${l.stringify(this.parameters)}`}else s=JSON.stringify(this.parameters);const o=new URL(t),n=new AbortController,{signal:i}=n;let a;this.timeout&&(a=setTimeout(()=>n.abort(),this.timeout));try{const l=await this.fetch(`${o}`,{method:e,headers:this.headers,body:s,signal:i,...this.fetchOptions});this.timeout&&clearTimeout(a);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 Le=Pe,q="SB-Agent",N={defaultAgentName:"SB-JS-CLIENT",defaultAgentVersion:"SB-Agent-Version",packageVersion:"6.0.0"};let P={};const E={};class Ne{constructor(e,t){g(this,"client"),g(this,"maxRetries"),g(this,"retriesDelay"),g(this,"throttle"),g(this,"accessToken"),g(this,"cache"),g(this,"helpers"),g(this,"resolveCounter"),g(this,"relations"),g(this,"links"),g(this,"richTextResolver"),g(this,"resolveNestedRelations"),g(this,"stringifiedStoriesCache");let s=e.endpoint||t;if(!s){const i=new A().getRegionURL,a=e.https===!1?"http":"https";e.oauthToken?s=`${a}://${i(e.region)}/v1`:s=`${a}://${i(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(([i,a])=>{o.set(i,a)}),o.has(q)||(o.set(q,N.defaultAgentName),o.set(N.defaultAgentVersion,N.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=ne(this.throttledRequest.bind(this),n,1e3),this.accessToken=e.accessToken||"",this.relations={},this.links={},this.cache=e.cache||{clear:"manual"},this.helpers=new A,this.resolveCounter=0,this.resolveNestedRelations=e.resolveNestedRelations||!0,this.stringifiedStoriesCache={},this.client=new Le({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=E[e.token]),Array.isArray(e.resolve_relations)&&(e.resolve_relations=e.resolve_relations.join(",")),typeof e.resolve_relations<"u"&&(e.resolve_level=2),e}factoryParamOptions(e,t){return this.helpers.isCDNUrl(e)?this.parseParams(t):t}makeRequest(e,t,s,o,n){const i=this.factoryParamOptions(e,this.helpers.getOptionsPage(t,s,o));return this.cacheResponse(e,i,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,i=`/${e}`.replace(/\/$/,""),a=s??i.substring(i.lastIndexOf("/")+1),l=1,h=await this.makeRequest(i,t,n,l,o),u=h.total?Math.ceil(h.total/n):1,d=await this.helpers.asyncMap(this.helpers.range(l,u),m=>this.makeRequest(i,t,n,m+1,o));return this.helpers.flatMap([h,...d],m=>Object.values(m.data[a]))}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){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]?(this.stringifiedStoriesCache[t]||(this.stringifiedStoriesCache[t]=JSON.stringify(this.relations[e][t])),JSON.parse(this.stringifiedStoriesCache[t])):t}_insertRelations(e,t,s,o){s.includes(`${e.component}.${t}`)&&(typeof e[t]=="string"?e[t]=this.getStoryReference(o,e[t]):Array.isArray(e[t])&&(e[t]=e[t].map(n=>this.getStoryReference(o,n)).filter(Boolean)))}iterateTree(e,t,s){const o=n=>{if(n!=null){if(n.constructor===Array)for(let i=0;i<n.length;i++)o(n[i]);else if(n.constructor===Object){if(n._stopResolving)return;for(const i in n)(n.component&&n._uid||n.type==="link")&&(this._insertRelations(n,i,t,s),this._insertLinks(n,i,s)),o(n[i])}}};o(e.content)}async resolveLinks(e,t,s){let o=[];if(e.link_uuids){const n=e.link_uuids.length,i=[],a=50;for(let l=0;l<n;l+=a){const h=Math.min(n,l+a);i.push(e.link_uuids.slice(l,h))}for(let l=0;l<i.length;l++)(await this.getStories({per_page:a,language:t.language,version:t.version,by_uuids:i[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,i=[],a=50;for(let l=0;l<n;l+=a){const h=Math.min(n,l+a);i.push(e.rel_uuids.slice(l,h))}for(let l=0;l<i.length;l++)(await this.getStories({per_page:a,language:t.language,version:t.version,by_uuids:i[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 i=[];if(this.links[s]={},this.relations[s]={},typeof t.resolve_relations<"u"&&t.resolve_relations.length>0&&(typeof t.resolve_relations=="string"&&(i=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 a in this.relations[s])this.iterateTree(this.relations[s][a],i,s);e.story?this.iterateTree(e.story,i,s):e.stories.forEach(a=>{this.iterateTree(a,i,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}),i=this.cacheProvider();if(this.cache.clear==="auto"&&t.version==="draft"&&await this.flushCache(),t.version==="published"&&e!=="/cdn/spaces/me"){const a=await i.get(n);if(a)return Promise.resolve(a)}return new Promise(async(a,l)=>{var h;try{const u=await this.throttle("get",e,t,o);if(u.status!==200)return l(u);let d={data:u.data,headers:u.headers};if((h=u.headers)!=null&&h["per-page"]&&(d=Object.assign({},d,{perPage:u.headers["per-page"]?Number.parseInt(u.headers["per-page"]):0,total:u.headers["per-page"]?Number.parseInt(u.headers.total):0})),d.data.story||d.data.stories){const m=this.resolveCounter=++this.resolveCounter%1e3;await this.resolveStories(d.data,t,`${m}`)}return t.version==="published"&&e!=="/cdn/spaces/me"&&await i.set(n,d),d.data.cv&&t.token&&E[t.token]!==d.data.cv&&(await this.flushCache(),E[t.token]=d.data.cv),a(d)}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(a).catch(l);l(u)}})}throttledRequest(e,t,s,o){return this.client.setFetchOptions(o),this.client[e](t,s)}cacheVersions(){return E}cacheVersion(){return E[this.accessToken]}setCacheVersion(e){this.accessToken&&(E[this.accessToken]=e)}clearCacheVersion(){this.accessToken&&(E[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.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 i(l,h,u,d,m){typeof l!="number"||l<=h||l>=u?console.warn(`[StoryblokRichText] - ${d.charAt(0).toUpperCase()+d.slice(1)} value must be a number between ${h} and ${u} (inclusive)`):m.push(`${d}(${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:d,format:m,grayscale:S,quality:v,rotate:_}=l||{};h&&i(h,0,100,"blur",n),v&&i(v,0,100,"quality",n),u&&i(u,0,100,"brightness",n),d&&n.push(`fill(${d})`),S&&n.push("grayscale()"),_&&[0,90,180,270].includes(e.filters.rotate||0)&&n.push(`rotate(${_})`),m&&["webp","png","jpeg"].includes(m)&&n.push(`format(${m})`)}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 a=`${r}/m/`;return t>0&&s>0&&(a=`${a}${t}x${s}/`),n.length>0&&(a=`${a}filters:${n.join(":")}`),{src:a,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))(k||{}),T=(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))(T||{}),M=(r=>(r.TEXT="text",r))(M||{}),O=(r=>(r.URL="url",r.STORY="story",r.ASSET="asset",r.EMAIL="email",r))(O||{});const Ue=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],ze=(r={})=>Object.keys(r).map(e=>`${e}="${r[e]}"`).join(" "),Be=(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 G=r=>Object.fromEntries(Object.entries(r).filter(([e,t])=>t!==void 0));function Ve(r,e={},t){const s=ze(e),o=s?`${r} ${s}`:r;return Ue.includes(r)?`<${o}>`:`<${o}>${Array.isArray(t)?t.join(""):t||""}</${r}>`}function K(r={}){let e=0;const{renderFn:t=Ve,textFn:s=Fe,resolvers:o={},optimizeImages:n=!1,keyedResolvers:i=!1}=r,a=c=>f=>{const y=f.attrs||{};return i&&(y.key=`${c}-${e}`),t(c,y,f.children||null)},l=c=>{const{src:f,alt:y,title:$,srcset:R,sizes:w}=c.attrs||{};let j=f,C={};if(n){const{src:ot,attrs:nt}=He(f,n);j=ot,C=nt}i&&(C={...C,key:`img-${e}`});const st={src:j,alt:y,title:$,srcset:R,sizes:w,...C};return t("img",G(st))},h=c=>{const{level:f,...y}=c.attrs||{},$={...y};return i&&($.key=`h${f}-${e}`),t(`h${f}`,$,c.children)},u=c=>{var f,y,$,R;const w=t("img",{src:(f=c.attrs)==null?void 0:f.fallbackImage,alt:(y=c.attrs)==null?void 0:y.alt,style:"width: 1.25em; height: 1.25em; vertical-align: text-top",draggable:"false",loading:"lazy"}),j={"data-type":"emoji","data-name":($=c.attrs)==null?void 0:$.name,"data-emoji":(R=c.attrs)==null?void 0:R.emoji};return i&&(j.key=`emoji-${e}`),t("span",j,w)},d=c=>t("pre",{...c.attrs,key:`code-${e}`},t("code",{key:`code-${e}`},c.children||"")),m=(c,f=!1)=>({text:y,attrs:$})=>{const{class:R,id:w,...j}=$||{},C=f?{class:R,id:w,style:Be(j)||void 0}:$||{};return i&&(C.key=`${c}-${e}`),t(c,G(C),y)},S=c=>U(c),v=c=>{const{marks:f,...y}=c;return"text"in c?f?f.reduce(($,R)=>S({...R,text:$}),S({...y,children:y.children})):s(y.text):""},_=c=>{const{linktype:f,href:y,anchor:$,...R}=c.attrs||{};let w="";switch(f){case O.ASSET:case O.URL:w=y;break;case O.EMAIL:w=`mailto:${y}`;break;case O.STORY:w=y;break}return $&&(w=`${w}#${$}`),t("a",{...R,href:w,key:`a-${e}`},c.text)},L=c=>{var f,y;return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),t("span",{blok:(f=c==null?void 0:c.attrs)==null?void 0:f.body[0],id:(y=c.attrs)==null?void 0:y.id,key:`component-${e}`,style:"display: none"})},rt=new Map([[k.DOCUMENT,a("div")],[k.HEADING,h],[k.PARAGRAPH,a("p")],[k.UL_LIST,a("ul")],[k.OL_LIST,a("ol")],[k.LIST_ITEM,a("li")],[k.IMAGE,l],[k.EMOJI,u],[k.CODE_BLOCK,d],[k.HR,a("hr")],[k.BR,a("br")],[k.QUOTE,a("blockquote")],[k.COMPONENT,L],[M.TEXT,v],[T.LINK,_],[T.ANCHOR,_],[T.STYLED,m("span",!0)],[T.BOLD,m("strong")],[T.TEXT_STYLE,m("span",!0)],[T.ITALIC,m("em")],[T.UNDERLINE,m("u")],[T.STRIKE,m("s")],[T.CODE,m("code")],[T.SUPERSCRIPT,m("sup")],[T.SUBSCRIPT,m("sub")],[T.HIGHLIGHT,m("mark")],...Object.entries(o).map(([c,f])=>[c,f])]);function ee(c){e+=1;const f=rt.get(c.type);if(!f)return console.error("<Storyblok>",`No resolver found for node type ${c.type}`),"";if(c.type==="text")return f(c);const y=c.content?c.content.map(U):void 0;return f({...c,children:y})}function U(c){return Array.isArray(c)?c.map(ee):ee(c)}return{render:U}}let D,J="https://app.storyblok.com/f/storyblok-v2-latest.js";const Y=(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")===r;if(!(!o||!n)){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=>{i.action==="input"&&i.story.id===r?e(i.story):(i.action==="change"||i.action==="published")&&i.storyId===r&&window.location.reload()})})}},qe=(r={})=>{var e,t;const{bridge:s,accessToken:o,use:n=[],apiOptions:i={},richText:a={},bridgeUrl:l}=r;i.accessToken=i.accessToken||o;const h={bridge:s,apiOptions:i};let u={};n.forEach(m=>{u={...u,...m(h)}}),l&&(J=l);const d=!(typeof window>"u")&&((t=(e=window.location)==null?void 0:e.search)==null?void 0:t.includes("_storyblok_tk"));return s!==!1&&d&&te(J),D=new I(a.schema),a.resolver&&X(D,a.resolver),u},X=(r,e)=>{r.addNode("blok",t=>{let s="";return t.attrs.body.forEach(o=>{s+=e(o.component,o)}),{html:s}})},Ge=r=>!r||!(r!=null&&r.content.some(e=>e.content||e.type==="blok"||e.type==="horizontal_rule")),Ke=(r,e,t)=>{let s=t||D;if(!s){console.error("Please initialize the Storyblok SDK before calling the renderRichText function");return}return Ge(r)?"":(e&&(s=new I(e.schema),e.resolver&&X(s,e.resolver)),s.render(r,{},!1))},H=p.defineComponent({__name:"StoryblokComponent",props:{blok:{}},setup(r,{expose:e}){const t=r,s=p.ref();e({value:s});const o=typeof p.resolveDynamicComponent(t.blok.component)!="string",n=p.inject("VueSDKOptions"),i=p.ref(t.blok.component);return!o&&n&&(n.enableFallbackComponent?(i.value=n.customFallbackComponent??"FallbackComponent",typeof p.resolveDynamicComponent(i.value)=="string"&&console.error(`Is the Fallback component "${i.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});"?`)),(a,l)=>(p.openBlock(),p.createBlock(p.resolveDynamicComponent(i.value),p.mergeProps({ref_key:"blokRef",ref:s},{...a.$props,...a.$attrs}),null,16))}}),Je=r=>{var e,t;return p.h(H,{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 W(r){const e={renderFn:p.h,textFn:p.createTextVNode,keyedResolvers:!0,resolvers:{[k.COMPONENT]:Je,...r.resolvers}};return K(e)}const Q=p.defineComponent({__name:"StoryblokRichText",props:{doc:{},resolvers:{}},setup(r){const e=r,t=p.ref(),s=()=>t.value;return p.watch([e.doc,e.resolvers],([o,n])=>{const{render:i}=W({resolvers:n??{}});t.value=i(o)},{immediate:!0}),(o,n)=>(p.openBlock(),p.createBlock(s))}}),Ye={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"))}}},Z=r=>{console.error(`You can't use ${r} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
`)};let x=null;const Xe=()=>(x||Z("useStoryblokApi"),x),We=async(r,e={},t={})=>{const s=p.ref(null);if(t.resolveRelations=t.resolveRelations??e.resolve_relations,t.resolveLinks=t.resolveLinks??e.resolve_links,p.onMounted(()=>{s.value&&s.value.id&&Y(s.value.id,o=>s.value=o,t)}),x){const{data:o}=await x.get(`cdn/stories/${r}`,e);s.value=o.story}else Z("useStoryblok");return s},Qe={install(r,e={}){r.directive("editable",Ye),r.component("StoryblokComponent",H),r.component("StoryblokRichText",Q),e.enableFallbackComponent&&!e.customFallbackComponent&&r.component("FallbackComponent",p.defineAsyncComponent(()=>Promise.resolve().then(()=>tt)));const{storyblokApi:t}=qe(e);x=t||null,r.provide("VueSDKOptions",e)}},Ze={class:"fallback-component"},et={class:"component"},tt=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})(p.defineComponent({__name:"FallbackComponent",props:{blok:{}},setup(r){return(e,t)=>(p.openBlock(),p.createElementBlock("div",Ze,[p.createElementVNode("p",null,[t[0]||(t[0]=p.createTextVNode(" Component could not be found for blok ")),p.createElementVNode("span",et,p.toDisplayString(e.blok.component),1),t[1]||(t[1]=p.createTextVNode("! Is it configured correctly? "))])]))}}),[["__scopeId","data-v-9abcd1f2"]])},Symbol.toStringTag,{value:"Module"}));b.BlockTypes=k,b.MarkTypes=T,b.RichTextResolver=I,b.RichTextSchema=F,b.StoryblokComponent=H,b.StoryblokRichText=Q,b.StoryblokVue=Qe,b.TextTypes=M,b.apiPlugin=Me,b.renderRichText=Ke,b.richTextResolver=K,b.useStoryblok=We,b.useStoryblokApi=Xe,b.useStoryblokBridge=Y,b.useStoryblokRichText=W,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
}`),""}optimizeImages(e,t){let r=0,o=0,n="",i="";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&&(i+=`:blur(${t.filters.blur})`),typeof t.filters.brightness=="number"&&t.filters.brightness>=-100&&t.filters.brightness<=100&&(i+=`:brightness(${t.filters.brightness})`),t.filters.fill&&(t.filters.fill.match(/[0-9A-F]{6}/gi)||t.filters.fill==="transparent")&&(i+=`:fill(${t.filters.fill})`),t.filters.format&&["webp","png","jpeg"].includes(t.filters.format)&&(i+=`:format(${t.filters.format})`),typeof t.filters.grayscale=="boolean"&&t.filters.grayscale&&(i+=":grayscale()"),typeof t.filters.quality=="number"&&t.filters.quality>=0&&t.filters.quality<=100&&(i+=`:quality(${t.filters.quality})`),t.filters.rotate&&[90,180,270].includes(t.filters.rotate)&&(i+=`:rotate(${t.filters.rotate})`),i.length>0&&(i=`/filters${i}`))),n.length>0&&(e=e.replace(/<img/g,`<img ${n.trim()}`));const l=r>0||o>0||i.length>0?`${r}x${o}${i}`:"";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,a=>{var h,u;const d=a.match(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|bmp)/g);if(d&&d.length>0){const b={srcset:(h=t.srcset)==null?void 0:h.map(k=>{if(typeof k=="number")return`//${d}/m/${k}x0${i} ${k}w`;if(typeof k=="object"&&k.length===2){let E=0,x=0;return typeof k[0]=="number"&&(E=k[0]),typeof k[1]=="number"&&(x=k[1]),`//${d}/m/${E}x${x}${i} ${E}w`}return""}).join(", "),sizes:(u=t.sizes)==null?void 0:u.map(k=>k).join(", ")};let $="";return b.srcset&&($+=`srcset="${b.srcset}" `),b.sizes&&($+=`sizes="${b.sizes}" `),a.replace(/<img/g,`<img ${$.trim()}`)}return a})),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(xe(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 i=r.attrs[n];i!==null&&(o+=` ${n}="${i}"`)}}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," /")}}const C=Pe;class Le{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=[],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 a=new P;t=`${this.baseURL}${this.url}?${a.stringify(this.parameters)}`}else r=JSON.stringify(this.parameters);const o=new URL(t),n=new AbortController,{signal:i}=n;let l;this.timeout&&(l=setTimeout(()=>n.abort(),this.timeout));try{const a=await this.fetch(`${o}`,{method:e,headers:this.headers,body:r,signal:i,...this.fetchOptions});this.timeout&&clearTimeout(l);const h=await this._responseHandler(a);return this.responseInterceptor&&!this.ejectInterceptor?this._statusHandler(this.responseInterceptor(h)):this._statusHandler(h)}catch(a){return{message:a}}}setFetchOptions(e={}){Object.keys(e).length>0&&"method"in e&&delete e.method,this.fetchOptions={...e}}eject(){this.ejectInterceptor=!0}_statusHandler(e){const t=/20[0-6]/g;return new Promise((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 Ne=Le,G="SB-Agent",M={defaultAgentName:"SB-JS-CLIENT",defaultAgentVersion:"SB-Agent-Version",packageVersion:"6.0.0"};let L={};const j={};class Me{constructor(e,t){g(this,"client"),g(this,"maxRetries"),g(this,"retriesDelay"),g(this,"throttle"),g(this,"accessToken"),g(this,"cache"),g(this,"helpers"),g(this,"resolveCounter"),g(this,"relations"),g(this,"links"),g(this,"richTextResolver"),g(this,"resolveNestedRelations"),g(this,"stringifiedStoriesCache");let r=e.endpoint||t;if(!r){const i=new P().getRegionURL,l=e.https===!1?"http":"https";e.oauthToken?r=`${l}://${i(e.region)}/v1`:r=`${l}://${i(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(([i,l])=>{o.set(i,l)}),o.has(G)||(o.set(G,M.defaultAgentName),o.set(M.defaultAgentVersion,M.packageVersion));let n=5;e.oauthToken&&(o.set("Authorization",e.oauthToken),n=3),e.rateLimit&&(n=e.rateLimit),e.richTextSchema?this.richTextResolver=new C(e.richTextSchema):this.richTextResolver=new C,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 P,this.resolveCounter=0,this.resolveNestedRelations=e.resolveNestedRelations||!0,this.stringifiedStoriesCache={},this.client=new Ne({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 i=this.factoryParamOptions(e,this.helpers.getOptionsPage(t,r,o));return this.cacheResponse(e,i,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,i=`/${e}`.replace(/\/$/,""),l=r??i.substring(i.lastIndexOf("/")+1),a=1,h=await this.makeRequest(i,t,n,a,o),u=h.total?Math.ceil(h.total/n):1,d=await this.helpers.asyncMap(this.helpers.range(a,u),b=>this.makeRequest(i,t,n,b+1,o));return this.helpers.flatMap([h,...d],b=>Object.values(b.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(i=>i.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,i="")=>{if(!(!n||n._stopResolving)){if(Array.isArray(n))n.forEach((l,a)=>o(l,`${i}[${a}]`));else if(typeof n=="object")for(const l in n){const a=i?`${i}.${l}`:l;(n.component&&n._uid||n.type==="link")&&(this._insertRelations(n,l,t,r),this._insertLinks(n,l,r)),o(n[l],a)}}};o(e.content)}async resolveLinks(e,t,r){let o=[];if(e.link_uuids){const n=e.link_uuids.length,i=[],l=50;for(let a=0;a<n;a+=l){const h=Math.min(n,a+l);i.push(e.link_uuids.slice(a,h))}for(let a=0;a<i.length;a++)(await this.getStories({per_page:l,language:t.language,version:t.version,by_uuids:i[a].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,i=[],l=50;for(let a=0;a<n;a+=l){const h=Math.min(n,a+l);i.push(e.rel_uuids.slice(a,h))}for(let a=0;a<i.length;a++)(await this.getStories({per_page:l,language:t.language,version:t.version,by_uuids:i[a].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 i=[];if(this.links[r]={},this.relations[r]={},typeof t.resolve_relations<"u"&&t.resolve_relations.length>0&&(typeof t.resolve_relations=="string"&&(i=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],i,r);e.story?this.iterateTree(e.story,i,r):e.stories.forEach(l=>{this.iterateTree(l,i,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}),i=this.cacheProvider();if(this.cache.clear==="auto"&&t.version==="draft"&&await this.flushCache(),t.version==="published"&&e!=="/cdn/spaces/me"){const l=await i.get(n);if(l)return Promise.resolve(l)}return new Promise(async(l,a)=>{var h;try{const u=await this.throttle("get",e,t,o);if(u.status!==200)return a(u);let d={data:u.data,headers:u.headers};if((h=u.headers)!=null&&h["per-page"]&&(d=Object.assign({},d,{perPage:u.headers["per-page"]?Number.parseInt(u.headers["per-page"]):0,total:u.headers["per-page"]?Number.parseInt(u.headers.total):0})),d.data.story||d.data.stories){const b=this.resolveCounter=++this.resolveCounter%1e3;await this.resolveStories(d.data,t,`${b}`)}return t.version==="published"&&e!=="/cdn/spaces/me"&&await i.set(n,d),d.data.cv&&t.token&&j[t.token]!==d.data.cv&&(await this.flushCache(),j[t.token]=d.data.cv),l(d)}catch(u){if(u.response&&u.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(a);a(u)}})}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(L[e])},getAll(){return Promise.resolve(L)},set(e,t){return L[e]=t,Promise.resolve(void 0)},flush(){return L={},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 De=(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 Me(e)}},He=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 Ue(s,e){if(!e)return{src:s,attrs:{}};let t=0,r=0;const o={},n=[];function i(a,h,u,d,b){typeof a!="number"||a<=h||a>=u?console.warn(`[StoryblokRichText] - ${d.charAt(0).toUpperCase()+d.slice(1)} value must be a number between ${h} and ${u} (inclusive)`):b.push(`${d}(${a})`)}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:a}=e||{},{blur:h,brightness:u,fill:d,format:b,grayscale:$,quality:k,rotate:E}=a||{};h&&i(h,0,100,"blur",n),k&&i(k,0,100,"quality",n),u&&i(u,0,100,"brightness",n),d&&n.push(`fill(${d})`),$&&n.push("grayscale()"),E&&[0,90,180,270].includes(e.filters.rotate||0)&&n.push(`rotate(${E})`),b&&["webp","png","jpeg"].includes(b)&&n.push(`format(${b})`)}e.srcset&&(o.srcset=e.srcset.map(a=>{if(typeof a=="number")return`${s}/m/${a}x0/${n.length>0?`filters:${n.join(":")}`:""} ${a}w`;if(Array.isArray(a)&&a.length===2){const[h,u]=a;return`${s}/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 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))(v||{}),_=(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))(_||{}),D=(s=>(s.TEXT="text",s))(D||{}),O=(s=>(s.URL="url",s.STORY="story",s.ASSET="asset",s.EMAIL="email",s))(O||{});const ze=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Fe=(s={})=>Object.keys(s).map(e=>`${e}="${s[e]}"`).join(" "),Be=(s={})=>Object.keys(s).map(e=>`${e}: ${s[e]}`).join("; ");function Ve(s){return s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}const K=s=>Object.fromEntries(Object.entries(s).filter(([e,t])=>t!==void 0));function J(s,e={},t){const r=Fe(e),o=r?`${s} ${r}`:s,n=Array.isArray(t)?t.join(""):t||"";if(s){if(ze.includes(s))return`<${o}>`}else return n;return`<${o}>${n}</${s}>`}function Y(s={}){let e=0;const{renderFn:t=J,textFn:r=Ve,resolvers:o={},optimizeImages:n=!1,keyedResolvers:i=!1}=s,l=t!==J,a=c=>m=>{const f=m.attrs||{};return i&&(f.key=`${c}-${e}`),t(c,f,m.children||null)},h=c=>{const{src:m,alt:f,title:T,srcset:S,sizes:w}=c.attrs||{};let R=m,I={};if(n){const{src:nt,attrs:it}=Ue(m,n);R=nt,I=it}i&&(I={...I,key:`img-${e}`});const ot={src:R,alt:f,title:T,srcset:S,sizes:w,...I};return t("img",K(ot))},u=c=>{const{level:m,...f}=c.attrs||{},T={...f};return i&&(T.key=`h${m}-${e}`),t(`h${m}`,T,c.children)},d=c=>{var m,f,T,S;const w=t("img",{src:(m=c.attrs)==null?void 0:m.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"}),R={"data-type":"emoji","data-name":(T=c.attrs)==null?void 0:T.name,"data-emoji":(S=c.attrs)==null?void 0:S.emoji};return i&&(R.key=`emoji-${e}`),t("span",R,w)},b=c=>t("pre",{...c.attrs,key:`code-${e}`},t("code",{key:`code-${e}`},c.children||"")),$=(c,m=!1)=>({text:f,attrs:T})=>{const{class:S,id:w,...R}=T||{},I=m?{class:S,id:w,style:Be(R)||void 0}:T||{};return i&&(I.key=`${c}-${e}`),t(c,K(I),f)},k=c=>z(c),E=c=>{const{marks:m,...f}=c;return"text"in c?m?m.reduce((T,S)=>k({...S,text:T}),k({...f,children:f.children})):r(f.text):""},x=c=>{const{linktype:m,href:f,anchor:T,...S}=c.attrs||{};let w="";switch(m){case O.ASSET:case O.URL:w=f;break;case O.EMAIL:w=`mailto:${f}`;break;case O.STORY:w=f,T&&(w=`${w}#${T}`);break;default:w=f;break}const R={...S};return w&&(R.href=w),i&&(R.key=`a-${e}`),t("a",R,c.text)},rt=c=>{var m,f;return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),t("span",{blok:(m=c==null?void 0:c.attrs)==null?void 0:m.body[0],id:(f=c.attrs)==null?void 0:f.id,key:`component-${e}`,style:"display: none"})},st=new Map([[v.DOCUMENT,a("")],[v.HEADING,u],[v.PARAGRAPH,a("p")],[v.UL_LIST,a("ul")],[v.OL_LIST,a("ol")],[v.LIST_ITEM,a("li")],[v.IMAGE,h],[v.EMOJI,d],[v.CODE_BLOCK,b],[v.HR,a("hr")],[v.BR,a("br")],[v.QUOTE,a("blockquote")],[v.COMPONENT,rt],[D.TEXT,E],[_.LINK,x],[_.ANCHOR,x],[_.STYLED,$("span",!0)],[_.BOLD,$("strong")],[_.TEXT_STYLE,$("span",!0)],[_.ITALIC,$("em")],[_.UNDERLINE,$("u")],[_.STRIKE,$("s")],[_.CODE,$("code")],[_.SUPERSCRIPT,$("sup")],[_.SUBSCRIPT,$("sub")],[_.HIGHLIGHT,$("mark")],...Object.entries(o).map(([c,m])=>[c,m])]);function N(c){e+=1;const m=st.get(c.type);if(!m)return console.error("<Storyblok>",`No resolver found for node type ${c.type}`),"";if(c.type==="text")return m(c);const f=c.content?c.content.map(z):void 0;return m({...c,children:f})}function z(c){return c.type==="doc"?l?c.content.map(N):c.content.map(N).join(""):Array.isArray(c)?c.map(N):N(c)}return{render:z}}let H,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"),i=n!==null&&+n===s;if(!(!o||!i)){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 a;l&&(l.action==="input"&&((a=l.story)==null?void 0:a.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}})},qe=(s={})=>{var e,t;const{bridge:r,accessToken:o,use:n=[],apiOptions:i={},richText:l={},bridgeUrl:a}=s;i.accessToken=i.accessToken||o;const h={bridge:r,apiOptions:i};let u={};n.forEach(b=>{u={...u,...b(h)}}),a&&(W=a);const d=!(typeof window>"u")&&((t=(e=window.location)==null?void 0:e.search)==null?void 0:t.includes("_storyblok_tk"));return r!==!1&&d&&re(W),H=new C(l.schema),l.resolver&&Q(H,l.resolver),u},Ge=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"))},Ke=(s,e,t)=>{let r=t||H;if(!r){console.error("Please initialize the Storyblok SDK before calling the renderRichText function");return}return Ge(s)?"":(e&&(r=new C(e.schema),e.resolver&&Q(r,e.resolver)),r.render(s,{},!1))},U=p.defineComponent({__name:"StoryblokComponent",props:{blok:{}},setup(s,{expose:e}){const t=s,r=p.ref();e({value:r});const o=typeof p.resolveDynamicComponent(t.blok.component)!="string",n=p.inject("VueSDKOptions"),i=p.ref(t.blok.component);return!o&&n&&(n.enableFallbackComponent?(i.value=n.customFallbackComponent??"FallbackComponent",typeof p.resolveDynamicComponent(i.value)=="string"&&console.error(`Is the Fallback component "${i.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,a)=>(p.openBlock(),p.createBlock(p.resolveDynamicComponent(i.value),p.mergeProps({ref_key:"blokRef",ref:r},{...l.$props,...l.$attrs}),null,16))}}),Je=s=>{var e,t;return p.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:p.h,textFn:p.createTextVNode,keyedResolvers:!0,resolvers:{[v.COMPONENT]:Je,...s.resolvers}};return Y(e)}const ee=p.defineComponent({__name:"StoryblokRichText",props:{doc:{},resolvers:{}},setup(s){const e=s,t=p.ref(),r=()=>t.value;return p.watch([e.doc,e.resolvers],([o,n])=>{const{render:i}=Z({resolvers:n??{}});t.value=i(o)},{immediate:!0}),(o,n)=>(p.openBlock(),p.createBlock(r))}}),Ye={beforeMount(s,e){if(e.value){const t=He(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.
`)};let A=null;const We=()=>(A||te("useStoryblokApi"),A),Xe=async(s,e={},t={})=>{const r=p.ref(null);if(t.resolveRelations=t.resolveRelations??e.resolve_relations,t.resolveLinks=t.resolveLinks??e.resolve_links,p.onMounted(()=>{r.value&&r.value.id&&X(r.value.id,o=>r.value=o,t)}),A){const{data:o}=await A.get(`cdn/stories/${s}`,e);r.value=o.story}else te("useStoryblok");return r},Qe={install(s,e={}){s.directive("editable",Ye),s.component("StoryblokComponent",U),s.component("StoryblokRichText",ee),e.enableFallbackComponent&&!e.customFallbackComponent&&s.component("FallbackComponent",p.defineAsyncComponent(()=>Promise.resolve().then(()=>tt)));const{storyblokApi:t}=qe(e);A=t||null,s.provide("VueSDKOptions",e)}},Ze={class:"fallback-component"},et={class:"component"},tt=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})(p.defineComponent({__name:"FallbackComponent",props:{blok:{}},setup(s){return(e,t)=>(p.openBlock(),p.createElementBlock("div",Ze,[p.createElementVNode("p",null,[t[0]||(t[0]=p.createTextVNode(" Component could not be found for blok ")),p.createElementVNode("span",et,p.toDisplayString(e.blok.component),1),t[1]||(t[1]=p.createTextVNode("! Is it configured correctly? "))])]))}}),[["__scopeId","data-v-9abcd1f2"]])},Symbol.toStringTag,{value:"Module"}));y.BlockTypes=v,y.MarkTypes=_,y.RichTextResolver=C,y.RichTextSchema=V,y.StoryblokComponent=U,y.StoryblokRichText=ee,y.StoryblokVue=Qe,y.TextTypes=D,y.apiPlugin=De,y.renderRichText=Ke,y.richTextResolver=Y,y.useStoryblok=Xe,y.useStoryblokApi=We,y.useStoryblokBridge=X,y.useStoryblokRichText=Z,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})});
{
"name": "@storyblok/vue",
"type": "module",
"version": "8.1.7",
"version": "8.1.8",
"packageManager": "pnpm@9.12.2",

@@ -49,3 +49,3 @@ "description": "SDK to integrate Storyblok into your project using Vue.",

"dependencies": {
"@storyblok/js": "3.1.9"
"@storyblok/js": "3.2.1"
},

@@ -52,0 +52,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc