import{_ as w}from"./lZjBw0yj.js";import{k as N,x as R,l as S}from"./AHiYuuv4.js";import{_ as M}from"./VCQnWH0d.js";import{l as z,k as T,E as u,P as h,V as i,L as x,N as I,u as f,U as p,Q as y}from"./DEIzhR9A.js";var O=Object.defineProperty,C=(r,e,t)=>e in r?O(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,g=(r,e,t)=>(C(r,typeof e!="symbol"?e+"":e,t),t);class q{constructor(){g(this,"isCDNUrl",(e="")=>e.indexOf("/cdn/")>-1),g(this,"getOptionsPage",(e,t=25,s=1)=>({...e,per_page:t,page:s})),g(this,"delay",e=>new Promise(t=>setTimeout(t,e))),g(this,"arrayFrom",(e=0,t)=>[...Array(e)].map(t)),g(this,"range",(e=0,t=e)=>{const s=Math.abs(t-e)||0,a=e<t?1:-1;return this.arrayFrom(s,(o,n)=>n*a+e)}),g(this,"asyncMap",async(e,t)=>Promise.all(e.map(t))),g(this,"flatMap",(e=[],t)=>e.map(t).reduce((s,a)=>[...s,...a],[])),g(this,"escapeHTML",function(e){const t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},s=/[&<>"']/g,a=RegExp(s.source);return e&&a.test(e)?e.replace(s,o=>t[o]):e})}stringify(e,t,s){const a=[];for(const o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;const n=e[o],d=s?"":encodeURIComponent(o);let l;typeof n=="object"?l=this.stringify(n,t?t+encodeURIComponent("["+d+"]"):d,Array.isArray(n)):l=(t?t+encodeURIComponent("["+d+"]"):d)+"="+encodeURIComponent(n),a.push(l)}return a.join("&")}getRegionURL(e){const t="api.storyblok.com",s="api-us.storyblok.com",a="app.storyblokchina.cn",o="api-ap.storyblok.com",n="api-ca.storyblok.com";switch(e){case"us":return s;case"cn":return a;case"ap":return o;case"ca":return n;default:return t}}}const E=function(r,e){const t={};for(const s in r){const a=r[s];e.indexOf(s)>-1&&a!==null&&(t[s]=a)}return t},P=r=>r==="email",A=()=>({singleTag:"hr"}),U=()=>({tag:"blockquote"}),H=()=>({tag:"ul"}),L=r=>({tag:["pre",{tag:"code",attrs:r.attrs}]}),B=()=>({singleTag:"br"}),D=r=>({tag:`h${r.attrs.level}`}),F=r=>({singleTag:[{tag:"img",attrs:E(r.attrs,["src","alt","title"])}]}),V=()=>({tag:"li"}),Q=()=>({tag:"ol"}),W=()=>({tag:"p"}),G=r=>({tag:[{tag:"span",attrs:{"data-type":"emoji","data-name":r.attrs.name,emoji:r.attrs.emoji}}]}),J=()=>({tag:"b"}),K=()=>({tag:"s"}),X=()=>({tag:"u"}),Y=()=>({tag:"strong"}),Z=()=>({tag:"code"}),tt=()=>({tag:"i"}),et=r=>{if(!r.attrs)return{tag:""};const e=new q().escapeHTML,t={...r.attrs},{linktype:s="url"}=r.attrs;if(delete t.linktype,t.href&&(t.href=e(r.attrs.href||"")),P(s)&&(t.href=`mailto:${t.href}`),t.anchor&&(t.href=`${t.href}#${t.anchor}`,delete t.anchor),t.custom){for(const a in t.custom)t[a]=t.custom[a];delete t.custom}return{tag:[{tag:"a",attrs:t}]}},rt=r=>({tag:[{tag:"span",attrs:r.attrs}]}),st=()=>({tag:"sub"}),at=()=>({tag:"sup"}),nt=r=>({tag:[{tag:"span",attrs:r.attrs}]}),ot=r=>{var e;return(e=r.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`background-color:${r.attrs.color};`}}]}:{tag:""}},it=r=>{var e;return(e=r.attrs)!=null&&e.color?{tag:[{tag:"span",attrs:{style:`color:${r.attrs.color}`}}]}:{tag:""}},lt={nodes:{horizontal_rule:A,blockquote:U,bullet_list:H,code_block:L,hard_break:B,heading:D,image:F,list_item:V,ordered_list:Q,paragraph:W,emoji:G},marks:{bold:J,strike:K,underline:X,strong:Y,code:Z,italic:tt,link:et,styled:rt,subscript:st,superscript:at,anchor:nt,highlight:ot,textStyle:it}},ct=function(r){const e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},t=/[&<>"']/g,s=RegExp(t.source);return r&&s.test(r)?r.replace(t,a=>e[a]):r};class gt{constructor(e){g(this,"marks"),g(this,"nodes"),e||(e=lt),this.marks=e.marks||[],this.nodes=e.nodes||[]}addNode(e,t){this.nodes[e]=t}addMark(e,t){this.marks[e]=t}render(e,t={optimizeImages:!1}){if(e&&e.content&&Array.isArray(e.content)){let s="";return e.content.forEach(a=>{s+=this.renderNode(a)}),t.optimizeImages?this.optimizeImages(s,t.optimizeImages):s}return console.warn(`The render method must receive an Object with a "content" field.
			The "content" field must be an array of nodes as the type ISbRichtext.
			ISbRichtext:
				content?: ISbRichtext[]
				marks?: ISbRichtext[]
				attrs?: any
				text?: string
				type: string
				
				Example:
				{
					content: [
						{
							content: [
								{
									text: 'Hello World',
									type: 'text'
								}
							],
							type: 'paragraph'
						}
					],
					type: 'doc'
				}`),""}optimizeImages(e,t){let s=0,a=0,o="",n="";typeof t!="boolean"&&(typeof t.width=="number"&&t.width>0&&(o+=`width="${t.width}" `,s=t.width),typeof t.height=="number"&&t.height>0&&(o+=`height="${t.height}" `,a=t.height),(t.loading==="lazy"||t.loading==="eager")&&(o+=`loading="${t.loading}" `),typeof t.class=="string"&&t.class.length>0&&(o+=`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))),o.length>0&&(e=e.replace(/<img/g,`<img ${o.trim()}`));const d=s>0||a>0||n.length>0?`${s}x${a}${n}`:"";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/${d}`),typeof t!="boolean"&&(t.sizes||t.srcset)&&(e=e.replace(/<img.*?src=["|'](.*?)["|']/g,l=>{var b,$;const m=l.match(/a.storyblok.com\/f\/(\d+)\/([^.]+)\.(gif|jpg|jpeg|png|tif|tiff|bmp)/g);if(m&&m.length>0){const k={srcset:(b=t.srcset)==null?void 0:b.map(c=>{if(typeof c=="number")return`//${m}/m/${c}x0${n} ${c}w`;if(typeof c=="object"&&c.length===2){let j=0,v=0;return typeof c[0]=="number"&&(j=c[0]),typeof c[1]=="number"&&(v=c[1]),`//${m}/m/${j}x${v}${n} ${j}w`}}).join(", "),sizes:($=t.sizes)==null?void 0:$.map(c=>c).join(", ")};let _="";return k.srcset&&(_+=`srcset="${k.srcset}" `),k.sizes&&(_+=`sizes="${k.sizes}" `),l.replace(/<img/g,`<img ${_.trim()}`)}return l})),e}renderNode(e){const t=[];e.marks&&e.marks.forEach(a=>{const o=this.getMatchingMark(a);o&&o.tag!==""&&t.push(this.renderOpeningTag(o.tag))});const s=this.getMatchingNode(e);return s&&s.tag&&t.push(this.renderOpeningTag(s.tag)),e.content?e.content.forEach(a=>{t.push(this.renderNode(a))}):e.text?t.push(ct(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(a=>{const o=this.getMatchingMark(a);o&&o.tag!==""&&t.push(this.renderClosingTag(o.tag))}),t.join("")}renderTag(e,t){return e.constructor===String?`<${e}${t}>`:e.map(s=>{if(s.constructor===String)return`<${s}${t}>`;{let a=`<${s.tag}`;if(s.attrs)for(const o in s.attrs){const n=s.attrs[o];n!==null&&(a+=` ${o}="${n}"`)}return`${a}${t}>`}}).join("")}renderOpeningTag(e){return this.renderTag(e,"")}renderClosingTag(e){return e.constructor===String?`</${e}>`:e.slice(0).reverse().map(t=>t.constructor===String?`</${t}>`:`</${t.tag}>`).join("")}getMatchingNode(e){const t=this.nodes[e.type];if(typeof t=="function")return t(e)}getMatchingMark(e){const t=this.marks[e.type];if(typeof t=="function")return t(e)}renderEmoji(e){if(e.attrs.emoji)return e.attrs.emoji;const t=[{tag:"img",attrs:{src:e.attrs.fallbackImage,draggable:"false",loading:"lazy",align:"absmiddle"}}];return this.renderTag(t," /")}}const dt=["id"],mt={key:0,name:"image"},ut={name:"store-details"},ht={class:"content-around px-5 py-6 sm:px-0"},ft={class:"inline-flex w-full justify-between"},pt={class:"space-y-1"},yt={class:"font-default text-md md:text-sm"},bt={class:"font-default text-md md:text-sm"},$t={key:0,class:"text-sm"},kt={key:1,class:"font-default text-md md:text-sm"},xt={class:"my-4"},_t={class:"font-default text-md md:text-sm"},jt=["href"],vt={class:"space-y-1 font-default text-md md:text-sm"},Tt={key:0,class:"flex gap-2"},wt=["href"],Nt={key:1,class:"flex gap-2"},Rt=["href"],Ot=z({__name:"StoreCard",props:{link:{type:Object,default:()=>{}},id:{type:Number,required:!0},name:{type:String,default:""},cityName:{type:String,default:""},address:{type:Object,default:()=>{}},openingHours:{type:Object,default:()=>{}},phone:{type:[String,Object],default:""},email:{type:String,default:""},image:{type:String,default:""},alt:{type:String,default:""}},setup(r){const e=r,t=N(),s=T(()=>R(e.address).replace(/<\/?[^>]+>/gi," ")),a=new gt,o=()=>a&&typeof e.phone=="object"?a.render(e.phone).replace(/<[^>]*>?/gm,""):e.phone,n=T(()=>o());return(d,l)=>{const b=w,$=S,m=M;return u(),h("div",null,[i("article",{id:`store-${r.id}`},[r.image?(u(),h("div",mt,[x($,{to:f(t)(d.$helpers.route.getStoreDetailRoute(r.cityName))},{default:I(()=>[x(b,{provider:"storyblok",src:r.image,alt:r.alt},null,8,["src","alt"])]),_:1},8,["to"])])):p("",!0),i("div",ut,[i("div",ht,[i("div",ft,[i("div",null,[i("div",pt,[i("b",yt,y(r.cityName),1),i("p",bt,y(r.name),1),r.address?(u(),h("div",$t,[x(m,{document:r.address},null,8,["document"])])):p("",!0),r.openingHours?(u(),h("div",kt,[x(m,{document:r.openingHours},null,8,["document"])])):p("",!0)]),i("div",xt,[i("p",_t,[i("a",{href:`https://maps.google.com/?q=${r.name},${f(s)}`,target:"_blank"},y(d.$t("stores.view_map")),9,jt)])]),i("div",vt,[f(n)?(u(),h("div",Tt,[l[0]||(l[0]=i("div",null,"T:",-1)),i("a",{href:`tel:${f(n)}`},y(f(n)),9,wt)])):p("",!0),r.email?(u(),h("div",Nt,[l[1]||(l[1]=i("div",null,"M:",-1)),i("a",{href:`mailto:${r.email}`},y(r.email),9,Rt)])):p("",!0)])])])])])],8,dt)])}}});export{Ot as _};