1/* Source and licensing information for the line(s) below can be found at https://www.racecase.it/core/misc/message.js. */ 2((Drupal)=>{Drupal.Message=class{constructor(messageWrapper=null){if(!messageWrapper){this.messageWrapper=Drupal.Message.defaultWrapper();}else{this.messageWrapper=messageWrapper;}} 3static defaultWrapper(){let wrapper=document.querySelector('[data-drupal-messages]');if(!wrapper){wrapper=document.querySelector('[data-drupal-messages-fallback]');wrapper.removeAttribute('data-drupal-messages-fallback');wrapper.setAttribute('data-drupal-messages','');wrapper.classList.remove('hidden');} 4return wrapper.innerHTML===''?Drupal.Message.messageInternalWrapper(wrapper):wrapper.firstElementChild;} 5static getMessageTypeLabels(){return{status:Drupal.t('Status message'),error:Drupal.t('Error message'),warning:Drupal.t('Warning message'),};} 6add(message,options={}){if(!options.hasOwnProperty('type')){options.type='status';} 7if(typeof message!=='string'){throw new Error('Message must be a string.');} 8Drupal.Message.announce(message,options);options.id=options.id?String(options.id):`${options.type}-${Math.random().toFixed(15).replace('0.', '')}`;if(!Drupal.Message.getMessageTypeLabels().hasOwnProperty(options.type)){const{type}=options;throw new Error(`The message type, ${type}, is not present in Drupal.Message.getMessageTypeLabels().`,);} 9this.messageWrapper.appendChild(Drupal.theme('message',{text:message},options),);return options.id;} 10select(id){return this.messageWrapper.querySelector(`[data-drupal-message-id^="${id}"]`,);} 11remove(id){return this.messageWrapper.removeChild(this.select(id));} 12clear(){Array.prototype.forEach.call(this.messageWrapper.querySelectorAll('[data-drupal-message-id]'),(message)=>{this.messageWrapper.removeChild(message);},);} 13static announce(message,options){if(!options.priority&&(options.type==='warning'||options.type==='error')){options.priority='assertive';} 14if(options.announce!==''){Drupal.announce(options.announce||message,options.priority);}} 15static messageInternalWrapper(messageWrapper){const innerWrapper=document.createElement('div');innerWrapper.setAttribute('class','messages__wrapper');messageWrapper.insertAdjacentElement('afterbegin',innerWrapper);return innerWrapper;}};Drupal.theme.message=({text},{type,id})=>{const messagesTypes=Drupal.Message.getMessageTypeLabels();const messageWrapper=document.createElement('div');messageWrapper.setAttribute('class',`messages messages--${type}`);messageWrapper.setAttribute('role',type==='error'||type==='warning'?'alert':'status',);messageWrapper.setAttribute('data-drupal-message-id',id);messageWrapper.setAttribute('data-drupal-message-type',type);messageWrapper.setAttribute('aria-label',messagesTypes[type]);messageWrapper.innerHTML=`${text}`;return messageWrapper;};})(Drupal); 16/* Source and licensing information for the above line(s) can be found at https://www.racecase.it/core/misc/message.js. */
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.