1import{af as ce,f as I,o as M,b as _,t as x,F as le,G as ue,ax as Z,ay as k,au as A,r as S,ag as de,az as C,aq as me,aA as fe,an as pe,ae as ge,a8 as he,N as ve,am as J,al as ye,ah as we,g as Ae}from"./B0CrMWu2.js";const Ce=0,Pe=1,Ee=2,be={content:Oe,availableComponents:$e,showAddButton:Te,activationStatus:De},E={content:["@path",""],dialog:["dialog","",h]},_e={name:["@name",""],content:E.content,dialog:E.dialog,availableComponents:["availableComponents",[]],type:["type","list",h],label:["title","",h],inherit:["inheritance",!1,h],optional:["optional",!1,h],createdAreaNode:["createAreaNode",!0,h],showAddButton:["maxComponents",!0],showNewComponentArea:[null,!0],description:["description","",h],activationStatus:[null,0]},Se={content:E.content,dialog:E.dialog,label:["title","",h],description:["description","",h],activationStatus:[null,0]};function L(e,t,n,a){const r=[];return Object.keys(t).forEach(i=>{const[o,c,f]=t[i],d=be[i];let u=c;d?u=d(e,o,n,a):f?u=f(n,o,c):e!=null&&o!==null&&(u=e[o]||"");const s={value:u};(typeof s.value!="string"||s.value)&&r.push(`${i}="${s.value}"`)}),r.join(" ")}function $e(e,t,n){return!n||!n[t]?"":Object.keys(n[t]).map(a=>n[t][a].id).join(",")}function Te(e,t,n,a){return!n||n.maxComponents==null||!a||a.componentCount==null?!0:a.componentCount<n.maxComponents}function h(e,t,n){let a=e&&typeof e=="object"&&t?e[t]:null;return a=a??n,a=typeof n=="boolean"?!!a:a,a??n}function Oe(e,t){const n=e?e[t]:null;return n!=null?`website:${n}`:""}function Re(e,t){if(!e||!t)return e;const n=JSON.parse(JSON.stringify(e));return Object.keys(t).forEach(a=>{if(a.includes(e==null?void 0:e["@path"])&&t[a].startsWith("cms:area")){const r=a.split("/").pop();r in e||(n[r]={"@path":`${e==null?void 0:e["@path"]}/${r}`,"@nodes":[],"@id":`${e==null?void 0:e["@path"]}/${r}`})}}),n}function De(e){if(!e||!e["mgnl:activationStatus"]||e["mgnl:activationStatus"]==="false")return Ce;const t=e["mgnl:lastModified"]?new Date(e["mgnl:lastModified"]):null,n=e["mgnl:lastActivated"]?new Date(e["mgnl:lastActivated"]):null;return t&&n&&t.getTime()>n.getTime()?Pe:Ee}const Ve=(e,t)=>`cms:page ${L(e,E,t)}`,Ie=(e,t,n)=>{const a={componentCount:n},r=t&&t.areas?t.areas[e["@name"]]:{};return`cms:area ${L(e,_e,r,a)}`},Me=(e,t)=>`cms:component ${L(e,Se,t)}`,ee={getAreaCommentString:Ie,getComponentCommentString:Me,getPageCommentString:Ve,generateMissingAreas:Re};function xe(e){try{const t=/^http(s?):\/\//i.test(e)?e:"http://valid-url.com"+(e.startsWith("/")?e:"/"+e);return new URL(t)}catch{return console.warn("requestUrl is not a valid URL"),!1}}function je(e,t,n){const a=xe(e),r={isMagnolia:!1,isMagnoliaEdit:!1,isMagnoliaPreview:!1,version:void 0,nodePath:void 0,currentLanguage:void 0,searchParams:void 0,search:void 0};if(a){const i=a.pathname,o=new URLSearchParams(a.search),c=o.get("mgnlPreview"),f=o.get("mgnlPreviewAsVisitor"),d=o.get("mgnlVersion"),u=c??f;u&&(r.isMagnolia=!0,u==="false"&&(r.isMagnoliaEdit=!0),u==="true"&&(r.isMagnoliaPreview=!0)),r.isMagnolia&&!f&&o.set("variants","all"),d?(r.version=d,o.set("version",d)):delete r.version,n&&(r.currentLanguage=n[0],n.some(function(s){return new RegExp("/"+s+"($|/)").test(i)?(r.currentLanguage=s,!0):!1}),o.set("lang",r.currentLanguage)),t&&(r.nodePath=t+i.replace(new RegExp("(.*"+t+"|.html|/$)","g"),""),r.currentLanguage&&(r.nodePath=r.nodePath.replace(new RegExp("/"+r.currentLanguage+"($|/)"),"/")),r.nodePath.slice(-1)==="/"&&(r.nodePath=r.nodePath.slice(0,-1))),r.searchParams=Object.fromEntries(o),r.search="?"+o.toString()}return r}const N=()=>{try{const{href:e}=window.parent.location;return e!=null}catch{return!1}};function b(){if(!(typeof window>"u"))return N()?window.parent:window}const P={serverUrl:N()&&typeof window<"u"?b().location.href:""},Ue=e=>new Promise(t=>{setTimeout(t,e)}),Fe=async e=>{for(;!e();)await Ue(200);return e()},Le=()=>typeof window<"u"?window!==window.parent:!1,Ne=()=>{const e=b();return new URLSearchParams(e.location.search).get("mgnlPreviewAsVisitor")==="true"},te=()=>P.serverUrl.endsWith(":edit"),Be=async()=>await Fe(()=>P.serverUrl.length>0)?P.serverUrl.endsWith(":edit"):!1,ze=()=>P.serverUrl.endsWith(":view"),He=()=>te()||!P.serverUrl;let j=null;const ne=e=>{j&&clearTimeout(j),j=setTimeout(We,e)},We=()=>{const e=b();e.mgnlRefresh&&(document.documentElement.innerHTML.indexOf("cms:page content=")>-1?e.mgnlRefresh():ne(200))},qe=()=>b().mgnlFrameReady!==void 0,Ke=()=>{const e=b();e.mgnlFrameReady&&e.mgnlFrameReady()},Je=e=>{P.serverUrl=e},l={inEditor:te,inEditorAsync:Be,inEditorPreview:ze,inIframe:Le,isRenderingAnnotation:He,isSameOrigin:N,refresh:ne,setServerUrl:Je,isPageEditorReady:qe,onFrameReady:Ke,inPreviewAsVisitor:Ne,getMagnoliaContext:je};function R(e="log",t,...n){typeof console>"u"||console[e](t,n)}const Ge=(e,...t)=>{R("log",e,t)},Qe=(e,...t)=>{R("info",e,t)},Xe=(e,...t)=>{R("warn",e,t)},Ye=(e,...t)=>{R("error",e,t)},w={log:Ge,info:Qe,warn:Xe,error:Ye},Ze=(e,t)=>{if(!e||!t)return e;const n=t[e==null?void 0:e["@path"]],a=n?n.match(/selectedVariant="(.+)"/):null;if(!a)return e;const r=a[1];return r===e["@name"]?e:e[r]},ke=(e,t)=>!l.inIframe()||l.inPreviewAsVisitor()?e:Ze(e,t),et=(e,t)=>{if(!t)return e;const n={},a=/selectedVariant="(.+?)"/,r=/content="(.+?)"/,i=/((variants|variantTitles)=".+?")/g;return Object.entries(e).forEach(o=>{const[c,f]=o;if(a.test(f)&&c in t){let d=t[c];if(d==="original")d=c.split("/").pop(),n[c]=f.replace(a,`selectedVariant="${d}"`);else{const u=c+"/variants/"+d,s=e[u];s!=null?(n[c]=s.replace(r,f.match(r)[0]),n[c]=n[c].concat(" ",f.match(i).join(" ")),n[c]=n[c].concat(" ",`selectedVariant="${d}"`)):w.warn("Cannot find the variant with path '%s'. Please review the document https://docs.magnolia-cms.com/headless/spa-development/personalization-of-headless-SPA-projects.html#_notes.",u)}}}),{...e,...n}},T={getVariant:ke,wrap:et}
1,re=(e,t,n)=>{if(!t||typeof n!="function")return;const a=t.toLowerCase();e[a]=e[a]||[],e[a].push(n)};function tt(e){const t=new URL(e);return`${t.protocol}//${t.hostname}${t.port?`:${t.port}`:""}${t.pathname.substring(0,t.pathname.indexOf(".magnolia"))}`}function nt(e,t){return t?e[t.toLowerCase()]||[]:[]}function rt(e,t){const n="mgnlPageEditorBridge";let a=document.getElementById(n);if(a||!t){typeof e=="function"&&e();return}const r=tt(t),i=document.getElementsByTagName("script")[0];a=document.createElement("script"),a.id=n,a.src=`${r}VAADIN/widgetsets/info.magnolia.PageEditor/info.magnolia.PageEditor.nocache.js`,i.parentNode.insertBefore(a,i),a.onload=()=>{setTimeout(function c(){l.isPageEditorReady()?(l.onFrameReady(),l.refresh(),typeof e=="function"&&e()):setTimeout(c,100)},50)};const o=document.createElement("link");o.href=`${r}VAADIN/themes/pages-app/page-editor.css`,o.type="text/css",o.rel="stylesheet",document.head.insertBefore(o,document.head.firstChild)}const ae=()=>{const e={element:{dialog:"",path:"/",workspace:"website"},action:"initialize",elementType:"page"};window.parent.postMessage(JSON.stringify(e),"*")},at=(e,t)=>{typeof window>"u"||l.isSameOrigin()||(window.addEventListener("message",n=>
1{if(!n.data||!(typeof n.data=="string"&&n.data.startsWith("{")))return;const a=JSON.parse(n.data);nt(e,a.action).forEach(i=>{try{i(a)}catch(o){console.error(o)}})}),re(e,"updateState",n=>{const a=n.serverUrl;l.setServerUrl(a),rt(t,a)}),ae())},G={init:at,onMessage:re,requestServerUrl:ae},U="mgnl:template",it={name:"DefaultFallbackComponent",props:{metadata:{type:Object},data:{type:Object}},computed:{templateId(){return this.metadata[U]}},methods:{trimIfObject(e){return e==="[object Object]"?"[object]":e},formatValue(e){return this.trimIfObject(""+e)}}};function ot(e,t,n,a,r,i){return M(),I("div",null,[_("div",null,[_("strong",null,[_("em",null,"Template not found: "+x(i.templateId),1)])]),(M(!0),I(le,null,ue(n.data,(o,c)=>(M(),I("div",{key:c},x(c)+": "+x(i.formatValue(o)),1))),128)),t[0]||(t[0]=_("p",null,null,-1))])}const B=ce(it,[["render",ot]]),D=(e,t,n)=>{e&&(e.parentNode.insertBefore(document.createComment(t),e),e.parentNode.insertBefore(document.createComment(n),e.nextSibling))};function Q(e){e&&e.nodeType===8&&e.remove()}const ie=e=>{e&&(Q(e.previousSibling),Q(e.nextSibling))},O=e=>e["@name"],oe=(e,t,n)=>{if(!e||typeof e!="object")return{};const a={};let r;return n?(a.data={},r=a.data):r=a,a.metadata={"@index":t},a.key=O(e),Object.keys(e).forEach(i=>{i.match(/^(@|mgnl:|jcr:)/)?a.metadata[i]=e[i]:r[i.replace("-","_")]=e[i]}),a},se=(e,t,n,a,r)=>{if(!e)return w.error("Component content is missing"),null;if(!t)return w.error("Component mappings is missing"),null;let o=t[e[U]],c=!1;if(!o){const u=`Component with ID ${e[U]} is not mapped.`;w.error(u);const s=st(n);if(!s)return null;o=s,c=!0}const f=oe(e,r,c),d=Z(o)?k(o):o;return A(d,f,a)};function st(e){const t=typeof e=="function"?e():e;return t!=null&&typeof t!="boolean"?t:t?B:null}const z=(e,t,n,a,r=0)=>se(e,t,n,a,r),ct=Object.freeze(Object.defineProperty({__proto__:null,buildKey:O,getComponentProperties:oe,getRenderedComponent:se,insertComments:D,mgnlRender:z,removeComments:ie},Symbol.toStringTag,{value:"Module"}));function lt(){return l.inEditorAsync()}function ut(){return l.inEditorPreview()}function dt(){return l.isRenderingAnnotation()}function mt(){return l.inIframe()}function ft(){return l.isSameOrigin()}function pt(e){l.refresh(e)}function gt(e){l.setServerUrl(e)}function ht(){return l.isPageEditorReady()}function vt(){l.onFrameReady()}function yt(){return l.inPreviewAsVisitor()}function wt(e,t,n){return l.getMagnoliaContext(e,t,n)}const v={inIframe:mt,isSameOrigin:ft,refresh:pt,setServerUrl:gt,isPageEditorReady:ht,onFrameReady:vt,inPreviewAsVisitor:yt,inEditorAsync:lt,inEditorPreview:ut,isRenderingAnnotation:dt,getMagnoliaContext:wt},At={name:"EditablePage",props:{content:{type:Object},config:{type:Object,required:!0},templateAnnotations:{type:Object}},setup(e){let t={};return e.templateAnnotations&&(t=S({value:e.templateAnnotations})),{reactiveTemplateAnnotations:t}},data(){return{selectedComponentVariants:"",listeners:{}}},computed:{renderingContent(){const e=ee.generateMissingAreas(this.content,this.reactiveTemplateAnnotations.value);return T.getVariant(e,this.reactiveTemplateAnnotations.value)}},methods:{writeAnnotation(){if(this.content&&this.reactiveTemplateAnnotations.value&&this.reactiveTemplateAnnotations.value[this.renderingContent["@path"]]){ie(this.$el);const e=this.reactiveTemplateAnnotations.value[this.renderingContent["@path"]];D(this.$el,e,"/cms:page"),v.onFrameReady(),v.refresh()}},updateTemplateAnnotationsProvider(){this.reactiveTemplateAnnotations.value=T.wrap(this.templateAnnotations,this.selectedComponentVariants)}},provide(){return{config:this.config,templateAnnotations:this.reactiveTemplateAnnotations}},mounted(){v.inIframe()&&(G.onMessage(this.listeners,"updateState",e=>{this.selectedComponentVariants=e.selectedComponentVariants,this.updateTemplateAnnotationsProvider()}),G.init(this.listeners),this.writeAnnotation())},beforeUpdate(){v.inIframe()&&(this.updateTemplateAnnotationsProvider(),this.writeAnnotation())},render(){return z(this.renderingContent,this.config.componentMappings,this.config.fallbackComponent)}},Ct=At,Pt={name:"EditableComponent",inject:["config","templateAnnotations"],props:["content","index"],computed:{renderingContent(){return ee.generateMissingAreas(this.personalizedContent,this.templateAnnotations.value)}},data(){return{personalizedContent:this.content}},methods:{writeAnnotation(){if(this.content&&this.templateAnnotations.value&&this.templateAnnotations.value[this.renderingContent["@path"]]){const e=this.templateAnnotations.value[this.renderingContent["@path"]];D(this.$el,e,"/cms:component"),v.refresh()}}},async mounted(){v.inEditorAsync().then(e=>{e&&this.writeAnnotation(),this.personalizedContent=T.getVariant(this.content,this.templateAnnotations.value)})},render(){return z(this.renderingContent,this.config.componentMappings,this.config.fallbackComponent,{},this.index)}},F=Pt,Et={name:"EditableArea",components:{EditableComponent:F},inject:["config","templateAnnotations"],props:{content:{type:Object},parentTemplateId:{type:String,required:!1},elementType:{type:String,default:"div"},customView:{type:Object}},methods:{writeAnnotation(){if(this.content&&this.templateAnnotations.value&&this.templateAnnotations.value[this.content["@path"]]){const e=this.templateAnnotations.value[this.content["@path"]];D(this.$el,e,"/cms:area"),v.refresh()}}},async mounted(){await v.inEditorAsync()&&this.writeAnnotation()}
1,render(){if(!this.content)return null;const e=this.content["@nodes"].map(n=>this.content[n]);let t=[];return this.$slots.default?A(this.elementType,null,this.$slots.default({content:this.content})):(t=e.map((n,a)=>A(F,{content:n,key:O(n),index:a},null)),A(this.elementType,null,this.customView?A(this.customView,{content:this.content,key:O(this.content)}):t))}},bt=Et,X=Object.freeze(Object.defineProperty({__proto__:null,DefaultFallbackComponent:B,EditableArea:bt,EditableComponent:F,EditablePage:Ct,EditorContextHelper:v,PersonalizationService:T,helper:ct},Symbol.toStringTag,{value:"Module"})),_t={install(e){(Object.keys(X)||[]).forEach(n=>{if(n!=="helper"&&n!=="EditableMixin"){const a=X[n];e.component(a.name,a)}})}};typeof window<"u"&&window.Vue&&window.Vue.use(_t);const $="mgnl:template",Kt=(e,t,n)=>{e&&(t.includes("cms:component")||n.includes("cms:component")?(e.prepend(document.createComment(t)),e.append(document.createComment(n))):(e.parentNode.insertBefore(document.createComment(t),e),e.parentNode.insertBefore(document.createComment(n),e.nextSibling)))};function Y(e){e&&e.nodeType===8&&e.remove()}const Jt=e=>{e&&(Y(e.previousSibling),Y(e.nextSibling))},St=e=>e["@name"],$t=(e,t,n)=>{if(!e||typeof e!="object")return{};const a={};let r;return n?(a.data={},r=a.data):r=a,a.metadata={"@index":t},a.key=St(e),a.templateId=e[$],Object.keys(e).forEach(i=>{i.match(/^(@|mgnl:|jcr:|#|\d+)/)?a.metadata[i]=e[i]:r[i.replace("-","_").replace(/^style$/,"lz:style")]=e[i]}),a},Tt=(e,t,n,a,r)=>{if(!e)return w.error("Component content is missing"),null;if(!t)return w.error("Component mappings is missing"),null;let o=t[e[$]],c=!1;if(!o){const u=e[$]?`Component with ID ${e[$]} is not mapped.`:`No template ID for path ${e["@path"]}`;w.error(u);const s=Ot(n);if(!s)return null;o=s,c=!0}const f=$t(e,r,c),d=Z(o)?k(o):o;return A(d,f,a)};function Ot(e){const t=typeof e=="function"?e():e;return t!=null&&typeof t!="boolean"?t:t?B:null}const Gt=(e,t,n,a,r=0)=>Tt(e,t,n,a,r);function Rt(){return l.inEditorAsync()}function Dt(){return l.inEditorPreview()}function Vt(){return l.isRenderingAnnotation()}function It(e=500){return new Promise(t=>{setTimeout(t,e)})}async function Mt(){return await It(),l.inIframe()}function xt(){return l.isSameOrigin()}function jt(e){l.refresh(e)}function Ut(e){l.setServerUrl(e)}function Ft(){return l.isPageEditorReady()}function Lt(){l.onFrameReady()}function Nt(){return l.inPreviewAsVisitor()}function Bt(e,t,n){return l.getMagnoliaContext(e,t,n)}const Qt={inIframe:Mt,isSameOrigin:xt,refresh:jt,setServerUrl:Ut,isPageEditorReady:Ft,onFrameReady:Lt,inPreviewAsVisitor:Nt,inEditorAsync:Rt,inEditorPreview:Dt,isRenderingAnnotation:Vt,getMagnoliaContext:Bt},zt=e=>e==="defer"||e===!1;function Xt(...e){var K;const t=typeof e[e.length-1]=="string"?e.pop():void 0;typeof e[0]!="string"&&e.unshift(t);let[n,a,r={}]=e;if(typeof n!="string")throw new TypeError("[nuxt] [asyncData] key must be a string.");if(typeof a!="function")throw new TypeError("[nuxt] [asyncData] handler must be a function.");const i=de(),o=a,c=()=>C.value,f=()=>i.isHydrating?i.payload.data[n]:i.static.data[n];r.server=r.server??!0,r.default=r.default??c,r.getCachedData=r.getCachedData??f,r.lazy=r.lazy??!1,r.immediate=r.immediate??!0,r.deep=r.deep??C.deep,r.dedupe=r.dedupe??"cancel";const d=r.getCachedData(n,i),u=d!=null;if(!i._asyncData[n]||!r.immediate){(K=i.payload._errors)[n]??(K[n]=C.error
1Value);const p=r.deep?S:me;i._asyncData[n]={data:p(u?d:r.default()),pending:S(!u),error:fe(i.payload._errors,n),status:S("idle"),_default:r.default}}const s={...i._asyncData[n]};delete s._default,s.refresh=s.execute=(p={})=>{if(i._asyncDataPromises[n]){if(zt(p.dedupe??r.dedupe))return i._asyncDataPromises[n];i._asyncDataPromises[n].cancelled=!0}if(p._initial||i.isHydrating&&p._initial!==!1){const g=p._initial?d:r.getCachedData(n,i);if(g!=null)return Promise.resolve(g)}s.pending.value=!0,s.status.value="pending";const y=new Promise((g,m)=>{try{g(o(i))}catch(V){m(V)}}).then(async g=>{if(y.cancelled)return i._asyncDataPromises[n];let m=g;r.transform&&(m=await r.transform(g)),r.pick&&(m=Wt(m,r.pick)),i.payload.data[n]=m,s.data.value=m,s.error.value=C.errorValue,s.status.value="success"}).catch(g=>{if(y.cancelled)return i._asyncDataPromises[n];s.error.value=we(g),s.data.value=Ae(r.default()),s.status.value="error"}).finally(()=>{y.cancelled||(s.pending.value=!1,delete i._asyncDataPromises[n])});return i._asyncDataPromises[n]=y,i._asyncDataPromises[n]},s.clear=()=>Ht(i,n);const H=()=>s.refresh({_initial:!0}),W=r.server!==!1&&i.payload.serverRendered;{const p=pe();if(p&&W&&r.immediate&&!p.sp&&(p.sp=[]),p&&!p._nuxtOnBeforeMountCbs){p._nuxtOnBeforeMountCbs=[];const m=p._nuxtOnBeforeMountCbs;ge(()=>{m.forEach(V=>{V()}),m.splice(0,m.length)}),he(()=>m.splice(0,m.length))}W&&i.isHydrating&&(s.error.value||d!=null)?(s.pending.value=!1,s.status.value=s.error.value?"error":"success"):p&&(i.payload.serverRendered&&i.isHydrating||r.lazy)&&r.immediate?p._nuxtOnBeforeMountCbs.push(H):r.immediate&&H();const y=ye();if(r.watch){const m=ve(r.watch,()=>s.refresh());y&&J(m)}const g=i.hook("app:data:refresh",async m=>{(!m||m.includes(n))&&await s.refresh()});y&&J(g)}const q=Promise.resolve(i._asyncDataPromises[n]).then(()=>s);return Object.assign(q,s),q}function Ht(e,t){t in e.payload.data&&(e.payload.data[t]=void 0),t in e.payload._errors&&(e.payload._errors[t]=C.errorValue),e._asyncData[t]&&(e._asyncData[t].data.value=void 0,e._asyncData[t].error.value=C.errorValue,e._asyncData[t].pending.value=!1,e._asyncData[t].status.value="idle"),t in e._asyncDataPromises&&(e._asyncDataPromises[t]&&(e._asyncDataPromises[t].cancelled=!0),e._asyncDataPromises[t]=void 0)}function Wt(e,t){const n={};for(const a of t)n[a]=e[a];return n}export{Qt as E,G as P,ee as T,T as a,v as b,St as c,Kt as i,Gt as m,Jt as r,Xt as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.