<NME> snuggsi.js
<BEF> // http://nshipster.com/method-swizzling/
// HTMLElement Swizzle - To swizzle a method is to change a class’s dispatch table in order to resolve messages from an existing selector to a different implementation, while aliasing the original method implementation to a new selector.

// 3.2.3 HTML element constructors
// https://html.spec.whatwg.org/multipage/dom.html#html-element-constructors
// Satisfy Element interface document.createElement
//   - https://dom.spec.whatwg.org/#concept-element-interface

var HTMLElement =

/*
// Domenic discusses
// https://esdiscuss.org/topic/extending-an-es6-class-using-es5-syntax#content-1
I believe this will work in most cases:

function B() {
  const obj = new A();
  Object.setPrototypeOf(obj, new.target.prototype); // or B.prototype, but if you derive from B you'll have to do this dance again

  // use obj instead of this

  return obj;
}
Also, in general you should do

instead of

B.prototype = Object.create(A.prototype);
for slightly better semantics, including class-side inheritance and not clobbering .constructor.
*/

( function (_) {
  function E () {}

  E.prototype =

    window.HTMLElement.prototype

  // Prevent `.constructor` clobbering
  // E.__proto__ = window.HTMLElement

    // https://github.com/whatwg/html/issues/1704
    // E.prototype.__proto__
    //   = (E.__proto__ = HTMLElement).prototype

    // Domenic's method
    // Object
    //   .setPrototypeOf
    //     (Object.setPrototypeOf (B, A).prototype, A.prototype)

    return E
})()

