@storyblok/js 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,4 +21,4 @@
21
21
  }
22
22
  ],
23
23
  type: 'doc'
24
- }`),""}optimizeImages(e,t){let s=0,r=0,i="",o="";typeof t!="boolean"&&(typeof t.width=="number"&&t.width>0&&(i+=`width="${t.width}" `,s=t.width),typeof t.height=="number"&&t.height>0&&(i+=`height="${t.height}" `,r=t.height),(t.loading==="lazy"||t.loading==="eager")&&(i+=`loading="${t.loading}" `),typeof t.class=="string"&&t.class.length>0&&(i+=`class="${t.class}" `),t.filters&&(typeof t.filters.blur=="number"&&t.filters.blur>=0&&t.filters.blur<=100&&(o+=`:blur(${t.filters.blur})`),typeof t.filters.brightness=="number"&&t.filters.brightness>=-100&&t.filters.brightness<=100&&(o+=`:brightness(${t.filters.brightness})`),t.filters.fill&&(t.filters.fill.match(/[0-9A-Fa-f]{6}/g)||t.filters.fill==="transparent")&&(o+=`:fill(${t.filters.fill})`),t.filters.format&&["webp","png","jpeg"].includes(t.filters.format)&&(o+=`:format(${t.filters.format})`),typeof t.filters.grayscale=="boolean"&&t.filters.grayscale&&(o+=":grayscale()"),typeof t.filters.quality=="number"&&t.filters.quality>=0&&t.filters.quality<=100&&(o+=`:quality(${t.filters.quality})`),t.filters.rotate&&[90,180,270].includes(t.filters.rotate)&&(o+=`:rotate(${t.filters.rotate})`),o.length>0&&(o="/filters"+o))),i.length>0&&(e=e.replace(/<img/g,`<img ${i.trim()}`));const c=s>0||r>0||o.length>0?`${s}x${r}${o}`:"";return e=e.replace(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g,`a.storyblok.com/f/$1/$2.$3/m/${c}`),typeof t!="boolean"&&(t.sizes||t.srcset)&&(e=e.replace(/<img.*?src=["|'](.*?)["|']/g,a=>{var l,u;const p=a.match(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g);if(p&&p.length>0){const f={srcset:(l=t.srcset)==null?void 0:l.map(g=>{if(typeof g=="number")return`//${p}/m/${g}x0${o} ${g}w`;if(typeof g=="object"&&g.length===2){let $=0,C=0;return typeof g[0]=="number"&&($=g[0]),typeof g[1]=="number"&&(C=g[1]),`//${p}/m/${$}x${C}${o} ${$}w`}}).join(", "),sizes:(u=t.sizes)==null?void 0:u.map(g=>g).join(", ")};let T="";return f.srcset&&(T+=`srcset="${f.srcset}" `),f.sizes&&(T+=`sizes="${f.sizes}" `),a.replace(/<img/g,`<img ${T.trim()}`)}return a})),e}renderNode(e){const t=[];e.marks&&e.marks.forEach(r=>{const i=this.getMatchingMark(r);i&&i.tag!==""&&t.push(this.renderOpeningTag(i.tag))});const s=this.getMatchingNode(e);return s&&s.tag&&t.push(this.renderOpeningTag(s.tag)),e.content?e.content.forEach(r=>{t.push(this.renderNode(r))}):e.text?t.push(le(e.text)):s&&s.singleTag?t.push(this.renderTag(s.singleTag," /")):s&&s.html?t.push(s.html):e.type==="emoji"&&t.push(this.renderEmoji(e)),s&&s.tag&&t.push(this.renderClosingTag(s.tag)),e.marks&&e.marks.slice(0).reverse().forEach(r=>{const i=this.getMatchingMark(r);i&&i.tag!==""&&t.push(this.renderClosingTag(i.tag))}),t.join("")}renderTag(e,t){return e.constructor===String?`<${e}${t}>`:e.map(s=>{if(s.constructor===String)return`<${s}${t}>`;{let r=`<${s.tag}`;if(s.attrs)for(const i in s.attrs){const o=s.attrs[i];o!==null&&(r+=` ${i}="${o}"`)}return`${r}${t}>`}}).join("")}renderOpeningTag(e){return this.renderTag(e,"")}renderClosingTag(e){return e.constructor===String?`</${e}>`:e.slice(0).reverse().map(t=>t.constructor===String?`</${t}>`:`</${t.tag}>`).join("")}getMatchingNode(e){const t=this.nodes[e.type];if(typeof t=="function")return t(e)}getMatchingMark(e){const t=this.marks[e.type];if(typeof t=="function")return t(e)}renderEmoji(e){if(e.attrs.emoji)return e.attrs.emoji;const t=[{tag:"img",attrs:{src:e.attrs.fallbackImage,draggable:"false",loading:"lazy",align:"absmiddle"}}];return this.renderTag(t," /")}}class v{constructor(){h(this,"isCDNUrl",(e="")=>e.indexOf("/cdn/")>-1),h(this,"getOptionsPage",(e,t=25,s=1)=>({...e,per_page:t,page:s})),h(this,"delay",e=>new Promise(t=>setTimeout(t,e))),h(this,"arrayFrom",(e=0,t)=>[...Array(e)].map(t)),h(this,"range",(e=0,t=e)=>{const s=Math.abs(t-e)||0,r=e<t?1:-1;return this.arrayFrom(s,(i,o)=>o*r+e)}),h(this,"asyncMap",async(e,t)=>Promise.all(e.map(t))),h(this,"flatMap",(e=[],t)=>e.map(t).reduce((s,r)=>[...s,...r],[]))}stringify(e,t,s){const r=[];for(const i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;const o=e[i],c=s?"":encodeURIComponent(i);let a;typeof o=="object"?a=this.stringify(o,t?t+encodeURIComponent("["+c+"]"):c,Array.isArray(o)):a=(t?t+encodeURIComponent("["+c+"]"):c)+"="+encodeURIComponent(o),r.push(a)}return r.join("&")}getRegionURL(e){const t="api.storyblok.com",s="api-us.storyblok.com",r="app.storyblokchina.cn";switch(e){case"us":return s;case"cn":return r;default:return t}}}class ce{constructor(e){h(this,"baseURL"),h(this,"timeout"),h(this,"headers"),h(this,"responseInterceptor"),h(this,"fetch"),h(this,"ejectInterceptor"),h(this,"url"),h(this,"parameters"),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={}}get(e,t){return this.url=e,this.parameters=t,this._methodHandler("get")}post(e,t){return this.url=e,this.parameters=t,this._methodHandler("post")}put(e,t){return this.url=e,this.parameters=t,this._methodHandler("put")}delete(e,t){return this.url=e,this.parameters=t,this._methodHandler("delete")}async _responseHandler(e){const t=[],s={data:{},headers:{},status:0,statusText:""};e.status!==204&&await e.json().then(r=>{s.data=r});for(const r of e.headers.entries())t[r[0]]=r[1];return s.headers={...t},s.status=e.status,s.statusText=e.statusText,s}async _methodHandler(e){let t=`${this.baseURL}${this.url}`,s=null;if(e==="get"){const a=new v;t=`${this.baseURL}${this.url}?${a.stringify(this.parameters)}`}else s=JSON.stringify(this.parameters);const r=new URL(t),i=new AbortController,{signal:o}=i;let c;this.timeout&&(c=setTimeout(()=>i.abort(),this.timeout));try{const a=await this.fetch(`${r}`,{method:e,headers:this.headers,body:s,signal:o});this.timeout&&clearTimeout(c);const l=await this._responseHandler(a);return this.responseInterceptor&&!this.ejectInterceptor?this._statusHandler(this.responseInterceptor(l)):this._statusHandler(l)}catch(a){return{message:a}}}eject(){this.ejectInterceptor=!0}_statusHandler(e){const t=/20[0-6]/g;return new Promise((s,r)=>{if(t.test(`${e.status}`))return s(e);const i={message:new Error(e.statusText),status:e.status,response:Array.isArray(e.data)?e.data[0]:e.data.error||e.data.slug};r(i)})}}let k={};const y={};class he{constructor(e,t){if(h(this,"client"),h(this,"maxRetries"),h(this,"throttle"),h(this,"accessToken"),h(this,"cache"),h(this,"helpers"),h(this,"resolveCounter"),h(this,"relations"),h(this,"links"),h(this,"richTextResolver"),h(this,"resolveNestedRelations"),!t){const i=new v().getRegionURL,o=e.https===!1?"http":"https";e.oauthToken?t=`${o}://${i(e.region)}/v1`:t=`${o}://${i(e.region)}/v2`}const s=new Headers;s.set("Content-Type","application/json"),s.set("Accept","application/json"),s.forEach((i,o)=>{e.headers&&e.headers[o]&&s.set(o,e.headers[o])});let r=5;e.oauthToken&&(s.set("Authorization",e.oauthToken),r=3),e.rateLimit&&(r=e.rateLimit),e.richTextSchema?this.richTextResolver=new b(e.richTextSchema):this.richTextResolver=new b,e.componentResolver&&this.setComponentResolver(e.componentResolver),this.maxRetries=e.maxRetries||5,this.throttle=N(this.throttledRequest,r,1e3),this.accessToken=e.accessToken||"",this.relations={},this.links={},this.cache=e.cache||{clear:"manual"},this.helpers=new v,this.resolveCounter=0,this.resolveNestedRelations=e.resolveNestedRelations||!0,this.client=new ce({baseURL:t,timeout:e.timeout||0,headers:s,responseInterceptor:e.responseInterceptor,fetch:e.fetch})}setComponentResolver(e){this.richTextResolver.addNode("blok",t=>{let s="";return t.attrs.body&&t.attrs.body.forEach(r=>{s+=e(r.component,r)}),{html:s}})}parseParams(e){return e.version||(e.version="published"),e.token||(e.token=this.getToken()),e.cv||(e.cv=y[e.token]),Array.isArray(e.resolve_relations)&&(e.resolve_relations=e.resolve_relations.join(",")),e}factoryParamOptions(e,t){return this.helpers.isCDNUrl(e)?this.parseParams(t):t}makeRequest(e,t,s,r){const i=this.factoryParamOptions(e,this.helpers.getOptionsPage(t,s,r));return this.cacheResponse(e,i)}get(e,t){t||(t={});const s=`/${e}`,r=this.factoryParamOptions(s,t);return this.cacheResponse(s,r)}async getAll(e,t,s){const r=(t==null?void 0:t.per_page)||25,i=`/${e}`,o=i.split("/"),c=s||o[o.length-1],a=1,l=await this.makeRequest(i,t,r,a),u=l.total?Math.ceil(l.total/r):1,p=await this.helpers.asyncMap(this.helpers.range(a,u),f=>this.makeRequest(i,t,r,f+1));return this.helpers.flatMap([l,...p],f=>Object.values(f.data[c]))}post(e,t){const s=`/${e}`;return Promise.resolve(this.throttle("post",s,t))}put(e,t){const s=`/${e}`;return Promise.resolve(this.throttle("put",s,t))}delete(e,t){const s=`/${e}`;return Promise.resolve(this.throttle("delete",s,t))}getStories(e){return this.get("cdn/stories",e)}getStory(e,t){return this.get(`cdn/stories/${e}`,t)}getToken(){return this.accessToken}ejectInterceptor(){this.client.eject()}_cleanCopy(e){return JSON.parse(JSON.stringify(e))}_insertLinks(e,t,s){const r=e[t];r&&r.fieldtype=="multilink"&&r.linktype=="story"&&typeof r.id=="string"&&this.links[s][r.id]?r.story=this._cleanCopy(this.links[s][r.id]):r&&r.linktype==="story"&&typeof r.uuid=="string"&&this.links[s][r.uuid]&&(r.story=this._cleanCopy(this.links[s][r.uuid]))}_insertRelations(e,t,s,r){if(s.indexOf(`${e.component}.${t}`)>-1){if(typeof e[t]=="string")this.relations[r][e[t]]&&(e[t]=this._cleanCopy(this.relations[r][e[t]]));else if(e[t]&&e[t].constructor===Array){const i=[];e[t].forEach(o=>{this.relations[r][o]&&i.push(this._cleanCopy(this.relations[r][o]))}),e[t]=i}}}iterateTree(e,t,s){const r=i=>{if(i!=null){if(i.constructor===Array)for(let o=0;o<i.length;o++)r(i[o]);else if(i.constructor===Object){if(i._stopResolving)return;for(const o in i)(i.component&&i._uid||i.type==="link")&&(this._insertRelations(i,o,t,s),this._insertLinks(i,o,s)),r(i[o])}}};r(e.content)}async resolveLinks(e,t,s){let r=[];if(e.link_uuids){const i=e.link_uuids.length,o=[],c=50;for(let a=0;a<i;a+=c){const l=Math.min(i,a+c);o.push(e.link_uuids.slice(a,l))}for(let a=0;a<o.length;a++)(await this.getStories({per_page:c,language:t.language,version:t.version,by_uuids:o[a].join(",")})).data.stories.forEach(l=>{r.push(l)})}else r=e.links;r.forEach(i=>{this.links[s][i.uuid]={...i,_stopResolving:!0}})}async resolveRelations(e,t,s){let r=[];if(e.rel_uuids){const i=e.rel_uuids.length,o=[],c=50;for(let a=0;a<i;a+=c){const l=Math.min(i,a+c);o.push(e.rel_uuids.slice(a,l))}for(let a=0;a<o.length;a++)(await this.getStories({per_page:c,language:t.language,version:t.version,by_uuids:o[a].join(",")})).data.stories.forEach(l=>{r.push(l)})}else r=e.rels;r&&r.length>0&&r.forEach(i=>{this.relations[s][i.uuid]={...i,_stopResolving:!0}})}async resolveStories(e,t,s){var r,i;let o=[];if(this.links[s]={},this.relations[s]={},typeof t.resolve_relations<"u"&&t.resolve_relations.length>0&&(typeof t.resolve_relations=="string"&&(o=t.resolve_relations.split(",")),await this.resolveRelations(e,t,s)),t.resolve_links&&["1","story","url"].indexOf(t.resolve_links)>-1&&((r=e.links)!=null&&r.length||(i=e.link_uuids)!=null&&i.length)&&await this.resolveLinks(e,t,s),this.resolveNestedRelations)for(const c in this.relations[s])this.iterateTree(this.relations[s][c],o,s);e.story?this.iterateTree(e.story,o,s):e.stories.forEach(c=>{this.iterateTree(c,o,s)}),delete this.links[s],delete this.relations[s]}async cacheResponse(e,t,s){const r=this.helpers.stringify({url:e,params:t}),i=this.cacheProvider();if(this.cache.clear==="auto"&&t.version==="draft"&&await this.flushCache(),t.version==="published"&&e!="/cdn/spaces/me"){const o=await i.get(r);if(o)return Promise.resolve(o)}return new Promise((o,c)=>{try{(async()=>{var a;try{const l=await this.throttle("get",e,t);let u={data:l.data,headers:l.headers};if((a=l.headers)!=null&&a["per-page"]&&(u=Object.assign({},u,{perPage:l.headers["per-page"]?parseInt(l.headers["per-page"]):0,total:l.headers["per-page"]?parseInt(l.headers.total):0})),l.status!=200)return c(l);if(u.data.story||u.data.stories){const p=this.resolveCounter=++this.resolveCounter%1e3;await this.resolveStories(u.data,t,`${p}`)}return t.version==="published"&&e!="/cdn/spaces/me"&&await i.set(r,u),u.data.cv&&t.token&&(t.version=="draft"&&y[t.token]!=u.data.cv&&await this.flushCache(),y[t.token]=u.data.cv),o(u)}catch(l){return c(l)}})()}catch{}})}throttledRequest(e,t,s){return this.client[e](t,s)}cacheVersions(){return y}cacheVersion(){return y[this.accessToken]}setCacheVersion(e){this.accessToken&&(y[this.accessToken]=e)}cacheProvider(){switch(this.cache.type){case"memory":return{get(e){return Promise.resolve(k[e])},getAll(){return Promise.resolve(k)},set(e,t){return k[e]=t,Promise.resolve(void 0)},flush(){return k={},Promise.resolve(void 0)}};case"custom":if(this.cache.custom)return this.cache.custom;default:return{get(){return Promise.resolve(void 0)},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}}const ue=(n={})=>{const{apiOptions:e}=n;if(!e.accessToken){console.error("You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication");return}return{storyblokApi:new he(e)}},de=n=>{if(typeof n!="object"||typeof n._editable>"u")return{};const e=JSON.parse(n._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return{"data-blok-c":JSON.stringify(e),"data-blok-uid":e.id+"-"+e.uid}};let w;const E="https://app.storyblok.com/f/storyblok-v2-latest.js",x=(n,e,t={})=>{var c;const r=!(typeof window>"u")&&typeof window.storyblokRegisterEvent<"u",o=+new URL((c=window.location)==null?void 0:c.href).searchParams.get("_storyblok")===n;if(!(!r||!o)){if(!n){console.warn("Story ID is not defined. Please provide a valid ID.");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(t).on(["input","published","change"],l=>{l.action==="input"&&l.story.id===n?e(l.story):(l.action==="change"||l.action==="published")&&l.storyId===n&&window.location.reload()})})}},pe=(n={})=>{var u,p;const{bridge:e,accessToken:t,use:s=[],apiOptions:r={},richText:i={}}=n;r.accessToken=r.accessToken||t;const o={bridge:e,apiOptions:r};let c={};s.forEach(f=>{c={...c,...f(o)}});const l=!(typeof window>"u")&&((p=(u=window.location)==null?void 0:u.search)==null?void 0:p.includes("_storyblok_tk"));return e!==!1&&l&&_(E),w=new b(i.schema),i.resolver&&I(w,i.resolver),c},I=(n,e)=>{n.addNode("blok",t=>{let s="";return t.attrs.body.forEach(r=>{s+=e(r.component,r)}),{html:s}})},P=n=>{var e,t;return!n||((e=n==null?void 0:n.content)==null?void 0:e[0].type)!=="blok"&&!((t=n==null?void 0:n.content)!=null&&t[0].content)},ge=(n,e,t)=>{let s=t||w;if(!s){console.error("Please initialize the Storyblok SDK before calling the renderRichText function");return}return P(n)?"":(e&&(s=new b(e.schema),e.resolver&&I(s,e.resolver)),s.render(n))},fe=()=>_(E);d.RichTextResolver=b,d.RichTextSchema=S,d.apiPlugin=ue,d.isRichTextEmpty=P,d.loadStoryblokBridge=fe,d.registerStoryblokBridge=x,d.renderRichText=ge,d.storyblokEditable=de,d.storyblokInit=pe,d.useStoryblokBridge=x,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
24
+ }`),""}optimizeImages(e,t){let s=0,r=0,i="",o="";typeof t!="boolean"&&(typeof t.width=="number"&&t.width>0&&(i+=`width="${t.width}" `,s=t.width),typeof t.height=="number"&&t.height>0&&(i+=`height="${t.height}" `,r=t.height),(t.loading==="lazy"||t.loading==="eager")&&(i+=`loading="${t.loading}" `),typeof t.class=="string"&&t.class.length>0&&(i+=`class="${t.class}" `),t.filters&&(typeof t.filters.blur=="number"&&t.filters.blur>=0&&t.filters.blur<=100&&(o+=`:blur(${t.filters.blur})`),typeof t.filters.brightness=="number"&&t.filters.brightness>=-100&&t.filters.brightness<=100&&(o+=`:brightness(${t.filters.brightness})`),t.filters.fill&&(t.filters.fill.match(/[0-9A-Fa-f]{6}/g)||t.filters.fill==="transparent")&&(o+=`:fill(${t.filters.fill})`),t.filters.format&&["webp","png","jpeg"].includes(t.filters.format)&&(o+=`:format(${t.filters.format})`),typeof t.filters.grayscale=="boolean"&&t.filters.grayscale&&(o+=":grayscale()"),typeof t.filters.quality=="number"&&t.filters.quality>=0&&t.filters.quality<=100&&(o+=`:quality(${t.filters.quality})`),t.filters.rotate&&[90,180,270].includes(t.filters.rotate)&&(o+=`:rotate(${t.filters.rotate})`),o.length>0&&(o="/filters"+o))),i.length>0&&(e=e.replace(/<img/g,`<img ${i.trim()}`));const c=s>0||r>0||o.length>0?`${s}x${r}${o}`:"";return e=e.replace(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g,`a.storyblok.com/f/$1/$2.$3/m/${c}`),typeof t!="boolean"&&(t.sizes||t.srcset)&&(e=e.replace(/<img.*?src=["|'](.*?)["|']/g,a=>{var l,u;const p=a.match(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g);if(p&&p.length>0){const f={srcset:(l=t.srcset)==null?void 0:l.map(g=>{if(typeof g=="number")return`//${p}/m/${g}x0${o} ${g}w`;if(typeof g=="object"&&g.length===2){let $=0,C=0;return typeof g[0]=="number"&&($=g[0]),typeof g[1]=="number"&&(C=g[1]),`//${p}/m/${$}x${C}${o} ${$}w`}}).join(", "),sizes:(u=t.sizes)==null?void 0:u.map(g=>g).join(", ")};let T="";return f.srcset&&(T+=`srcset="${f.srcset}" `),f.sizes&&(T+=`sizes="${f.sizes}" `),a.replace(/<img/g,`<img ${T.trim()}`)}return a})),e}renderNode(e){const t=[];e.marks&&e.marks.forEach(r=>{const i=this.getMatchingMark(r);i&&i.tag!==""&&t.push(this.renderOpeningTag(i.tag))});const s=this.getMatchingNode(e);return s&&s.tag&&t.push(this.renderOpeningTag(s.tag)),e.content?e.content.forEach(r=>{t.push(this.renderNode(r))}):e.text?t.push(le(e.text)):s&&s.singleTag?t.push(this.renderTag(s.singleTag," /")):s&&s.html?t.push(s.html):e.type==="emoji"&&t.push(this.renderEmoji(e)),s&&s.tag&&t.push(this.renderClosingTag(s.tag)),e.marks&&e.marks.slice(0).reverse().forEach(r=>{const i=this.getMatchingMark(r);i&&i.tag!==""&&t.push(this.renderClosingTag(i.tag))}),t.join("")}renderTag(e,t){return e.constructor===String?`<${e}${t}>`:e.map(s=>{if(s.constructor===String)return`<${s}${t}>`;{let r=`<${s.tag}`;if(s.attrs)for(const i in s.attrs){const o=s.attrs[i];o!==null&&(r+=` ${i}="${o}"`)}return`${r}${t}>`}}).join("")}renderOpeningTag(e){return this.renderTag(e,"")}renderClosingTag(e){return e.constructor===String?`</${e}>`:e.slice(0).reverse().map(t=>t.constructor===String?`</${t}>`:`</${t.tag}>`).join("")}getMatchingNode(e){const t=this.nodes[e.type];if(typeof t=="function")return t(e)}getMatchingMark(e){const t=this.marks[e.type];if(typeof t=="function")return t(e)}renderEmoji(e){if(e.attrs.emoji)return e.attrs.emoji;const t=[{tag:"img",attrs:{src:e.attrs.fallbackImage,draggable:"false",loading:"lazy",align:"absmiddle"}}];return this.renderTag(t," /")}}class v{constructor(){h(this,"isCDNUrl",(e="")=>e.indexOf("/cdn/")>-1),h(this,"getOptionsPage",(e,t=25,s=1)=>({...e,per_page:t,page:s})),h(this,"delay",e=>new Promise(t=>setTimeout(t,e))),h(this,"arrayFrom",(e=0,t)=>[...Array(e)].map(t)),h(this,"range",(e=0,t=e)=>{const s=Math.abs(t-e)||0,r=e<t?1:-1;return this.arrayFrom(s,(i,o)=>o*r+e)}),h(this,"asyncMap",async(e,t)=>Promise.all(e.map(t))),h(this,"flatMap",(e=[],t)=>e.map(t).reduce((s,r)=>[...s,...r],[]))}stringify(e,t,s){const r=[];for(const i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;const o=e[i],c=s?"":encodeURIComponent(i);let a;typeof o=="object"?a=this.stringify(o,t?t+encodeURIComponent("["+c+"]"):c,Array.isArray(o)):a=(t?t+encodeURIComponent("["+c+"]"):c)+"="+encodeURIComponent(o),r.push(a)}return r.join("&")}getRegionURL(e){const t="api.storyblok.com",s="api-us.storyblok.com",r="app.storyblokchina.cn";switch(e){case"us":return s;case"cn":return r;default:return t}}}class ce{constructor(e){h(this,"baseURL"),h(this,"timeout"),h(this,"headers"),h(this,"responseInterceptor"),h(this,"fetch"),h(this,"ejectInterceptor"),h(this,"url"),h(this,"parameters"),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={}}get(e,t){return this.url=e,this.parameters=t,this._methodHandler("get")}post(e,t){return this.url=e,this.parameters=t,this._methodHandler("post")}put(e,t){return this.url=e,this.parameters=t,this._methodHandler("put")}delete(e,t){return this.url=e,this.parameters=t,this._methodHandler("delete")}async _responseHandler(e){const t=[],s={data:{},headers:{},status:0,statusText:""};e.status!==204&&await e.json().then(r=>{s.data=r});for(const r of e.headers.entries())t[r[0]]=r[1];return s.headers={...t},s.status=e.status,s.statusText=e.statusText,s}async _methodHandler(e){let t=`${this.baseURL}${this.url}`,s=null;if(e==="get"){const a=new v;t=`${this.baseURL}${this.url}?${a.stringify(this.parameters)}`}else s=JSON.stringify(this.parameters);const r=new URL(t),i=new AbortController,{signal:o}=i;let c;this.timeout&&(c=setTimeout(()=>i.abort(),this.timeout));try{const a=await this.fetch(`${r}`,{method:e,headers:this.headers,body:s,signal:o});this.timeout&&clearTimeout(c);const l=await this._responseHandler(a);return this.responseInterceptor&&!this.ejectInterceptor?this._statusHandler(this.responseInterceptor(l)):this._statusHandler(l)}catch(a){return{message:a}}}eject(){this.ejectInterceptor=!0}_statusHandler(e){const t=/20[0-6]/g;return new Promise((s,r)=>{if(t.test(`${e.status}`))return s(e);const i={message:new Error(e.statusText),status:e.status,response:Array.isArray(e.data)?e.data[0]:e.data.error||e.data.slug};r(i)})}}let k={};const y={};class he{constructor(e,t){h(this,"client"),h(this,"maxRetries"),h(this,"throttle"),h(this,"accessToken"),h(this,"cache"),h(this,"helpers"),h(this,"resolveCounter"),h(this,"relations"),h(this,"links"),h(this,"richTextResolver"),h(this,"resolveNestedRelations");let s=e.endpoint||t;if(!s){const o=new v().getRegionURL,c=e.https===!1?"http":"https";e.oauthToken?s=`${c}://${o(e.region)}/v1`:s=`${c}://${o(e.region)}/v2`}const r=new Headers;r.set("Content-Type","application/json"),r.set("Accept","application/json"),r.forEach((o,c)=>{e.headers&&e.headers[c]&&r.set(c,e.headers[c])});let i=5;e.oauthToken&&(r.set("Authorization",e.oauthToken),i=3),e.rateLimit&&(i=e.rateLimit),e.richTextSchema?this.richTextResolver=new b(e.richTextSchema):this.richTextResolver=new b,e.componentResolver&&this.setComponentResolver(e.componentResolver),this.maxRetries=e.maxRetries||5,this.throttle=N(this.throttledRequest,i,1e3),this.accessToken=e.accessToken||"",this.relations={},this.links={},this.cache=e.cache||{clear:"manual"},this.helpers=new v,this.resolveCounter=0,this.resolveNestedRelations=e.resolveNestedRelations||!0,this.client=new ce({baseURL:s,timeout:e.timeout||0,headers:r,responseInterceptor:e.responseInterceptor,fetch:e.fetch})}setComponentResolver(e){this.richTextResolver.addNode("blok",t=>{let s="";return t.attrs.body&&t.attrs.body.forEach(r=>{s+=e(r.component,r)}),{html:s}})}parseParams(e){return e.version||(e.version="published"),e.token||(e.token=this.getToken()),e.cv||(e.cv=y[e.token]),Array.isArray(e.resolve_relations)&&(e.resolve_relations=e.resolve_relations.join(",")),e}factoryParamOptions(e,t){return this.helpers.isCDNUrl(e)?this.parseParams(t):t}makeRequest(e,t,s,r){const i=this.factoryParamOptions(e,this.helpers.getOptionsPage(t,s,r));return this.cacheResponse(e,i)}get(e,t){t||(t={});const s=`/${e}`,r=this.factoryParamOptions(s,t);return this.cacheResponse(s,r)}async getAll(e,t,s){const r=(t==null?void 0:t.per_page)||25,i=`/${e}`,o=i.split("/"),c=s||o[o.length-1],a=1,l=await this.makeRequest(i,t,r,a),u=l.total?Math.ceil(l.total/r):1,p=await this.helpers.asyncMap(this.helpers.range(a,u),f=>this.makeRequest(i,t,r,f+1));return this.helpers.flatMap([l,...p],f=>Object.values(f.data[c]))}post(e,t){const s=`/${e}`;return Promise.resolve(this.throttle("post",s,t))}put(e,t){const s=`/${e}`;return Promise.resolve(this.throttle("put",s,t))}delete(e,t){const s=`/${e}`;return Promise.resolve(this.throttle("delete",s,t))}getStories(e){return this.get("cdn/stories",e)}getStory(e,t){return this.get(`cdn/stories/${e}`,t)}getToken(){return this.accessToken}ejectInterceptor(){this.client.eject()}_cleanCopy(e){return JSON.parse(JSON.stringify(e))}_insertLinks(e,t,s){const r=e[t];r&&r.fieldtype=="multilink"&&r.linktype=="story"&&typeof r.id=="string"&&this.links[s][r.id]?r.story=this._cleanCopy(this.links[s][r.id]):r&&r.linktype==="story"&&typeof r.uuid=="string"&&this.links[s][r.uuid]&&(r.story=this._cleanCopy(this.links[s][r.uuid]))}_insertRelations(e,t,s,r){if(s.indexOf(`${e.component}.${t}`)>-1){if(typeof e[t]=="string")this.relations[r][e[t]]&&(e[t]=this._cleanCopy(this.relations[r][e[t]]));else if(e[t]&&e[t].constructor===Array){const i=[];e[t].forEach(o=>{this.relations[r][o]&&i.push(this._cleanCopy(this.relations[r][o]))}),e[t]=i}}}iterateTree(e,t,s){const r=i=>{if(i!=null){if(i.constructor===Array)for(let o=0;o<i.length;o++)r(i[o]);else if(i.constructor===Object){if(i._stopResolving)return;for(const o in i)(i.component&&i._uid||i.type==="link")&&(this._insertRelations(i,o,t,s),this._insertLinks(i,o,s)),r(i[o])}}};r(e.content)}async resolveLinks(e,t,s){let r=[];if(e.link_uuids){const i=e.link_uuids.length,o=[],c=50;for(let a=0;a<i;a+=c){const l=Math.min(i,a+c);o.push(e.link_uuids.slice(a,l))}for(let a=0;a<o.length;a++)(await this.getStories({per_page:c,language:t.language,version:t.version,by_uuids:o[a].join(",")})).data.stories.forEach(l=>{r.push(l)})}else r=e.links;r.forEach(i=>{this.links[s][i.uuid]={...i,_stopResolving:!0}})}async resolveRelations(e,t,s){let r=[];if(e.rel_uuids){const i=e.rel_uuids.length,o=[],c=50;for(let a=0;a<i;a+=c){const l=Math.min(i,a+c);o.push(e.rel_uuids.slice(a,l))}for(let a=0;a<o.length;a++)(await this.getStories({per_page:c,language:t.language,version:t.version,by_uuids:o[a].join(",")})).data.stories.forEach(l=>{r.push(l)})}else r=e.rels;r&&r.length>0&&r.forEach(i=>{this.relations[s][i.uuid]={...i,_stopResolving:!0}})}async resolveStories(e,t,s){var r,i;let o=[];if(this.links[s]={},this.relations[s]={},typeof t.resolve_relations<"u"&&t.resolve_relations.length>0&&(typeof t.resolve_relations=="string"&&(o=t.resolve_relations.split(",")),await this.resolveRelations(e,t,s)),t.resolve_links&&["1","story","url"].indexOf(t.resolve_links)>-1&&((r=e.links)!=null&&r.length||(i=e.link_uuids)!=null&&i.length)&&await this.resolveLinks(e,t,s),this.resolveNestedRelations)for(const c in this.relations[s])this.iterateTree(this.relations[s][c],o,s);e.story?this.iterateTree(e.story,o,s):e.stories.forEach(c=>{this.iterateTree(c,o,s)}),delete this.links[s],delete this.relations[s]}async cacheResponse(e,t,s){const r=this.helpers.stringify({url:e,params:t}),i=this.cacheProvider();if(this.cache.clear==="auto"&&t.version==="draft"&&await this.flushCache(),t.version==="published"&&e!="/cdn/spaces/me"){const o=await i.get(r);if(o)return Promise.resolve(o)}return new Promise((o,c)=>{try{(async()=>{var a;try{const l=await this.throttle("get",e,t);let u={data:l.data,headers:l.headers};if((a=l.headers)!=null&&a["per-page"]&&(u=Object.assign({},u,{perPage:l.headers["per-page"]?parseInt(l.headers["per-page"]):0,total:l.headers["per-page"]?parseInt(l.headers.total):0})),l.status!=200)return c(l);if(u.data.story||u.data.stories){const p=this.resolveCounter=++this.resolveCounter%1e3;await this.resolveStories(u.data,t,`${p}`)}return t.version==="published"&&e!="/cdn/spaces/me"&&await i.set(r,u),u.data.cv&&t.token&&(t.version=="draft"&&y[t.token]!=u.data.cv&&await this.flushCache(),y[t.token]=u.data.cv),o(u)}catch(l){return c(l)}})()}catch{}})}throttledRequest(e,t,s){return this.client[e](t,s)}cacheVersions(){return y}cacheVersion(){return y[this.accessToken]}setCacheVersion(e){this.accessToken&&(y[this.accessToken]=e)}cacheProvider(){switch(this.cache.type){case"memory":return{get(e){return Promise.resolve(k[e])},getAll(){return Promise.resolve(k)},set(e,t){return k[e]=t,Promise.resolve(void 0)},flush(){return k={},Promise.resolve(void 0)}};case"custom":if(this.cache.custom)return this.cache.custom;default:return{get(){return Promise.resolve(void 0)},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}}const ue=(n={})=>{const{apiOptions:e}=n;if(!e.accessToken){console.error("You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication");return}return{storyblokApi:new he(e)}},de=n=>{if(typeof n!="object"||typeof n._editable>"u")return{};const e=JSON.parse(n._editable.replace(/^<!--#storyblok#/,"").replace(/-->$/,""));return{"data-blok-c":JSON.stringify(e),"data-blok-uid":e.id+"-"+e.uid}};let w;const E="https://app.storyblok.com/f/storyblok-v2-latest.js",x=(n,e,t={})=>{var c;const r=!(typeof window>"u")&&typeof window.storyblokRegisterEvent<"u",o=+new URL((c=window.location)==null?void 0:c.href).searchParams.get("_storyblok")===n;if(!(!r||!o)){if(!n){console.warn("Story ID is not defined. Please provide a valid ID.");return}window.storyblokRegisterEvent(()=>{new window.StoryblokBridge(t).on(["input","published","change"],l=>{l.action==="input"&&l.story.id===n?e(l.story):(l.action==="change"||l.action==="published")&&l.storyId===n&&window.location.reload()})})}},pe=(n={})=>{var u,p;const{bridge:e,accessToken:t,use:s=[],apiOptions:r={},richText:i={}}=n;r.accessToken=r.accessToken||t;const o={bridge:e,apiOptions:r};let c={};s.forEach(f=>{c={...c,...f(o)}});const l=!(typeof window>"u")&&((p=(u=window.location)==null?void 0:u.search)==null?void 0:p.includes("_storyblok_tk"));return e!==!1&&l&&_(E),w=new b(i.schema),i.resolver&&I(w,i.resolver),c},I=(n,e)=>{n.addNode("blok",t=>{let s="";return t.attrs.body.forEach(r=>{s+=e(r.component,r)}),{html:s}})},P=n=>{var e,t;return!n||((e=n==null?void 0:n.content)==null?void 0:e[0].type)!=="blok"&&!((t=n==null?void 0:n.content)!=null&&t[0].content)},ge=(n,e,t)=>{let s=t||w;if(!s){console.error("Please initialize the Storyblok SDK before calling the renderRichText function");return}return P(n)?"":(e&&(s=new b(e.schema),e.resolver&&I(s,e.resolver)),s.render(n))},fe=()=>_(E);d.RichTextResolver=b,d.RichTextSchema=S,d.apiPlugin=ue,d.isRichTextEmpty=P,d.loadStoryblokBridge=fe,d.registerStoryblokBridge=x,d.renderRichText=ge,d.storyblokEditable=de,d.storyblokInit=pe,d.useStoryblokBridge=x,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
@@ -1,5 +1,5 @@
1
1
  let R = !1;
