var u=Object.defineProperty;var f=(i,t)=>{for(var e in t)u(i,e,{get:t[e],enumerable:!0})};var d={};f(d,{Linkifier:()=>n,LinkifierClick:()=>o});import*as h from"./../../../core/platform/platform.js";import*as r from"./../../lit/lit.js";import*as c from"./../render_coordinator/render_coordinator.js";var l=`.link:link,
.link:visited{color:var(--sys-color-primary);text-decoration:underline;cursor:pointer;outline-offset:2px}
/*# sourceURL=${import.meta.resolve("./linkifierImpl.css")} */`;import*as a from"./../../../models/bindings/bindings.js";function m(i,t){if(i){let s=`${a.ResourceUtils.displayNameForURL(i)}`;return typeof t<"u"&&(s+=`:${t+1}`),s}throw new Error("New linkifier component error: don't know how to generate link text for given arguments")}var{html:k}=r,o=class i extends Event{data;static eventName="linkifieractivated";constructor(t){super(i.eventName,{bubbles:!0,composed:!0}),this.data=t,this.data=t}},n=class extends HTMLElement{#n=this.attachShadow({mode:"open"});#t=h.DevToolsPath.EmptyUrlString;#e;#i;#r;#o;set data(t){if(this.#t=t.url,this.#e=t.lineNumber,this.#i=t.columnNumber,this.#r=t.linkText,this.#o=t.title,!this.#t)throw new Error("Cannot construct a Linkifier without providing a valid string URL.");this.#l()}cloneNode(t){let e=super.cloneNode(t);return e.data={url:this.#t,lineNumber:this.#e,columnNumber:this.#i,linkText:this.#r,title:this.#o},e}#s(t){t.preventDefault();let e=new o({url:this.#t,lineNumber:this.#e,columnNumber:this.#i});this.dispatchEvent(e)}async#l(){let t=this.#r??m(this.#t,this.#e);await c.write(()=>{r.render(k`
        <style>${l}</style>
        <a class="link" href=${this.#t} @click=${this.#s} title=${r.Directives.ifDefined(this.#o)}>
          <slot>${t}</slot>
        </a>`,this.#n,{host:this})})}};customElements.define("devtools-linkifier",n);export{d as Linkifier};
//# sourceMappingURL=linkifier.js.map