var TokenList = function (node) {
  var this$1 = this;


  var
    visit = function (node) { return node.attributes && [].slice
         .call (node.attributes)
         .map(collect)
      || collect (node); }

  , collect = function (node) { return /{(\w+|#)}/.test (node.textContent)
        && (node.text = node.textContent)
            .match (/[^{]+(?=})/g)
            .map (function (symbol) { return (this$1 [symbol] || (this$1 [symbol] = [])).push (node); }); }

  , walker =
      document.createNodeIterator
        (node, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, visit, null)

  while (walker.nextNode ()) { null } // Walk all nodes and do nothing.
};


TokenList.prototype.bind = function (context) {

  var
    tokenize = function (symbol) { return function (node) { return (node.textContent
        = node.textContent
        .split ('{'+symbol+'}')
        .join(context [symbol])); }; }

  for (var symbol in this)
    { symbol != 'bind'
      && this [symbol].map
        (function (node) { return (node.textContent = node.text); }) }

  for (var symbol$1 in this)
    { symbol$1 != 'bind'
      && this [symbol$1].map
        (tokenize (symbol$1)) } // more than one occurrence
};

// https://codereview.chromium.org/1987413002
// https://github.com/whatwg/fetch/pull/442
// https://chromium.googlesource.com/chromium/src.git/+/a5a314d3249ecf1c291b417fbe067e8c2a65fad2
//
// Link rel preload as attribute doesn't support the as=document value
// https://bugs.chromium.org/p/chromium/issues/detail?id=593267
//
// Requests with useStreamOnResponse flag don't reuse preloaded resources
// https://bugs.chromium.org/p/chromium/issues/detail?id=652228
//
// Spurious warning preloading script
// https://bugs.chromium.org/p/chromium/issues/detail?id=655698
//
// WPT
// https://github.com/w3c/web-platform-tests/pull/4505
//
// w3c preload Tighter definition of "load was successful"
// https://github.com/w3c/preload/issues/83
void ( function (_) {

  //create an observer instance
  // Can always default to DOMContentLoaded
  // https://bugs.webkit.org/show_bug.cgi?id=38995#c26
  (new MutationObserver ( function (mutations) {

    for (var i$1 = 0, list$1 = mutations; i$1 < list$1.length; i$1 += 1)
      {
      var mutation = list$1[i$1];

      for (var i = 0, list = mutation.addedNodes; i < list.length; i += 1) {
         var node = list[i];

          /^p/.test (node.rel)
           && /\-/.test (node.id)
           && load (node)

         !! /\-/.test (node.localName)
           && (link = document.querySelector ('#'+node.localName))
           && link.content
           && stamp.call (node, link.content)
           && customElements.upgrade (node)
      }
    }
  }))

  .observe (document.documentElement, { childList: true, subtree: true })

  void

  [].slice
    .call (document.querySelectorAll ('[rel^=pre][id~="-"]'))
    .map  (load)


  // XHR Specs
  // https://xhr.spec.whatwg.org
  // Progress events
  // https://xhr.spec.whatwg.org/#interface-progressevent
  // Loader - https://trac.webkit.org/browser/trunk/WebCore/loader/loader.cpp
  function load (link) {

    var xhr = new XMLHttpRequest

    // Destination - https://fetch.spec.whatwg.org/#requestdestination

    xhr.link   = link
    xhr.onload = onload
    // progress events won't fire unless defining before open
    xhr.open ('GET', link.href)
    xhr.responseType = 'document'
    // Max requests
    xhr.send ()
  }


  // https://github.com/w3c/preload/pull/40
  // https://bugs.webkit.org/show_bug.cgi?id=38995
  // https://www.w3.org/TR/html5/document-metadata.html#the-link-element
  function onload () {
    var
      link = this.link

    , response =
        this.response

    , anchor =
        link.nextChild

    , template =
        link.content =
           response.querySelector ('template')

    // https://www.nczonline.net/blog/2010/09/28/why-is-getelementsbytagname-faster-that-queryselectorall
    for (var i = 0, list = document.querySelectorAll (link.id); i < list.length; i += 1)
      {
      var node = list[i];

      template && stamp.call (node, template)
    }


    for (var i$1 = 0, list$1 = response.querySelectorAll ('style,link,script'); i$1 < list$1.length; i$1 += 1)
      {
      var node$1 = list$1[i$1];

      process (link, node$1, anchor)
    }
  }


  function process (link, node, anchor) {
      var
        // https://chromium.googlesource.com/chromium/src.git/+/0661feafc9a84f03b04dd3719b8aaa255dfaec63/third_party/WebKit/Source/core/loader/LinkLoader.cpp
        // HTML WhatWG scripting
        // https://html.spec.whatwg.org/multipage/scripting.html
        // https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script
        // Classic script graph - https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-classic-script
        // Module script tree - https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-module-script-tree
        // Concept Script script - https://html.spec.whatwg.org/multipage/scripting.html#concept-script-script
        as = node.getAttribute ('as')

      , clone =
          document.createElement
            ('script' == as ? as : node.localName)

      void

      // 'type' is used for data blocks (i.e. `type=text/recipe` or `type=application/x-game-data`
      // https://html.spec.whatwg.org/multipage/scripting.html#data-block
      ['id', 'rel', 'href', 'src', 'textContent', 'as', 'defer', 'crossOrigin' ]
        // setAttribute won't work for textContent and likewise explicit set for crossorigin
        .map (function (attr) { return node [attr] && attr in clone && (clone [attr] = node [attr]); })

      // use rel = 'preload stylesheet' for async
      // or use media=snuggsi => media || 'all' trick
      // loadCSS - https://github.com/filamentgroup/loadCSS
      // http://keithclark.co.uk/articles/loading-css-without-blocking-render
      'style' == as
      // https://www.smashingmagazine.com/2016/02/preload-what-is-it-good-for/#markup-based-async-loader
        && (clone.rel = 'stylesheet')

      'script' == as // smelly
        && (clone.src = clone.href)

      link
        .parentNode
        .insertBefore (clone, anchor)
  }

  // Slot replacement & light DOM stamping
  // https://github.com/w3c/webcomponents/issues/288
  // https://dom.spec.whatwg.org/#slot-assigned-nodes
  function stamp (template) {
    var this$1 = this;


    template =
      document.importNode (template, true)

    var slot

    [] // distribute attributes
      .slice
      .call (template.attributes)
      .map  (function (attr) { return !   this$1.attributes [attr.name]
        &&  this$1.setAttribute (attr.name, attr.value); })


    for (var i = 0, list = this.querySelectorAll ('[slot]'); i < list.length; i += 1)
      {
      var replacement = list[i];

      (slot = (template.content || template).querySelector
       ( 'slot[name=' + replacement.getAttribute ('slot') + ']' ))

      && // this could be slow
        slot.parentNode.replaceChild (replacement, slot)
    }

    return this.innerHTML = template.innerHTML
  }

}) ()

var Template = function (template) {

  var
    range = document.createRange ()

  template
    = typeof template === 'string'
    ? document.querySelector ( 'template[name=' + template + ']' )
    : template

  range.selectNodeContents ( template.content )

  var
    fragment = range.cloneContents ()

  , tokenize = function (context, index) {
      var
        clone = fragment.cloneNode (true)

      typeof context != 'object'
        && ( context  = { self: context })

      context ['#'] = index

      void (new TokenList (clone))
        .bind (context)

      return clone
    }

  , bind = function (context) {
      range.deleteContents ()

      context && []
        .concat (context)
        .map (tokenize)
        .reverse () // Range.insertNode does prepend
        .map (function (fragment) { return range.insertNode (fragment); })
    }

  range.setStartAfter (template)
  template.bind = bind
  return template
}

window.customElements =
  window.customElements
  || {/* microfill */}

void ( function (_) { /* CustomElementRegistry */

  customElements.define = function ( name, constructor ) {

    !! /\-/.test (name)
    && (customElements [name] = constructor)
    && [].slice
      // https://www.nczonline.net/blog/2010/09/28/why-is-getelementsbytagname-faster-that-queryselectorall
      .call ( document.querySelectorAll (name) )
      .map  ( customElements.upgrade )
  }


  customElements.upgrade = function (root) {

    var candidates = []

    // Here's where we can swizzle
    // https://github.com/whatwg/html/issues/1704#issuecomment-241881091

    Object.setPrototypeOf
      (root, customElements [root.localName].prototype)

    root.connectedCallback ()
  }


  void (new MutationObserver ( function (mutations) {

    for (var i$1 = 0, list$1 = mutations; i$1 < list$1.length; i$1 += 1)
      {
      var mutation = list$1[i$1];

      for (var i = 0, list = mutation.addedNodes; i < list.length; i += 1)

         {
          var root = list[i];

          !! /\-/.test (root.localName)
         && customElements [root.localName]
         && customElements.upgrade (root)
        }
    }
  }))

  .observe (document.documentElement, { childList: true, subtree: true })

})() /* CustomElementRegistry */

function ParentNode (Element) {

  // DOM Levels
  // (https://developer.mozilla.org/fr/docs/DOM_Levels)
  //
  // Living Standard HTML5 ParentNode
  // https://dom.spec.whatwg.org/#parentnode
  //
  // MDN ParentNode
  // https://developer.mozilla.org/en-US/docs/Web/API/ParentNode
  //
  // ElementTraversal interface
  // https://www.w3.org/TR/ElementTraversal/#interface-elementTraversal

return /*@__PURE__*/(function (Element) {
  function anonymous () {
    Element.apply(this, arguments);
  }

  if ( Element ) anonymous.__proto__ = Element;
  anonymous.prototype = Object.create( Element && Element.prototype );
  anonymous.prototype.constructor = anonymous;

  anonymous.prototype.select = function ( )
    {
    var ref;
 return (ref = this).selectAll.apply ( ref, arguments ) [0] };

  anonymous.prototype.selectAll = function ( strings ) {
    var tokens = [], len = arguments.length - 1;
    while ( len-- > 0 ) tokens[ len ] = arguments[ len + 1 ];

    strings = [ ].concat ( strings )

    return [].slice.call
      (this.querySelectorAll
        (tokens.reduce // denormalize selector
          (function (part, token) { return part + token + strings.shift (); }
          , strings.shift ())))
  };

  return anonymous;
}(Element))
}
function EventTarget (HTMLElement) { // why buble

  // DOM Levels
  // (https://developer.mozilla.org/fr/docs/DOM_Levels)
  //
  // WHATWG Living Standard HTML5 EventTarget
  // https://dom.spec.whatwg.org/#eventtarget
  //
  // MDN EventTarget
  // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget
  //
  // DOM Level 3 EventTarget
  // https://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-EventTarget
  //
  // DOM Level 2 EventTarget
  // (AKA Str🎱  W3C #fockery) ➡️  https://annevankesteren.nl/2016/01/film-at-11
  // 😕  https://w3c.github.io/uievents/DOM3-Events.html#interface-EventTarget
  //❓❓ https://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html
  // https://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-EventTarget
  // Within https://w3c.github.io/uievents/#conf-interactive-ua
  // EventTarget links to WHATWG - https://dom.spec.whatwg.org/#eventtarget

return /*@__PURE__*/(function (HTMLElement) {
  function anonymous () {
    HTMLElement.apply(this, arguments);
  }

  if ( HTMLElement ) anonymous.__proto__ = HTMLElement;
  anonymous.prototype = Object.create( HTMLElement && HTMLElement.prototype );
  anonymous.prototype.constructor = anonymous;

  anonymous.prototype.on = function ( event, handler ) {

    this.addEventListener
      (event, this.renderable (handler))
  };

  anonymous.prototype.renderable = function ( handler ) {
    var this$1 = this;


    // BIG BUG IN IE!!!
    //
    // https://connect.microsoft.com/IE/feedback/details/790389/event-defaultprevented-returns-false-after-preventdefault-was-called
    //
    // https://github.com/webcomponents/webcomponents-platform/blob/master/webcomponents-platform.js#L16

    return function (event) { return handler.call (this$1, event) !== false
        // check render availability
        && event.defaultPrevented
        || this$1.render (); }
  };

//off (event, listener = 'on' + this [event])
//  // MDN EventTarget.removeEventListener
//  // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener
//  //
//  // WHATWG Living Standard EventTarget.removeEventListener
//  // https://dom.spec.whatwg.org/#dom-eventtarget-removeeventlistener
//  //
//  // DOM Level 2 EventTarget.removeEventListener
//  // https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventTarget-removeEventListener

//  { this.removeEventListener (event, listener) }

//dispatch (event)
//  // MDN EventTarget.dispatchEvent
//  // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent
//  //
//  // WHATWG Living Standard EventTarget.dispatchEvent
//  // https://dom.spec.whatwg.org/#dom-eventtarget-dispatchevent
//  //
//  // DOM Level 2 EventTarget.dispatchEvent
//  //  https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventTarget-dispatchEvent

//  { }


  // Reflection - https://en.wikipedia.org/wiki/Reflection_(computer_programming)
  // Type Introspection - https://en.wikipedia.org/wiki/Type_introspection
  //
  // In computing, type introspection is the ability of a program
  // to examine the type or properties of an object at runtime.
  // Some programming languages possess this capability.
  //
  // Introspection should not be confused with reflection,
  // which goes a step further and is the ability for a program to manipulate the values,
  // meta-data, properties and/or functions of an object at runtime.


  anonymous.prototype.reflect = function (handler) {

    /^on/.test (handler) // is a W3C `on`event
      && handler in HTMLElement.prototype // `on*`

      && // automagically delegate event
        this.on ( handler.substr (2), this [handler] )
  };


  anonymous.prototype.register = function (node, handler, event) {
    for (var i = 0, list = [].slice.call (node.attributes); i < list.length; i += 1)
            {
      var attribute = list[i];

      /^on/.test (event = attribute.name)
            // https://www.quirksmode.org/js/events_tradmod.html
            // because under traditional registration the handler value is wrapped in scope `{ onfoo }`
            && ( handler = (/{\s*(\w+)/.exec (node [event]) || []) [1])
            && ( node [event] = this.renderable (this [handler]) )
    }
  };

  return anonymous;
}(HTMLElement))
}
function GlobalEventHandlers (Element) {

  // Living Standard HTML5 GlobalEventHandlers
  // https://html.spec.whatwg.org/multipage/webappapis.html#globaleventhandlers
  //
  // MDN GlobalEventHandlers
  // https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers
  //
  // MDN on* Events
  // https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Event_handlers
  //
  // DOM Level 0
  // This event handling model was introduced by Netscape Navigator,
  // and remains the most cross-browser model as of 2005
  // https://en.wikipedia.org/wiki/DOM_events#DOM_Level_0#DOM_Level_0
  //
  // All Event Handling Models
  // https://en.wikipedia.org/wiki/DOM_events#Event_handling_models
  //
  // Inline Model
  // https://en.wikipedia.org/wiki/DOM_events#Inline_model
  //
  // Traditional Model
  // https://en.wikipedia.org/wiki/DOM_events#Traditional_model
  //
  // Traditional Registration
  // http://www.quirksmode.org/js/events_tradmod.html


  // HandleEvent Registration - https://viperhtml.js.org/hyperhtml/documentation/#essentials-6

return /*@__PURE__*/(function (Element) {
  function anonymous () {
    Element.apply(this, arguments);
  }

  if ( Element ) anonymous.__proto__ = Element;
  anonymous.prototype = Object.create( Element && Element.prototype );
  anonymous.prototype.constructor = anonymous;

  anonymous.prototype.onconnect = function (event) {

    this.templates =
      this
        .selectAll ('template[name]')
        .map (Template)

    this.tokens =
      new TokenList (this)

    Element.prototype.onconnect
      && Element.prototype.onconnect.call (this, event)
  };

  return anonymous;
}(Element))
}
var Custom = function (Element) { return ( /*@__PURE__*/(function (superclass) {
    function anonymous () {
      superclass.apply(this, arguments);
    }

    if ( superclass ) anonymous.__proto__ = superclass;
    anonymous.prototype = Object.create( superclass && superclass.prototype );
    anonymous.prototype.constructor = anonymous;

    anonymous.prototype.connectedCallback = function () {
    this.context = {}

    superclass.prototype.initialize
      && superclass.prototype.initialize.call (this)

    Object
      .getOwnPropertyNames (Element.prototype)
      .map (this.reflect, this)

    this.addEventListener
      ('connect', this.onconnect)
 
    this.addEventListener.call
      (this, 'idle', superclass.prototype.onidle)

    this.dispatchEvent
      (new Event ('connect'))

    this.render ()
  };


  anonymous.prototype.render = function () {

    for (var i = 0, list = this.templates; i < list.length; i += 1)
      {
      var template = list[i];

      template.bind
        (this [template.getAttribute ('name')])
    }

    this
      .tokens
      .bind (this)

    this.register (this)

    this
      // possibly restrict to elements with on event
      .selectAll ('*')
      .map (this.register, this)

    this.dispatchEvent
      (new Event ('idle'))
  };

    return anonymous;
  }(( ParentNode
  ( EventTarget
  ( GlobalEventHandlers
  ( Element ))))))); }

// http://2ality.com/2013/09/window.html
// http://tobyho.com/2013/03/13/window-prop-vs-global-var

var Element = function (tag) { return (

//      const constructor =// swizzle
//        typeof tag === 'string'
//    //    ? HTMLCustomElement
//    //    : HTMLElement

        //https://gist.github.com/allenwb/53927e46b31564168a1d
        // https://github.com/w3c/webcomponents/issues/587#issuecomment-271031208
        // https://github.com/w3c/webcomponents/issues/587#issuecomment-254017839

      function (Element) { return customElements.define
          ( tag + '', Custom (Element) ); }

// Assign `window.Element.prototype` in case of feature checking on `Element`
//  E.prototype = Element.prototype
//  return E
); }


<MSG> :muscle: bump TRANSPILED distribution dist/snuggsi.js

<DFF> @@ -658,7 +658,7 @@ var Custom = function (Element) { return ( /*@__PURE__*/(function (superclass) {
 // http://2ality.com/2013/09/window.html
 // http://tobyho.com/2013/03/13/window-prop-vs-global-var
 
-var Element = function (tag) { return (
+var Element = function () {
 
 //      const constructor =// swizzle
 //        typeof tag === 'string'
@@ -669,11 +669,11 @@ var Element = function (tag) { return (
         // https://github.com/w3c/webcomponents/issues/587#issuecomment-271031208
         // https://github.com/w3c/webcomponents/issues/587#issuecomment-254017839
 
-      function (Element) { return customElements.define
+      !function(Element) { return customElements.define
           ( tag + '', Custom (Element) ); }
 
 // Assign `window.Element.prototype` in case of feature checking on `Element`
 //  E.prototype = Element.prototype
 //  return E
-); }
+}
 

{'commit': "diff --git a/dist/snuggsi.js b/dist/snuggsi.js\nindex 8219def6..629d4f9a 100644\n--- a/dist/snuggsi.js\n+++ b/dist/snuggsi.js\n@@ -658,7 +658,7 @@ var Custom = function (Element) { return ( /*@__PURE__*/(function (superclass) {\n // http://2ality.com/2013/09/window.html\n // http://tobyho.com/2013/03/13/window-prop-vs-global-var\n \n-var Element = function (tag) { return (\n+var Element = function () {\n \n //      const constructor =// swizzle\n //        typeof tag === 'string'\n@@ -669,11 +669,11 @@ var Element = function (tag) { return (\n         // https://github.com/w3c/webcomponents/issues/587#issuecomment-271031208\n         // https://github.com/w3c/webcomponents/issues/587#issuecomment-254017839\n \n-      function (Element) { return customElements.define\n+      !function(Element) { return customElements.define\n           ( tag + '', Custom (Element) ); }\n \n // Assign `window.Element.prototype` in case of feature checking on `Element`\n //  E.prototype = Element.prototype\n //  return E\n-); }\n+}\n \n", 'commit_subject': ':muscle: bump TRANSPILED distribution dist/snuggsi.js', 'repo_name': 'devpunks/snuggsi', 'committer': {'name': 'snuggs', 'email': 'c6b737713e2e92b7bd225b33e0014d7aadc48be6@gmail.com', 'time_sec': '1609471498', 'tz_offset': '-300', 'date': {'seconds': '1609471498'}}, 'commit_tree': 'f17b17a3c127194b696ce5dbd817e49f6494f9b6', 'commit_message': ':muscle: bump TRANSPILED distribution dist/snuggsi.js\n', 'language_name': 'Ruby', 'license': 'mit', 'hunks': "@@ -658,7 +658,7 @@ var Custom = function (Element) { return ( /*@__PURE__*/(function (superclass) {\n // http://2ality.com/2013/09/window.html\n // http://tobyho.com/2013/03/13/window-prop-vs-global-var\n \n-var Element = function (tag) { return (\n+var Element = function () {\n \n //      const constructor =// swizzle\n //        typeof tag === 'string'\n@@ -669,11 +669,11 @@ var Element = function (tag) { return (\n         // https://github.com/w3c/webcomponents/issues/587#issuecomment-271031208\n         // https://github.com/w3c/webcomponents/issues/587#issuecomment-254017839\n \n-      function (Element) { return customElements.define\n+      !function(Element) { return customElements.define\n           ( tag + '', Custom (Element) ); }\n \n // Assign `window.Element.prototype` in case of feature checking on `Element`\n //  E.prototype = Element.prototype\n //  return E\n-); }\n+}\n \n", 'addition_count': 3, 'deletion_count': 3, 'src_file': 'a/dist/snuggsi.js', 'tgt_file': 'b/dist/snuggsi.js', 'file_extension': '.js', 'before_file': '// http://nshipster.com/method-swizzling/\n// HTMLElement Swizzle - To swizzle a method is to change a class’s dispatch table in order to resolve messages from an existing selector to a different implementation, while aliasing the original method implementation to a new selector.\n\n// 3.2.3 HTML element constructors\n// https://html.spec.whatwg.org/multipage/dom.html#html-element-constructors\n// Satisfy Element interface document.createElement\n//   - https://dom.spec.whatwg.org/#concept-element-interface\n\nvar HTMLElement =\n\n/*\n// Domenic discusses\n// https://esdiscuss.org/topic/extending-an-es6-class-using-es5-syntax#content-1\nI believe this will work in most cases:\n\nfunction B() {\n  const obj = new A();\n  Object.setPrototypeOf(obj, new.target.prototype); // or B.prototype, but if you derive from B you\'ll have to do this dance again\n\n  // use obj instead of this\n\n  return obj;\n}\nAlso, in general you should do\n\ninstead of\n\nB.prototype = Object.create(A.prototype);\nfor slightly better semantics, including class-side inheritance and not clobbering .constructor.\n*/\n\n( function (_) {\n  function E () {}\n\n  E.prototype =\n\n    window.HTMLElement.prototype\n\n  // Prevent `.constructor` clobbering\n  // E.__proto__ = window.HTMLElement\n\n    // https://github.com/whatwg/html/issues/1704\n    // E.prototype.__proto__\n    //   = (E.__proto__ = HTMLElement).prototype\n\n    // Domenic\'s method\n    // Object\n    //   .setPrototypeOf\n    //     (Object.setPrototypeOf (B, A).prototype, A.prototype)\n\n    return E\n})()\n\nvar TokenList = function (node) {\n  var this$1 = this;\n\n\n  var\n    visit = function (node) { return node.attributes && [].slice\n         .call (node.attributes)\n         .map(collect)\n      || collect (node); }\n\n  , collect = function (node) { return /{(\\w+|#)}/.test (node.textContent)\n        && (node.text = node.textContent)\n            .match (/[^{]+(?=})/g)\n            .map (function (symbol) { return (this$1 [symbol] || (this$1 [symbol] = [])).push (node); }); }\n\n  , walker =\n      document.createNodeIterator\n        (node, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, visit, null)\n\n  while (walker.nextNode ()) { null } // Walk all nodes and do nothing.\n};\n\n\nTokenList.prototype.bind = function (context) {\n\n  var\n    tokenize = function (symbol) { return function (node) { return (node.textContent\n        = node.textContent\n        .split (\'{\'+symbol+\'}\')\n        .join(context [symbol])); }; }\n\n  for (var symbol in this)\n    { symbol != \'bind\'\n      && this [symbol].map\n        (function (node) { return (node.textContent = node.text); }) }\n\n  for (var symbol$1 in this)\n    { symbol$1 != \'bind\'\n      && this [symbol$1].map\n        (tokenize (symbol$1)) } // more than one occurrence\n};\n\n// https://codereview.chromium.org/1987413002\n// https://github.com/whatwg/fetch/pull/442\n// https://chromium.googlesource.com/chromium/src.git/+/a5a314d3249ecf1c291b417fbe067e8c2a65fad2\n//\n// Link rel preload as attribute doesn\'t support the as=document value\n// https://bugs.chromium.org/p/chromium/issues/detail?id=593267\n//\n// Requests with useStreamOnResponse flag don\'t reuse preloaded resources\n// https://bugs.chromium.org/p/chromium/issues/detail?id=652228\n//\n// Spurious warning preloading script\n// https://bugs.chromium.org/p/chromium/issues/detail?id=655698\n//\n// WPT\n// https://github.com/w3c/web-platform-tests/pull/4505\n//\n// w3c preload Tighter definition of "load was successful"\n// https://github.com/w3c/preload/issues/83\nvoid ( function (_) {\n\n  //create an observer instance\n  // Can always default to DOMContentLoaded\n  // https://bugs.webkit.org/show_bug.cgi?id=38995#c26\n  (new MutationObserver ( function (mutations) {\n\n    for (var i$1 = 0, list$1 = mutations; i$1 < list$1.length; i$1 += 1)\n      {\n      var mutation = list$1[i$1];\n\n      for (var i = 0, list = mutation.addedNodes; i < list.length; i += 1) {\n         var node = list[i];\n\n          /^p/.test (node.rel)\n           && /\\-/.test (node.id)\n           && load (node)\n\n         !! /\\-/.test (node.localName)\n           && (link = document.querySelector (\'#\'+node.localName))\n           && link.content\n           && stamp.call (node, link.content)\n           && customElements.upgrade (node)\n      }\n    }\n  }))\n\n  .observe (document.documentElement, { childList: true, subtree: true })\n\n  void\n\n  [].slice\n    .call (document.querySelectorAll (\'[rel^=pre][id~="-"]\'))\n    .map  (load)\n\n\n  // XHR Specs\n  // https://xhr.spec.whatwg.org\n  // Progress events\n  // https://xhr.spec.whatwg.org/#interface-progressevent\n  // Loader - https://trac.webkit.org/browser/trunk/WebCore/loader/loader.cpp\n  function load (link) {\n\n    var xhr = new XMLHttpRequest\n\n    // Destination - https://fetch.spec.whatwg.org/#requestdestination\n\n    xhr.link   = link\n    xhr.onload = onload\n    // progress events won\'t fire unless defining before open\n    xhr.open (\'GET\', link.href)\n    xhr.responseType = \'document\'\n    // Max requests\n    xhr.send ()\n  }\n\n\n  // https://github.com/w3c/preload/pull/40\n  // https://bugs.webkit.org/show_bug.cgi?id=38995\n  // https://www.w3.org/TR/html5/document-metadata.html#the-link-element\n  function onload () {\n    var\n      link = this.link\n\n    , response =\n        this.response\n\n    , anchor =\n        link.nextChild\n\n    , template =\n        link.content =\n           response.querySelector (\'template\')\n\n    // https://www.nczonline.net/blog/2010/09/28/why-is-getelementsbytagname-faster-that-queryselectorall\n    for (var i = 0, list = document.querySelectorAll (link.id); i < list.length; i += 1)\n      {\n      var node = list[i];\n\n      template && stamp.call (node, template)\n    }\n\n\n    for (var i$1 = 0, list$1 = response.querySelectorAll (\'style,link,script\'); i$1 < list$1.length; i$1 += 1)\n      {\n      var node$1 = list$1[i$1];\n\n      process (link, node$1, anchor)\n    }\n  }\n\n\n  function process (link, node, anchor) {\n      var\n        // https://chromium.googlesource.com/chromium/src.git/+/0661feafc9a84f03b04dd3719b8aaa255dfaec63/third_party/WebKit/Source/core/loader/LinkLoader.cpp\n        // HTML WhatWG scripting\n        // https://html.spec.whatwg.org/multipage/scripting.html\n        // https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script\n        // Classic script graph - https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-classic-script\n        // Module script tree - https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-module-script-tree\n        // Concept Script script - https://html.spec.whatwg.org/multipage/scripting.html#concept-script-script\n        as = node.getAttribute (\'as\')\n\n      , clone =\n          document.createElement\n            (\'script\' == as ? as : node.localName)\n\n      void\n\n      // \'type\' is used for data blocks (i.e. `type=text/recipe` or `type=application/x-game-data`\n      // https://html.spec.whatwg.org/multipage/scripting.html#data-block\n      [\'id\', \'rel\', \'href\', \'src\', \'textContent\', \'as\', \'defer\', \'crossOrigin\' ]\n        // setAttribute won\'t work for textContent and likewise explicit set for crossorigin\n        .map (function (attr) { return node [attr] && attr in clone && (clone [attr] = node [attr]); })\n\n      // use rel = \'preload stylesheet\' for async\n      // or use media=snuggsi => media || \'all\' trick\n      // loadCSS - https://github.com/filamentgroup/loadCSS\n      // http://keithclark.co.uk/articles/loading-css-without-blocking-render\n      \'style\' == as\n      // https://www.smashingmagazine.com/2016/02/preload-what-is-it-good-for/#markup-based-async-loader\n        && (clone.rel = \'stylesheet\')\n\n      \'script\' == as // smelly\n        && (clone.src = clone.href)\n\n      link\n        .parentNode\n        .insertBefore (clone, anchor)\n  }\n\n  // Slot replacement & light DOM stamping\n  // https://github.com/w3c/webcomponents/issues/288\n  // https://dom.spec.whatwg.org/#slot-assigned-nodes\n  function stamp (template) {\n    var this$1 = this;\n\n\n    template =\n      document.importNode (template, true)\n\n    var slot\n\n    [] // distribute attributes\n      .slice\n      .call (template.attributes)\n      .map  (function (attr) { return !   this$1.attributes [attr.name]\n        &&  this$1.setAttribute (attr.name, attr.value); })\n\n\n    for (var i = 0, list = this.querySelectorAll (\'[slot]\'); i < list.length; i += 1)\n      {\n      var replacement = list[i];\n\n      (slot = (template.content || template).querySelector\n       ( \'slot[name=\' + replacement.getAttribute (\'slot\') + \']\' ))\n\n      && // this could be slow\n        slot.parentNode.replaceChild (replacement, slot)\n    }\n\n    return this.innerHTML = template.innerHTML\n  }\n\n}) ()\n\nvar Template = function (template) {\n\n  var\n    range = document.createRange ()\n\n  template\n    = typeof template === \'string\'\n    ? document.querySelector ( \'template[name=\' + template + \']\' )\n    : template\n\n  range.selectNodeContents ( template.content )\n\n  var\n    fragment = range.cloneContents ()\n\n  , tokenize = function (context, index) {\n      var\n        clone = fragment.cloneNode (true)\n\n      typeof context != \'object\'\n        && ( context  = { self: context })\n\n      context [\'#\'] = index\n\n      void (new TokenList (clone))\n        .bind (context)\n\n      return clone\n    }\n\n  , bind = function (context) {\n      range.deleteContents ()\n\n      context && []\n        .concat (context)\n        .map (tokenize)\n        .reverse () // Range.insertNode does prepend\n        .map (function (fragment) { return range.insertNode (fragment); })\n    }\n\n  range.setStartAfter (template)\n  template.bind = bind\n  return template\n}\n\nwindow.customElements =\n  window.customElements\n  || {/* microfill */}\n\nvoid ( function (_) { /* CustomElementRegistry */\n\n  customElements.define = function ( name, constructor ) {\n\n    !! /\\-/.test (name)\n    && (customElements [name] = constructor)\n    && [].slice\n      // https://www.nczonline.net/blog/2010/09/28/why-is-getelementsbytagname-faster-that-queryselectorall\n      .call ( document.querySelectorAll (name) )\n      .map  ( customElements.upgrade )\n  }\n\n\n  customElements.upgrade = function (root) {\n\n    var candidates = []\n\n    // Here\'s where we can swizzle\n    // https://github.com/whatwg/html/issues/1704#issuecomment-241881091\n\n    Object.setPrototypeOf\n      (root, customElements [root.localName].prototype)\n\n    root.connectedCallback ()\n  }\n\n\n  void (new MutationObserver ( function (mutations) {\n\n    for (var i$1 = 0, list$1 = mutations; i$1 < list$1.length; i$1 += 1)\n      {\n      var mutation = list$1[i$1];\n\n      for (var i = 0, list = mutation.addedNodes; i < list.length; i += 1)\n\n         {\n          var root = list[i];\n\n          !! /\\-/.test (root.localName)\n         && customElements [root.localName]\n         && customElements.upgrade (root)\n        }\n    }\n  }))\n\n  .observe (document.documentElement, { childList: true, subtree: true })\n\n})() /* CustomElementRegistry */\n\nfunction ParentNode (Element) {\n\n  // DOM Levels\n  // (https://developer.mozilla.org/fr/docs/DOM_Levels)\n  //\n  // Living Standard HTML5 ParentNode\n  // https://dom.spec.whatwg.org/#parentnode\n  //\n  // MDN ParentNode\n  // https://developer.mozilla.org/en-US/docs/Web/API/ParentNode\n  //\n  // ElementTraversal interface\n  // https://www.w3.org/TR/ElementTraversal/#interface-elementTraversal\n\nreturn /*@__PURE__*/(function (Element) {\n  function anonymous () {\n    Element.apply(this, arguments);\n  }\n\n  if ( Element ) anonymous.__proto__ = Element;\n  anonymous.prototype = Object.create( Element && Element.prototype );\n  anonymous.prototype.constructor = anonymous;\n\n  anonymous.prototype.select = function ( )\n    {\n    var ref;\n return (ref = this).selectAll.apply ( ref, arguments ) [0] };\n\n  anonymous.prototype.selectAll = function ( strings ) {\n    var tokens = [], len = arguments.length - 1;\n    while ( len-- > 0 ) tokens[ len ] = arguments[ len + 1 ];\n\n    strings = [ ].concat ( strings )\n\n    return [].slice.call\n      (this.querySelectorAll\n        (tokens.reduce // denormalize selector\n          (function (part, token) { return part + token + strings.shift (); }\n          , strings.shift ())))\n  };\n\n  return anonymous;\n}(Element))\n}\nfunction EventTarget (HTMLElement) { // why buble\n\n  // DOM Levels\n  // (https://developer.mozilla.org/fr/docs/DOM_Levels)\n  //\n  // WHATWG Living Standard HTML5 EventTarget\n  // https://dom.spec.whatwg.org/#eventtarget\n  //\n  // MDN EventTarget\n  // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget\n  //\n  // DOM Level 3 EventTarget\n  // https://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-EventTarget\n  //\n  // DOM Level 2 EventTarget\n  // (AKA Str🎱  W3C #fockery) ➡️  https://annevankesteren.nl/2016/01/film-at-11\n  // 😕  https://w3c.github.io/uievents/DOM3-Events.html#interface-EventTarget\n  //❓❓ https://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html\n  // https://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-EventTarget\n  // Within https://w3c.github.io/uievents/#conf-interactive-ua\n  // EventTarget links to WHATWG - https://dom.spec.whatwg.org/#eventtarget\n\nreturn /*@__PURE__*/(function (HTMLElement) {\n  function anonymous () {\n    HTMLElement.apply(this, arguments);\n  }\n\n  if ( HTMLElement ) anonymous.__proto__ = HTMLElement;\n  anonymous.prototype = Object.create( HTMLElement && HTMLElement.prototype );\n  anonymous.prototype.constructor = anonymous;\n\n  anonymous.prototype.on = function ( event, handler ) {\n\n    this.addEventListener\n      (event, this.renderable (handler))\n  };\n\n  anonymous.prototype.renderable = function ( handler ) {\n    var this$1 = this;\n\n\n    // BIG BUG IN IE!!!\n    //\n    // https://connect.microsoft.com/IE/feedback/details/790389/event-defaultprevented-returns-false-after-preventdefault-was-called\n    //\n    // https://github.com/webcomponents/webcomponents-platform/blob/master/webcomponents-platform.js#L16\n\n    return function (event) { return handler.call (this$1, event) !== false\n        // check render availability\n        && event.defaultPrevented\n        || this$1.render (); }\n  };\n\n//off (event, listener = \'on\' + this [event])\n//  // MDN EventTarget.removeEventListener\n//  // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener\n//  //\n//  // WHATWG Living Standard EventTarget.removeEventListener\n//  // https://dom.spec.whatwg.org/#dom-eventtarget-removeeventlistener\n//  //\n//  // DOM Level 2 EventTarget.removeEventListener\n//  // https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventTarget-removeEventListener\n\n//  { this.removeEventListener (event, listener) }\n\n//dispatch (event)\n//  // MDN EventTarget.dispatchEvent\n//  // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent\n//  //\n//  // WHATWG Living Standard EventTarget.dispatchEvent\n//  // https://dom.spec.whatwg.org/#dom-eventtarget-dispatchevent\n//  //\n//  // DOM Level 2 EventTarget.dispatchEvent\n//  //  https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventTarget-dispatchEvent\n\n//  { }\n\n\n  // Reflection - https://en.wikipedia.org/wiki/Reflection_(computer_programming)\n  // Type Introspection - https://en.wikipedia.org/wiki/Type_introspection\n  //\n  // In computing, type introspection is the ability of a program\n  // to examine the type or properties of an object at runtime.\n  // Some programming languages possess this capability.\n  //\n  // Introspection should not be confused with reflection,\n  // which goes a step further and is the ability for a program to manipulate the values,\n  // meta-data, properties and/or functions of an object at runtime.\n\n\n  anonymous.prototype.reflect = function (handler) {\n\n    /^on/.test (handler) // is a W3C `on`event\n      && handler in HTMLElement.prototype // `on*`\n\n      && // automagically delegate event\n        this.on ( handler.substr (2), this [handler] )\n  };\n\n\n  anonymous.prototype.register = function (node, handler, event) {\n    for (var i = 0, list = [].slice.call (node.attributes); i < list.length; i += 1)\n            {\n      var attribute = list[i];\n\n      /^on/.test (event = attribute.name)\n            // https://www.quirksmode.org/js/events_tradmod.html\n            // because under traditional registration the handler value is wrapped in scope `{ onfoo }`\n            && ( handler = (/{\\s*(\\w+)/.exec (node [event]) || []) [1])\n            && ( node [event] = this.renderable (this [handler]) )\n    }\n  };\n\n  return anonymous;\n}(HTMLElement))\n}\nfunction GlobalEventHandlers (Element) {\n\n  // Living Standard HTML5 GlobalEventHandlers\n  // https://html.spec.whatwg.org/multipage/webappapis.html#globaleventhandlers\n  //\n  // MDN GlobalEventHandlers\n  // https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers\n  //\n  // MDN on* Events\n  // https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Event_handlers\n  //\n  // DOM Level 0\n  // This event handling model was introduced by Netscape Navigator,\n  // and remains the most cross-browser model as of 2005\n  // https://en.wikipedia.org/wiki/DOM_events#DOM_Level_0#DOM_Level_0\n  //\n  // All Event Handling Models\n  // https://en.wikipedia.org/wiki/DOM_events#Event_handling_models\n  //\n  // Inline Model\n  // https://en.wikipedia.org/wiki/DOM_events#Inline_model\n  //\n  // Traditional Model\n  // https://en.wikipedia.org/wiki/DOM_events#Traditional_model\n  //\n  // Traditional Registration\n  // http://www.quirksmode.org/js/events_tradmod.html\n\n\n  // HandleEvent Registration - https://viperhtml.js.org/hyperhtml/documentation/#essentials-6\n\nreturn /*@__PURE__*/(function (Element) {\n  function anonymous () {\n    Element.apply(this, arguments);\n  }\n\n  if ( Element ) anonymous.__proto__ = Element;\n  anonymous.prototype = Object.create( Element && Element.prototype );\n  anonymous.prototype.constructor = anonymous;\n\n  anonymous.prototype.onconnect = function (event) {\n\n    this.templates =\n      this\n        .selectAll (\'template[name]\')\n        .map (Template)\n\n    this.tokens =\n      new TokenList (this)\n\n    Element.prototype.onconnect\n      && Element.prototype.onconnect.call (this, event)\n  };\n\n  return anonymous;\n}(Element))\n}\nvar Custom = function (Element) { return ( /*@__PURE__*/(function (superclass) {\n    function anonymous () {\n      superclass.apply(this, arguments);\n    }\n\n    if ( superclass ) anonymous.__proto__ = superclass;\n    anonymous.prototype = Object.create( superclass && superclass.prototype );\n    anonymous.prototype.constructor = anonymous;\n\n    anonymous.prototype.connectedCallback = function () {\n    this.context = {}\n\n    superclass.prototype.initialize\n      && superclass.prototype.initialize.call (this)\n\n    Object\n      .getOwnPropertyNames (Element.prototype)\n      .map (this.reflect, this)\n\n    this.addEventListener\n      (\'connect\', this.onconnect)\n \n    this.addEventListener.call\n      (this, \'idle\', superclass.prototype.onidle)\n\n    this.dispatchEvent\n      (new Event (\'connect\'))\n\n    this.render ()\n  };\n\n\n  anonymous.prototype.render = function () {\n\n    for (var i = 0, list = this.templates; i < list.length; i += 1)\n      {\n      var template = list[i];\n\n      template.bind\n        (this [template.getAttribute (\'name\')])\n    }\n\n    this\n      .tokens\n      .bind (this)\n\n    this.register (this)\n\n    this\n      // possibly restrict to elements with on event\n      .selectAll (\'*\')\n      .map (this.register, this)\n\n    this.dispatchEvent\n      (new Event (\'idle\'))\n  };\n\n    return anonymous;\n  }(( ParentNode\n  ( EventTarget\n  ( GlobalEventHandlers\n  ( Element ))))))); }\n\n// http://2ality.com/2013/09/window.html\n// http://tobyho.com/2013/03/13/window-prop-vs-global-var\n\nvar Element = function (tag) { return (\n\n//      const constructor =// swizzle\n//        typeof tag === \'string\'\n//    //    ? HTMLCustomElement\n//    //    : HTMLElement\n\n        //https://gist.github.com/allenwb/53927e46b31564168a1d\n        // https://github.com/w3c/webcomponents/issues/587#issuecomment-271031208\n        // https://github.com/w3c/webcomponents/issues/587#issuecomment-254017839\n\n      function (Element) { return customElements.define\n          ( tag + \'\', Custom (Element) ); }\n\n// Assign `window.Element.prototype` in case of feature checking on `Element`\n//  E.prototype = Element.prototype\n//  return E\n); }\n\n', 'message': ':muscle: bump TRANSPILED distribution dist/snuggsi.js\n', 'author_name': 'snuggs', 'lang': 'js'}