class WordCount extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: 'open' });
let body = JSON.parse(atob(this.getAttribute('body')));
let inspected = htl`<div></div>`;
this.inspector = new Inspector(inspected);
let wrapper = htl`
<link rel="stylesheet" href="https://unpkg.com/@observablehq/inspector@3.2.1/dist/inspector.css" />
<span class="wrapper">
<span class="icon" tabindex=0>
${inspected}
</span>
<slot name="error" />
</span>
`;
this.shadowRoot.append(wrapper);
}
connectedCallback() {
console.log('HEY');
let body = JSON.parse(atob(this.getAttribute('body')));
this.inspector.fulfilled(body);
}
disconnectedCallback() {
console.log("BYE");
}
}