@aurodesignsystem/auro-hyperlink
Version:
auro-hyperlink HTML custom element
379 lines (316 loc) • 42.2 kB
JavaScript
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const t$3=globalThis,i$4=t$3.trustedTypes,s$3=i$4?i$4.createPolicy("lit-html",{createHTML:t=>t}):void 0,e$6="$lit$",h$2=`lit$${(Math.random()+"").slice(9)}$`,o$5="?"+h$2,n$4=`<${o$5}>`,r$5=document,l$2=()=>r$5.createComment(""),c$4=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a$2=Array.isArray,u$2=t=>a$2(t)||"function"==typeof t?.[Symbol.iterator],d$2="[ \t\n\f\r]",f$2=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d$2}(?:([^\\s"'>=/]+)(${d$2}*=${d$2}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p$2=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,y$2=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y$2(1),w=Symbol.for("lit-noChange"),T=Symbol.for("lit-nothing"),A=new WeakMap,E=r$5.createTreeWalker(r$5,129);function C(t,i){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s$3?s$3.createHTML(i):i}const P=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":"",c=f$2;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f$2?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f$2,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p$2):c===g||c===p$2?c=m:c===v||c===_?c=f$2:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f$2?s+n$4:d>=0?(o.push(a),s.slice(0,d)+e$6+s.slice(d)+h$2+x):s+h$2+(-2===d?i:x);}return [C(t,l+(t[s]||"<?>")+(2===i?"</svg>":"")),o]};class V{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=P(t,s);if(this.el=V.createElement(f,n),E.currentNode=this.el.content,2===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=E.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e$6)){const i=v[a++],s=r.getAttribute(t).split(h$2),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?k:"?"===e[1]?H:"@"===e[1]?I:R}),r.removeAttribute(t);}else t.startsWith(h$2)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h$2),s=t.length-1;if(s>0){r.textContent=i$4?i$4.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l$2()),E.nextNode(),d.push({type:2,index:++c});r.append(t[s],l$2());}}}else if(8===r.nodeType)if(r.data===o$5)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h$2,t+1));)d.push({type:7,index:c}),t+=h$2.length-1;}c++;}}static createElement(t,i){const s=r$5.createElement("template");return s.innerHTML=t,s}}function N(t,i,s=t,e){if(i===w)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c$4(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(!1),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=N(t,h._$AS(t,i.values),h,e)),i}let S$2 = class S{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??r$5).importNode(i,!0);E.currentNode=e;let h=E.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new M(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new L(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=E.nextNode(),o++);}return E.currentNode=r$5,e}p(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}};class M{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=T,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??!0;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=N(this,t,i),c$4(t)?t===T||null==t||""===t?(this._$AH!==T&&this._$AR(),this._$AH=T):t!==this._$AH&&t!==w&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):u$2(t)?this.T(t):this._(t);}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t));}_(t){this._$AH!==T&&c$4(this._$AH)?this._$AA.nextSibling.data=t:this.$(r$5.createTextNode(t)),this._$AH=t;}g(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=V.createElement(C(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new S$2(e,this),s=t.u(this.options);t.p(i),this.$(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new V(t)),i}T(t){a$2(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new M(this.k(l$2()),this.k(l$2()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class R{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=T,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=T;}_$AI(t,i=this,s,e){const h=this.strings;let o=!1;if(void 0===h)t=N(this,t,i,0),o=!c$4(t)||t!==this._$AH&&t!==w,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=N(this,e[s+n],i,n),r===w&&(r=this._$AH[n]),o||=!c$4(r)||r!==this._$AH[n],r===T?t=T:t!==T&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.O(t);}O(t){t===T?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class k extends R{constructor(){super(...arguments),this.type=3;}O(t){this.element[this.name]=t===T?void 0:t;}}class H extends R{constructor(){super(...arguments),this.type=4;}O(t){this.element.toggleAttribute(this.name,!!t&&t!==T);}}class I extends R{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=N(this,t,i,0)??T)===w)return;const s=this._$AH,e=t===T&&s!==T||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==T&&(s===T||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class L{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){N(this,t);}}const Z=t$3.litHtmlPolyfillSupport;Z?.(V,M),(t$3.litHtmlVersions??=[]).push("3.1.0");const j=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new M(i.insertBefore(l$2(),t),t,void 0,s??{});}return h._$AI(t),h};
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const o$4=o=>o??T;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const t$2={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},e$5=t=>(...e)=>({_$litDirective$:t,values:e});let i$3 = class i{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i;}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};
/**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const e$4=e$5(class extends i$3{constructor(t){if(super(t),t.type!==t$2.ATTRIBUTE||"class"!==t.name||t.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(t){return " "+Object.keys(t).filter((s=>t[s])).join(" ")+" "}update(s,[i]){if(void 0===this.it){this.it=new Set,void 0!==s.strings&&(this.st=new Set(s.strings.join(" ").split(/\s/).filter((t=>""!==t))));for(const t in i)i[t]&&!this.st?.has(t)&&this.it.add(t);return this.render(i)}const r=s.element.classList;for(const t of this.it)t in i||(r.remove(t),this.it.delete(t));for(const t in i){const s=!!i[t];s===this.it.has(t)||this.st?.has(t)||(s?(r.add(t),this.it.add(t)):(r.remove(t),this.it.delete(t)));}return w}});
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const t$1=globalThis,e$3=t$1.ShadowRoot&&(void 0===t$1.ShadyCSS||t$1.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$2=Symbol(),o$3=new WeakMap;let n$3 = class n{constructor(t,e,o){if(this._$cssResult$=!0,o!==s$2)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$3&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$3.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$3.set(s,t));}return t}toString(){return this.cssText}};const r$4=t=>new n$3("string"==typeof t?t:t+"",void 0,s$2),S$1=(s,o)=>{if(e$3)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$1.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$3=e$3?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$4(e)})(t):t;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const{is:i$2,defineProperty:e$2,getOwnPropertyDescriptor:r$3,getOwnPropertyNames:h$1,getOwnPropertySymbols:o$2,getPrototypeOf:n$2}=Object,a$1=globalThis,c$2=a$1.trustedTypes,l$1=c$2?c$2.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$2(t,s),y$1={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;let b$1 = class b extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=y$1){if(s.state&&(s.attribute=!1),this._$Ei(),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(t,i,s);void 0!==r&&e$2(this.prototype,t,r);}}static getPropertyDescriptor(t,s,i){const{get:e,set:h}=r$3(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get(){return e?.call(this)},set(s){const r=e?.call(this);h.call(this,s),this.requestUpdate(t,r,i);},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??y$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$2(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...h$1(t),...o$2(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$3(s));}else void 0!==s&&i.push(c$3(s));return i}static _$Eu(t,s){const i=s.attribute;return !1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev();}_$Ev(){this._$Eg=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$ES(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$E_??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$E_?.delete(t);}_$ES(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$E_?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$E_?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$EO(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==r?this.removeAttribute(e):this.setAttribute(e,r),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e,this[e]=r.fromAttribute(s,t.type),this._$Em=null;}}requestUpdate(t,s,i,e=!1,r){if(void 0!==t){if(i??=this.constructor.getPropertyOptions(t),!(i.hasChanged??f$1)(e?r:this[t],s))return;this.C(t,s,i);}!1===this.isUpdatePending&&(this._$Eg=this._$EP());}C(t,s,i){this._$AL.has(t)||this._$AL.set(t,s),!0===i.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t);}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t)!0!==i.wrapped||this._$AL.has(s)||void 0===this[s]||this.C(s,this[s],i);}let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$E_?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$ET();}catch(s){throw t=!1,this._$ET(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$E_?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t);}_$ET(){this._$AL=new Map,this.isUpdatePending=!1;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return !0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EO(t,this[t]))),this._$ET();}updated(t){}firstUpdated(t){}};b$1.elementStyles=[],b$1.shadowRootOptions={mode:"open"},b$1[d$1("elementProperties")]=new Map,b$1[d$1("finalized")]=new Map,p$1?.({ReactiveElement:b$1}),(a$1.reactiveElementVersions??=[]).push("2.0.2");
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const t=globalThis,e$1=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$1=Symbol(),o$1=new WeakMap;let n$1 = class n{constructor(t,e,o){if(this._$cssResult$=!0,o!==s$1)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$1&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$1.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$1.set(s,t));}return t}toString(){return this.cssText}};const r$2=t=>new n$1("string"==typeof t?t:t+"",void 0,s$1),i$1=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1]),t[0]);return new n$1(o,t,s$1)},S=(s,o)=>{if(e$1)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$1=e$1?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$2(e)})(t):t;
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const{is:i,defineProperty:e,getOwnPropertyDescriptor:r$1,getOwnPropertyNames:h,getOwnPropertySymbols:o,getPrototypeOf:n}=Object,a=globalThis,c=a.trustedTypes,l=c?c.emptyScript:"",p=a.reactiveElementPolyfillSupport,d=(t,s)=>t,u={toAttribute(t,s){switch(s){case Boolean:t=t?l:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f=(t,s)=>!i(t,s),y={attribute:!0,type:String,converter:u,reflect:!1,hasChanged:f};Symbol.metadata??=Symbol("metadata"),a.litPropertyMetadata??=new WeakMap;class b extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=y){if(s.state&&(s.attribute=!1),this._$Ei(),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(t,i,s);void 0!==r&&e(this.prototype,t,r);}}static getPropertyDescriptor(t,s,i){const{get:e,set:h}=r$1(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get(){return e?.call(this)},set(s){const r=e?.call(this);h.call(this,s),this.requestUpdate(t,r,i);},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??y}static _$Ei(){if(this.hasOwnProperty(d("elementProperties")))return;const t=n(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(d("properties"))){const t=this.properties,s=[...h(t),...o(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$1(s));}else void 0!==s&&i.push(c$1(s));return i}static _$Eu(t,s){const i=s.attribute;return !1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev();}_$Ev(){this._$Eg=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$ES(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$E_??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$E_?.delete(t);}_$ES(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$E_?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$E_?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$EO(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:u).toAttribute(s,i.type);this._$Em=t,null==r?this.removeAttribute(e):this.setAttribute(e,r),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u;this._$Em=e,this[e]=r.fromAttribute(s,t.type),this._$Em=null;}}requestUpdate(t,s,i,e=!1,r){if(void 0!==t){if(i??=this.constructor.getPropertyOptions(t),!(i.hasChanged??f)(e?r:this[t],s))return;this.C(t,s,i);}!1===this.isUpdatePending&&(this._$Eg=this._$EP());}C(t,s,i){this._$AL.has(t)||this._$AL.set(t,s),!0===i.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t);}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t)!0!==i.wrapped||this._$AL.has(s)||void 0===this[s]||this.C(s,this[s],i);}let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$E_?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$ET();}catch(s){throw t=!1,this._$ET(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$E_?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t);}_$ET(){this._$AL=new Map,this.isUpdatePending=!1;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return !0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EO(t,this[t]))),this._$ET();}updated(t){}firstUpdated(t){}}b.elementStyles=[],b.shadowRootOptions={mode:"open"},b[d("elementProperties")]=new Map,b[d("finalized")]=new Map,p?.({ReactiveElement:b}),(a.reactiveElementVersions??=[]).push("2.0.2");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/class s extends b{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const i=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=j(i,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1);}render(){return w}}s._$litElement$=!0,s[("finalized")]=!0,globalThis.litElementHydrateSupport?.({LitElement:s});const r=globalThis.litElementPolyfillSupport;r?.({LitElement:s});(globalThis.litElementVersions??=[]).push("4.0.2");
var externalLink = {"role":"img","color":"currentColor","title":"Link to external site.","desc":"This indicates a link to an external site that may not follow the same accessibility or privacy policies as Alaska Airlines. By selecting a partner link you agree to share your data with these sites.","width":"var(--auro-size-lg, var(--ds-size-300, 1.5rem))","height":"var(--auro-size-lg, var(--ds-size-300, 1.5rem))","xmlns":"http://www.w3.org/2000/svg","xmlns_xlink":"http://www.w3.org/1999/xlink","viewBox":"0 0 24 24","path":"/icons","style":"ico_squareLarge","name":"external-link","category":"interface","svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-labelledby=\"external-link__title external-link__desc\" class=\"ico_squareLarge\" role=\"img\" style=\"min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor\" viewBox=\"0 0 24 24\"><title id=\"external-link__title\">Link to external site.</title><desc id=\"external-link__desc\">This indicates a link to an external site that may not follow the same accessibility or privacy policies as Alaska Airlines. By selecting a partner link you agree to share your data with these sites.</desc><path d=\"M7 6.25h5a.75.75 0 0 1 .102 1.494L12 7.75H7a1.25 1.25 0 0 0-1.244 1.123L5.75 9v8c0 .648.492 1.18 1.122 1.244L7 18.25h8a1.25 1.25 0 0 0 1.244-1.122L16.25 17v-5a.75.75 0 0 1 1.493-.101l.007.101v5a2.75 2.75 0 0 1-2.582 2.745L15 19.75H7a2.75 2.75 0 0 1-2.745-2.582L4.25 17V9a2.75 2.75 0 0 1 2.582-2.745L7 6.25h5-5Zm12.025-2 .125.015.11.032.128.061c.18.108.317.29.353.522l.009.12v5a.75.75 0 0 1-1.493.102L18.25 10V6.811l-6.72 6.72a.75.75 0 0 1-1.133-.977l.073-.084 6.718-6.72H14a.75.75 0 0 1-.743-.648L13.25 5a.75.75 0 0 1 .648-.743L14 4.25h5.025Z\"/></svg>"};
var newWindow = {"role":"img","color":"currentColor","title":"Link will open a new tab or window.","desc":"Notice indicator to alert users that action will result in the browser opening a new tab or window.","width":"var(--auro-size-lg, var(--ds-size-300, 1.5rem))","height":"var(--auro-size-lg, var(--ds-size-300, 1.5rem))","xmlns":"http://www.w3.org/2000/svg","xmlns_xlink":"http://www.w3.org/1999/xlink","viewBox":"0 0 24 24","path":"/icons","style":"ico_squareLarge","name":"new-window","category":"interface","svg":"<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" aria-labelledby=\"new-window__title new-window__desc\" class=\"ico_squareLarge\" role=\"img\" style=\"min-width:var(--auro-size-lg, var(--ds-size-300, 1.5rem));height:var(--auro-size-lg, var(--ds-size-300, 1.5rem));fill:currentColor\" viewBox=\"0 0 24 24\"><title id=\"new-window__title\">Link will open a new tab or window.</title><desc id=\"new-window__desc\">Notice indicator to alert users that action will result in the browser opening a new tab or window.</desc><path fill-rule=\"evenodd\" d=\"M20.246 5.687a2.063 2.063 0 0 0-2.058-1.937H8.813l-.126.004A2.063 2.063 0 0 0 6.75 5.812v.938H6.5l-.168.005A2.75 2.75 0 0 0 3.75 9.5v8l.005.168A2.75 2.75 0 0 0 6.5 20.25h8l.168-.005A2.75 2.75 0 0 0 17.25 17.5v-.25h.938l.125-.004a2.063 2.063 0 0 0 1.937-2.058V5.812l-.004-.125ZM15.75 17.25H8.812a2.063 2.063 0 0 1-2.058-1.937l-.004-.126V8.25H6.5a1.25 1.25 0 0 0-1.244 1.123L5.25 9.5v8c0 .648.492 1.18 1.122 1.244l.128.006h8a1.25 1.25 0 0 0 1.243-1.122l.007-.128v-.25Zm-6.625-12h8.75l.09.005a.875.875 0 0 1 .785.87v8.75l-.005.09a.875.875 0 0 1-.87.785h-8.75l-.09-.005a.875.875 0 0 1-.785-.87v-8.75l.005-.09a.875.875 0 0 1 .87-.785Zm4.28 1.757L13.507 7c.38 0 .693.3.743.69l.007.11-.007 1.938h2c.38 0 .694.301.743.691l.007.108c0 .405-.282.74-.648.792l-.102.007h-2.001l.001 1.865c0 .404-.282.739-.648.792L13.5 14c-.38 0-.694-.3-.743-.69l-.007-.11-.001-1.864H10.75c-.38 0-.694-.3-.743-.69L10 10.537c0-.404.282-.738.648-.791l.102-.008h2l.007-1.939c0-.404.282-.739.648-.792Z\"/></svg>"};
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
// See LICENSE in the project root for license information.
// build the component class
class ComponentBase extends s {
constructor() {
super();
this.download = false;
this.relative = false;
this.secondary = false;
this.ondark = false;
this.small = false;
/**
* @private
*/
this.defaultreferrerpolicy = 'strict-origin-when-cross-origin';
/**
* @private
*/
this.ariapressed = 'false';
/**
* @private
*/
this.tabisactive = 'false';
/*
If the component requires a touch detection,
please use this function to determine if a user is
actively touching a device, versus detecting if
the device is touch enables or a handheld device.
Also uncomment the touch detection lib above
*/
this.addEventListener('touchstart', function() {
this.classList.add('is-touching');
});
}
// function to define props used within the scope of thie component
static get properties() {
return {
href: { type: String },
rel: { type: String },
role: { type: String },
target: { type: String },
download: { type: Boolean },
relative: { type: Boolean },
secondary: { type: Boolean },
ondark: { type: Boolean },
type: { type: String },
fluid: { type: Boolean },
referrerpolicy: { type: Boolean },
small: { type: Boolean }
};
}
/**
* @private
* @returns {string} Cleaned URL.
*/
get safeUri() {
return this.href ? this.safeUrl(this.href, this.relative) : '';
}
/**
* @private
* @returns {boolean} Whether or not URL includes protocol.
*/
get includesDomain() {
return this.href ? this.safeUri.includes('http') : false;
}
/**
* @private
* @param {string} href - Include href value.
* @param {boolean} relative - Include relative value.
* @returns {string} URL definition.
*/
safeUrl(href, relative) {
if (href !== undefined) {
const url = new URL(href, 'https://www.alaskaair.com');
switch (url.protocol) {
case 'javascript:': // eslint-disable-line
return '';
case 'tel:':
return href;
case 'sms:':
return href;
case 'mailto:':
return href;
default:
if (!relative) {
url.protocol = 'https:';
return url.href;
} else if (relative) {
return href;
}
}
} else if (href === undefined) {
return undefined;
}
return undefined;
}
/**
* Internal function to generate the HTML for the icon to use.
* @private
* @param {string} svgContent - The imported svg icon.
* @returns {string} - The html template for the icon.
*/
generateIconHtml(svgContent) {
const dom = new DOMParser().parseFromString(svgContent, 'text/html'),
svg = dom.body.firstChild;
return svg;
}
/**
* @private
* @param {string} target - Link destination target.
* @returns {string} Correct icon.
*/
targetIcon(target) {
if (target === '_blank' && this.safeUri.includes('alaskaair.com')) {
return this.generateIconHtml(newWindow.svg);
} else if (target === '_blank' && this.includesDomain) {
return this.generateIconHtml(externalLink.svg);
}
return undefined;
}
/**
* @private
* @param {boolean} tabisactive - Tab state.
* @returns {string} CSS class for active state.
*/
getTabState(tabisactive) {
return tabisactive === true ? "is-active" : '';
}
/**
* @private
* @param {string} target - Link destination target.
* @param {string} rel - Defined rel option.
* @returns {string} SEO security options.
*/
getReltype(target, rel) {
if (rel) {
return rel;
}
if (target === '_blank' && this.safeUri.includes('alaskaair.com')) {
return rel;
}
if (target === '_blank' && this.includesDomain && !this.rel && !this.referrerpolicy) {
return 'noopener noreferrer';
}
if (target === '_blank' && this.referrerpolicy) {
return 'external';
}
return undefined;
}
/**
* @private
* @param {boolean} ariapressed - Aria state.
* @returns {string} Aria attribute definition.
*/
ariaPressedState(ariapressed) {
const ariaToggle = function (event) {
const ariaPressedNode = this.shadowRoot.querySelector('[aria-pressed]');
ariaPressedNode.setAttribute("aria-pressed", 'false');
if (event.type === 'mousedown') {
ariaPressedNode.ariaPressed = true;
} else {
ariaPressedNode.ariaPressed = false;
}
if (event.type === 'keydown') {
if (event.code === 'Enter' || event.code === 'Space') {
ariaPressedNode.ariaPressed = true;
} else {
ariaPressedNode.ariaPressed = false;
}
}
};
// Add our event listeners
this.addEventListener('mousedown', ariaToggle);
this.addEventListener('mouseup', ariaToggle);
this.addEventListener('keydown', ariaToggle);
this.addEventListener('keyup', ariaToggle);
return ariapressed;
}
// function that renders the HTML and CSS into the scope of the component
render() {
return x`
${this.getMarkup()}
`;
}
}
var styleCss = i$1`*,*:before,*:after{box-sizing:border-box}@media(prefers-reduced-motion: reduce){*,*:before,*:after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important}}*:focus-visible{outline:0}*:focus-visible{outline:0}:focus:not(:focus-visible){outline:3px solid transparent}:host{display:inline-block}:host([type=nav]) .hyperlink:focus{text-decoration:underline}:host([fluid][type=cta]),:host([fluid=true][type=cta]){width:100%}:host([fluid][type=cta]) .hyperlink--cta,:host([fluid=true][type=cta]) .hyperlink--cta{width:100%}.hyperlink{transition:all .15s ease;color:var(--ds-color-ui-default-default, #0074c8);text-decoration:underline}.hyperlink:focus{text-decoration:none}.hyperlink:visited{color:var(--ds-color-ui-default-default, #0074c8)}.hyperlink:focus-visible{background-color:var(--ds-color-ui-default-default, #0074c8);color:var(--ds-color-text-primary-inverse, #ffffff);outline:var(--ds-color-ui-default-default, #0074c8) solid var(--ds-size-50, 0.25rem);outline-offset:unset}.hyperlink:focus-visible:hover{color:var(--ds-color-text-primary-inverse, #ffffff)}@media(hover: hover){.hyperlink:hover{color:var(--ds-color-ui-hover-default, #054687);text-decoration:none}.hyperlink--nav:hover{text-decoration:underline}.hyperlink--ondark:hover{color:var(--ds-color-ui-hover-inverse, #5de3f7)}}.hyperlink--button{display:inline-block;padding:0 var(--ds-size-200);text-decoration:none;color:var(--ds-color-text-link-default);border:1px solid transparent;line-height:var(--ds-unitless-scale-300)}:host(:not(.is-touching)) .hyperlink--button:hover{cursor:pointer;text-decoration:underline;color:var(--ds-color-ui-hover-default)}.hyperlink--nav{display:block;text-decoration:none}.hyperlink--cta{display:block;padding:0 var(--ds-size-200);text-decoration:none;color:var(--ds-color-text-link-default);border:1px solid transparent;line-height:var(--ds-unitless-scale-300);border:1px solid var(--ds-color-ui-default-default, #0074c8);border-radius:var(--ds-border-radius, 0.375rem);background-color:var(--ds-color-ui-default-default, #0074c8);color:var(--ds-color-text-primary-inverse, #ffffff);font-family:var(--ds-font-family-default, "AS Circular", Helvetica Neue, Arial, sans-serif);font-size:var(--ds-text-body-size-default, 1rem);font-weight:var(--ds-text-body-default-weight, 500);min-height:var(--ds-size-600, 3rem);max-height:var(--ds-size-600, 3rem);text-align:center;vertical-align:middle}:host(:not(.is-touching)) .hyperlink--cta:hover{cursor:pointer;text-decoration:underline;color:var(--ds-color-ui-hover-default)}.hyperlink--cta:active{transform:scale(0.95)}:host(:not(.is-touching)) .hyperlink--cta:hover{border:1px solid var(--ds-color-ui-hover-default, #054687);background-image:linear-gradient(var(--ds-color-ui-hover-default, #054687), var(--ds-color-ui-hover-default, #054687));color:var(--ds-color-text-primary-inverse, #ffffff);text-decoration:none}.hyperlink--cta:visited{color:var(--ds-color-text-primary-inverse, #ffffff)}@media screen and (min-width: 576px){.hyperlink--cta{display:inline-block;min-width:8.75rem;width:auto;padding:0 var(--ds-size-300, 1.5rem)}}.hyperlink--cta.hyperlink--secondary{border:1px solid var(--ds-color-ui-default-default, #0074c8);background-color:var(--ds-color-background-lightest, #ffffff);color:var(--ds-color-text-link-default, #0074c8)}:host(:not(.is-touching)) .hyperlink--cta.hyperlink--secondary:hover{border:1px solid var(--ds-color-ui-default-default, #0074c8);background-image:linear-gradient(var(--ds-color-background-lighter, #f8f8f8), var(--ds-color-background-lighter, #f8f8f8));color:var(--ds-color-text-link-default, #0074c8)}.hyperlink--cta.hyperlink--secondary.hyperlink--ondark{border:1px solid var(--ds-color-ui-default-inverse, #00cff0);background-color:transparent;color:var(--ds-color-ui-default-inverse, #00cff0)}:host(:not(.is-touching)) .hyperlink--cta.hyperlink--secondary.hyperlink--ondark:hover{border:1px solid var(--ds-color-ui-default-inverse, #00cff0);background-image:linear-gradient(var(--ds-color-base-black-opacity-15, rgba(0, 0, 0, 0.15)), var(--ds-color-base-black-opacity-15, rgba(0, 0, 0, 0.15)));color:var(--ds-color-ui-default-inverse, #00cff0)}:host(:not(.is-touching)) .hyperlink--cta.hyperlink--secondary.hyperlink--ondark:visited{color:var(--ds-color-ui-default-inverse, #00cff0)}.hyperlink--cta.hyperlink--ondark{border:1px solid var(--ds-color-ui-default-inverse, #00cff0);background-color:var(--ds-color-ui-default-inverse, #00cff0);color:var(--ds-color-text-primary-default, #222222)}:host(:not(.is-touching)) .hyperlink--cta.hyperlink--ondark:hover{border:1px solid var(--ds-color-ui-hover-inverse, #5de3f7);background-image:linear-gradient(var(--ds-color-ui-hover-inverse, #5de3f7), var(--ds-color-ui-hover-inverse, #5de3f7));color:var(--ds-color-text-primary-default, #222222)}:host(:not(.is-touching)) .hyperlink--cta.hyperlink--ondark:visited{color:var(--ds-color-text-primary-default, #222222)}.hyperlink--ondark{color:var(--ds-color-ui-default-inverse, #00cff0)}.hyperlink--ondark:visited{color:var(--ds-color-ui-default-inverse, #00cff0)}:host([small][type=cta]) .hyperlink--cta,:host([small=true][type=cta]) .hyperlink--cta{display:flex;min-width:unset;min-height:2.25rem;max-height:2.25rem;padding:var(--ds-size-100, 0.5rem) var(--ds-size-200, 1rem);line-height:var(--ds-unitless-scale-140, 1.4);font-size:var(--ds-text-body-size-sm, 0.875rem)}:host([small][type=cta]) .hyperlink--cta svg,:host([small=true][type=cta]) .hyperlink--cta svg{top:unset}svg{--auro-size-lg:1rem;position:relative;top:var(--ds-size-25, 0.125rem);margin-left:var(--ds-size-25, 0.125rem)}`;
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
// See LICENSE in the project root for license information.
// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
/**
* `<auro-hyperlink>` is a wrapper components for an HTML `<a>` element containing styling and behavior.
*
* @attr {Boolean} download - Specifies that the target will be downloaded when a user clicks on the hyperlink.
* @attr {Boolean} fluid - Modifier for `type="cta"` fluid-width UI option.
* @attr {Boolean} ondark - Specifies dark theme use of hyperlink.
* @attr {Boolean} relative - Add flag to disable auto URL re-write feature.
* @attr {Boolean} secondary - Modifier for `type="cta"` secondary UI option.
* @attr {Boolean} small - Modifier for `type="cta"` small UI option.
* @attr {Boolean} referrerpolicy - Sets `strict-origin-when-cross-origin` to send a full URL when performing a same-origin request, only sends the origin when the protocol security level stays the same (HTTPS→HTTPS), and sends no header to a less secure destination (HTTPS→HTTP).
* @attr {String} rel - Specifies the relationship between the current document and the linked document.
* @attr {String} role - Use for aria roles; currently supports `button` for extended experiences.
* @attr {String} href - Specifies the URL of the page link.
* @attr {String} target - Specifies where to open the linked document.
* @attr {String} type - Enumerable attribute; [`nav`, `cta`]
* @csspart link - Apply CSS to the `a` element
*/
// build the component class
class AuroHyperlink extends ComponentBase {
// function to define props used within the scope of this component
static get properties() {
return {
...super.properties
};
}
static get styles() {
return [styleCss];
}
/**
* @private
* @returns {object} Classes object.
*/
getMarkup() {
const classes = {
'hyperlink': this.safeUri || this.role,
'hyperlink--nav': this.type === 'nav',
'hyperlink--ondark': this.ondark,
'hyperlink--button': this.role,
'hyperlink--cta': this.type === 'cta',
'hyperlink--secondary': this.secondary
};
return x`
${this.safeUri || this.role ? x`
<a
part="link"
aria-pressed="${o$4(this.role === 'button' ? this.ariaPressedState(this.ariapressed) : undefined)}"
class="${e$4(classes)}"
href="${o$4(this.role ? undefined : this.safeUri)}"
rel="${o$4(this.target || this.rel ? this.getReltype(this.target, this.rel) : undefined)}"
referrerpolicy="${o$4(this.referrerpolicy ? this.defaultreferrerpolicy : undefined)}"
role="${o$4(this.role === 'button' ? this.role : undefined)}"
?download="${this.download}"
target="${o$4(this.target && this.includesDomain ? this.target : undefined)}"
tabindex="${o$4(this.role === 'button' ? '0' : undefined)}"
><slot></slot>${this.targetIcon(this.target, this.relative)}</a>`
: x`<slot></slot>`}
`;
}
}
// default internal definition
if (!customElements.get("auro-hyperlink")) {
customElements.define("auro-hyperlink", AuroHyperlink);
}
/**
* Register Custom Element.
* @param {Object} name - Name to use for custom element.
* @returns {void}
*/
function registerComponent(name = 'custom-hyperlink') {
// alias definition
if (!customElements.get(name)) {
customElements.define(name, class extends AuroHyperlink {});
}
}
registerComponent('auro-hyperlink');
export { registerComponent };