1"use strict";(self.webpackChunkibm_cms_project=self.webpackChunkibm_cms_project||[]).push([[8655],{8655:function(e,t,r){r.r(t);var a=r(5909),o=r(9762),n=r(6136),s=r(7372);const i=(0,r(2024).b)("JCard");class c extends o.uA{constructor(e){super(e),this.surface=e.dataset.surface||"",this.pagePath=e.dataset.pagePath||"",this.componentId=e.id||"",this.authorMode="true"===e.dataset.authorMode,i.logInit({componentId:this.componentId,surface:this.surface,pagePath:this.pagePath,authorMode:this.authorMode}),this.surface?this.pagePath?this.resolveVariation().catch((e=>{i.logError("resolveVariation FAILED",e),this.showError()})):a.A.warn("[AjoJourneyCard] No page path â skipping initialization"):a.A.warn("[AjoJourneyCard] No surface URI â skipping initialization")}async resolveVariation(){try{const e=function(){const e=document.cookie.match(new RegExp("(?:^|;\\s*)ajo-author-preview=([^;]*)"));if(!e)return null;try{const t=JSON.parse(decodeURIComponent(e[1]));return"string"==typeof t.variationId&&t.variationId.length>0?{variationId:t.variationId}:null}catch{return null}}();let t;if(e)t=e.variationId,i.logVariationSource("preview",null,t);else{let e;try{e=await(0,n.e)(this.surface)}catch(e){if(e instanceof s.c)return i.logError("AJO Web SDK (Alloy) not available",e),void(this.authorMode?this.showAuthorPreviewUnavailable():this.showError());throw e}if(!e)return i.logDecisionEmpty(this.surface,this.surface),void this.showEmpty();t=e,i.logVariationSource("alloy",this.surface,t)}i.logDecisionVariation(t),await this.fetchAndRenderCard(t)}catch(e){i.logError("Variation resolution failed",e),this.showError()}}async fetchAndRenderCard(e){const t=`/services/ajo/journey-card?variationId=${encodeURIComponent(e)}&pagePath=${encodeURIComponent(this.pagePath)}&_=${Date.now()}`;i.logServletRequest(t);const r=await fetch(t);if(!r.ok)return i.logError(`Servlet returned ${r.status}`),void this.showError();const a=await r.json();
1i.logServletResponse(a),i.logServletMatch(a.found,e,a.pagePath),a.found?(i.logCardRender(a.pagePath||""),this.renderCard(a)):this.showEmpty()}renderCard(e){const t=this.$cmp,r=e.ctaHref||"#",a="_self",o=e.ctaText||"Read more",n="local",s=e.siteSection?e.siteSection.charAt(0).toUpperCase()+e.siteSection.slice(1):"",i=s?`<c4d-card-eyebrow slot="eyebrow" aria-hidden="true">${this.escapeHtml(s)}</c4d-card-eyebrow>`:"",c=e.offerCopy?`<c4d-card-heading role="heading" aria-level="3" slot="heading">${this.escapeHtml(e.offerCopy)}</c4d-card-heading>`:"",d=e.subcopy?`<p>${this.escapeHtml(e.subcopy)}</p>`:"";t.innerHTML=`\n <div class="card-list-item card link button" data-variation-page="${this.escapeAttr(e.pagePath||"")}">\n <a target="${this.escapeAttr(a)}" style="display: contents;" href="${this.escapeAttr(r)}">\n <c4d-card\n target="${this.escapeAttr(a)}"\n pictogram-placement="top"\n cta-type="${n}"\n grid-mode="condensed"\n no-poster="true"\n href="${this.escapeAttr(r)}">\n ${i}\n ${c}\n ${d}\n <c4d-card-footer\n icon-placement="right"\n cta-type="${n}"\n target="${this.escapeAttr(a)}"\n slot="footer"\n aria-hidden="true"\n class="cds--card__footer-icon-size"\n href="${this.escapeAttr(r)}">\n <span>${this.escapeHtml(o)}</span>\n </c4d-card-footer>\n </c4d-card>\n </a>\n </div>\n `;const h=t.querySelector("a[href]");h&&this.isCurrentPageLink(h.href)&&!this.authorMode?this.showEmpty():(this.authorMode||(t.classList.add("ajo-card-enter"),t.addEventListener("animationend",(()=>t.classList.remove("ajo-card-enter")),{once:!0})),t.removeAttribute("aria-busy"),this.hideArticleContentSlot())}hideArticleContentSlot(){if(this.authorMode)return;let e=this.$cmp.parentElement;for(;e;){const t=e.querySelector(".article-content-slot");if(t)return void t.classList.add("article-content-slot--ajo-suppressed");e=e.parentElement}}showEmpty(){const e=this.$cmp;if(e.removeAttribute("aria-busy"),e.classList.add("ajo-journey-card--empty"),this.authorMode)e.innerHTML='<p class="ajo-journey-card__empty-message">\n <strong>No matching content found.</strong><br/>\n The AJO journey state did not include a step that matches any published page.\n Verify that the taxonomy tags and content pages are configured correctly.\n </p>';else{e.innerHTML="";const t=e.parentElement?.closest(".ajo-journey-card");t&&t.classList.add("ajo-journey-card--empty")}}showError(){const e=this.$cmp;if(e.removeAttribute("aria-busy"),e.classList.add("ajo-journey-card--error"),this.authorMode)e.innerHTML='<p class="ajo-journey-card__empty-message ajo-journey-card__empty-message--error">\n <strong>Unable to load card.</strong><br/>\n An error occurred while resolving the AJO journey state.\n </p>';else{e.innerHTML="";const t=e.parentElement?.closest(".ajo-journey-card");t&&t.classList.add("ajo-journey-card--empty")}}showAuthorPreviewUnavailable(){const e=this.$cmp;e.removeAttribute("aria-busy"),e.classList.add("ajo-journey-card--unavailable"),e.innerHTML='<p class="ajo-journey-card__empty-message">\n <strong>Preview unavailable in author mode.</strong><br/>\n The AJO journey state is not published in the author editing interface.\n Use <em>View as Published</em> to preview this card.\n </p>'}escapeHtml(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}isCurrentPageLink(e){try{const t=new URL(window.location.href),r=new URL(e,t);return r.origin===t.origin&&r.pathname===t.pathname}catch{return!1}}escapeAttr(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}}t.default=c}}]);
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.