@storyblok/vue 9.2.4 → 9.2.7

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.
@@ -4,5 +4,5 @@
4
4
  * description: SDK to integrate Storyblok into your project using Vue.
5
5
  * author: Storyblok
6
6
  */
7
- (function(k,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],f):(k=typeof globalThis<"u"?globalThis:k||self,f(k.storyblokVue={},k.Vue))})(this,function(k,f){"use strict";var oe=Object.defineProperty,ne=(e,t,r)=>t in e?oe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,b=(e,t,r)=>ne(e,typeof t!="symbol"?t+"":t,r);function C(e,t,r){this.type=e,this.tag=t,this.attrs=null,this.map=null,this.nesting=r,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}C.prototype.attrIndex=function(e){if(!this.attrs)return-1;const t=this.attrs;for(let r=0,s=t.length;r<s;r++)if(t[r][0]===e)return r;return-1},C.prototype.attrPush=function(e){this.attrs?this.attrs.push(e):this.attrs=[e]},C.prototype.attrSet=function(e,t){const r=this.attrIndex(e),s=[e,t];r<0?this.attrPush(s):this.attrs[r]=s},C.prototype.attrGet=function(e){const t=this.attrIndex(e);let r=null;return t>=0&&(r=this.attrs[t][1]),r},C.prototype.attrJoin=function(e,t){const r=this.attrIndex(e);r<0?this.attrPush([e,t]):this.attrs[r][1]=this.attrs[r][1]+" "+t};const ie="[a-zA-Z_:][a-zA-Z0-9:._-]*",ae="[^\"'=<>`\\x00-\\x20]+",le="'[^']*'",ce='"[^"]*"',ue="(?:"+ae+"|"+le+"|"+ce+")",he="(?:\\s+"+ie+"(?:\\s*=\\s*"+ue+")?)",de="<[A-Za-z][A-Za-z0-9\\-]*"+he+"*\\s*\\/?>",pe="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",fe=new RegExp("^(?:"+de+"|"+pe+")");new RegExp(fe.source+"\\s*$");const M=[];for(let e=0;e<256;e++)M.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e){M[e.charCodeAt(0)]=1});let v=function(e){return e.DOCUMENT="doc",e.HEADING="heading",e.PARAGRAPH="paragraph",e.QUOTE="blockquote",e.OL_LIST="ordered_list",e.UL_LIST="bullet_list",e.LIST_ITEM="list_item",e.CODE_BLOCK="code_block",e.HR="horizontal_rule",e.BR="hard_break",e.IMAGE="image",e.EMOJI="emoji",e.COMPONENT="blok",e.TABLE="table",e.TABLE_ROW="tableRow",e.TABLE_CELL="tableCell",e.TABLE_HEADER="tableHeader",e}({}),$=function(e){return e.BOLD="bold",e.STRONG="strong",e.STRIKE="strike",e.UNDERLINE="underline",e.ITALIC="italic",e.CODE="code",e.LINK="link",e.ANCHOR="anchor",e.STYLED="styled",e.SUPERSCRIPT="superscript",e.SUBSCRIPT="subscript",e.TEXT_STYLE="textStyle",e.HIGHLIGHT="highlight",e}({}),V=function(e){return e.TEXT="text",e}({}),j=function(e){return e.URL="url",e.STORY="story",e.ASSET="asset",e.EMAIL="email",e}({});function ye(e,t){if(!t)return{src:e,attrs:{}};let r=0,s=0;const o={},n=[];function l(c,u,y,m,E){typeof c!="number"||c<=u||c>=y?console.warn(`[StoryblokRichText] - ${m.charAt(0).toUpperCase()+m.slice(1)} value must be a number between ${u} and ${y} (inclusive)`):E.push(`${m}(${c})`)}if(typeof t=="object"){if(typeof t.width=="number"&&t.width>0?(o.width=t.width,r=t.width):console.warn("[StoryblokRichText] - Width value must be a number greater than 0"),t.height&&typeof t.height=="number"&&t.height>0?(o.height=t.height,s=t.height):console.warn("[StoryblokRichText] - Height value must be a number greater than 0"),t.loading&&["lazy","eager"].includes(t.loading)&&(o.loading=t.loading),t.class&&(o.class=t.class),t.filters){const{filters:c}=t||{},{blur:u,brightness:y,fill:m,format:E,grayscale:A,quality:L,rotate:x}=c||{};u&&l(u,0,100,"blur",n),L&&l(L,0,100,"quality",n),y&&l(y,0,100,"brightness",n),m&&n.push(`fill(${m})`),A&&n.push("grayscale()"),x&&[0,90,180,270].includes(t.filters.rotate||0)&&n.push(`rotate(${x})`),E&&["webp","png","jpeg"].includes(E)&&n.push(`format(${E})`)}t.srcset&&(o.srcset=t.srcset.map(c=>{if(typeof c=="number")return`${e}/m/${c}x0/${n.length>0?`filters:${n.join(":")}`:""} ${c}w`;if(Array.isArray(c)&&c.length===2){const[u,y]=c;return`${e}/m/${u}x${y}/${n.length>0?`filters:${n.join(":")}`:""} ${u}w`}else{console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");return}}).join(", ")),t.sizes&&(o.sizes=t.sizes.join(", "))}let a=`${e}/m/`;return r>0&&s>0&&(a=`${a}${r}x${s}/`),n.length>0&&(a=`${a}filters:${n.join(":")}`),{src:a,attrs:o}}const me=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],be=(e={})=>Object.keys(e).map(t=>`${t}="${e[t]}"`).join(" "),ge=(e={})=>Object.keys(e).map(t=>`${t}: ${e[t]}`).join("; ");function ke(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}const O=e=>Object.fromEntries(Object.entries(e).filter(([t,r])=>r!==void 0));function z(e,t={},r){const s=be(t),o=s?`${e} ${s}`:e,n=Array.isArray(r)?r.join(""):r||"";if(e){if(me.includes(e))return`<${o}>`}else return n;return`<${o}>${n}</${e}>`}function D(e={}){const t=new Map,{renderFn:r=z,textFn:s=ke,resolvers:o={},optimizeImages:n=!1,keyedResolvers:l=!1}=e,a=r!==z,c=i=>(h,d)=>{const p=h.attrs||{};return d.render(i,p,h.children||null)},u=(i,h)=>{const{src:d,alt:p,title:g,srcset:T,sizes:_}=i.attrs||{};let w=d,R={};if(n){const{src:et,attrs:tt}=ye(d,n);w=et,R=tt}const Qe={src:w,alt:p,title:g,srcset:T,sizes:_,...R};return h.render("img",O(Qe))},y=(i,h)=>{const{level:d,...p}=i.attrs||{};return h.render(`h${d}`,p,i.children)},m=(i,h)=>{var d,p,g,T;const _=h.render("img",{src:(d=i.attrs)==null?void 0:d.fallbackImage,alt:(p=i.attrs)==null?void 0:p.alt,style:"width: 1.25em; height: 1.25em; vertical-align: text-top",draggable:"false",loading:"lazy"});return h.render("span",{"data-type":"emoji","data-name":(g=i.attrs)==null?void 0:g.name,"data-emoji":(T=i.attrs)==null?void 0:T.emoji},_)},E=(i,h)=>h.render("pre",i.attrs||{},h.render("code",{},i.children||"")),A=(i,h=!1)=>({text:d,attrs:p},g)=>{const{class:T,id:_,...w}=p||{},R=h?{class:T,id:_,style:ge(w)||void 0}:p||{};return g.render(i,O(R),d)},L=i=>F(i),x=i=>{const{marks:h,...d}=i;if("text"in i){if(h)return h.reduce((g,T)=>L({...T,text:g}),L({...d,children:d.children}));const p=i.attrs||{};if(l){const g=t.get("txt")||0;t.set("txt",g+1),p.key=`txt-${g}`}return s(d.text,p)}return""},te=(i,h)=>{const{linktype:d,href:p,anchor:g,...T}=i.attrs||{};let _="";switch(d){case j.ASSET:case j.URL:_=p;break;case j.EMAIL:_=`mailto:${p}`;break;case j.STORY:_=p,g&&(_=`${_}#${g}`);break;default:_=p;break}const w={...T};return _&&(w.href=_),h.render("a",w,i.text)},Ke=(i,h)=>{var d,p;return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),h.render("span",{blok:(d=i==null?void 0:i.attrs)==null?void 0:d.body[0],id:(p=i.attrs)==null?void 0:p.id,style:"display: none"})},Je=(i,h)=>{const d={},p=h.render("tbody",{},i.children);return h.render("table",d,p)},Ye=(i,h)=>{const d={};return h.render("tr",d,i.children)},Ze=(i,h)=>{const{colspan:d,rowspan:p,colwidth:g,backgroundColor:T,..._}=i.attrs||{},w={..._};d>1&&(w.colspan=d),p>1&&(w.rowspan=p);const R=[];return g&&R.push(`width: ${g}px;`),T&&R.push(`background-color: ${T};`),R.length>0&&(w.style=R.join(" ")),h.render("td",O(w),i.children)},We=(i,h)=>{const{colspan:d,rowspan:p,colwidth:g,backgroundColor:T,..._}=i.attrs||{},w={..._};d>1&&(w.colspan=d),p>1&&(w.rowspan=p);const R=[];return g&&R.push(`width: ${g}px;`),T&&R.push(`background-color: ${T};`),R.length>0&&(w.style=R.join(" ")),h.render("th",O(w),i.children)},re=new Map([[v.DOCUMENT,c("")],[v.HEADING,y],[v.PARAGRAPH,c("p")],[v.UL_LIST,c("ul")],[v.OL_LIST,c("ol")],[v.LIST_ITEM,c("li")],[v.IMAGE,u],[v.EMOJI,m],[v.CODE_BLOCK,E],[v.HR,c("hr")],[v.BR,c("br")],[v.QUOTE,c("blockquote")],[v.COMPONENT,Ke],[V.TEXT,x],[$.LINK,te],[$.ANCHOR,te],[$.STYLED,A("span",!0)],[$.BOLD,A("strong")],[$.TEXT_STYLE,A("span",!0)],[$.ITALIC,A("em")],[$.UNDERLINE,A("u")],[$.STRIKE,A("s")],[$.CODE,A("code")],[$.SUPERSCRIPT,A("sup")],[$.SUBSCRIPT,A("sub")],[$.HIGHLIGHT,A("mark")],[v.TABLE,Je],[v.TABLE_ROW,Ye],[v.TABLE_CELL,Ze],[v.TABLE_HEADER,We]]),se=new Map([...re,...Object.entries(o).map(([i,h])=>[i,h])]),Xe=()=>({render:(i,h={},d)=>{if(l&&i){const p=t.get(i)||0;t.set(i,p+1),h.key=`${i}-${p}`}return r(i,h,d)},originalResolvers:re,mergedResolvers:se});function N(i){const h=se.get(i.type);if(!h)return console.error("<Storyblok>",`No resolver found for node type ${i.type}`),"";const d=Xe();if(i.type==="text")return h(i,d);const p=i.content?i.content.map(F):void 0;return h({...i,children:p},d)}function F(i){return i.type==="doc"?a?i.content.map(N):i.content.map(N).join(""):Array.isArray(i)?i.map(N):N(i)}return{render:F}}let G=!1;const q=[],ve=e=>new Promise((t,r)=>{if(typeof window>"u"){r(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));return}if(window.storyblokRegisterEvent=o=>{if(!window.location.search.includes("_storyblok")){console.warn("You are not in Draft Mode or in the Visual Editor.");return}G?o():q.push(o)},document.getElementById("storyblok-javascript-bridge")){t(void 0);return}const s=document.createElement("script");s.async=!0,s.src=e,s.id="storyblok-javascript-bridge",s.onerror=o=>r(o),s.onload=o=>{q.forEach(n=>n()),G=!0,t(o)},document.getElementsByTagName("head")[0].appendChild(s)});var _e=class extends Error{constructor(e){super(e),this.name="AbortError"}};function we(e,t,r){if(!Number.isFinite(t))throw new TypeError("Expected `limit` to be a finite number");if(!Number.isFinite(r))throw new TypeError("Expected `interval` to be a finite number");const s=[];let o=[],n=0,l=!1;const a=async()=>{n++;const u=s.shift();if(u)try{const m=await e(...u.args);u.resolve(m)}catch(m){u.reject(m)}const y=setTimeout(()=>{n--,s.length>0&&a(),o=o.filter(m=>m!==y)},r);o.includes(y)||o.push(y)},c=(...u)=>l?Promise.reject(new Error("Throttled function is already aborted and not accepting new promises")):new Promise((y,m)=>{s.push({resolve:y,reject:m,args:u}),n<t&&a()});return c.abort=()=>{l=!0,o.forEach(clearTimeout),o=[],s.forEach(u=>u.reject(()=>new _e("Throttle function aborted"))),s.length=0},c}var Te=we;const K=(e="")=>e.includes("/cdn/"),Re=(e,t=25,r=1)=>({...e,per_page:t,page:r}),$e=e=>new Promise(t=>setTimeout(t,e)),Ae=(e=0,t)=>Array.from({length:e},t),Ee=(e=0,t=e)=>{const r=Math.abs(t-e)||0,s=e<t?1:-1;return Ae(r,(o,n)=>n*s+e)},Se=async(e,t)=>Promise.all(e.map(t)),Ce=(e=[],t)=>e.map(t).reduce((r,s)=>[...r,...s],[]),B=(e,t,r)=>{const s=[];for(const o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;const n=e[o];if(n==null)continue;const l=r?"":encodeURIComponent(o);let a;typeof n=="object"?a=B(n,t?t+encodeURIComponent(`[${l}]`):l,Array.isArray(n)):a=`${t?t+encodeURIComponent(`[${l}]`):l}=${encodeURIComponent(n)}`,s.push(a)}return s.join("&")},J=e=>{const t={eu:"api.storyblok.com",us:"api-us.storyblok.com",cn:"app.storyblokchina.cn",ap:"api-ap.storyblok.com",ca:"api-ca.storyblok.com"};return t[e]??t.eu};var Ie=class{constructor(e){b(this,"baseURL"),b(this,"timeout"),b(this,"headers"),b(this,"responseInterceptor"),b(this,"fetch"),b(this,"ejectInterceptor"),b(this,"url"),b(this,"parameters"),b(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(s=>{r.data=s});for(const s of e.headers.entries())t[s[0]]=s[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;e==="get"?t=`${this.baseURL}${this.url}?${B(this.parameters)}`:r=JSON.stringify(this.parameters);const s=new URL(t),o=new AbortController,{signal:n}=o;let l;this.timeout&&(l=setTimeout(()=>o.abort(),this.timeout));try{const a=await this.fetch(`${s}`,{method:e,headers:this.headers,body:r,signal:n,...this.fetchOptions});this.timeout&&clearTimeout(l);const c=await this._responseHandler(a);return this.responseInterceptor&&!this.ejectInterceptor?this._statusHandler(this.responseInterceptor(c)):this._statusHandler(c)}catch(a){return{message:a}}}setFetchOptions(e={}){Object.keys(e).length>0&&"method"in e&&delete e.method,this.fetchOptions={...e}}eject(){this.ejectInterceptor=!0}_normalizeErrorMessage(e){if(Array.isArray(e))return e[0]||"Unknown error";if(e&&typeof e=="object"){if(e.error)return e.error;for(const t in e){if(Array.isArray(e[t]))return`${t}: ${e[t][0]}`;if(typeof e[t]=="string")return`${t}: ${e[t]}`}if(e.slug)return e.slug}return"Unknown error"}_statusHandler(e){const t=/20[0-6]/g;return new Promise((r,s)=>{if(t.test(`${e.status}`))return r(e);const o={message:this._normalizeErrorMessage(e.data),status:e.status,response:e};s(o)})}},Le=Ie;const Y="SB-Agent",H={defaultAgentName:"SB-JS-CLIENT",defaultAgentVersion:"SB-Agent-Version",packageVersion:"7.0.0"},je={PUBLISHED:"published"};let P={};const S={};var Oe=class{constructor(e,t){b(this,"client"),b(this,"maxRetries"),b(this,"retriesDelay"),b(this,"throttle"),b(this,"accessToken"),b(this,"cache"),b(this,"resolveCounter"),b(this,"relations"),b(this,"links"),b(this,"version"),b(this,"richTextResolver"),b(this,"resolveNestedRelations"),b(this,"stringifiedStoriesCache"),b(this,"inlineAssets");let r=e.endpoint||t;if(!r){const n=e.https===!1?"http":"https";e.oauthToken?r=`${n}://${J(e.region)}/v1`:r=`${n}://${J(e.region)}/v2`}const s=new Headers;s.set("Content-Type","application/json"),s.set("Accept","application/json"),e.headers&&(e.headers.constructor.name==="Headers"?e.headers.entries().toArray():Object.entries(e.headers)).forEach(([n,l])=>{s.set(n,l)}),s.has(Y)||(s.set(Y,H.defaultAgentName),s.set(H.defaultAgentVersion,H.packageVersion));let o=5;e.oauthToken&&(s.set("Authorization",e.oauthToken),o=3),e.rateLimit&&(o=e.rateLimit),this.maxRetries=e.maxRetries||10,this.retriesDelay=300,this.throttle=Te(this.throttledRequest.bind(this),o,1e3),this.accessToken=e.accessToken||"",this.relations={},this.links={},this.cache=e.cache||{clear:"manual"},this.resolveCounter=0,this.resolveNestedRelations=e.resolveNestedRelations||!0,this.stringifiedStoriesCache={},this.version=e.version||je.PUBLISHED,this.inlineAssets=e.inlineAssets||!1,this.client=new Le({baseURL:r,timeout:e.timeout||0,headers:s,responseInterceptor:e.responseInterceptor,fetch:e.fetch})}parseParams(e){return e.token||(e.token=this.getToken()),e.cv||(e.cv=S[e.token]),Array.isArray(e.resolve_relations)&&(e.resolve_relations=e.resolve_relations.join(",")),typeof e.resolve_relations<"u"&&(e.resolve_level=2),e}factoryParamOptions(e,t){return K(e)?this.parseParams(t):t}makeRequest(e,t,r,s,o){const n=this.factoryParamOptions(e,Re(t,r,s));return this.cacheResponse(e,n,void 0,o)}get(e,t={},r){t||(t={});const s=`/${e}`;K(s)&&(t.version=t.version||this.version);const o=this.factoryParamOptions(s,t);return this.cacheResponse(s,o,void 0,r)}async getAll(e,t={},r,s){const o=(t==null?void 0:t.per_page)||25,n=`/${e}`.replace(/\/$/,""),l=r??n.substring(n.lastIndexOf("/")+1);t.version=t.version||this.version;const a=1,c=await this.makeRequest(n,t,o,a,s),u=c.total?Math.ceil(c.total/(c.perPage||o)):1,y=await Se(Ee(a,u),m=>this.makeRequest(n,t,o,m+1,s));return Ce([c,...y],m=>Object.values(m.data[l]))}post(e,t={},r){const s=`/${e}`;return this.throttle("post",s,t,r)}put(e,t={},r){const s=`/${e}`;return this.throttle("put",s,t,r)}delete(e,t={},r){t||(t={});const s=`/${e}`;return this.throttle("delete",s,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 s=e[t];s&&s.fieldtype==="multilink"&&s.linktype==="story"&&typeof s.id=="string"&&this.links[r][s.id]?s.story=this._cleanCopy(this.links[r][s.id]):s&&s.linktype==="story"&&typeof s.uuid=="string"&&this.links[r][s.uuid]&&(s.story=this._cleanCopy(this.links[r][s.uuid]))}getStoryReference(e,t){return this.relations[e][t]?JSON.parse(this.stringifiedStoriesCache[t]||JSON.stringify(this.relations[e][t])):t}_resolveField(e,t,r){const s=e[t];typeof s=="string"?e[t]=this.getStoryReference(r,s):Array.isArray(s)&&(e[t]=s.map(o=>this.getStoryReference(r,o)).filter(Boolean))}_insertRelations(e,t,r,s){if(Array.isArray(r)?r.find(n=>n.endsWith(`.${t}`)):r.endsWith(`.${t}`)){this._resolveField(e,t,s);return}const o=e.component?`${e.component}.${t}`:t;(Array.isArray(r)?r.includes(o):r===o)&&this._resolveField(e,t,s)}iterateTree(e,t,r){const s=(o,n="")=>{if(!(!o||o._stopResolving)){if(Array.isArray(o))o.forEach((l,a)=>s(l,`${n}[${a}]`));else if(typeof o=="object")for(const l in o){const a=n?`${n}.${l}`:l;(o.component&&o._uid||o.type==="link")&&(this._insertRelations(o,l,t,r),this._insertLinks(o,l,r)),s(o[l],a)}}};s(e.content)}async resolveLinks(e,t,r){let s=[];if(e.link_uuids){const o=e.link_uuids.length,n=[],l=50;for(let a=0;a<o;a+=l){const c=Math.min(o,a+l);n.push(e.link_uuids.slice(a,c))}for(let a=0;a<n.length;a++)(await this.getStories({per_page:l,language:t.language,version:t.version,starts_with:t.starts_with,by_uuids:n[a].join(",")})).data.stories.forEach(c=>{s.push(c)})}else s=e.links;s.forEach(o=>{this.links[r][o.uuid]={...o,_stopResolving:!0}})}async resolveRelations(e,t,r){let s=[];if(e.rel_uuids){const o=e.rel_uuids.length,n=[],l=50;for(let a=0;a<o;a+=l){const c=Math.min(o,a+l);n.push(e.rel_uuids.slice(a,c))}for(let a=0;a<n.length;a++)(await this.getStories({per_page:l,language:t.language,version:t.version,starts_with:t.starts_with,by_uuids:n[a].join(","),excluding_fields:t.excluding_fields})).data.stories.forEach(c=>{s.push(c)});s.length>0&&(e.rels=s,delete e.rel_uuids)}else s=e.rels;s&&s.length>0&&s.forEach(o=>{this.relations[r][o.uuid]={...o,_stopResolving:!0}})}async resolveStories(e,t,r){var s,o;let n=[];if(this.links[r]={},this.relations[r]={},typeof t.resolve_relations<"u"&&t.resolve_relations.length>0&&(typeof t.resolve_relations=="string"&&(n=t.resolve_relations.split(",")),await this.resolveRelations(e,t,r)),t.resolve_links&&["1","story","url","link"].includes(t.resolve_links)&&((s=e.links)!=null&&s.length||(o=e.link_uuids)!=null&&o.length)&&await this.resolveLinks(e,t,r),this.resolveNestedRelations)for(const l in this.relations[r])this.iterateTree(this.relations[r][l],n,r);e.story?this.iterateTree(e.story,n,r):e.stories.forEach(l=>{this.iterateTree(l,n,r)}),this.stringifiedStoriesCache={},delete this.links[r],delete this.relations[r]}async cacheResponse(e,t,r,s){const o=B({url:e,params:t}),n=this.cacheProvider();if(t.version==="published"&&e!=="/cdn/spaces/me"){const l=await n.get(o);if(l)return Promise.resolve(l)}return new Promise(async(l,a)=>{var c;try{const u=await this.throttle("get",e,t,s);if(u.status!==200)return a(u);let y={data:u.data,headers:u.headers};if((c=u.headers)!=null&&c["per-page"]&&(y=Object.assign({},y,{perPage:u.headers["per-page"]?Number.parseInt(u.headers["per-page"]):0,total:u.headers["per-page"]?Number.parseInt(u.headers.total):0})),y.data.story||y.data.stories){const E=this.resolveCounter=++this.resolveCounter%1e3;await this.resolveStories(y.data,t,`${E}`),y=await this.processInlineAssets(y)}t.version==="published"&&e!=="/cdn/spaces/me"&&await n.set(o,y);const m=this.cache.clear==="onpreview"&&t.version==="draft"||this.cache.clear==="auto";return t.token&&y.data.cv&&(m&&S[t.token]&&S[t.token]!==y.data.cv&&await this.flushCache(),S[t.token]=y.data.cv),l(y)}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 $e(this.retriesDelay),this.cacheResponse(e,t,r).then(l).catch(a);a(u)}})}throttledRequest(e,t,r,s){return this.client.setFetchOptions(s),this.client[e](t,r)}cacheVersions(){return S}cacheVersion(){return S[this.accessToken]}setCacheVersion(e){this.accessToken&&(S[this.accessToken]=e)}clearCacheVersion(){this.accessToken&&(S[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}async processInlineAssets(e){if(!this.inlineAssets)return e;const t=r=>{if(!r||typeof r!="object")return r;if(Array.isArray(r))return r.map(o=>t(o));let s={...r};s.fieldtype==="asset"&&Array.isArray(e.data.assets)&&(s={...s,...e.data.assets.find(o=>o.id===s.id)});for(const o in s)typeof s[o]=="object"&&(s[o]=t(s[o]));return s};return e.data.story&&(e.data.story.content=t(e.data.story.content)),e.data.stories&&(e.data.stories=e.data.stories.map(r=>(r.content=t(r.content),r))),e}},Pe=Oe;const xe=(e={})=>{const{apiOptions:t}=e;if(!t||!t.accessToken){console.error("You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication");return}return{storyblokApi:new Pe(t)}},Ne=e=>{if(typeof e!="object"||typeof e._editable>"u")return{};try{const t=JSON.parse(e._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return t?{"data-blok-c":JSON.stringify(t),"data-blok-uid":`${t.id}-${t.uid}`}:{}}catch{return{}}};let Z="https://app.storyblok.com/f/storyblok-v2-latest.js";const W=(e,t,r={})=>{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"),l=n!==null&&+n===e;if(!(!o||!l)){if(!e){console.warn("Story ID is not defined. Please provide a valid ID.");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(r).on(["input","published","change"],a=>{var c;a&&(a.action==="input"&&((c=a.story)==null?void 0:c.id)===e?t(a.story):(a.action==="change"||a.action==="published")&&a.storyId===e&&window.location.reload())})})}},De=(e={})=>{var t,r;const{bridge:s,accessToken:o,use:n=[],apiOptions:l={},bridgeUrl:a}=e;l.accessToken=l.accessToken||o;const c={bridge:s,apiOptions:l};let u={};n.forEach(m=>{u={...u,...m(c)}}),a&&(Z=a);const y=!(typeof window>"u")&&((r=(t=window.location)==null?void 0:t.search)==null?void 0:r.includes("_storyblok_tk"));return s!==!1&&y&&ve(Z),u};function Be(e,t){return D(t).render(e)}const U=f.defineComponent({__name:"StoryblokComponent",props:{blok:{}},setup(e,{expose:t}){var a;const r=e,s=f.ref();t({value:s});const o=typeof f.resolveDynamicComponent(r.blok.component)!="string",n=f.inject("VueSDKOptions"),l=f.ref((a=r.blok.component)==null?void 0:a.replace(/_/g,"-"));return!o&&n&&(n.enableFallbackComponent?(l.value=n.customFallbackComponent??"FallbackComponent",typeof f.resolveDynamicComponent(l.value)=="string"&&console.error(`Is the Fallback component "${l.value}" registered properly?`)):console.error(`Component could not be found for blok "${r.blok.component}"! Is it defined in main.ts as "app.component("${r.blok.component}", ${r.blok.component});"?`)),(c,u)=>(f.openBlock(),f.createBlock(f.resolveDynamicComponent(l.value),f.mergeProps({ref_key:"blokRef",ref:s},{...c.$props,...c.$attrs}),null,16))}}),He=e=>{var t,r;return f.h(U,{blok:(t=e==null?void 0:e.attrs)==null?void 0:t.body[0],id:(r=e.attrs)==null?void 0:r.id},e.children)};function X(e){const t={renderFn:f.h,textFn:f.createTextVNode,keyedResolvers:!0,resolvers:{[v.COMPONENT]:He,...e.resolvers}};return D(t)}const Q=f.defineComponent({__name:"StoryblokRichText",props:{doc:{},resolvers:{}},setup(e){const t=e,r=f.ref(),s=()=>r.value;return f.watch([()=>t.doc,()=>t.resolvers],([o,n])=>{const{render:l}=X({resolvers:n??{}});r.value=l(o)},{immediate:!0,deep:!0}),(o,n)=>(f.openBlock(),f.createBlock(s))}}),Ue={beforeMount(e,t){if(t.value){const r=Ne(t.value);Object.keys(r).length>0&&(e.setAttribute("data-blok-c",r["data-blok-c"]),e.setAttribute("data-blok-uid",r["data-blok-uid"]),e.classList.add("storyblok__outline"))}}},ee=e=>{console.error(`You can't use ${e} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
8
- `)};let I=null;const Fe=()=>(I||ee("useStoryblokApi"),I),Me=async(e,t={},r={})=>{const s=f.ref(null);if(r.resolveRelations=r.resolveRelations??t.resolve_relations,r.resolveLinks=r.resolveLinks??t.resolve_links,f.onMounted(()=>{s.value&&s.value.id&&W(s.value.id,o=>s.value=o,r)}),I){const{data:o}=await I.get(`cdn/stories/${e}`,t);s.value=o.story}else ee("useStoryblok");return s},Ve={install(e,t={}){e.directive("editable",Ue),e.component("StoryblokComponent",U),e.component("StoryblokRichText",Q),t.enableFallbackComponent&&!t.customFallbackComponent&&e.component("FallbackComponent",f.defineAsyncComponent(()=>Promise.resolve().then(()=>qe)));const{storyblokApi:r}=De(t);I=r||null,e.provide("VueSDKOptions",t)}},ze={class:"fallback-component"},Ge={class:"component"},qe=Object.freeze(Object.defineProperty({__proto__:null,default:((e,t)=>{const r=e.__vccOpts||e;for(const[s,o]of t)r[s]=o;return r})(f.defineComponent({__name:"FallbackComponent",props:{blok:{}},setup(e){return(t,r)=>(f.openBlock(),f.createElementBlock("div",ze,[f.createElementVNode("p",null,[r[0]||(r[0]=f.createTextVNode(" Component could not be found for blok ")),f.createElementVNode("span",Ge,f.toDisplayString(t.blok.component),1),r[1]||(r[1]=f.createTextVNode("! Is it configured correctly? "))])]))}}),[["__scopeId","data-v-9abcd1f2"]])},Symbol.toStringTag,{value:"Module"}));k.BlockTypes=v,k.MarkTypes=$,k.StoryblokComponent=U,k.StoryblokRichText=Q,k.StoryblokVue=Ve,k.TextTypes=V,k.apiPlugin=xe,k.renderRichText=Be,k.richTextResolver=D,k.useStoryblok=Me,k.useStoryblokApi=Fe,k.useStoryblokBridge=W,k.useStoryblokRichText=X,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});
7
+ (function(k,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],f):(k=typeof globalThis<"u"?globalThis:k||self,f(k.storyblokVue={},k.Vue))})(this,function(k,f){"use strict";var re=Object.defineProperty,se=(e,t,r)=>t in e?re(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,b=(e,t,r)=>se(e,typeof t!="symbol"?t+"":t,r);let v=function(e){return e.DOCUMENT="doc",e.HEADING="heading",e.PARAGRAPH="paragraph",e.QUOTE="blockquote",e.OL_LIST="ordered_list",e.UL_LIST="bullet_list",e.LIST_ITEM="list_item",e.CODE_BLOCK="code_block",e.HR="horizontal_rule",e.BR="hard_break",e.IMAGE="image",e.EMOJI="emoji",e.COMPONENT="blok",e.TABLE="table",e.TABLE_ROW="tableRow",e.TABLE_CELL="tableCell",e.TABLE_HEADER="tableHeader",e}({}),$=function(e){return e.BOLD="bold",e.STRONG="strong",e.STRIKE="strike",e.UNDERLINE="underline",e.ITALIC="italic",e.CODE="code",e.LINK="link",e.ANCHOR="anchor",e.STYLED="styled",e.SUPERSCRIPT="superscript",e.SUBSCRIPT="subscript",e.TEXT_STYLE="textStyle",e.HIGHLIGHT="highlight",e}({}),M=function(e){return e.TEXT="text",e}({}),L=function(e){return e.URL="url",e.STORY="story",e.ASSET="asset",e.EMAIL="email",e}({});const oe=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],ne=(e={})=>Object.keys(e).map(t=>`${t}="${e[t]}"`).join(" "),ie=(e={})=>Object.keys(e).map(t=>`${t}: ${e[t]}`).join("; ");function ae(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}const O=e=>Object.fromEntries(Object.entries(e).filter(([t,r])=>r!==void 0));function le(e,t){if(!t)return{src:e,attrs:{}};let r=0,s=0;const o={},n=[];function l(c,u,m,y,S){typeof c!="number"||c<=u||c>=m?console.warn(`[StoryblokRichText] - ${y.charAt(0).toUpperCase()+y.slice(1)} value must be a number between ${u} and ${m} (inclusive)`):S.push(`${y}(${c})`)}if(typeof t=="object"){if(typeof t.width=="number"&&t.width>0?(o.width=t.width,r=t.width):console.warn("[StoryblokRichText] - Width value must be a number greater than 0"),t.height&&typeof t.height=="number"&&t.height>0?(o.height=t.height,s=t.height):console.warn("[StoryblokRichText] - Height value must be a number greater than 0"),t.loading&&["lazy","eager"].includes(t.loading)&&(o.loading=t.loading),t.class&&(o.class=t.class),t.filters){const{filters:c}=t||{},{blur:u,brightness:m,fill:y,format:S,grayscale:E,quality:I,rotate:P}=c||{};u&&l(u,0,100,"blur",n),I&&l(I,0,100,"quality",n),m&&l(m,0,100,"brightness",n),y&&n.push(`fill(${y})`),E&&n.push("grayscale()"),P&&[0,90,180,270].includes(t.filters.rotate||0)&&n.push(`rotate(${P})`),S&&["webp","png","jpeg"].includes(S)&&n.push(`format(${S})`)}t.srcset&&(o.srcset=t.srcset.map(c=>{if(typeof c=="number")return`${e}/m/${c}x0/${n.length>0?`filters:${n.join(":")}`:""} ${c}w`;if(Array.isArray(c)&&c.length===2){const[u,m]=c;return`${e}/m/${u}x${m}/${n.length>0?`filters:${n.join(":")}`:""} ${u}w`}else{console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");return}}).join(", ")),t.sizes&&(o.sizes=t.sizes.join(", "))}let a=`${e}/m/`;return r>0&&s>0&&(a=`${a}${r}x${s}/`),n.length>0&&(a=`${a}filters:${n.join(":")}`),{src:a,attrs:o}}function V(e,t={},r){const s=ne(t),o=s?`${e} ${s}`:e,n=Array.isArray(r)?r.join(""):r||"";if(e){if(oe.includes(e))return`<${o}>`}else return n;return`<${o}>${n}</${e}>`}function x(e={}){const t=new Map,{renderFn:r=V,textFn:s=ae,resolvers:o={},optimizeImages:n=!1,keyedResolvers:l=!1}=e,a=r!==V,c=i=>(h,d)=>{const p=h.attrs||{};return d.render(i,p,h.children||null)},u=(i,h)=>{const{src:d,alt:p,title:g,srcset:w,sizes:_}=i.attrs||{};let T=d,R={};if(n){const{src:Fe,attrs:ze}=le(d,n);T=Fe,R=ze}const Ve={src:T,alt:p,title:g,srcset:w,sizes:_,...R};return h.render("img",O(Ve))},m=(i,h)=>{const{level:d,...p}=i.attrs||{};return h.render(`h${d}`,p,i.children)},y=(i,h)=>{var d,p,g,w;const _=h.render("img",{src:(d=i.attrs)==null?void 0:d.fallbackImage,alt:(p=i.attrs)==null?void 0:p.alt,style:"width: 1.25em; height: 1.25em; vertical-align: text-top",draggable:"false",loading:"lazy"});return h.render("span",{"data-type":"emoji","data-name":(g=i.attrs)==null?void 0:g.name,"data-emoji":(w=i.attrs)==null?void 0:w.emoji},_)},S=(i,h)=>h.render("pre",i.attrs||{},h.render("code",{},i.children||"")),E=(i,h=!1)=>({text:d,attrs:p},g)=>{const{class:w,id:_,...T}=p||{},R=h?{class:w,id:_,style:ie(T)||void 0}:p||{};return g.render(i,O(R),d)},I=i=>U(i),P=i=>{const{marks:h,...d}=i;if("text"in i){if(h)return h.reduce((g,w)=>I({...w,text:g}),I({...d,children:d.children}));const p=i.attrs||{};if(l){const g=t.get("txt")||0;t.set("txt",g+1),p.key=`txt-${g}`}return s(d.text,p)}return""},Z=(i,h)=>{const{linktype:d,href:p,anchor:g,...w}=i.attrs||{};let _="";switch(d){case L.ASSET:case L.URL:_=p;break;case L.EMAIL:_=`mailto:${p}`;break;case L.STORY:_=p,g&&(_=`${_}#${g}`);break;default:_=p;break}const T={...w};return _&&(T.href=_),h.render("a",T,i.text)},xe=(i,h)=>{var d,p;return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"),h.render("span",{blok:(d=i==null?void 0:i.attrs)==null?void 0:d.body[0],id:(p=i.attrs)==null?void 0:p.id,style:"display: none"})},Be=(i,h)=>{const d={},p=h.render("tbody",{},i.children);return h.render("table",d,p)},De=(i,h)=>{const d={};return h.render("tr",d,i.children)},He=(i,h)=>{const{colspan:d,rowspan:p,colwidth:g,backgroundColor:w,..._}=i.attrs||{},T={..._};d>1&&(T.colspan=d),p>1&&(T.rowspan=p);const R=[];return g&&R.push(`width: ${g}px;`),w&&R.push(`background-color: ${w};`),R.length>0&&(T.style=R.join(" ")),h.render("td",O(T),i.children)},Ue=(i,h)=>{const{colspan:d,rowspan:p,colwidth:g,backgroundColor:w,..._}=i.attrs||{},T={..._};d>1&&(T.colspan=d),p>1&&(T.rowspan=p);const R=[];return g&&R.push(`width: ${g}px;`),w&&R.push(`background-color: ${w};`),R.length>0&&(T.style=R.join(" ")),h.render("th",O(T),i.children)},ee=new Map([[v.DOCUMENT,c("")],[v.HEADING,m],[v.PARAGRAPH,c("p")],[v.UL_LIST,c("ul")],[v.OL_LIST,c("ol")],[v.LIST_ITEM,c("li")],[v.IMAGE,u],[v.EMOJI,y],[v.CODE_BLOCK,S],[v.HR,c("hr")],[v.BR,c("br")],[v.QUOTE,c("blockquote")],[v.COMPONENT,xe],[M.TEXT,P],[$.LINK,Z],[$.ANCHOR,Z],[$.STYLED,E("span",!0)],[$.BOLD,E("strong")],[$.TEXT_STYLE,E("span",!0)],[$.ITALIC,E("em")],[$.UNDERLINE,E("u")],[$.STRIKE,E("s")],[$.CODE,E("code")],[$.SUPERSCRIPT,E("sup")],[$.SUBSCRIPT,E("sub")],[$.HIGHLIGHT,E("mark")],[v.TABLE,Be],[v.TABLE_ROW,De],[v.TABLE_CELL,He],[v.TABLE_HEADER,Ue]]),te=new Map([...ee,...Object.entries(o).map(([i,h])=>[i,h])]),Me=()=>({render:(i,h={},d)=>{if(l&&i){const p=t.get(i)||0;t.set(i,p+1),h.key=`${i}-${p}`}return r(i,h,d)},originalResolvers:ee,mergedResolvers:te});function N(i){const h=te.get(i.type);if(!h)return console.error("<Storyblok>",`No resolver found for node type ${i.type}`),"";const d=Me();if(i.type==="text")return h(i,d);const p=i.content?i.content.map(U):void 0;return h({...i,children:p},d)}function U(i){return i.type==="doc"?a?i.content.map(N):i.content.map(N).join(""):Array.isArray(i)?i.map(N):N(i)}return{render:U}}let F=!1;const z=[],ce=e=>new Promise((t,r)=>{if(typeof window>"u"){r(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));return}if(window.storyblokRegisterEvent=o=>{if(!window.location.search.includes("_storyblok")){console.warn("You are not in Draft Mode or in the Visual Editor.");return}F?o():z.push(o)},document.getElementById("storyblok-javascript-bridge")){t(void 0);return}const s=document.createElement("script");s.async=!0,s.src=e,s.id="storyblok-javascript-bridge",s.onerror=o=>r(o),s.onload=o=>{z.forEach(n=>n()),F=!0,t(o)},document.getElementsByTagName("head")[0].appendChild(s)});var ue=class extends Error{constructor(e){super(e),this.name="AbortError"}};function he(e,t,r){if(!Number.isFinite(t))throw new TypeError("Expected `limit` to be a finite number");if(!Number.isFinite(r))throw new TypeError("Expected `interval` to be a finite number");const s=[];let o=[],n=0,l=!1;const a=async()=>{n++;const u=s.shift();if(u)try{const y=await e(...u.args);u.resolve(y)}catch(y){u.reject(y)}const m=setTimeout(()=>{n--,s.length>0&&a(),o=o.filter(y=>y!==m)},r);o.includes(m)||o.push(m)},c=(...u)=>l?Promise.reject(new Error("Throttled function is already aborted and not accepting new promises")):new Promise((m,y)=>{s.push({resolve:m,reject:y,args:u}),n<t&&a()});return c.abort=()=>{l=!0,o.forEach(clearTimeout),o=[],s.forEach(u=>u.reject(()=>new ue("Throttle function aborted"))),s.length=0},c}var de=he;const q=(e="")=>e.includes("/cdn/"),pe=(e,t=25,r=1)=>({...e,per_page:t,page:r}),fe=e=>new Promise(t=>setTimeout(t,e)),me=(e=0,t)=>Array.from({length:e},t),ye=(e=0,t=e)=>{const r=Math.abs(t-e)||0,s=e<t?1:-1;return me(r,(o,n)=>n*s+e)},be=async(e,t)=>Promise.all(e.map(t)),ge=(e=[],t)=>e.map(t).reduce((r,s)=>[...r,...s],[]),B=(e,t,r)=>{const s=[];for(const o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;const n=e[o];if(n==null)continue;const l=r?"":encodeURIComponent(o);let a;typeof n=="object"?a=B(n,t?t+encodeURIComponent(`[${l}]`):l,Array.isArray(n)):a=`${t?t+encodeURIComponent(`[${l}]`):l}=${encodeURIComponent(n)}`,s.push(a)}return s.join("&")},G=e=>{const t={eu:"api.storyblok.com",us:"api-us.storyblok.com",cn:"app.storyblokchina.cn",ap:"api-ap.storyblok.com",ca:"api-ca.storyblok.com"};return t[e]??t.eu};var ke=class{constructor(e){b(this,"baseURL"),b(this,"timeout"),b(this,"headers"),b(this,"responseInterceptor"),b(this,"fetch"),b(this,"ejectInterceptor"),b(this,"url"),b(this,"parameters"),b(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(s=>{r.data=s});for(const s of e.headers.entries())t[s[0]]=s[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;e==="get"?t=`${this.baseURL}${this.url}?${B(this.parameters)}`:r=JSON.stringify(this.parameters);const s=new URL(t),o=new AbortController,{signal:n}=o;let l;this.timeout&&(l=setTimeout(()=>o.abort(),this.timeout));try{const a=await this.fetch(`${s}`,{method:e,headers:this.headers,body:r,signal:n,...this.fetchOptions});this.timeout&&clearTimeout(l);const c=await this._responseHandler(a);return this.responseInterceptor&&!this.ejectInterceptor?this._statusHandler(this.responseInterceptor(c)):this._statusHandler(c)}catch(a){return{message:a}}}setFetchOptions(e={}){Object.keys(e).length>0&&"method"in e&&delete e.method,this.fetchOptions={...e}}eject(){this.ejectInterceptor=!0}_normalizeErrorMessage(e){if(Array.isArray(e))return e[0]||"Unknown error";if(e&&typeof e=="object"){if(e.error)return e.error;for(const t in e){if(Array.isArray(e[t]))return`${t}: ${e[t][0]}`;if(typeof e[t]=="string")return`${t}: ${e[t]}`}if(e.slug)return e.slug}return"Unknown error"}_statusHandler(e){const t=/20[0-6]/g;return new Promise((r,s)=>{if(t.test(`${e.status}`))return r(e);const o={message:this._normalizeErrorMessage(e.data),status:e.status,response:e};s(o)})}},ve=ke;const J="SB-Agent",D={defaultAgentName:"SB-JS-CLIENT",defaultAgentVersion:"SB-Agent-Version",packageVersion:"7.0.0"},_e={PUBLISHED:"published"};let j={};const A={};var Te=class{constructor(e,t){b(this,"client"),b(this,"maxRetries"),b(this,"retriesDelay"),b(this,"throttle"),b(this,"accessToken"),b(this,"cache"),b(this,"resolveCounter"),b(this,"relations"),b(this,"links"),b(this,"version"),b(this,"richTextResolver"),b(this,"resolveNestedRelations"),b(this,"stringifiedStoriesCache"),b(this,"inlineAssets");let r=e.endpoint||t;if(!r){const n=e.https===!1?"http":"https";e.oauthToken?r=`${n}://${G(e.region)}/v1`:r=`${n}://${G(e.region)}/v2`}const s=new Headers;s.set("Content-Type","application/json"),s.set("Accept","application/json"),e.headers&&(e.headers.constructor.name==="Headers"?e.headers.entries().toArray():Object.entries(e.headers)).forEach(([n,l])=>{s.set(n,l)}),s.has(J)||(s.set(J,D.defaultAgentName),s.set(D.defaultAgentVersion,D.packageVersion));let o=5;e.oauthToken&&(s.set("Authorization",e.oauthToken),o=3),e.rateLimit&&(o=e.rateLimit),this.maxRetries=e.maxRetries||10,this.retriesDelay=300,this.throttle=de(this.throttledRequest.bind(this),o,1e3),this.accessToken=e.accessToken||"",this.relations={},this.links={},this.cache=e.cache||{clear:"manual"},this.resolveCounter=0,this.resolveNestedRelations=e.resolveNestedRelations||!0,this.stringifiedStoriesCache={},this.version=e.version||_e.PUBLISHED,this.inlineAssets=e.inlineAssets||!1,this.client=new ve({baseURL:r,timeout:e.timeout||0,headers:s,responseInterceptor:e.responseInterceptor,fetch:e.fetch})}parseParams(e){return e.token||(e.token=this.getToken()),e.cv||(e.cv=A[e.token]),Array.isArray(e.resolve_relations)&&(e.resolve_relations=e.resolve_relations.join(",")),typeof e.resolve_relations<"u"&&(e.resolve_level=2),e}factoryParamOptions(e,t){return q(e)?this.parseParams(t):t}makeRequest(e,t,r,s,o){const n=this.factoryParamOptions(e,pe(t,r,s));return this.cacheResponse(e,n,void 0,o)}get(e,t={},r){t||(t={});const s=`/${e}`;q(s)&&(t.version=t.version||this.version);const o=this.factoryParamOptions(s,t);return this.cacheResponse(s,o,void 0,r)}async getAll(e,t={},r,s){const o=(t==null?void 0:t.per_page)||25,n=`/${e}`.replace(/\/$/,""),l=r??n.substring(n.lastIndexOf("/")+1);t.version=t.version||this.version;const a=1,c=await this.makeRequest(n,t,o,a,s),u=c.total?Math.ceil(c.total/(c.perPage||o)):1,m=await be(ye(a,u),y=>this.makeRequest(n,t,o,y+1,s));return ge([c,...m],y=>Object.values(y.data[l]))}post(e,t={},r){const s=`/${e}`;return this.throttle("post",s,t,r)}put(e,t={},r){const s=`/${e}`;return this.throttle("put",s,t,r)}delete(e,t={},r){t||(t={});const s=`/${e}`;return this.throttle("delete",s,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 s=e[t];s&&s.fieldtype==="multilink"&&s.linktype==="story"&&typeof s.id=="string"&&this.links[r][s.id]?s.story=this._cleanCopy(this.links[r][s.id]):s&&s.linktype==="story"&&typeof s.uuid=="string"&&this.links[r][s.uuid]&&(s.story=this._cleanCopy(this.links[r][s.uuid]))}getStoryReference(e,t){return this.relations[e][t]?JSON.parse(this.stringifiedStoriesCache[t]||JSON.stringify(this.relations[e][t])):t}_resolveField(e,t,r){const s=e[t];typeof s=="string"?e[t]=this.getStoryReference(r,s):Array.isArray(s)&&(e[t]=s.map(o=>this.getStoryReference(r,o)).filter(Boolean))}_insertRelations(e,t,r,s){if(Array.isArray(r)?r.find(n=>n.endsWith(`.${t}`)):r.endsWith(`.${t}`)){this._resolveField(e,t,s);return}const o=e.component?`${e.component}.${t}`:t;(Array.isArray(r)?r.includes(o):r===o)&&this._resolveField(e,t,s)}iterateTree(e,t,r){const s=(o,n="")=>{if(!(!o||o._stopResolving)){if(Array.isArray(o))o.forEach((l,a)=>s(l,`${n}[${a}]`));else if(typeof o=="object")for(const l in o){const a=n?`${n}.${l}`:l;(o.component&&o._uid||o.type==="link")&&(this._insertRelations(o,l,t,r),this._insertLinks(o,l,r)),s(o[l],a)}}};s(e.content)}async resolveLinks(e,t,r){let s=[];if(e.link_uuids){const o=e.link_uuids.length,n=[],l=50;for(let a=0;a<o;a+=l){const c=Math.min(o,a+l);n.push(e.link_uuids.slice(a,c))}for(let a=0;a<n.length;a++)(await this.getStories({per_page:l,language:t.language,version:t.version,starts_with:t.starts_with,by_uuids:n[a].join(",")})).data.stories.forEach(c=>{s.push(c)})}else s=e.links;s.forEach(o=>{this.links[r][o.uuid]={...o,_stopResolving:!0}})}async resolveRelations(e,t,r){let s=[];if(e.rel_uuids){const o=e.rel_uuids.length,n=[],l=50;for(let a=0;a<o;a+=l){const c=Math.min(o,a+l);n.push(e.rel_uuids.slice(a,c))}for(let a=0;a<n.length;a++)(await this.getStories({per_page:l,language:t.language,version:t.version,starts_with:t.starts_with,by_uuids:n[a].join(","),excluding_fields:t.excluding_fields})).data.stories.forEach(c=>{s.push(c)});s.length>0&&(e.rels=s,delete e.rel_uuids)}else s=e.rels;s&&s.length>0&&s.forEach(o=>{this.relations[r][o.uuid]={...o,_stopResolving:!0}})}async resolveStories(e,t,r){var s,o;let n=[];if(this.links[r]={},this.relations[r]={},typeof t.resolve_relations<"u"&&t.resolve_relations.length>0&&(typeof t.resolve_relations=="string"&&(n=t.resolve_relations.split(",")),await this.resolveRelations(e,t,r)),t.resolve_links&&["1","story","url","link"].includes(t.resolve_links)&&((s=e.links)!=null&&s.length||(o=e.link_uuids)!=null&&o.length)&&await this.resolveLinks(e,t,r),this.resolveNestedRelations)for(const l in this.relations[r])this.iterateTree(this.relations[r][l],n,r);e.story?this.iterateTree(e.story,n,r):e.stories.forEach(l=>{this.iterateTree(l,n,r)}),this.stringifiedStoriesCache={},delete this.links[r],delete this.relations[r]}async cacheResponse(e,t,r,s){const o=B({url:e,params:t}),n=this.cacheProvider();if(t.version==="published"&&e!=="/cdn/spaces/me"){const l=await n.get(o);if(l)return Promise.resolve(l)}return new Promise(async(l,a)=>{var c;try{const u=await this.throttle("get",e,t,s);if(u.status!==200)return a(u);let m={data:u.data,headers:u.headers};if((c=u.headers)!=null&&c["per-page"]&&(m=Object.assign({},m,{perPage:u.headers["per-page"]?Number.parseInt(u.headers["per-page"]):0,total:u.headers["per-page"]?Number.parseInt(u.headers.total):0})),m.data.story||m.data.stories){const S=this.resolveCounter=++this.resolveCounter%1e3;await this.resolveStories(m.data,t,`${S}`),m=await this.processInlineAssets(m)}t.version==="published"&&e!=="/cdn/spaces/me"&&await n.set(o,m);const y=this.cache.clear==="onpreview"&&t.version==="draft"||this.cache.clear==="auto";return t.token&&m.data.cv&&(y&&A[t.token]&&A[t.token]!==m.data.cv&&await this.flushCache(),A[t.token]=m.data.cv),l(m)}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 fe(this.retriesDelay),this.cacheResponse(e,t,r).then(l).catch(a);a(u)}})}throttledRequest(e,t,r,s){return this.client.setFetchOptions(s),this.client[e](t,r)}cacheVersions(){return A}cacheVersion(){return A[this.accessToken]}setCacheVersion(e){this.accessToken&&(A[this.accessToken]=e)}clearCacheVersion(){this.accessToken&&(A[this.accessToken]=0)}cacheProvider(){switch(this.cache.type){case"memory":return{get(e){return Promise.resolve(j[e])},getAll(){return Promise.resolve(j)},set(e,t){return j[e]=t,Promise.resolve(void 0)},flush(){return j={},Promise.resolve(void 0)}};case"custom":if(this.cache.custom)return this.cache.custom;default:return{get(){return Promise.resolve()},getAll(){return Promise.resolve(void 0)},set(){return Promise.resolve(void 0)},flush(){return Promise.resolve(void 0)}}}}async flushCache(){return await this.cacheProvider().flush(),this.clearCacheVersion(),this}async processInlineAssets(e){if(!this.inlineAssets)return e;const t=r=>{if(!r||typeof r!="object")return r;if(Array.isArray(r))return r.map(o=>t(o));let s={...r};s.fieldtype==="asset"&&Array.isArray(e.data.assets)&&(s={...s,...e.data.assets.find(o=>o.id===s.id)});for(const o in s)typeof s[o]=="object"&&(s[o]=t(s[o]));return s};return e.data.story&&(e.data.story.content=t(e.data.story.content)),e.data.stories&&(e.data.stories=e.data.stories.map(r=>(r.content=t(r.content),r))),e}},we=Te;const Re=(e={})=>{const{apiOptions:t}=e;if(!t||!t.accessToken){console.error("You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication");return}return{storyblokApi:new we(t)}},$e=e=>{if(typeof e!="object"||typeof e._editable>"u")return{};try{const t=JSON.parse(e._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return t?{"data-blok-c":JSON.stringify(t),"data-blok-uid":`${t.id}-${t.uid}`}:{}}catch{return{}}};let K="https://app.storyblok.com/f/storyblok-v2-latest.js";const Y=(e,t,r={})=>{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"),l=n!==null&&+n===e;if(!(!o||!l)){if(!e){console.warn("Story ID is not defined. Please provide a valid ID.");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(r).on(["input","published","change"],a=>{var c;a&&(a.action==="input"&&((c=a.story)==null?void 0:c.id)===e?t(a.story):(a.action==="change"||a.action==="published")&&a.storyId===e&&window.location.reload())})})}},Ee=(e={})=>{var t,r;const{bridge:s,accessToken:o,use:n=[],apiOptions:l={},bridgeUrl:a}=e;l.accessToken=l.accessToken||o;const c={bridge:s,apiOptions:l};let u={};n.forEach(y=>{u={...u,...y(c)}}),a&&(K=a);const m=!(typeof window>"u")&&((r=(t=window.location)==null?void 0:t.search)==null?void 0:r.includes("_storyblok_tk"));return s!==!1&&m&&ce(K),u};function Se(e,t){return x(t).render(e)}const H=f.defineComponent({__name:"StoryblokComponent",props:{blok:{}},setup(e,{expose:t}){var a;const r=e,s=f.ref();t({value:s});const o=typeof f.resolveDynamicComponent(r.blok.component)!="string",n=f.inject("VueSDKOptions"),l=f.ref((a=r.blok.component)==null?void 0:a.replace(/_/g,"-"));return!o&&n&&(n.enableFallbackComponent?(l.value=n.customFallbackComponent??"FallbackComponent",typeof f.resolveDynamicComponent(l.value)=="string"&&console.error(`Is the Fallback component "${l.value}" registered properly?`)):console.error(`Component could not be found for blok "${r.blok.component}"! Is it defined in main.ts as "app.component("${r.blok.component}", ${r.blok.component});"?`)),(c,u)=>(f.openBlock(),f.createBlock(f.resolveDynamicComponent(l.value),f.mergeProps({ref_key:"blokRef",ref:s},{...c.$props,...c.$attrs}),null,16))}}),Ae=e=>{var t,r;return f.h(H,{blok:(t=e==null?void 0:e.attrs)==null?void 0:t.body[0],id:(r=e.attrs)==null?void 0:r.id},e.children)};function W(e){const t={renderFn:f.h,textFn:f.createTextVNode,keyedResolvers:!0,resolvers:{[v.COMPONENT]:Ae,...e.resolvers}};return x(t)}const X=f.defineComponent({__name:"StoryblokRichText",props:{doc:{},resolvers:{}},setup(e){const t=e,r=f.ref(),s=()=>r.value;return f.watch([()=>t.doc,()=>t.resolvers],([o,n])=>{const{render:l}=W({resolvers:n??{}});r.value=l(o)},{immediate:!0,deep:!0}),(o,n)=>(f.openBlock(),f.createBlock(s))}}),Ce={beforeMount(e,t){if(t.value){const r=$e(t.value);Object.keys(r).length>0&&(e.setAttribute("data-blok-c",r["data-blok-c"]),e.setAttribute("data-blok-uid",r["data-blok-uid"]),e.classList.add("storyblok__outline"))}}},Q=e=>{console.error(`You can't use ${e} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
8
+ `)};let C=null;const Ie=()=>(C||Q("useStoryblokApi"),C),Le=async(e,t={},r={})=>{const s=f.ref(null);if(r.resolveRelations=r.resolveRelations??t.resolve_relations,r.resolveLinks=r.resolveLinks??t.resolve_links,f.onMounted(()=>{s.value&&s.value.id&&Y(s.value.id,o=>s.value=o,r)}),C){const{data:o}=await C.get(`cdn/stories/${e}`,t);s.value=o.story}else Q("useStoryblok");return s},Oe={install(e,t={}){e.directive("editable",Ce),e.component("StoryblokComponent",H),e.component("StoryblokRichText",X),t.enableFallbackComponent&&!t.customFallbackComponent&&e.component("FallbackComponent",f.defineAsyncComponent(()=>Promise.resolve().then(()=>Ne)));const{storyblokApi:r}=Ee(t);C=r||null,e.provide("VueSDKOptions",t)}},je={class:"fallback-component"},Pe={class:"component"},Ne=Object.freeze(Object.defineProperty({__proto__:null,default:((e,t)=>{const r=e.__vccOpts||e;for(const[s,o]of t)r[s]=o;return r})(f.defineComponent({__name:"FallbackComponent",props:{blok:{}},setup(e){return(t,r)=>(f.openBlock(),f.createElementBlock("div",je,[f.createElementVNode("p",null,[r[0]||(r[0]=f.createTextVNode(" Component could not be found for blok ")),f.createElementVNode("span",Pe,f.toDisplayString(t.blok.component),1),r[1]||(r[1]=f.createTextVNode("! Is it configured correctly? "))])]))}}),[["__scopeId","data-v-9abcd1f2"]])},Symbol.toStringTag,{value:"Module"}));k.BlockTypes=v,k.MarkTypes=$,k.StoryblokComponent=H,k.StoryblokRichText=X,k.StoryblokVue=Oe,k.TextTypes=M,k.apiPlugin=Re,k.renderRichText=Se,k.richTextResolver=x,k.useStoryblok=Le,k.useStoryblokApi=Ie,k.useStoryblokBridge=Y,k.useStoryblokRichText=W,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});
@@ -4,147 +4,111 @@
4
4
  * description: SDK to integrate Storyblok into your project using Vue.
5
5
  * author: Storyblok
6
6
  */
7
- import { defineComponent as Z, ref as P, resolveDynamicComponent as H, inject as pe, createBlock as W, openBlock as X, mergeProps as fe, h as Q, createTextVNode as ye, watch as me, onMounted as be, defineAsyncComponent as ge } from "vue";
8
- var ve = Object.defineProperty, ke = (e, t, r) => t in e ? ve(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, m = (e, t, r) => ke(e, typeof t != "symbol" ? t + "" : t, r);
9
- function I(e, t, r) {
10
- this.type = e, this.tag = t, this.attrs = null, this.map = null, this.nesting = r, this.level = 0, this.children = null, this.content = "", this.markup = "", this.info = "", this.meta = null, this.block = !1, this.hidden = !1;
11
- }
12
- I.prototype.attrIndex = function(e) {
13
- if (!this.attrs)
14
- return -1;
15
- const t = this.attrs;
16
- for (let r = 0, s = t.length; r < s; r++)
17
- if (t[r][0] === e)
18
- return r;
19
- return -1;
20
- };
21
- I.prototype.attrPush = function(e) {
22
- this.attrs ? this.attrs.push(e) : this.attrs = [e];
23
- };
24
- I.prototype.attrSet = function(e, t) {
25
- const r = this.attrIndex(e), s = [e, t];
26
- r < 0 ? this.attrPush(s) : this.attrs[r] = s;
27
- };
28
- I.prototype.attrGet = function(e) {
29
- const t = this.attrIndex(e);
30
- let r = null;
31
- return t >= 0 && (r = this.attrs[t][1]), r;
32
- };
33
- I.prototype.attrJoin = function(e, t) {
34
- const r = this.attrIndex(e);
35
- r < 0 ? this.attrPush([e, t]) : this.attrs[r][1] = this.attrs[r][1] + " " + t;
36
- };
37
- const we = "[a-zA-Z_:][a-zA-Z0-9:._-]*", _e = "[^\"'=<>`\\x00-\\x20]+", Te = "'[^']*'", Re = '"[^"]*"', Ae = "(?:" + _e + "|" + Te + "|" + Re + ")", $e = "(?:\\s+" + we + "(?:\\s*=\\s*" + Ae + ")?)", Ee = "<[A-Za-z][A-Za-z0-9\\-]*" + $e + "*\\s*\\/?>", Se = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>", Ie = new RegExp("^(?:" + Ee + "|" + Se + ")");
38
- new RegExp(Ie.source + "\\s*$");
39
- const ee = [];
40
- for (let e = 0; e < 256; e++)
41
- ee.push(0);
42
- "\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e) {
43
- ee[e.charCodeAt(0)] = 1;
44
- });
45
- let v = /* @__PURE__ */ function(e) {
7
+ import { defineComponent as Y, ref as P, resolveDynamicComponent as N, inject as he, createBlock as W, openBlock as X, mergeProps as de, h as Q, createTextVNode as pe, watch as fe, onMounted as ye, defineAsyncComponent as me } from "vue";
8
+ var be = Object.defineProperty, ve = (e, t, r) => t in e ? be(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, m = (e, t, r) => ve(e, typeof t != "symbol" ? t + "" : t, r);
9
+ let g = /* @__PURE__ */ function(e) {
46
10
  return e.DOCUMENT = "doc", e.HEADING = "heading", e.PARAGRAPH = "paragraph", e.QUOTE = "blockquote", e.OL_LIST = "ordered_list", e.UL_LIST = "bullet_list", e.LIST_ITEM = "list_item", e.CODE_BLOCK = "code_block", e.HR = "horizontal_rule", e.BR = "hard_break", e.IMAGE = "image", e.EMOJI = "emoji", e.COMPONENT = "blok", e.TABLE = "table", e.TABLE_ROW = "tableRow", e.TABLE_CELL = "tableCell", e.TABLE_HEADER = "tableHeader", e;
47
11
  }({}), R = /* @__PURE__ */ function(e) {
48
12
  return e.BOLD = "bold", e.STRONG = "strong", e.STRIKE = "strike", e.UNDERLINE = "underline", e.ITALIC = "italic", e.CODE = "code", e.LINK = "link", e.ANCHOR = "anchor", e.STYLED = "styled", e.SUPERSCRIPT = "superscript", e.SUBSCRIPT = "subscript", e.TEXT_STYLE = "textStyle", e.HIGHLIGHT = "highlight", e;
49
- }({}), Ce = /* @__PURE__ */ function(e) {
13
+ }({}), ge = /* @__PURE__ */ function(e) {
50
14
  return e.TEXT = "text", e;
51
- }({}), j = /* @__PURE__ */ function(e) {
15
+ }({}), C = /* @__PURE__ */ function(e) {
52
16
  return e.URL = "url", e.STORY = "story", e.ASSET = "asset", e.EMAIL = "email", e;
53
17
  }({});
54
- function Le(e, t) {
18
+ const ke = [
19
+ "area",
20
+ "base",
21
+ "br",
22
+ "col",
23
+ "embed",
24
+ "hr",
25
+ "img",
26
+ "input",
27
+ "link",
28
+ "meta",
29
+ "param",
30
+ "source",
31
+ "track",
32
+ "wbr"
33
+ ], we = (e = {}) => Object.keys(e).map((t) => `${t}="${e[t]}"`).join(" "), _e = (e = {}) => Object.keys(e).map((t) => `${t}: ${e[t]}`).join("; ");
34
+ function Te(e) {
35
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
36
+ }
37
+ const O = (e) => Object.fromEntries(Object.entries(e).filter(([t, r]) => r !== void 0));
38
+ function Re(e, t) {
55
39
  if (!t) return {
56
40
  src: e,
57
41
  attrs: {}
58
42
  };
59
43
  let r = 0, s = 0;
60
- const o = {}, n = [];
61
- function l(c, u, f, y, A) {
62
- typeof c != "number" || c <= u || c >= f ? console.warn(`[StoryblokRichText] - ${y.charAt(0).toUpperCase() + y.slice(1)} value must be a number between ${u} and ${f} (inclusive)`) : A.push(`${y}(${c})`);
44
+ const n = {}, o = [];
45
+ function l(c, u, f, y, $) {
46
+ typeof c != "number" || c <= u || c >= f ? console.warn(`[StoryblokRichText] - ${y.charAt(0).toUpperCase() + y.slice(1)} value must be a number between ${u} and ${f} (inclusive)`) : $.push(`${y}(${c})`);
63
47
  }
64
48
  if (typeof t == "object") {
65
- if (typeof t.width == "number" && t.width > 0 ? (o.width = t.width, r = t.width) : console.warn("[StoryblokRichText] - Width value must be a number greater than 0"), t.height && typeof t.height == "number" && t.height > 0 ? (o.height = t.height, s = t.height) : console.warn("[StoryblokRichText] - Height value must be a number greater than 0"), t.loading && ["lazy", "eager"].includes(t.loading) && (o.loading = t.loading), t.class && (o.class = t.class), t.filters) {
66
- const { filters: c } = t || {}, { blur: u, brightness: f, fill: y, format: A, grayscale: T, quality: E, rotate: C } = c || {};
67
- u && l(u, 0, 100, "blur", n), E && l(E, 0, 100, "quality", n), f && l(f, 0, 100, "brightness", n), y && n.push(`fill(${y})`), T && n.push("grayscale()"), C && [
49
+ if (typeof t.width == "number" && t.width > 0 ? (n.width = t.width, r = t.width) : console.warn("[StoryblokRichText] - Width value must be a number greater than 0"), t.height && typeof t.height == "number" && t.height > 0 ? (n.height = t.height, s = t.height) : console.warn("[StoryblokRichText] - Height value must be a number greater than 0"), t.loading && ["lazy", "eager"].includes(t.loading) && (n.loading = t.loading), t.class && (n.class = t.class), t.filters) {
50
+ const { filters: c } = t || {}, { blur: u, brightness: f, fill: y, format: $, grayscale: T, quality: A, rotate: I } = c || {};
51
+ u && l(u, 0, 100, "blur", o), A && l(A, 0, 100, "quality", o), f && l(f, 0, 100, "brightness", o), y && o.push(`fill(${y})`), T && o.push("grayscale()"), I && [
68
52
  0,
69
53
  90,
70
54
  180,
71
55
  270
72
- ].includes(t.filters.rotate || 0) && n.push(`rotate(${C})`), A && [
56
+ ].includes(t.filters.rotate || 0) && o.push(`rotate(${I})`), $ && [
73
57
  "webp",
74
58
  "png",
75
59
  "jpeg"
76
- ].includes(A) && n.push(`format(${A})`);
60
+ ].includes($) && o.push(`format(${$})`);
77
61
  }
78
- t.srcset && (o.srcset = t.srcset.map((c) => {
79
- if (typeof c == "number") return `${e}/m/${c}x0/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${c}w`;
62
+ t.srcset && (n.srcset = t.srcset.map((c) => {
63
+ if (typeof c == "number") return `${e}/m/${c}x0/${o.length > 0 ? `filters:${o.join(":")}` : ""} ${c}w`;
80
64
  if (Array.isArray(c) && c.length === 2) {
81
65
  const [u, f] = c;
82
- return `${e}/m/${u}x${f}/${n.length > 0 ? `filters:${n.join(":")}` : ""} ${u}w`;
66
+ return `${e}/m/${u}x${f}/${o.length > 0 ? `filters:${o.join(":")}` : ""} ${u}w`;
83
67
  } else {
84
68
  console.warn("[StoryblokRichText] - srcset entry must be a number or a tuple of two numbers");
85
69
  return;
86
70
  }
87
- }).join(", ")), t.sizes && (o.sizes = t.sizes.join(", "));
71
+ }).join(", ")), t.sizes && (n.sizes = t.sizes.join(", "));
88
72
  }
89
73
  let a = `${e}/m/`;
90
- return r > 0 && s > 0 && (a = `${a}${r}x${s}/`), n.length > 0 && (a = `${a}filters:${n.join(":")}`), {
74
+ return r > 0 && s > 0 && (a = `${a}${r}x${s}/`), o.length > 0 && (a = `${a}filters:${o.join(":")}`), {
91
75
  src: a,
92
- attrs: o
76
+ attrs: n
93
77
  };
94
78
  }
95
- const je = [
96
- "area",
97
- "base",
98
- "br",
99
- "col",
100
- "embed",
101
- "hr",
102
- "img",
103
- "input",
104
- "link",
105
- "meta",
106
- "param",
107
- "source",
108
- "track",
109
- "wbr"
110
- ], Oe = (e = {}) => Object.keys(e).map((t) => `${t}="${e[t]}"`).join(" "), xe = (e = {}) => Object.keys(e).map((t) => `${t}: ${e[t]}`).join("; ");
111
- function Pe(e) {
112
- return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
113
- }
114
- const O = (e) => Object.fromEntries(Object.entries(e).filter(([t, r]) => r !== void 0));
115
- function z(e, t = {}, r) {
116
- const s = Oe(t), o = s ? `${e} ${s}` : e, n = Array.isArray(r) ? r.join("") : r || "";
79
+ function F(e, t = {}, r) {
80
+ const s = we(t), n = s ? `${e} ${s}` : e, o = Array.isArray(r) ? r.join("") : r || "";
117
81
  if (e) {
118
- if (je.includes(e)) return `<${o}>`;
119
- } else return n;
120
- return `<${o}>${n}</${e}>`;
82
+ if (ke.includes(e)) return `<${n}>`;
83
+ } else return o;
84
+ return `<${n}>${o}</${e}>`;
121
85
  }
122
- function te(e = {}) {
123
- const t = /* @__PURE__ */ new Map(), { renderFn: r = z, textFn: s = Pe, resolvers: o = {}, optimizeImages: n = !1, keyedResolvers: l = !1 } = e, a = r !== z, c = (i) => (h, d) => {
86
+ function Z(e = {}) {
87
+ const t = /* @__PURE__ */ new Map(), { renderFn: r = F, textFn: s = Te, resolvers: n = {}, optimizeImages: o = !1, keyedResolvers: l = !1 } = e, a = r !== F, c = (i) => (h, d) => {
124
88
  const p = h.attrs || {};
125
89
  return d.render(i, p, h.children || null);
126
90
  }, u = (i, h) => {
127
- const { src: d, alt: p, title: b, srcset: w, sizes: g } = i.attrs || {};
91
+ const { src: d, alt: p, title: b, srcset: w, sizes: v } = i.attrs || {};
128
92
  let k = d, _ = {};
129
- if (n) {
130
- const { src: he, attrs: de } = Le(d, n);
131
- k = he, _ = de;
93
+ if (o) {
94
+ const { src: ce, attrs: ue } = Re(d, o);
95
+ k = ce, _ = ue;
132
96
  }
133
- const ue = {
97
+ const le = {
134
98
  src: k,
135
99
  alt: p,
136
100
  title: b,
137
101
  srcset: w,
138
- sizes: g,
102
+ sizes: v,
139
103
  ..._
140
104
  };
141
- return h.render("img", O(ue));
105
+ return h.render("img", O(le));
142
106
  }, f = (i, h) => {
143
107
  const { level: d, ...p } = i.attrs || {};
144
108
  return h.render(`h${d}`, p, i.children);
145
109
  }, y = (i, h) => {
146
110
  var d, p, b, w;
147
- const g = h.render("img", {
111
+ const v = h.render("img", {
148
112
  src: (d = i.attrs) == null ? void 0 : d.fallbackImage,
149
113
  alt: (p = i.attrs) == null ? void 0 : p.alt,
150
114
  style: "width: 1.25em; height: 1.25em; vertical-align: text-top",
@@ -155,21 +119,21 @@ function te(e = {}) {
155
119
  "data-type": "emoji",
156
120
  "data-name": (b = i.attrs) == null ? void 0 : b.name,
157
121
  "data-emoji": (w = i.attrs) == null ? void 0 : w.emoji
158
- }, g);
159
- }, A = (i, h) => h.render("pre", i.attrs || {}, h.render("code", {}, i.children || "")), T = (i, h = !1) => ({ text: d, attrs: p }, b) => {
160
- const { class: w, id: g, ...k } = p || {}, _ = h ? {
122
+ }, v);
123
+ }, $ = (i, h) => h.render("pre", i.attrs || {}, h.render("code", {}, i.children || "")), T = (i, h = !1) => ({ text: d, attrs: p }, b) => {
124
+ const { class: w, id: v, ...k } = p || {}, _ = h ? {
161
125
  class: w,
162
- id: g,
163
- style: xe(k) || void 0
126
+ id: v,
127
+ style: _e(k) || void 0
164
128
  } : p || {};
165
129
  return b.render(i, O(_), d);
166
- }, E = (i) => N(i), C = (i) => {
130
+ }, A = (i) => x(i), I = (i) => {
167
131
  const { marks: h, ...d } = i;
168
132
  if ("text" in i) {
169
- if (h) return h.reduce((b, w) => E({
133
+ if (h) return h.reduce((b, w) => A({
170
134
  ...w,
171
135
  text: b
172
- }), E({
136
+ }), A({
173
137
  ...d,
174
138
  children: d.children
175
139
  }));
@@ -181,66 +145,66 @@ function te(e = {}) {
181
145
  return s(d.text, p);
182
146
  }
183
147
  return "";
184
- }, B = (i, h) => {
148
+ }, D = (i, h) => {
185
149
  const { linktype: d, href: p, anchor: b, ...w } = i.attrs || {};
186
- let g = "";
150
+ let v = "";
187
151
  switch (d) {
188
- case j.ASSET:
189
- case j.URL:
190
- g = p;
152
+ case C.ASSET:
153
+ case C.URL:
154
+ v = p;
191
155
  break;
192
- case j.EMAIL:
193
- g = `mailto:${p}`;
156
+ case C.EMAIL:
157
+ v = `mailto:${p}`;
194
158
  break;
195
- case j.STORY:
196
- g = p, b && (g = `${g}#${b}`);
159
+ case C.STORY:
160
+ v = p, b && (v = `${v}#${b}`);
197
161
  break;
198
162
  default:
199
- g = p;
163
+ v = p;
200
164
  break;
201
165
  }
202
166
  const k = { ...w };
203
- return g && (k.href = g), h.render("a", k, i.text);
204
- }, oe = (i, h) => {
167
+ return v && (k.href = v), h.render("a", k, i.text);
168
+ }, re = (i, h) => {
205
169
  var d, p;
206
170
  return console.warn("[StoryblokRichtText] - BLOK resolver is not available for vanilla usage"), h.render("span", {
207
171
  blok: (d = i == null ? void 0 : i.attrs) == null ? void 0 : d.body[0],
208
172
  id: (p = i.attrs) == null ? void 0 : p.id,
209
173
  style: "display: none"
210
174
  });
211
- }, ne = (i, h) => {
175
+ }, se = (i, h) => {
212
176
  const d = {}, p = h.render("tbody", {}, i.children);
213
177
  return h.render("table", d, p);
214
- }, ie = (i, h) => {
178
+ }, ne = (i, h) => {
215
179
  const d = {};
216
180
  return h.render("tr", d, i.children);
217
- }, ae = (i, h) => {
218
- const { colspan: d, rowspan: p, colwidth: b, backgroundColor: w, ...g } = i.attrs || {}, k = { ...g };
181
+ }, oe = (i, h) => {
182
+ const { colspan: d, rowspan: p, colwidth: b, backgroundColor: w, ...v } = i.attrs || {}, k = { ...v };
219
183
  d > 1 && (k.colspan = d), p > 1 && (k.rowspan = p);
220
184
  const _ = [];
221
185
  return b && _.push(`width: ${b}px;`), w && _.push(`background-color: ${w};`), _.length > 0 && (k.style = _.join(" ")), h.render("td", O(k), i.children);
222
- }, le = (i, h) => {
223
- const { colspan: d, rowspan: p, colwidth: b, backgroundColor: w, ...g } = i.attrs || {}, k = { ...g };
186
+ }, ie = (i, h) => {
187
+ const { colspan: d, rowspan: p, colwidth: b, backgroundColor: w, ...v } = i.attrs || {}, k = { ...v };
224
188
  d > 1 && (k.colspan = d), p > 1 && (k.rowspan = p);
225
189
  const _ = [];
226
190
  return b && _.push(`width: ${b}px;`), w && _.push(`background-color: ${w};`), _.length > 0 && (k.style = _.join(" ")), h.render("th", O(k), i.children);
227
- }, F = /* @__PURE__ */ new Map([
228
- [v.DOCUMENT, c("")],
229
- [v.HEADING, f],
230
- [v.PARAGRAPH, c("p")],
231
- [v.UL_LIST, c("ul")],
232
- [v.OL_LIST, c("ol")],
233
- [v.LIST_ITEM, c("li")],
234
- [v.IMAGE, u],
235
- [v.EMOJI, y],
236
- [v.CODE_BLOCK, A],
237
- [v.HR, c("hr")],
238
- [v.BR, c("br")],
239
- [v.QUOTE, c("blockquote")],
240
- [v.COMPONENT, oe],
241
- [Ce.TEXT, C],
242
- [R.LINK, B],
243
- [R.ANCHOR, B],
191
+ }, B = /* @__PURE__ */ new Map([
192
+ [g.DOCUMENT, c("")],
193
+ [g.HEADING, f],
194
+ [g.PARAGRAPH, c("p")],
195
+ [g.UL_LIST, c("ul")],
196
+ [g.OL_LIST, c("ol")],
197
+ [g.LIST_ITEM, c("li")],
198
+ [g.IMAGE, u],
199
+ [g.EMOJI, y],
200
+ [g.CODE_BLOCK, $],
201
+ [g.HR, c("hr")],
202
+ [g.BR, c("br")],
203
+ [g.QUOTE, c("blockquote")],
204
+ [g.COMPONENT, re],
205
+ [ge.TEXT, I],
206
+ [R.LINK, D],
207
+ [R.ANCHOR, D],
244
208
  [R.STYLED, T("span", !0)],
245
209
  [R.BOLD, T("strong")],
246
210
  [R.TEXT_STYLE, T("span", !0)],
@@ -251,11 +215,11 @@ function te(e = {}) {
251
215
  [R.SUPERSCRIPT, T("sup")],
252
216
  [R.SUBSCRIPT, T("sub")],
253
217
  [R.HIGHLIGHT, T("mark")],
254
- [v.TABLE, ne],
255
- [v.TABLE_ROW, ie],
256
- [v.TABLE_CELL, ae],
257
- [v.TABLE_HEADER, le]
258
- ]), M = new Map([...F, ...Object.entries(o).map(([i, h]) => [i, h])]), ce = () => ({
218
+ [g.TABLE, se],
219
+ [g.TABLE_ROW, ne],
220
+ [g.TABLE_CELL, oe],
221
+ [g.TABLE_HEADER, ie]
222
+ ]), M = new Map([...B, ...Object.entries(n).map(([i, h]) => [i, h])]), ae = () => ({
259
223
  render: (i, h = {}, d) => {
260
224
  if (l && i) {
261
225
  const p = t.get(i) || 0;
@@ -263,59 +227,59 @@ function te(e = {}) {
263
227
  }
264
228
  return r(i, h, d);
265
229
  },
266
- originalResolvers: F,
230
+ originalResolvers: B,
267
231
  mergedResolvers: M
268
232
  });
269
233
  function L(i) {
270
234
  const h = M.get(i.type);
271
235
  if (!h)
272
236
  return console.error("<Storyblok>", `No resolver found for node type ${i.type}`), "";
273
- const d = ce();
237
+ const d = ae();
274
238
  if (i.type === "text") return h(i, d);
275
- const p = i.content ? i.content.map(N) : void 0;
239
+ const p = i.content ? i.content.map(x) : void 0;
276
240
  return h({
277
241
  ...i,
278
242
  children: p
279
243
  }, d);
280
244
  }
281
- function N(i) {
245
+ function x(i) {
282
246
  return i.type === "doc" ? a ? i.content.map(L) : i.content.map(L).join("") : Array.isArray(i) ? i.map(L) : L(i);
283
247
  }
284
- return { render: N };
248
+ return { render: x };
285
249
  }
286
250
  let V = !1;
287
- const G = [], Ne = (e) => new Promise((t, r) => {
251
+ const z = [], $e = (e) => new Promise((t, r) => {
288
252
  if (typeof window > "u") {
289
253
  r(new Error("Cannot load Storyblok bridge: window is undefined (server-side environment)"));
290
254
  return;
291
255
  }
292
- if (window.storyblokRegisterEvent = (o) => {
256
+ if (window.storyblokRegisterEvent = (n) => {
293
257
  if (!window.location.search.includes("_storyblok")) {
294
258
  console.warn("You are not in Draft Mode or in the Visual Editor.");
295
259
  return;
296
260
  }
297
- V ? o() : G.push(o);
261
+ V ? n() : z.push(n);
298
262
  }, document.getElementById("storyblok-javascript-bridge")) {
299
263
  t(void 0);
300
264
  return;
301
265
  }
302
266
  const s = document.createElement("script");
303
- s.async = !0, s.src = e, s.id = "storyblok-javascript-bridge", s.onerror = (o) => r(o), s.onload = (o) => {
304
- G.forEach((n) => n()), V = !0, t(o);
267
+ s.async = !0, s.src = e, s.id = "storyblok-javascript-bridge", s.onerror = (n) => r(n), s.onload = (n) => {
268
+ z.forEach((o) => o()), V = !0, t(n);
305
269
  }, document.getElementsByTagName("head")[0].appendChild(s);
306
270
  });
307
- var He = class extends Error {
271
+ var Ee = class extends Error {
308
272
  constructor(e) {
309
273
  super(e), this.name = "AbortError";
310
274
  }
311
275
  };
312
- function De(e, t, r) {
276
+ function Ae(e, t, r) {
313
277
  if (!Number.isFinite(t)) throw new TypeError("Expected `limit` to be a finite number");
314
278
  if (!Number.isFinite(r)) throw new TypeError("Expected `interval` to be a finite number");
315
279
  const s = [];
316
- let o = [], n = 0, l = !1;
280
+ let n = [], o = 0, l = !1;
317
281
  const a = async () => {
318
- n++;
282
+ o++;
319
283
  const u = s.shift();
320
284
  if (u) try {
321
285
  const y = await e(...u.args);
@@ -324,37 +288,37 @@ function De(e, t, r) {
324
288
  u.reject(y);
325
289
  }
326
290
  const f = setTimeout(() => {
327
- n--, s.length > 0 && a(), o = o.filter((y) => y !== f);
291
+ o--, s.length > 0 && a(), n = n.filter((y) => y !== f);
328
292
  }, r);
329
- o.includes(f) || o.push(f);
293
+ n.includes(f) || n.push(f);
330
294
  }, c = (...u) => l ? Promise.reject(/* @__PURE__ */ new Error("Throttled function is already aborted and not accepting new promises")) : new Promise((f, y) => {
331
295
  s.push({
332
296
  resolve: f,
333
297
  reject: y,
334
298
  args: u
335
- }), n < t && a();
299
+ }), o < t && a();
336
300
  });
337
301
  return c.abort = () => {
338
- l = !0, o.forEach(clearTimeout), o = [], s.forEach((u) => u.reject(() => new He("Throttle function aborted"))), s.length = 0;
302
+ l = !0, n.forEach(clearTimeout), n = [], s.forEach((u) => u.reject(() => new Ee("Throttle function aborted"))), s.length = 0;
339
303
  }, c;
340
304
  }
341
- var Ue = De;
342
- const K = (e = "") => e.includes("/cdn/"), Be = (e, t = 25, r = 1) => ({
305
+ var Se = Ae;
306
+ const G = (e = "") => e.includes("/cdn/"), Ie = (e, t = 25, r = 1) => ({
343
307
  ...e,
344
308
  per_page: t,
345
309
  page: r
346
- }), Fe = (e) => new Promise((t) => setTimeout(t, e)), Me = (e = 0, t) => Array.from({ length: e }, t), ze = (e = 0, t = e) => {
310
+ }), Le = (e) => new Promise((t) => setTimeout(t, e)), Ce = (e = 0, t) => Array.from({ length: e }, t), Oe = (e = 0, t = e) => {
347
311
  const r = Math.abs(t - e) || 0, s = e < t ? 1 : -1;
348
- return Me(r, (o, n) => n * s + e);
349
- }, Ve = async (e, t) => Promise.all(e.map(t)), Ge = (e = [], t) => e.map(t).reduce((r, s) => [...r, ...s], []), U = (e, t, r) => {
312
+ return Ce(r, (n, o) => o * s + e);
313
+ }, je = async (e, t) => Promise.all(e.map(t)), Pe = (e = [], t) => e.map(t).reduce((r, s) => [...r, ...s], []), U = (e, t, r) => {
350
314
  const s = [];
351
- for (const o in e) {
352
- if (!Object.prototype.hasOwnProperty.call(e, o)) continue;
353
- const n = e[o];
354
- if (n == null) continue;
355
- const l = r ? "" : encodeURIComponent(o);
315
+ for (const n in e) {
316
+ if (!Object.prototype.hasOwnProperty.call(e, n)) continue;
317
+ const o = e[n];
318
+ if (o == null) continue;
319
+ const l = r ? "" : encodeURIComponent(n);
356
320
  let a;
357
- typeof n == "object" ? a = U(n, t ? t + encodeURIComponent(`[${l}]`) : l, Array.isArray(n)) : a = `${t ? t + encodeURIComponent(`[${l}]`) : l}=${encodeURIComponent(n)}`, s.push(a);
321
+ typeof o == "object" ? a = U(o, t ? t + encodeURIComponent(`[${l}]`) : l, Array.isArray(o)) : a = `${t ? t + encodeURIComponent(`[${l}]`) : l}=${encodeURIComponent(o)}`, s.push(a);
358
322
  }
359
323
  return s.join("&");
360
324
  }, q = (e) => {
@@ -367,7 +331,7 @@ const K = (e = "") => e.includes("/cdn/"), Be = (e, t = 25, r = 1) => ({
367
331
  };
368
332
  return t[e] ?? t.eu;
369
333
  };
370
- var Ke = class {
334
+ var xe = class {
371
335
  constructor(e) {
372
336
  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 = {};
373
337
  }
@@ -405,15 +369,15 @@ var Ke = class {
405
369
  async _methodHandler(e) {
406
370
  let t = `${this.baseURL}${this.url}`, r = null;
407
371
  e === "get" ? t = `${this.baseURL}${this.url}?${U(this.parameters)}` : r = JSON.stringify(this.parameters);
408
- const s = new URL(t), o = new AbortController(), { signal: n } = o;
372
+ const s = new URL(t), n = new AbortController(), { signal: o } = n;
409
373
  let l;
410
- this.timeout && (l = setTimeout(() => o.abort(), this.timeout));
374
+ this.timeout && (l = setTimeout(() => n.abort(), this.timeout));
411
375
  try {
412
376
  const a = await this.fetch(`${s}`, {
413
377
  method: e,
414
378
  headers: this.headers,
415
379
  body: r,
416
- signal: n,
380
+ signal: o,
417
381
  ...this.fetchOptions
418
382
  });
419
383
  this.timeout && clearTimeout(l);
@@ -450,25 +414,25 @@ var Ke = class {
450
414
  const t = /20[0-6]/g;
451
415
  return new Promise((r, s) => {
452
416
  if (t.test(`${e.status}`)) return r(e);
453
- const o = {
417
+ const n = {
454
418
  message: this._normalizeErrorMessage(e.data),
455
419
  status: e.status,
456
420
  response: e
457
421
  };
458
- s(o);
422
+ s(n);
459
423
  });
460
424
  }
461
- }, qe = Ke;
462
- const J = "SB-Agent", D = {
425
+ }, Ne = xe;
426
+ const J = "SB-Agent", H = {
463
427
  defaultAgentName: "SB-JS-CLIENT",
464
428
  defaultAgentVersion: "SB-Agent-Version",
465
429
  packageVersion: "7.0.0"
466
- }, Je = {
430
+ }, He = {
467
431
  PUBLISHED: "published"
468
432
  };
469
- let x = {};
470
- const $ = {};
471
- var Ye = class {
433
+ let j = {};
434
+ const E = {};
435
+ var Ue = class {
472
436
  /**
473
437
  *
474
438
  * @param config ISbConfig interface
@@ -478,15 +442,15 @@ var Ye = class {
478
442
  m(this, "client"), m(this, "maxRetries"), m(this, "retriesDelay"), m(this, "throttle"), m(this, "accessToken"), m(this, "cache"), m(this, "resolveCounter"), m(this, "relations"), m(this, "links"), m(this, "version"), m(this, "richTextResolver"), m(this, "resolveNestedRelations"), m(this, "stringifiedStoriesCache"), m(this, "inlineAssets");
479
443
  let r = e.endpoint || t;
480
444
  if (!r) {
481
- const n = e.https === !1 ? "http" : "https";
482
- e.oauthToken ? r = `${n}://${q(e.region)}/v1` : r = `${n}://${q(e.region)}/v2`;
445
+ const o = e.https === !1 ? "http" : "https";
446
+ e.oauthToken ? r = `${o}://${q(e.region)}/v1` : r = `${o}://${q(e.region)}/v2`;
483
447
  }
484
448
  const s = new Headers();
485
- s.set("Content-Type", "application/json"), s.set("Accept", "application/json"), e.headers && (e.headers.constructor.name === "Headers" ? e.headers.entries().toArray() : Object.entries(e.headers)).forEach(([n, l]) => {
486
- s.set(n, l);
487
- }), s.has(J) || (s.set(J, D.defaultAgentName), s.set(D.defaultAgentVersion, D.packageVersion));
488
- let o = 5;
489
- e.oauthToken && (s.set("Authorization", e.oauthToken), o = 3), e.rateLimit && (o = e.rateLimit), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttle = Ue(this.throttledRequest.bind(this), o, 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.version = e.version || Je.PUBLISHED, this.inlineAssets = e.inlineAssets || !1, this.client = new qe({
449
+ s.set("Content-Type", "application/json"), s.set("Accept", "application/json"), e.headers && (e.headers.constructor.name === "Headers" ? e.headers.entries().toArray() : Object.entries(e.headers)).forEach(([o, l]) => {
450
+ s.set(o, l);
451
+ }), s.has(J) || (s.set(J, H.defaultAgentName), s.set(H.defaultAgentVersion, H.packageVersion));
452
+ let n = 5;
453
+ e.oauthToken && (s.set("Authorization", e.oauthToken), n = 3), e.rateLimit && (n = e.rateLimit), this.maxRetries = e.maxRetries || 10, this.retriesDelay = 300, this.throttle = Se(this.throttledRequest.bind(this), n, 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.stringifiedStoriesCache = {}, this.version = e.version || He.PUBLISHED, this.inlineAssets = e.inlineAssets || !1, this.client = new Ne({
490
454
  baseURL: r,
491
455
  timeout: e.timeout || 0,
492
456
  headers: s,
@@ -495,27 +459,27 @@ var Ye = class {
495
459
  });
496
460
  }
497
461
  parseParams(e) {
498
- return e.token || (e.token = this.getToken()), e.cv || (e.cv = $[e.token]), Array.isArray(e.resolve_relations) && (e.resolve_relations = e.resolve_relations.join(",")), typeof e.resolve_relations < "u" && (e.resolve_level = 2), e;
462
+ 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;
499
463
  }
500
464
  factoryParamOptions(e, t) {
501
- return K(e) ? this.parseParams(t) : t;
465
+ return G(e) ? this.parseParams(t) : t;
502
466
  }
503
- makeRequest(e, t, r, s, o) {
504
- const n = this.factoryParamOptions(e, Be(t, r, s));
505
- return this.cacheResponse(e, n, void 0, o);
467
+ makeRequest(e, t, r, s, n) {
468
+ const o = this.factoryParamOptions(e, Ie(t, r, s));
469
+ return this.cacheResponse(e, o, void 0, n);
506
470
  }
507
471
  get(e, t = {}, r) {
508
472
  t || (t = {});
509
473
  const s = `/${e}`;
510
- K(s) && (t.version = t.version || this.version);
511
- const o = this.factoryParamOptions(s, t);
512
- return this.cacheResponse(s, o, void 0, r);
474
+ G(s) && (t.version = t.version || this.version);
475
+ const n = this.factoryParamOptions(s, t);
476
+ return this.cacheResponse(s, n, void 0, r);
513
477
  }
514
478
  async getAll(e, t = {}, r, s) {
515
- const o = (t == null ? void 0 : t.per_page) || 25, n = `/${e}`.replace(/\/$/, ""), l = r ?? n.substring(n.lastIndexOf("/") + 1);
479
+ const n = (t == null ? void 0 : t.per_page) || 25, o = `/${e}`.replace(/\/$/, ""), l = r ?? o.substring(o.lastIndexOf("/") + 1);
516
480
  t.version = t.version || this.version;
517
- const a = 1, c = await this.makeRequest(n, t, o, a, s), u = c.total ? Math.ceil(c.total / (c.perPage || o)) : 1, f = await Ve(ze(a, u), (y) => this.makeRequest(n, t, o, y + 1, s));
518
- return Ge([c, ...f], (y) => Object.values(y.data[l]));
481
+ const a = 1, c = await this.makeRequest(o, t, n, a, s), u = c.total ? Math.ceil(c.total / (c.perPage || n)) : 1, f = await je(Oe(a, u), (y) => this.makeRequest(o, t, n, y + 1, s));
482
+ return Pe([c, ...f], (y) => Object.values(y.data[l]));
519
483
  }
520
484
  post(e, t = {}, r) {
521
485
  const s = `/${e}`;
@@ -573,7 +537,7 @@ var Ye = class {
573
537
  */
574
538
  _resolveField(e, t, r) {
575
539
  const s = e[t];
576
- typeof s == "string" ? e[t] = this.getStoryReference(r, s) : Array.isArray(s) && (e[t] = s.map((o) => this.getStoryReference(r, o)).filter(Boolean));
540
+ typeof s == "string" ? e[t] = this.getStoryReference(r, s) : Array.isArray(s) && (e[t] = s.map((n) => this.getStoryReference(r, n)).filter(Boolean));
577
541
  }
578
542
  /**
579
543
  * Inserts relations into the JSON tree by resolving references
@@ -593,12 +557,12 @@ var Ye = class {
593
557
  * allowing flexible specification of relation patterns.
594
558
  */
595
559
  _insertRelations(e, t, r, s) {
596
- if (Array.isArray(r) ? r.find((n) => n.endsWith(`.${t}`)) : r.endsWith(`.${t}`)) {
560
+ if (Array.isArray(r) ? r.find((o) => o.endsWith(`.${t}`)) : r.endsWith(`.${t}`)) {
597
561
  this._resolveField(e, t, s);
598
562
  return;
599
563
  }
600
- const o = e.component ? `${e.component}.${t}` : t;
601
- (Array.isArray(r) ? r.includes(o) : r === o) && this._resolveField(e, t, s);
564
+ const n = e.component ? `${e.component}.${t}` : t;
565
+ (Array.isArray(r) ? r.includes(n) : r === n) && this._resolveField(e, t, s);
602
566
  }
603
567
  /**
604
568
  * Recursively traverses and resolves relations in the story content tree
@@ -607,12 +571,12 @@ var Ye = class {
607
571
  * @param resolveId - The unique identifier for the current resolution context
608
572
  */
609
573
  iterateTree(e, t, r) {
610
- const s = (o, n = "") => {
611
- if (!(!o || o._stopResolving)) {
612
- if (Array.isArray(o)) o.forEach((l, a) => s(l, `${n}[${a}]`));
613
- else if (typeof o == "object") for (const l in o) {
614
- const a = n ? `${n}.${l}` : l;
615
- (o.component && o._uid || o.type === "link") && (this._insertRelations(o, l, t, r), this._insertLinks(o, l, r)), s(o[l], a);
574
+ const s = (n, o = "") => {
575
+ if (!(!n || n._stopResolving)) {
576
+ if (Array.isArray(n)) n.forEach((l, a) => s(l, `${o}[${a}]`));
577
+ else if (typeof n == "object") for (const l in n) {
578
+ const a = o ? `${o}.${l}` : l;
579
+ (n.component && n._uid || n.type === "link") && (this._insertRelations(n, l, t, r), this._insertLinks(n, l, r)), s(n[l], a);
616
580
  }
617
581
  }
618
582
  };
@@ -621,25 +585,25 @@ var Ye = class {
621
585
  async resolveLinks(e, t, r) {
622
586
  let s = [];
623
587
  if (e.link_uuids) {
624
- const o = e.link_uuids.length, n = [], l = 50;
625
- for (let a = 0; a < o; a += l) {
626
- const c = Math.min(o, a + l);
627
- n.push(e.link_uuids.slice(a, c));
588
+ const n = e.link_uuids.length, o = [], l = 50;
589
+ for (let a = 0; a < n; a += l) {
590
+ const c = Math.min(n, a + l);
591
+ o.push(e.link_uuids.slice(a, c));
628
592
  }
629
- for (let a = 0; a < n.length; a++)
593
+ for (let a = 0; a < o.length; a++)
630
594
  (await this.getStories({
631
595
  per_page: l,
632
596
  language: t.language,
633
597
  version: t.version,
634
598
  starts_with: t.starts_with,
635
- by_uuids: n[a].join(",")
599
+ by_uuids: o[a].join(",")
636
600
  })).data.stories.forEach((c) => {
637
601
  s.push(c);
638
602
  });
639
603
  } else s = e.links;
640
- s.forEach((o) => {
641
- this.links[r][o.uuid] = {
642
- ...o,
604
+ s.forEach((n) => {
605
+ this.links[r][n.uuid] = {
606
+ ...n,
643
607
  _stopResolving: !0
644
608
  };
645
609
  });
@@ -647,27 +611,27 @@ var Ye = class {
647
611
  async resolveRelations(e, t, r) {
648
612
  let s = [];
649
613
  if (e.rel_uuids) {
650
- const o = e.rel_uuids.length, n = [], l = 50;
651
- for (let a = 0; a < o; a += l) {
652
- const c = Math.min(o, a + l);
653
- n.push(e.rel_uuids.slice(a, c));
614
+ const n = e.rel_uuids.length, o = [], l = 50;
615
+ for (let a = 0; a < n; a += l) {
616
+ const c = Math.min(n, a + l);
617
+ o.push(e.rel_uuids.slice(a, c));
654
618
  }
655
- for (let a = 0; a < n.length; a++)
619
+ for (let a = 0; a < o.length; a++)
656
620
  (await this.getStories({
657
621
  per_page: l,
658
622
  language: t.language,
659
623
  version: t.version,
660
624
  starts_with: t.starts_with,
661
- by_uuids: n[a].join(","),
625
+ by_uuids: o[a].join(","),
662
626
  excluding_fields: t.excluding_fields
663
627
  })).data.stories.forEach((c) => {
664
628
  s.push(c);
665
629
  });
666
630
  s.length > 0 && (e.rels = s, delete e.rel_uuids);
667
631
  } else s = e.rels;
668
- s && s.length > 0 && s.forEach((o) => {
669
- this.relations[r][o.uuid] = {
670
- ...o,
632
+ s && s.length > 0 && s.forEach((n) => {
633
+ this.relations[r][n.uuid] = {
634
+ ...n,
671
635
  _stopResolving: !0
672
636
  };
673
637
  });
@@ -682,25 +646,25 @@ var Ye = class {
682
646
  *
683
647
  */
684
648
  async resolveStories(e, t, r) {
685
- var s, o;
686
- let n = [];
687
- if (this.links[r] = {}, this.relations[r] = {}, typeof t.resolve_relations < "u" && t.resolve_relations.length > 0 && (typeof t.resolve_relations == "string" && (n = t.resolve_relations.split(",")), await this.resolveRelations(e, t, r)), t.resolve_links && [
649
+ var s, n;
650
+ let o = [];
651
+ if (this.links[r] = {}, this.relations[r] = {}, typeof t.resolve_relations < "u" && t.resolve_relations.length > 0 && (typeof t.resolve_relations == "string" && (o = t.resolve_relations.split(",")), await this.resolveRelations(e, t, r)), t.resolve_links && [
688
652
  "1",
689
653
  "story",
690
654
  "url",
691
655
  "link"
692
- ].includes(t.resolve_links) && ((s = e.links) != null && s.length || (o = e.link_uuids) != null && o.length) && await this.resolveLinks(e, t, r), this.resolveNestedRelations) for (const l in this.relations[r]) this.iterateTree(this.relations[r][l], n, r);
693
- e.story ? this.iterateTree(e.story, n, r) : e.stories.forEach((l) => {
694
- this.iterateTree(l, n, r);
656
+ ].includes(t.resolve_links) && ((s = e.links) != null && s.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], o, r);
657
+ e.story ? this.iterateTree(e.story, o, r) : e.stories.forEach((l) => {
658
+ this.iterateTree(l, o, r);
695
659
  }), this.stringifiedStoriesCache = {}, delete this.links[r], delete this.relations[r];
696
660
  }
697
661
  async cacheResponse(e, t, r, s) {
698
- const o = U({
662
+ const n = U({
699
663
  url: e,
700
664
  params: t
701
- }), n = this.cacheProvider();
665
+ }), o = this.cacheProvider();
702
666
  if (t.version === "published" && e !== "/cdn/spaces/me") {
703
- const l = await n.get(o);
667
+ const l = await o.get(n);
704
668
  if (l) return Promise.resolve(l);
705
669
  }
706
670
  return new Promise(async (l, a) => {
@@ -716,15 +680,15 @@ var Ye = class {
716
680
  perPage: u.headers["per-page"] ? Number.parseInt(u.headers["per-page"]) : 0,
717
681
  total: u.headers["per-page"] ? Number.parseInt(u.headers.total) : 0
718
682
  })), f.data.story || f.data.stories) {
719
- const A = this.resolveCounter = ++this.resolveCounter % 1e3;
720
- await this.resolveStories(f.data, t, `${A}`), f = await this.processInlineAssets(f);
683
+ const $ = this.resolveCounter = ++this.resolveCounter % 1e3;
684
+ await this.resolveStories(f.data, t, `${$}`), f = await this.processInlineAssets(f);
721
685
  }
722
- t.version === "published" && e !== "/cdn/spaces/me" && await n.set(o, f);
686
+ t.version === "published" && e !== "/cdn/spaces/me" && await o.set(n, f);
723
687
  const y = this.cache.clear === "onpreview" && t.version === "draft" || this.cache.clear === "auto";
724
- return t.token && f.data.cv && (y && $[t.token] && $[t.token] !== f.data.cv && await this.flushCache(), $[t.token] = f.data.cv), l(f);
688
+ return t.token && f.data.cv && (y && E[t.token] && E[t.token] !== f.data.cv && await this.flushCache(), E[t.token] = f.data.cv), l(f);
725
689
  } catch (u) {
726
690
  if (u.response && u.status === 429 && (r = typeof r > "u" ? 0 : r + 1, r < this.maxRetries))
727
- return console.log(`Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`), await Fe(this.retriesDelay), this.cacheResponse(e, t, r).then(l).catch(a);
691
+ return console.log(`Hit rate limit. Retrying in ${this.retriesDelay / 1e3} seconds.`), await Le(this.retriesDelay), this.cacheResponse(e, t, r).then(l).catch(a);
728
692
  a(u);
729
693
  }
730
694
  });
@@ -733,32 +697,32 @@ var Ye = class {
733
697
  return this.client.setFetchOptions(s), this.client[e](t, r);
734
698
  }
735
699
  cacheVersions() {
736
- return $;
700
+ return E;
737
701
  }
738
702
  cacheVersion() {
739
- return $[this.accessToken];
703
+ return E[this.accessToken];
740
704
  }
741
705
  setCacheVersion(e) {
742
- this.accessToken && ($[this.accessToken] = e);
706
+ this.accessToken && (E[this.accessToken] = e);
743
707
  }
744
708
  clearCacheVersion() {
745
- this.accessToken && ($[this.accessToken] = 0);
709
+ this.accessToken && (E[this.accessToken] = 0);
746
710
  }
747
711
  cacheProvider() {
748
712
  switch (this.cache.type) {
749
713
  case "memory":
750
714
  return {
751
715
  get(e) {
752
- return Promise.resolve(x[e]);
716
+ return Promise.resolve(j[e]);
753
717
  },
754
718
  getAll() {
755
- return Promise.resolve(x);
719
+ return Promise.resolve(j);
756
720
  },
757
721
  set(e, t) {
758
- return x[e] = t, Promise.resolve(void 0);
722
+ return j[e] = t, Promise.resolve(void 0);
759
723
  },
760
724
  flush() {
761
- return x = {}, Promise.resolve(void 0);
725
+ return j = {}, Promise.resolve(void 0);
762
726
  }
763
727
  };
764
728
  case "custom":
@@ -787,19 +751,19 @@ var Ye = class {
787
751
  if (!this.inlineAssets) return e;
788
752
  const t = (r) => {
789
753
  if (!r || typeof r != "object") return r;
790
- if (Array.isArray(r)) return r.map((o) => t(o));
754
+ if (Array.isArray(r)) return r.map((n) => t(n));
791
755
  let s = { ...r };
792
756
  s.fieldtype === "asset" && Array.isArray(e.data.assets) && (s = {
793
757
  ...s,
794
- ...e.data.assets.find((o) => o.id === s.id)
758
+ ...e.data.assets.find((n) => n.id === s.id)
795
759
  });
796
- for (const o in s) typeof s[o] == "object" && (s[o] = t(s[o]));
760
+ for (const n in s) typeof s[n] == "object" && (s[n] = t(s[n]));
797
761
  return s;
798
762
  };
799
763
  return e.data.story && (e.data.story.content = t(e.data.story.content)), e.data.stories && (e.data.stories = e.data.stories.map((r) => (r.content = t(r.content), r))), e;
800
764
  }
801
- }, Ze = Ye;
802
- const nt = (e = {}) => {
765
+ }, De = Ue;
766
+ const Ke = (e = {}) => {
803
767
  const { apiOptions: t } = e;
804
768
  if (!t || !t.accessToken) {
805
769
  console.error(
@@ -807,8 +771,8 @@ const nt = (e = {}) => {
807
771
  );
808
772
  return;
809
773
  }
810
- return { storyblokApi: new Ze(t) };
811
- }, We = (e) => {
774
+ return { storyblokApi: new De(t) };
775
+ }, Be = (e) => {
812
776
  if (typeof e != "object" || typeof e._editable > "u")
813
777
  return {};
814
778
  try {
@@ -823,13 +787,13 @@ const nt = (e = {}) => {
823
787
  return {};
824
788
  }
825
789
  };
826
- let Y = "https://app.storyblok.com/f/storyblok-v2-latest.js";
827
- const Xe = (e, t, r = {}) => {
790
+ let K = "https://app.storyblok.com/f/storyblok-v2-latest.js";
791
+ const Me = (e, t, r = {}) => {
828
792
  var s;
829
- const o = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", n = new URL((s = window.location) == null ? void 0 : s.href).searchParams.get(
793
+ const n = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", o = new URL((s = window.location) == null ? void 0 : s.href).searchParams.get(
830
794
  "_storyblok"
831
- ), l = n !== null && +n === e;
832
- if (!(!o || !l)) {
795
+ ), l = o !== null && +o === e;
796
+ if (!(!n || !l)) {
833
797
  if (!e) {
834
798
  console.warn("Story ID is not defined. Please provide a valid ID.");
835
799
  return;
@@ -841,28 +805,28 @@ const Xe = (e, t, r = {}) => {
841
805
  });
842
806
  });
843
807
  }
844
- }, Qe = (e = {}) => {
808
+ }, Fe = (e = {}) => {
845
809
  var t, r;
846
810
  const {
847
811
  bridge: s,
848
- accessToken: o,
849
- use: n = [],
812
+ accessToken: n,
813
+ use: o = [],
850
814
  apiOptions: l = {},
851
815
  bridgeUrl: a
852
816
  } = e;
853
- l.accessToken = l.accessToken || o;
817
+ l.accessToken = l.accessToken || n;
854
818
  const c = { bridge: s, apiOptions: l };
855
819
  let u = {};
856
- n.forEach((y) => {
820
+ o.forEach((y) => {
857
821
  u = { ...u, ...y(c) };
858
- }), a && (Y = a);
822
+ }), a && (K = a);
859
823
  const f = !(typeof window > "u") && ((r = (t = window.location) == null ? void 0 : t.search) == null ? void 0 : r.includes("_storyblok_tk"));
860
- return s !== !1 && f && Ne(Y), u;
824
+ return s !== !1 && f && $e(K), u;
861
825
  };
862
- function it(e, t) {
863
- return te(t).render(e);
826
+ function Ye(e, t) {
827
+ return Z(t).render(e);
864
828
  }
865
- const re = /* @__PURE__ */ Z({
829
+ const ee = /* @__PURE__ */ Y({
866
830
  __name: "StoryblokComponent",
867
831
  props: {
868
832
  blok: {}
@@ -873,20 +837,20 @@ const re = /* @__PURE__ */ Z({
873
837
  t({
874
838
  value: s
875
839
  });
876
- const o = typeof H(r.blok.component) != "string", n = pe("VueSDKOptions"), l = P((a = r.blok.component) == null ? void 0 : a.replace(/_/g, "-"));
877
- return !o && n && (n.enableFallbackComponent ? (l.value = n.customFallbackComponent ?? "FallbackComponent", typeof H(l.value) == "string" && console.error(
840
+ const n = typeof N(r.blok.component) != "string", o = he("VueSDKOptions"), l = P((a = r.blok.component) == null ? void 0 : a.replace(/_/g, "-"));
841
+ return !n && o && (o.enableFallbackComponent ? (l.value = o.customFallbackComponent ?? "FallbackComponent", typeof N(l.value) == "string" && console.error(
878
842
  `Is the Fallback component "${l.value}" registered properly?`
879
843
  )) : console.error(
880
844
  `Component could not be found for blok "${r.blok.component}"! Is it defined in main.ts as "app.component("${r.blok.component}", ${r.blok.component});"?`
881
- )), (c, u) => (X(), W(H(l.value), fe({
845
+ )), (c, u) => (X(), W(N(l.value), de({
882
846
  ref_key: "blokRef",
883
847
  ref: s
884
848
  }, { ...c.$props, ...c.$attrs }), null, 16));
885
849
  }
886
- }), et = (e) => {
850
+ }), Ve = (e) => {
887
851
  var t, r;
888
852
  return Q(
889
- re,
853
+ ee,
890
854
  {
891
855
  blok: (t = e == null ? void 0 : e.attrs) == null ? void 0 : t.body[0],
892
856
  id: (r = e.attrs) == null ? void 0 : r.id
@@ -894,21 +858,21 @@ const re = /* @__PURE__ */ Z({
894
858
  e.children
895
859
  );
896
860
  };
897
- function tt(e) {
861
+ function ze(e) {
898
862
  const t = {
899
863
  renderFn: Q,
900
864
  // TODO: Check why this changed.
901
865
  // @ts-expect-error - createTextVNode types has been recently changed.
902
- textFn: ye,
866
+ textFn: pe,
903
867
  keyedResolvers: !0,
904
868
  resolvers: {
905
- [v.COMPONENT]: et,
869
+ [g.COMPONENT]: Ve,
906
870
  ...e.resolvers
907
871
  }
908
872
  };
909
- return te(t);
873
+ return Z(t);
910
874
  }
911
- const rt = /* @__PURE__ */ Z({
875
+ const Ge = /* @__PURE__ */ Y({
912
876
  __name: "StoryblokRichText",
913
877
  props: {
914
878
  doc: {},
@@ -916,67 +880,67 @@ const rt = /* @__PURE__ */ Z({
916
880
  },
917
881
  setup(e) {
918
882
  const t = e, r = P(), s = () => r.value;
919
- return me([() => t.doc, () => t.resolvers], ([o, n]) => {
920
- const { render: l } = tt({
921
- resolvers: n ?? {}
883
+ return fe([() => t.doc, () => t.resolvers], ([n, o]) => {
884
+ const { render: l } = ze({
885
+ resolvers: o ?? {}
922
886
  });
923
- r.value = l(o);
887
+ r.value = l(n);
924
888
  }, {
925
889
  immediate: !0,
926
890
  deep: !0
927
- }), (o, n) => (X(), W(s));
891
+ }), (n, o) => (X(), W(s));
928
892
  }
929
- }), st = {
893
+ }), qe = {
930
894
  beforeMount(e, t) {
931
895
  if (t.value) {
932
- const r = We(t.value);
896
+ const r = Be(t.value);
933
897
  Object.keys(r).length > 0 && (e.setAttribute("data-blok-c", r["data-blok-c"]), e.setAttribute("data-blok-uid", r["data-blok-uid"]), e.classList.add("storyblok__outline"));
934
898
  }
935
899
  }
936
- }, se = (e) => {
900
+ }, te = (e) => {
937
901
  console.error(`You can't use ${e} if you're not loading apiPlugin. Please provide it on StoryblokVue initialization.
938
902
  `);
939
903
  };
940
904
  let S = null;
941
- const at = () => (S || se("useStoryblokApi"), S), lt = async (e, t = {}, r = {}) => {
905
+ const We = () => (S || te("useStoryblokApi"), S), Xe = async (e, t = {}, r = {}) => {
942
906
  const s = P(null);
943
- if (r.resolveRelations = r.resolveRelations ?? t.resolve_relations, r.resolveLinks = r.resolveLinks ?? t.resolve_links, be(() => {
944
- s.value && s.value.id && Xe(
907
+ if (r.resolveRelations = r.resolveRelations ?? t.resolve_relations, r.resolveLinks = r.resolveLinks ?? t.resolve_links, ye(() => {
908
+ s.value && s.value.id && Me(
945
909
  s.value.id,
946
- (o) => s.value = o,
910
+ (n) => s.value = n,
947
911
  r
948
912
  );
949
913
  }), S) {
950
- const { data: o } = await S.get(
914
+ const { data: n } = await S.get(
951
915
  `cdn/stories/${e}`,
952
916
  t
953
917
  );
954
- s.value = o.story;
918
+ s.value = n.story;
955
919
  } else
956
- se("useStoryblok");
920
+ te("useStoryblok");
957
921
  return s;
958
- }, ct = {
922
+ }, Qe = {
959
923
  install(e, t = {}) {
960
- e.directive("editable", st), e.component("StoryblokComponent", re), e.component("StoryblokRichText", rt), t.enableFallbackComponent && !t.customFallbackComponent && e.component(
924
+ e.directive("editable", qe), e.component("StoryblokComponent", ee), e.component("StoryblokRichText", Ge), t.enableFallbackComponent && !t.customFallbackComponent && e.component(
961
925
  "FallbackComponent",
962
- ge(() => import("./FallbackComponent-Dky11gEu.js"))
926
+ me(() => import("./FallbackComponent-Dky11gEu.js"))
963
927
  );
964
- const { storyblokApi: r } = Qe(t);
928
+ const { storyblokApi: r } = Fe(t);
965
929
  S = r || null, e.provide("VueSDKOptions", t);
966
930
  }
967
931
  };
968
932
  export {
969
- v as BlockTypes,
933
+ g as BlockTypes,
970
934
  R as MarkTypes,
971
- re as StoryblokComponent,
972
- rt as StoryblokRichText,
973
- ct as StoryblokVue,
974
- Ce as TextTypes,
975
- nt as apiPlugin,
976
- it as renderRichText,
977
- te as richTextResolver,
978
- lt as useStoryblok,
979
- at as useStoryblokApi,
980
- Xe as useStoryblokBridge,
981
- tt as useStoryblokRichText
935
+ ee as StoryblokComponent,
936
+ Ge as StoryblokRichText,
937
+ Qe as StoryblokVue,
938
+ ge as TextTypes,
939
+ Ke as apiPlugin,
940
+ Ye as renderRichText,
941
+ Z as richTextResolver,
942
+ Xe as useStoryblok,
943
+ We as useStoryblokApi,
944
+ Me as useStoryblokBridge,
945
+ ze as useStoryblokRichText
982
946
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@storyblok/vue",
3
3
  "type": "module",
4
- "version": "9.2.4",
4
+ "version": "9.2.7",
5
5
  "description": "SDK to integrate Storyblok into your project using Vue.",
6
6
  "author": "Storyblok",
7
7
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "vue": ">=3.4"
32
32
  },
33
33
  "dependencies": {
34
- "@storyblok/js": "4.2.4"
34
+ "@storyblok/js": "4.2.7"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@rollup/plugin-typescript": "^12.1.2",