2
- const T = [], j = (o) => new Promise((e, t) => {
2
+ const T = [], j = (n) => new Promise((e, t) => {
3
3
  if (typeof window > "u" || (window.storyblokRegisterEvent = (r) => {
4
4
  if (window.location === window.parent.location) {
5
5
  console.warn("You are not in Draft Mode or in the Visual Editor.");
@@ -9,31 +9,31 @@ const T = [], j = (o) => new Promise((e, t) => {
9
9
  }, document.getElementById("storyblok-javascript-bridge")))
10
10
  return;
11
11
  const s = document.createElement("script");
12
- s.async = !0, s.src = o, s.id = "storyblok-javascript-bridge", s.onerror = (r) => t(r), s.onload = (r) => {
12
+ s.async = !0, s.src = n, s.id = "storyblok-javascript-bridge", s.onerror = (r) => t(r), s.onload = (r) => {
13
13
  T.forEach((i) => i()), R = !0, e(r);
14
14
  }, document.getElementsByTagName("head")[0].appendChild(s);
15
15
  });
16
- var I = Object.defineProperty, P = (o, e, t) => e in o ? I(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t, h = (o, e, t) => (P(o, typeof e != "symbol" ? e + "" : e, t), t);
17
- function _(o) {
18
- return !(o !== o || o === 1 / 0 || o === -1 / 0);
16
+ var I = Object.defineProperty, P = (n, e, t) => e in n ? I(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, h = (n, e, t) => (P(n, typeof e != "symbol" ? e + "" : e, t), t);
17
+ function _(n) {
18
+ return !(n !== n || n === 1 / 0 || n === -1 / 0);
19
19
  }
20
- function S(o, e, t) {
20
+ function S(n, e, t) {
21
21
  if (!_(e))
22
22
  throw new TypeError("Expected `limit` to be a finite number");
23
23
  if (!_(t))
24
24
  throw new TypeError("Expected `interval` to be a finite number");
25
25
  const s = [];
26
26
  let r = [], i = 0;
27
- const n = function() {
27
+ const o = function() {
28
28
  i++;
29
29
  const a = setTimeout(function() {
30
- i--, s.length > 0 && n(), r = r.filter(function(u) {
30
+ i--, s.length > 0 && o(), r = r.filter(function(u) {
31
31
  return u !== a;
32
32
  });
33
33
  }, t);
34
34
  r.indexOf(a) < 0 && r.push(a);
35
35
  const l = s.shift();
36
- l.resolve(o.apply(l.self, l.args));
36
+ l.resolve(n.apply(l.self, l.args));
37
37
  }, c = function(...a) {
38
38
  const l = this;
39
39
  return new Promise(function(u, p) {
@@ -42,7 +42,7 @@ function S(o, e, t) {
42
42
  reject: p,
43
43
  args: a,
44
44
  self: l
45
- }), i < e && n();
45
+ }), i < e && o();
46
46
  });
47
47
  };
48
48
  return c.abort = function() {
@@ -53,36 +53,36 @@ function S(o, e, t) {
53
53
  }), s.length = 0;
54
54
  }, c;
55
55
  }
56
- const C = function(o, e) {
56
+ const C = function(n, e) {
57
57
  const t = {};
58
- for (const s in o) {
59
- const r = o[s];
58
+ for (const s in n) {
59
+ const r = n[s];
60
60
  e.indexOf(s) > -1 && r !== null && (t[s] = r);
61
61
  }
62
62
  return t;
63
- }, O = (o) => o === "email", A = () => ({
63
+ }, O = (n) => n === "email", A = () => ({
64
64
  singleTag: "hr"
65
65
  }), N = () => ({
66
66
  tag: "blockquote"
67
67
  }), L = () => ({
68
68
  tag: "ul"
69
- }), M = (o) => ({
69
+ }), M = (n) => ({
70
70
  tag: [
71
71
  "pre",
72
72
  {
73
73
  tag: "code",
74
- attrs: o.attrs
74
+ attrs: n.attrs
75
75
  }
76
76
  ]
77
77
  }), z = () => ({
78
78
  singleTag: "br"
79
- }), U = (o) => ({
80
- tag: `h${o.attrs.level}`
81
- }), q = (o) => ({
79
+ }), U = (n) => ({
80
+ tag: `h${n.attrs.level}`
81
+ }), q = (n) => ({
82
82
  singleTag: [
83
83
  {
84
84
  tag: "img",
85
- attrs: C(o.attrs, ["src", "alt", "title"])
85
+ attrs: C(n.attrs, ["src", "alt", "title"])
86
86
  }
87
87
  ]
88
88
  }), H = () => ({
@@ -91,14 +91,14 @@ const C = function(o, e) {
91
91
  tag: "ol"
92
92
  }), D = () => ({
93
93
  tag: "p"
94
- }), J = (o) => ({
94
+ }), J = (n) => ({
95
95
  tag: [
96
96
  {
97
97
  tag: "span",
98
98
  attrs: {
99
99
  ["data-type"]: "emoji",
100
- ["data-name"]: o.attrs.name,
101
- emoji: o.attrs.emoji
100
+ ["data-name"]: n.attrs.name,
101
+ emoji: n.attrs.emoji
102
102
  }
103
103
  }
104
104
  ]
@@ -114,8 +114,8 @@ const C = function(o, e) {
114
114
  tag: "code"
115
115
  }), G = () => ({
116
116
  tag: "i"
117
- }), Q = (o) => {
118
- const e = { ...o.attrs }, { linktype: t = "url" } = o.attrs;
117
+ }), Q = (n) => {
118
+ const e = { ...n.attrs }, { linktype: t = "url" } = n.attrs;
119
119
  if (O(t) && (e.href = `mailto:${e.href}`), e.anchor && (e.href = `${e.href}#${e.anchor}`, delete e.anchor), e.custom) {
120
120
  for (const s in e.custom)
121
121
  e[s] = e.custom[s];
@@ -129,46 +129,46 @@ const C = function(o, e) {
129
129
  }
130
130
  ]
131
131
  };
132
- }, X = (o) => ({
132
+ }, X = (n) => ({
133
133
  tag: [
134
134
  {
135
135
  tag: "span",
136
- attrs: o.attrs
136
+ attrs: n.attrs
137
137
  }
138
138
  ]
139
139
  }), Z = () => ({
140
140
  tag: "sub"
141
141
  }), ee = () => ({
142
142
  tag: "sup"
143
- }), te = (o) => ({
143
+ }), te = (n) => ({
144
144
  tag: [
145
145
  {
146
146
  tag: "span",
147
- attrs: o.attrs
147
+ attrs: n.attrs
148
148
  }
149
149
  ]
150
- }), se = (o) => {
150
+ }), se = (n) => {
151
151
  var e;
152
- return (e = o.attrs) != null && e.color ? {
152
+ return (e = n.attrs) != null && e.color ? {
153
153
  tag: [
154
154
  {
155
155
  tag: "span",
156
156
  attrs: {
157
- style: `background-color:${o.attrs.color};`
157
+ style: `background-color:${n.attrs.color};`
158
158
  }
159
159
  }
160
160
  ]
161
161
  } : {
162
162
  tag: ""
163
163
  };
164
- }, re = (o) => {
164
+ }, re = (n) => {
165
165
  var e;
166
- return (e = o.attrs) != null && e.color ? {
166
+ return (e = n.attrs) != null && e.color ? {
167
167
  tag: [
168
168
  {
169
169
  tag: "span",
170
170
  attrs: {
171
- style: `color:${o.attrs.color}`
171
+ style: `color:${n.attrs.color}`
172
172
  }
173
173
  }
174
174
  ]
@@ -204,7 +204,7 @@ const C = function(o, e) {
204
204
  highlight: se,
205
205
  textStyle: re
206
206
  }
207
- }, oe = function(o) {
207
+ }, ne = function(n) {
208
208
  const e = {
209
209
  "&": "&amp;",
210
210
  "<": "&lt;",
@@ -212,7 +212,7 @@ const C = function(o, e) {
212
212
  '"': "&quot;",
213
213
  "'": "&#39;"
214
214
  }, t = /[&<>"']/g, s = RegExp(t.source);
215
- return o && s.test(o) ? o.replace(t, (r) => e[r]) : o;
215
+ return n && s.test(n) ? n.replace(t, (r) => e[r]) : n;
216
216
  };
217
217
  class y {
218
218
  constructor(e) {
@@ -259,9 +259,9 @@ class y {
259
259
  ), "";
260
260
  }
261
261
  optimizeImages(e, t) {
262
- let s = 0, r = 0, i = "", n = "";
263
- typeof t != "boolean" && (typeof t.width == "number" && t.width > 0 && (i += `width="${t.width}" `, s = t.width), typeof t.height == "number" && t.height > 0 && (i += `height="${t.height}" `, r = t.height), (t.loading === "lazy" || t.loading === "eager") && (i += `loading="${t.loading}" `), typeof t.class == "string" && t.class.length > 0 && (i += `class="${t.class}" `), t.filters && (typeof t.filters.blur == "number" && t.filters.blur >= 0 && t.filters.blur <= 100 && (n += `:blur(${t.filters.blur})`), typeof t.filters.brightness == "number" && t.filters.brightness >= -100 && t.filters.brightness <= 100 && (n += `:brightness(${t.filters.brightness})`), t.filters.fill && (t.filters.fill.match(/[0-9A-Fa-f]{6}/g) || t.filters.fill === "transparent") && (n += `:fill(${t.filters.fill})`), t.filters.format && ["webp", "png", "jpeg"].includes(t.filters.format) && (n += `:format(${t.filters.format})`), typeof t.filters.grayscale == "boolean" && t.filters.grayscale && (n += ":grayscale()"), typeof t.filters.quality == "number" && t.filters.quality >= 0 && t.filters.quality <= 100 && (n += `:quality(${t.filters.quality})`), t.filters.rotate && [90, 180, 270].includes(t.filters.rotate) && (n += `:rotate(${t.filters.rotate})`), n.length > 0 && (n = "/filters" + n))), i.length > 0 && (e = e.replace(/<img/g, `<img ${i.trim()}`));
264
- const c = s > 0 || r > 0 || n.length > 0 ? `${s}x${r}${n}` : "";
262
+ let s = 0, r = 0, i = "", o = "";
263
+ typeof t != "boolean" && (typeof t.width == "number" && t.width > 0 && (i += `width="${t.width}" `, s = t.width), typeof t.height == "number" && t.height > 0 && (i += `height="${t.height}" `, r = t.height), (t.loading === "lazy" || t.loading === "eager") && (i += `loading="${t.loading}" `), typeof t.class == "string" && t.class.length > 0 && (i += `class="${t.class}" `), t.filters && (typeof t.filters.blur == "number" && t.filters.blur >= 0 && t.filters.blur <= 100 && (o += `:blur(${t.filters.blur})`), typeof t.filters.brightness == "number" && t.filters.brightness >= -100 && t.filters.brightness <= 100 && (o += `:brightness(${t.filters.brightness})`), t.filters.fill && (t.filters.fill.match(/[0-9A-Fa-f]{6}/g) || t.filters.fill === "transparent") && (o += `:fill(${t.filters.fill})`), t.filters.format && ["webp", "png", "jpeg"].includes(t.filters.format) && (o += `:format(${t.filters.format})`), typeof t.filters.grayscale == "boolean" && t.filters.grayscale && (o += ":grayscale()"), typeof t.filters.quality == "number" && t.filters.quality >= 0 && t.filters.quality <= 100 && (o += `:quality(${t.filters.quality})`), t.filters.rotate && [90, 180, 270].includes(t.filters.rotate) && (o += `:rotate(${t.filters.rotate})`), o.length > 0 && (o = "/filters" + o))), i.length > 0 && (e = e.replace(/<img/g, `<img ${i.trim()}`));
264
+ const c = s > 0 || r > 0 || o.length > 0 ? `${s}x${r}${o}` : "";
265
265
  return e = e.replace(
266
266
  /a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g,
267
267
  `a.storyblok.com/f/$1/$2.$3/m/${c}`
@@ -274,10 +274,10 @@ class y {
274
274
  const g = {
275
275
  srcset: (l = t.srcset) == null ? void 0 : l.map((d) => {
276
276
  if (typeof d == "number")
277
- return `//${p}/m/${d}x0${n} ${d}w`;
277
+ return `//${p}/m/${d}x0${o} ${d}w`;
278
278
  if (typeof d == "object" && d.length === 2) {
279
279
  let v = 0, $ = 0;
280
- return typeof d[0] == "number" && (v = d[0]), typeof d[1] == "number" && ($ = d[1]), `//${p}/m/${v}x${$}${n} ${v}w`;
280
+ return typeof d[0] == "number" && (v = d[0]), typeof d[1] == "number" && ($ = d[1]), `//${p}/m/${v}x${$}${o} ${v}w`;
281
281
  }
282
282
  }).join(", "),
283
283
  sizes: (u = t.sizes) == null ? void 0 : u.map((d) => d).join(", ")
@@ -297,7 +297,7 @@ class y {
297
297
  const s = this.getMatchingNode(e);
298
298
  return s && s.tag && t.push(this.renderOpeningTag(s.tag)), e.content ? e.content.forEach((r) => {
299
299
  t.push(this.renderNode(r));
300
- }) : e.text ? t.push(oe(e.text)) : s && s.singleTag ? t.push(this.renderTag(s.singleTag, " /")) : s && s.html ? t.push(s.html) : e.type === "emoji" && t.push(this.renderEmoji(e)), s && s.tag && t.push(this.renderClosingTag(s.tag)), e.marks && e.marks.slice(0).reverse().forEach((r) => {
300
+ }) : e.text ? t.push(ne(e.text)) : s && s.singleTag ? t.push(this.renderTag(s.singleTag, " /")) : s && s.html ? t.push(s.html) : e.type === "emoji" && t.push(this.renderEmoji(e)), s && s.tag && t.push(this.renderClosingTag(s.tag)), e.marks && e.marks.slice(0).reverse().forEach((r) => {
301
301
  const i = this.getMatchingMark(r);
302
302
  i && i.tag !== "" && t.push(this.renderClosingTag(i.tag));
303
303
  }), t.join("");
@@ -310,8 +310,8 @@ class y {
310
310
  let r = `<${s.tag}`;
311
311
  if (s.attrs)
312
312
  for (const i in s.attrs) {
313
- const n = s.attrs[i];
314
- n !== null && (r += ` ${i}="${n}"`);
313
+ const o = s.attrs[i];
314
+ o !== null && (r += ` ${i}="${o}"`);
315
315
  }
316
316
  return `${r}${t}>`;
317
317
  }
@@ -358,7 +358,7 @@ class k {
358
358
  page: s
359
359
  })), h(this, "delay", (e) => new Promise((t) => setTimeout(t, e))), h(this, "arrayFrom", (e = 0, t) => [...Array(e)].map(t)), h(this, "range", (e = 0, t = e) => {
360
360
  const s = Math.abs(t - e) || 0, r = e < t ? 1 : -1;
361
- return this.arrayFrom(s, (i, n) => n * r + e);
361
+ return this.arrayFrom(s, (i, o) => o * r + e);
362
362
  }), h(this, "asyncMap", async (e, t) => Promise.all(e.map(t))), h(this, "flatMap", (e = [], t) => e.map(t).reduce((s, r) => [...s, ...r], []));
363
363
  }
364
364
  /**
@@ -373,13 +373,13 @@ class k {
373
373
  for (const i in e) {
374
374
  if (!Object.prototype.hasOwnProperty.call(e, i))
375
375
  continue;
376
- const n = e[i], c = s ? "" : encodeURIComponent(i);
376
+ const o = e[i], c = s ? "" : encodeURIComponent(i);
377
377
  let a;
378
- typeof n == "object" ? a = this.stringify(
379
- n,
378
+ typeof o == "object" ? a = this.stringify(
379
+ o,
380
380
  t ? t + encodeURIComponent("[" + c + "]") : c,
381
- Array.isArray(n)
382
- ) : a = (t ? t + encodeURIComponent("[" + c + "]") : c) + "=" + encodeURIComponent(n), r.push(a);
381
+ Array.isArray(o)
382
+ ) : a = (t ? t + encodeURIComponent("[" + c + "]") : c) + "=" + encodeURIComponent(o), r.push(a);
383
383
  }
384
384
  return r.join("&");
385
385
  }
@@ -400,7 +400,7 @@ class k {
400
400
  }
401
401
  }
402
402
  }
403
- class ne {
403
+ class oe {
404
404
  constructor(e) {
405
405
  h(this, "baseURL"), h(this, "timeout"), h(this, "headers"), h(this, "responseInterceptor"), h(this, "fetch"), h(this, "ejectInterceptor"), h(this, "url"), h(this, "parameters"), 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 = {};
406
406
  }
@@ -445,7 +445,7 @@ class ne {
445
445
  )}`;
446
446
  } else
447
447
  s = JSON.stringify(this.parameters);
448
- const r = new URL(t), i = new AbortController(), { signal: n } = i;
448
+ const r = new URL(t), i = new AbortController(), { signal: o } = i;
449
449
  let c;
450
450
  this.timeout && (c = setTimeout(() => i.abort(), this.timeout));
451
451
  try {
@@ -453,7 +453,7 @@ class ne {
453
453
  method: e,
454
454
  headers: this.headers,
455
455
  body: s,
456
- signal: n
456
+ signal: o
457
457
  });
458
458
  this.timeout && clearTimeout(c);
459
459
  const l = await this._responseHandler(a);
@@ -490,19 +490,21 @@ class ae {
490
490
  * @param endpoint string, optional
491
491
  */
492
492
  constructor(e, t) {
493
- if (h(this, "client"), h(this, "maxRetries"), h(this, "throttle"), h(this, "accessToken"), h(this, "cache"), h(this, "helpers"), h(this, "resolveCounter"), h(this, "relations"), h(this, "links"), h(this, "richTextResolver"), h(this, "resolveNestedRelations"), !t) {
494
- const i = new k().getRegionURL, n = e.https === !1 ? "http" : "https";
495
- e.oauthToken ? t = `${n}://${i(e.region)}/v1` : t = `${n}://${i(e.region)}/v2`;
493
+ h(this, "client"), h(this, "maxRetries"), h(this, "throttle"), h(this, "accessToken"), h(this, "cache"), h(this, "helpers"), h(this, "resolveCounter"), h(this, "relations"), h(this, "links"), h(this, "richTextResolver"), h(this, "resolveNestedRelations");
494
+ let s = e.endpoint || t;
495
+ if (!s) {
496
+ const o = new k().getRegionURL, c = e.https === !1 ? "http" : "https";
497
+ e.oauthToken ? s = `${c}://${o(e.region)}/v1` : s = `${c}://${o(e.region)}/v2`;
496
498
  }
497
- const s = new Headers();
498
- s.set("Content-Type", "application/json"), s.set("Accept", "application/json"), s.forEach((i, n) => {
499
- e.headers && e.headers[n] && s.set(n, e.headers[n]);
499
+ const r = new Headers();
500
+ r.set("Content-Type", "application/json"), r.set("Accept", "application/json"), r.forEach((o, c) => {
501
+ e.headers && e.headers[c] && r.set(c, e.headers[c]);
500
502
  });
501
- let r = 5;
502
- e.oauthToken && (s.set("Authorization", e.oauthToken), r = 3), e.rateLimit && (r = e.rateLimit), e.richTextSchema ? this.richTextResolver = new y(e.richTextSchema) : this.richTextResolver = new y(), e.componentResolver && this.setComponentResolver(e.componentResolver), this.maxRetries = e.maxRetries || 5, this.throttle = S(this.throttledRequest, r, 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.helpers = new k(), this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.client = new ne({
503
- baseURL: t,
503
+ let i = 5;
504
+ e.oauthToken && (r.set("Authorization", e.oauthToken), i = 3), e.rateLimit && (i = e.rateLimit), e.richTextSchema ? this.richTextResolver = new y(e.richTextSchema) : this.richTextResolver = new y(), e.componentResolver && this.setComponentResolver(e.componentResolver), this.maxRetries = e.maxRetries || 5, this.throttle = S(this.throttledRequest, i, 1e3), this.accessToken = e.accessToken || "", this.relations = {}, this.links = {}, this.cache = e.cache || { clear: "manual" }, this.helpers = new k(), this.resolveCounter = 0, this.resolveNestedRelations = e.resolveNestedRelations || !0, this.client = new oe({
505
+ baseURL: s,
504
506
  timeout: e.timeout || 0,
505
- headers: s,
507
+ headers: r,
506
508
  responseInterceptor: e.responseInterceptor,
507
509
  fetch: e.fetch
508
510
  });
@@ -536,7 +538,7 @@ class ae {
536
538
  return this.cacheResponse(s, r);
537
539
  }
538
540
  async getAll(e, t, s) {
539
- const r = (t == null ? void 0 : t.per_page) || 25, i = `/${e}`, n = i.split("/"), c = s || n[n.length - 1], a = 1, l = await this.makeRequest(i, t, r, a), u = l.total ? Math.ceil(l.total / r) : 1, p = await this.helpers.asyncMap(
541
+ const r = (t == null ? void 0 : t.per_page) || 25, i = `/${e}`, o = i.split("/"), c = s || o[o.length - 1], a = 1, l = await this.makeRequest(i, t, r, a), u = l.total ? Math.ceil(l.total / r) : 1, p = await this.helpers.asyncMap(
540
542
  this.helpers.range(a, u),
541
543
  (g) => this.makeRequest(i, t, r, g + 1)
542
544
  );
@@ -584,8 +586,8 @@ class ae {
584
586
  ));
585
587
  else if (e[t] && e[t].constructor === Array) {
586
588
  const i = [];
587
- e[t].forEach((n) => {
588
- this.relations[r][n] && i.push(this._cleanCopy(this.relations[r][n]));
589
+ e[t].forEach((o) => {
590
+ this.relations[r][o] && i.push(this._cleanCopy(this.relations[r][o]));
589
591
  }), e[t] = i;
590
592
  }
591
593
  }
@@ -594,22 +596,22 @@ class ae {
594
596
  const r = (i) => {
595
597
  if (i != null) {
596
598
  if (i.constructor === Array)
597
- for (let n = 0; n < i.length; n++)
598
- r(i[n]);
599
+ for (let o = 0; o < i.length; o++)
600
+ r(i[o]);
599
601
  else if (i.constructor === Object) {
600
602
  if (i._stopResolving)
601
603
  return;
602
- for (const n in i)
604
+ for (const o in i)
603
605
  (i.component && i._uid || i.type === "link") && (this._insertRelations(
604
606
  i,
605
- n,
607
+ o,
606
608
  t,
607
609
  s
608
610
  ), this._insertLinks(
609
611
  i,
610
- n,
612
+ o,
611
613
  s
612
- )), r(i[n]);
614
+ )), r(i[o]);
613
615
  }
614
616
  }
615
617
  };
@@ -618,17 +620,17 @@ class ae {
618
620
  async resolveLinks(e, t, s) {
619
621
  let r = [];
620
622
  if (e.link_uuids) {
621
- const i = e.link_uuids.length, n = [], c = 50;
623
+ const i = e.link_uuids.length, o = [], c = 50;
622
624
  for (let a = 0; a < i; a += c) {
623
625
  const l = Math.min(i, a + c);
624
- n.push(e.link_uuids.slice(a, l));
626
+ o.push(e.link_uuids.slice(a, l));
625
627
  }
626
- for (let a = 0; a < n.length; a++)
628
+ for (let a = 0; a < o.length; a++)
627
629
  (await this.getStories({
628
630
  per_page: c,
629
631
  language: t.language,
630
632
  version: t.version,
631
- by_uuids: n[a].join(",")
633
+ by_uuids: o[a].join(",")
632
634
  })).data.stories.forEach(
633
635
  (l) => {
634
636
  r.push(l);
@@ -646,17 +648,17 @@ class ae {
646
648
  async resolveRelations(e, t, s) {
647
649
  let r = [];
648
650
  if (e.rel_uuids) {
649
- const i = e.rel_uuids.length, n = [], c = 50;
651
+ const i = e.rel_uuids.length, o = [], c = 50;
650
652
  for (let a = 0; a < i; a += c) {
651
653
  const l = Math.min(i, a + c);
652
- n.push(e.rel_uuids.slice(a, l));
654
+ o.push(e.rel_uuids.slice(a, l));
653
655
  }
654
- for (let a = 0; a < n.length; a++)
656
+ for (let a = 0; a < o.length; a++)
655
657
  (await this.getStories({
656
658
  per_page: c,
657
659
  language: t.language,
658
660
  version: t.version,
659
- by_uuids: n[a].join(",")
661
+ by_uuids: o[a].join(",")
660
662
  })).data.stories.forEach((l) => {
661
663
  r.push(l);
662
664
  });
@@ -671,26 +673,26 @@ class ae {
671
673
  }
672
674
  async resolveStories(e, t, s) {
673
675
  var r, i;
674
- let n = [];
675
- if (this.links[s] = {}, this.relations[s] = {}, 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, s)), t.resolve_links && ["1", "story", "url"].indexOf(t.resolve_links) > -1 && ((r = e.links) != null && r.length || (i = e.link_uuids) != null && i.length) && await this.resolveLinks(e, t, s), this.resolveNestedRelations)
676
+ let o = [];
677
+ if (this.links[s] = {}, this.relations[s] = {}, typeof t.resolve_relations < "u" && t.resolve_relations.length > 0 && (typeof t.resolve_relations == "string" && (o = t.resolve_relations.split(",")), await this.resolveRelations(e, t, s)), t.resolve_links && ["1", "story", "url"].indexOf(t.resolve_links) > -1 && ((r = e.links) != null && r.length || (i = e.link_uuids) != null && i.length) && await this.resolveLinks(e, t, s), this.resolveNestedRelations)
676
678
  for (const c in this.relations[s])
677
679
  this.iterateTree(
678
680
  this.relations[s][c],
679
- n,
681
+ o,
680
682
  s
681
683
  );
682
- e.story ? this.iterateTree(e.story, n, s) : e.stories.forEach((c) => {
683
- this.iterateTree(c, n, s);
684
+ e.story ? this.iterateTree(e.story, o, s) : e.stories.forEach((c) => {
685
+ this.iterateTree(c, o, s);
684
686
  }), delete this.links[s], delete this.relations[s];
685
687
  }
686
688
  async cacheResponse(e, t, s) {
687
689
  const r = this.helpers.stringify({ url: e, params: t }), i = this.cacheProvider();
688
690
  if (this.cache.clear === "auto" && t.version === "draft" && await this.flushCache(), t.version === "published" && e != "/cdn/spaces/me") {
689
- const n = await i.get(r);
690
- if (n)
691
- return Promise.resolve(n);
691
+ const o = await i.get(r);
692
+ if (o)
693
+ return Promise.resolve(o);
692
694
  }
693
- return new Promise((n, c) => {
695
+ return new Promise((o, c) => {
694
696
  try {
695
697
  (async () => {
696
698
  var a;
@@ -706,7 +708,7 @@ class ae {
706
708
  const p = this.resolveCounter = ++this.resolveCounter % 1e3;
707
709
  await this.resolveStories(u.data, t, `${p}`);
708
710
  }
709
- return t.version === "published" && e != "/cdn/spaces/me" && await i.set(r, u), u.data.cv && t.token && (t.version == "draft" && f[t.token] != u.data.cv && await this.flushCache(), f[t.token] = u.data.cv), n(u);
711
+ return t.version === "published" && e != "/cdn/spaces/me" && await i.set(r, u), u.data.cv && t.token && (t.version == "draft" && f[t.token] != u.data.cv && await this.flushCache(), f[t.token] = u.data.cv), o(u);
710
712
  } catch (l) {
711
713
  return c(l);
712
714
  }
@@ -768,8 +770,8 @@ class ae {
768
770
  return await this.cacheProvider().flush(), this;
769
771
  }
770
772
  }
771
- const ce = (o = {}) => {
772
- const { apiOptions: e } = o;
773
+ const ce = (n = {}) => {
774
+ const { apiOptions: e } = n;
773
775
  if (!e.accessToken) {
774
776
  console.error(
775
777
  "You need to provide an access token to interact with Storyblok API. Read https://www.storyblok.com/docs/api/content-delivery#topics/authentication"
@@ -777,11 +779,11 @@ const ce = (o = {}) => {
777
779
  return;
778
780
  }
779
781
  return { storyblokApi: new ae(e) };
780
- }, he = (o) => {
781
- if (typeof o != "object" || typeof o._editable > "u")
782
+ }, he = (n) => {
783
+ if (typeof n != "object" || typeof n._editable > "u")
782
784
  return {};
783
785
  const e = JSON.parse(
784
- o._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
786
+ n._editable.replace(/^<!--#storyblok#/, "").replace(/-->$/, "")
785
787
  );
786
788
  return {
787
789
  "data-blok-c": JSON.stringify(e),
@@ -789,23 +791,23 @@ const ce = (o = {}) => {
789
791
  };
790
792
  };
791
793
  let w;
792
- const x = "https://app.storyblok.com/f/storyblok-v2-latest.js", ue = (o, e, t = {}) => {
794
+ const x = "https://app.storyblok.com/f/storyblok-v2-latest.js", ue = (n, e, t = {}) => {
793
795
  var c;
794
- const r = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", n = +new URL((c = window.location) == null ? void 0 : c.href).searchParams.get(
796
+ const r = !(typeof window > "u") && typeof window.storyblokRegisterEvent < "u", o = +new URL((c = window.location) == null ? void 0 : c.href).searchParams.get(
795
797
  "_storyblok"
796
- ) === o;
797
- if (!(!r || !n)) {
798
- if (!o) {
798
+ ) === n;
799
+ if (!(!r || !o)) {
800
+ if (!n) {
799
801
  console.warn("Story ID is not defined. Please provide a valid ID.");
800
802
  return;
801
803
  }
802
804
  window.storyblokRegisterEvent(() => {
803
805
  new window.StoryblokBridge(t).on(["input", "published", "change"], (l) => {
804
- l.action === "input" && l.story.id === o ? e(l.story) : (l.action === "change" || l.action === "published") && l.storyId === o && window.location.reload();
806
+ l.action === "input" && l.story.id === n ? e(l.story) : (l.action === "change" || l.action === "published") && l.storyId === n && window.location.reload();
805
807
  });
806
808
  });
807
809
  }
808
- }, pe = (o = {}) => {
810
+ }, pe = (n = {}) => {
809
811
  var u, p;
810
812
  const {
811
813
  bridge: e,
@@ -813,17 +815,17 @@ const x = "https://app.storyblok.com/f/storyblok-v2-latest.js", ue = (o, e, t =
813
815
  use: s = [],
814
816
  apiOptions: r = {},
815
817
  richText: i = {}
816
- } = o;
818
+ } = n;
817
819
  r.accessToken = r.accessToken || t;
818
- const n = { bridge: e, apiOptions: r };
820
+ const o = { bridge: e, apiOptions: r };
819
821
  let c = {};
820
822
  s.forEach((g) => {
821
- c = { ...c, ...g(n) };
823
+ c = { ...c, ...g(o) };
822
824
  });
823
825
  const l = !(typeof window > "u") && ((p = (u = window.location) == null ? void 0 : u.search) == null ? void 0 : p.includes("_storyblok_tk"));
824
826
  return e !== !1 && l && j(x), w = new y(i.schema), i.resolver && E(w, i.resolver), c;
825
- }, E = (o, e) => {
826
- o.addNode("blok", (t) => {
827
+ }, E = (n, e) => {
828
+ n.addNode("blok", (t) => {
827
829
  let s = "";
828
830
  return t.attrs.body.forEach((r) => {
829
831
  s += e(r.component, r);
@@ -831,10 +833,10 @@ const x = "https://app.storyblok.com/f/storyblok-v2-latest.js", ue = (o, e, t =
831
833
  html: s
832
834
  };
833
835
  });
834
- }, le = (o) => {
836
+ }, le = (n) => {
835
837
  var e, t;
836
- return !o || ((e = o == null ? void 0 : o.content) == null ? void 0 : e[0].type) !== "blok" && !((t = o == null ? void 0 : o.content) != null && t[0].content);
837
- }, de = (o, e, t) => {
838
+ return !n || ((e = n == null ? void 0 : n.content) == null ? void 0 : e[0].type) !== "blok" && !((t = n == null ? void 0 : n.content) != null && t[0].content);
839
+ }, de = (n, e, t) => {
838
840
  let s = t || w;
839
841
  if (!s) {
840
842
  console.error(
@@ -842,7 +844,7 @@ const x = "https://app.storyblok.com/f/storyblok-v2-latest.js", ue = (o, e, t =
842
844
  );
843
845
  return;
844
846
  }
845
- return le(o) ? "" : (e && (s = new y(e.schema), e.resolver && E(s, e.resolver)), s.render(o));
847
+ return le(n) ? "" : (e && (s = new y(e.schema), e.resolver && E(s, e.resolver)), s.render(n));
846
848
  }, ge = () => j(x);
847
849
  export {
848
850
  y as RichTextResolver,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storyblok/js",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "SDK to integrate Storyblok into your project using JavaScript.",
5
5
  "main": "./dist/storyblok-js.js",
6
6
  "module": "./dist/storyblok-js.mjs",
@@ -28,7 +28,7 @@
28
28
  "prepublishOnly": "npm run build && cp ../README.md ./"
29
29
  },
30
30
  "dependencies": {
31
- "storyblok-js-client": "^5.10.6"
31
+ "storyblok-js-client": "^5.11.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@tsconfig/recommended": "^1.0.1",
@@ -38,7 +38,7 @@
38
38
  "isomorphic-fetch": "^3.0.0",
39
39
  "start-server-and-test": "^1.15.2",
40
40
  "vite": "^4.0.4",
41
- "vitest": "^0.31.1"
41
+ "vitest": "^0.32.2"
42
42
  },
43
43
  "babel": {
44
44
  "presets": [