1/* eslint-disable */ 2import{FranklinBlock,platformFetchPage,Select,initDropdownsInLocalStorage,checkLocalStorageForDropdownOption,GetLocaleSegment}from"../../scripts/lib-franklin.js";export default class MultiIndicationDropdown extends FranklinBlock{constructor(t,o,i,n){super(t,o,i),this.options=[],this.selectedOption=null,this.parentToAppend=n,this.popupPosition="bottom-right",this.showChevron=!0,this.id=""}setPopupPosition(t){this.popupPosition=t,this.block.querySelector(".combo-menu")?.classList.remove("bottom-right","bottom-left","top-right","top-left"),this.block.querySelector(".combo-menu")?.classList.add(t)}static generateUniqueId(){return Math.floor(1e4+9e4*Math.random()).toString()}async beforeBlockRender(){let t;const o=GetLocaleSegment();try{t=await platformFetchPage("multi-indication-dropdown",`${o}/global/multi-indication-dropdown`,"/global/multi-indication-dropdown")}catch(t){return console.error(`Error fetching multi indication dropdown from ${o}/global/multi-indication-dropdown:`,t),null}if(!t)return console.error("No content found for multi indication dropdown"),null;const i=this.block.querySelector(".multi-indication-dropdown-container"),n=document.createElement("div");n.innerHTML=t;const e=n.querySelector(".core-multi-indication-dropdown");return e?e.querySelectorAll(":scope > div").forEach(t=>{const o=t.querySelectorAll("div");if(!o||o.length<2)return;const i=o[0].innerText.toLowerCase().trim(),n=o[1].innerText.trim();switch(i){case"icon":{const t=o[1].querySelector("span")?.outerHTML||"";this.inputData={...this.inputData,icon:t};break}case"default-text":this.inputData={...this.inputData,defaultMessage:n};break;case"popup-position":this.setPopupPosition(n.toLowerCase().trim());break;case"hide-chevron":this.showChevron="true"!==n.toLowerCase();break;case"dropdown-title":this.dropdownTitle=n;break;default:this.options.push({originalOption:o[0].innerText,optionValue:n})}}):console.warn("Multi indication dropdown content not found"),this.inputData={...this.inputData,options:this.options,id:this.id||MultiIndicationDropdown.generateUniqueId(),showChevron:this.showChevron,dropdownTitle:this.dropdownTitle},i}truncateText(t,o,i=!0){return t.length>o?i?`${t.substring(0,o)}...`:t.substring(0,o):t}afterBlockRender(){const t=this.block.querySelector(".js-select");if(this.selectedOption=checkLocalStorageForDropdownOption(this.inputData.id),"/"===window.location.pathname||"/index.html"===window.location.pathname)null!==this.selectedOption&&void 0!==this.selectedOption&&initDropdownsInLocalStorage(this.inputData.id,null),this.selectedOption=null;else{this.selectedOption=null;const t=window.location.href;this.options?.forEach((o,i)=>{let n=o.optionValue;n.includes("http")&&n.includes("https")||(n=n.includes(".")?`https://${n}`:`${window.location.origin}${n}`),t.includes(n)&&(this.selectedOption=i)})}new Select(t,t=>{let o=this.options[t].optionValue;o.includes("http")&&o.includes("https")||(o=o.includes(".")?`https://${o}`:`${window.location.origin}${o}`),initDropdownsInLocalStorage(this.inputData.id,t);const i=document.createElement("div");i.setAttribute("aria-live","assertive"),i.className="sr-only",i.innerText=`Redirecting to ${this.options[t].originalOption}`,document.body.appendChild(i),setTimeout(()=>{window.open(o,"_self").focus()},100)},{options:this.options.map(t=>t.originalOption),optionsValues:this.options.map(t=>t.optionValue),optionType:"button",popupPosition:this.popupPosition,defaultMessage:this.inputData.defaultMessage,withChevron:!0,transformPresentedOption:t=>(this.block.setAttribute("title",t),this.truncateText(t,27)),activeIndex:this.selectedOption,preSelectedOption:this.selectedOption},this.parentToAppend).init()}}export const schema='{\n "multi-indication-dropdown": {\n "name": "multi-indication-dropdown",\n "description": "A specialized dropdown component for managing and displaying multiple medical indications or use cases. Enables users to select and view content specific to different medical conditions or treatment scenarios while maintaining a clean and organized interface.",\n "coreBlockData": {\n "notApplicable": true\n },\n "schema": {\n "classes": []\n }\n }\n}\n';export const template=' <div class="multi-indication-dropdown-container">\n <div class="combo js-select">\n <div id="combo-{{ id }}-label" class="combo-label">{{ defaultMessage }}</div>\n <div\n aria-controls="listbox-{{ id }}"\n aria-expanded="false"\n aria-haspopup="listbox"\n aria-labelledby="combo-{{ id }}-label"\n id="combo-{{ id }}
2"\n class="combo-input"\n role="combobox"\n tabindex="0"\n >\n <div class="dropdown-left-side">\n {{#icon}}\n {{ icon }}\n {{/icon}}\n {{^icon}}\n <span class="icon icon-lib-globe1"> </span>\n {{/icon}}\n </div>\n <div class="dropdown-right-side"></div>\n </div>\n <div class="combo-menu" role="listbox" id="listbox-{{ id }}" aria-labelledby="combo-{{ id }}-label" tabindex="-1">\n {{ #dropdownTitle }}<p class="list-title">{{ dropdownTitle }}</p>{{ /dropdownTitle }}\n </div>\n </div>\n</div>\n';export const smartCaptureConfig=" {}";
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.