Version 0.6.9.1 .

svn merge -c 25379 https://dart.googlecode.com/svn/branches/bleeding_edge trunk
svn merge -c 25383 https://dart.googlecode.com/svn/branches/bleeding_edge trunk

git-svn-id: http://dart.googlecode.com/svn/trunk@25385 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/pkg/shadow_dom/lib/shadow_dom.debug.js b/pkg/shadow_dom/lib/shadow_dom.debug.js
index dc87a19..bd4252d 100644
--- a/pkg/shadow_dom/lib/shadow_dom.debug.js
+++ b/pkg/shadow_dom/lib/shadow_dom.debug.js
@@ -232,6 +232,10 @@
     GeneratedWrapper.prototype =
         Object.create(superWrapperConstructor.prototype);
     GeneratedWrapper.prototype.constructor = GeneratedWrapper;
+    // We add this property to work around a Firefox bug where HTMLFormElement
+    // and HTMLInputElements sometimes have their constructor incorrectly
+    // attached to GeneratedWrapper. See lib/patches-shadowdom-polyfill.js
+    GeneratedWrapper._ShadowDOMPolyfill$isGeneratedWrapper = true;
 
     return GeneratedWrapper;
   }
@@ -367,6 +371,7 @@
   scope.wrappers = wrappers;
 
 })(this.ShadowDOMPolyfill);
+
 // Copyright 2013 The Polymer Authors. All rights reserved.
 // Use of this source code is goverened by a BSD-style
 // license that can be found in the LICENSE file.
@@ -3153,69 +3158,41 @@
   HTMLElement.prototype.webkitCreateShadowRoot =
       HTMLElement.prototype.createShadowRoot;
 
-  // TODO(jmesserly): figure out what to do about these Dart-specific patches
-  // Right now it depends on some dart2js impl details to patch getTypeNameOf
   // TODO(jmesserly): we need to wrap document somehow (a dart:html hook?)
-  window.dartMainRunner = function(main) {
+  window.dartExperimentalFixupGetTag = function(originalGetTag) {
     var NodeList = ShadowDOMPolyfill.wrappers.NodeList;
     var ShadowRoot = ShadowDOMPolyfill.wrappers.ShadowRoot;
     var isWrapper = ShadowDOMPolyfill.isWrapper;
     var unwrap = ShadowDOMPolyfill.unwrap;
-    var innerTypeNameOf = window.$.getFunctionForTypeNameOf();
+    function getTag(obj) {
+      if (obj instanceof NodeList) return 'NodeList';
+      if (obj instanceof ShadowRoot) return 'ShadowRoot';
+      if (obj instanceof MutationRecord) return 'MutationRecord';
+      if (obj instanceof MutationObserver) return 'MutationObserver';
 
-    function typeNameOfShadowDOM(obj) {
-      var result;
-      if (obj instanceof NodeList) {
-        result = 'NodeList';
-      } else if (obj instanceof ShadowRoot) {
-        result = 'ShadowRoot';
-      } else if (obj instanceof MutationRecord) {
-        result = 'MutationRecord';
-      } else if (obj instanceof MutationObserver) {
-        result = 'MutationObserver';
-      } else {
-        if (isWrapper(obj)) {
-          obj = unwrap(obj);
+      if (isWrapper(obj)) {
+        obj = unwrap(obj);
 
-          // Fix up class names for Firefox. For some of them like
-          // HTMLFormElement and HTMLInputElement, the "constructor" property of
-          // the unwrapped nodes points at the wrapper for some reason.
-          // TODO(jmesserly): figure out why this is happening.
-          var ctor = obj.constructor;
-          if (ctor && !ctor.builtin$cls && ctor.name == 'GeneratedWrapper') {
-            var name = Object.prototype.toString.call(obj);
+        // Fix up class names for Firefox. For some of them like
+        // HTMLFormElement and HTMLInputElement, the "constructor" property of
+        // the unwrapped nodes points at the wrapper for some reason.
+        // TODO(jmesserly): figure out why this is happening.
+        var ctor = obj.constructor;
+        if (ctor && ctor._ShadowDOMPolyfill$isGeneratedWrapper) {
+          var name = ctor._ShadowDOMPolyfill$cacheTag_;
+          if (!name) {
+            name = Object.prototype.toString.call(obj);
             name = name.substring(8, name.length - 1);
-            ctor.builtin$cls = name;
+            ctor._ShadowDOMPolyfill$cacheTag_ = name;
           }
+          return name;
         }
-
-        result = innerTypeNameOf.call$1(obj);
       }
-
-      return result;
+      return originalGetTag(obj);
     }
 
-    function constructorNameShadowDOM(object) {
-      var $constructor, $name, string;
-      if (object == null)
-        return "Null";
-      $constructor = object.constructor;
-      if (typeof $constructor === "function") {
-        $name = $constructor.builtin$cls;
-        if ($name != null)
-          return $name;
-      }
-
-    }
-
-    window.$.constructorNameFallback = constructorNameShadowDOM;
-    window.$._getTypeNameOf = { call$1: typeNameOfShadowDOM };
-    window.Isolate.$isolateProperties._getTypeNameOf = window.$._getTypeNameOf;
-
-    // Invoke the real main
-    main();
+    return getTag;
   };
-
 })();
 
 }
\ No newline at end of file
diff --git a/pkg/shadow_dom/lib/shadow_dom.min.js b/pkg/shadow_dom/lib/shadow_dom.min.js
index cea694d..8606fcf 100644
--- a/pkg/shadow_dom/lib/shadow_dom.min.js
+++ b/pkg/shadow_dom/lib/shadow_dom.min.js
@@ -1,2 +1,2 @@
-if(!HTMLElement.prototype.createShadowRoot&&!HTMLElement.prototype.webkitCreateShadowRoot||window.__forceShadowDomPolyfill){(function(){Element.prototype.webkitCreateShadowRoot&&(Element.prototype.webkitCreateShadowRoot=function(){return window.ShadowDOMPolyfill.wrapIfNeeded(this).createShadowRoot()})})();var SideTable;"undefined"!=typeof WeakMap&&0>navigator.userAgent.indexOf("Firefox/")?SideTable=WeakMap:function(){var e=Object.defineProperty,t=Object.hasOwnProperty,n=(new Date).getTime()%1e9;SideTable=function(){this.name="__st"+(1e9*Math.random()>>>0)+(n++ +"__")},SideTable.prototype={set:function(t,n){e(t,this.name,{value:n,writable:!0})},get:function(e){return t.call(e,this.name)?e[this.name]:void 0},"delete":function(e){this.set(e,void 0)}}}();var ShadowDOMPolyfill={};(function(e){"use strict";function t(e){if(!e)throw new Error("Assertion failed")}function n(e,t){return Object.getOwnPropertyNames(t).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function r(e,t){return Object.getOwnPropertyNames(t).forEach(function(n){switch(n){case"arguments":case"caller":case"length":case"name":case"prototype":case"toString":return}Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function i(e){var t=e.__proto__||Object.getPrototypeOf(e),n=M.get(t);if(n)return n;var r=i(t),o=p(r);return u(t,o,e),o}function o(e,t){l(e,t,!0)}function a(e,t){l(t,e,!1)}function l(e,t,n){Object.getOwnPropertyNames(e).forEach(function(r){if(!(r in t)){L&&e.__lookupGetter__(r);var i;try{i=Object.getOwnPropertyDescriptor(e,r)}catch(o){i=C}var a,l;if(n&&"function"==typeof i.value)return t[r]=function(){return this.impl[r].apply(this.impl,arguments)},void 0;a=function(){return this.impl[r]},(i.writable||i.set)&&(l=function(e){this.impl[r]=e}),Object.defineProperty(t,r,{get:a,set:l,configurable:i.configurable,enumerable:i.enumerable})}})}function s(e,t,n){var i=e.prototype;u(i,t,n),r(t,e)}function u(e,n,r){var i=n.prototype;t(void 0===M.get(e)),M.set(e,n),o(e,i),r&&a(i,r)}function c(e,t){return M.get(t.prototype)===e}function d(e){var t=Object.getPrototypeOf(e),n=i(t),r=p(n);return u(t,r,e),r}function p(e){function t(t){e.call(this,t)}return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t}function f(e){return e instanceof N.EventTarget||e instanceof N.Event||e instanceof N.DOMImplementation}function h(e){return e instanceof D||e instanceof O||e instanceof _||e instanceof H}function m(e){if(null===e)return null;t(h(e));var n=S.get(e);if(!n){var r=i(e);n=new r(e),S.set(e,n)}return n}function w(e){return null===e?null:(t(f(e)),e.impl)}function g(e){return e&&f(e)?w(e):e}function v(e){return e&&!f(e)?m(e):e}function E(e,n){null!==n&&(t(h(e)),t(void 0===n||f(n)),S.set(e,n))}function y(e,t,n){Object.defineProperty(e.prototype,t,{get:n,configurable:!0,enumerable:!0})}function T(e,t){y(e,t,function(){return m(this.impl[t])})}function b(e,t){e.forEach(function(e){t.forEach(function(t){e.prototype[t]=function(){var e=m(this);return e[t].apply(e,arguments)}})})}var S=new SideTable,M=new SideTable,N=Object.create(null);Object.getOwnPropertyNames(window);var L=/Firefox/.test(navigator.userAgent),C={get:function(){},set:function(){},configurable:!0,enumerable:!0},H=DOMImplementation,O=Event,D=Node,_=Window;e.assert=t,e.defineGetter=y,e.defineWrapGetter=T,e.forwardMethodsToWrapper=b,e.isWrapper=f,e.isWrapperFor=c,e.mixin=n,e.registerObject=d,e.registerWrapper=s,e.rewrap=E,e.unwrap=w,e.unwrapIfNeeded=g,e.wrap=m,e.wrapIfNeeded=v,e.wrappers=N})(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){return e instanceof I.ShadowRoot}function n(e){var t=e.localName;return"content"===t||"shadow"===t}function r(e){return!!e.shadowRoot}function i(e){var t;return e.parentNode||(t=e.defaultView)&&R(t)||null}function o(o,a,l){if(l.length)return l.shift();if(t(o))return o.insertionParent||e.getHostForShadowRoot(o);var s=e.eventParentsTable.get(o);if(s){for(var u=1;s.length>u;u++)l[u-1]=s[u];return s[0]}if(a&&n(o)){var c=o.parentNode;if(c&&r(c))for(var d=e.getShadowTrees(c),p=a.insertionParent,u=0;d.length>u;u++)if(d[u].contains(p))return p}return i(o)}function a(e){for(var r=[],i=e,a=[],s=[];i;){var u=null;if(n(i)){u=l(r);var c=r[r.length-1]||i;r.push(c)}else r.length||r.push(i);var d=r[r.length-1];a.push({target:d,currentTarget:i}),t(i)&&r.pop(),i=o(i,u,s)}return a}function l(e){for(var t=e.length-1;t>=0;t--)if(!n(e[t]))return e[t];return null}function s(r,i){for(var a=[];r;){for(var s=[],c=i,p=void 0;c;){var f=null;if(s.length){if(n(c)&&(f=l(s),u(p))){var h=s[s.length-1];s.push(h)}}else s.push(c);if(d(c,r))return s[s.length-1];t(c)&&s.pop(),p=c,c=o(c,f,a)}r=t(r)?e.getHostForShadowRoot(r):r.parentNode}}function u(e){return e.insertionParent}function c(e){for(var t;t=e.parentNode;)e=t;return e}function d(e,t){return c(e)===c(t)}function p(e){switch(e){case"DOMAttrModified":case"DOMAttributeNameChanged":case"DOMCharacterDataModified":case"DOMElementNameChanged":case"DOMNodeInserted":case"DOMNodeInsertedIntoDocument":case"DOMNodeRemoved":case"DOMNodeRemovedFromDocument":case"DOMSubtreeModified":return!0}return!1}function f(t){if(!F.get(t)){F.set(t,!0),p(t.type)||e.renderAllPending();var n=R(t.target),r=R(t);return h(r,n)}}function h(e,t){var n=a(t);return"load"===e.type&&2===n.length&&n[0].target instanceof I.Document&&n.shift(),m(e,n)&&w(e,n)&&g(e,n),k.set(e,y.NONE),W.set(e,null),e.defaultPrevented}function m(e,t){for(var n,r=t.length-1;r>0;r--){var i=t[r].target,o=t[r].currentTarget;if(i!==o&&(n=y.CAPTURING_PHASE,!v(t[r],e,n)))return!1}return!0}function w(e,t){var n=y.AT_TARGET;return v(t[0],e,n)}function g(e,t){for(var n,r=e.bubbles,i=1;t.length>i;i++){var o=t[i].target,a=t[i].currentTarget;if(o===a)n=y.AT_TARGET;else{if(!r||q.get(e))continue;n=y.BUBBLING_PHASE}if(!v(t[i],e,n))return}}function v(e,t,n){var r=e.target,i=e.currentTarget,o=A.get(i);if(!o)return!0;if("relatedTarget"in t){var a=x(t),l=R(a.relatedTarget),u=s(i,l);if(u===r)return!0;B.set(t,u)}k.set(t,n);var c=t.type,d=!1;j.set(t,r),W.set(t,i);for(var p=0;o.length>p;p++){var f=o[p];if(f.removed)d=!0;else if(!(f.type!==c||!f.capture&&n===y.CAPTURING_PHASE||f.capture&&n===y.BUBBLING_PHASE))try{if("function"==typeof f.handler?f.handler.call(i,t):f.handler.handleEvent(t),q.get(t))return!1}catch(h){window.onerror?window.onerror(h.message):console.error(h)}}if(d){var m=o.slice();o.length=0;for(var p=0;m.length>p;p++)m[p].removed||o.push(m[p])}return!G.get(t)}function E(e,t,n){this.type=e,this.handler=t,this.capture=Boolean(n)}function y(e,t){return e instanceof U?(this.impl=e,void 0):R(M(U,"Event",e,t))}function T(e){return e&&e.relatedTarget?Object.create(e,{relatedTarget:{value:x(e.relatedTarget)}}):e}function b(e,t,n){var r=window[e],i=function(t,n){return t instanceof r?(this.impl=t,void 0):R(M(r,e,t,n))};return i.prototype=Object.create(t.prototype),n&&_(i.prototype,n),r&&P(r,i,document.createEvent(e)),i}function S(e,t){return function(){arguments[t]=x(arguments[t]);var n=x(this);n[e].apply(n,arguments)}}function M(e,t,n,r){if(et)return new e(n,T(r));var i=x(document.createEvent(t)),o=J[t],a=[n];return Object.keys(o).forEach(function(e){var t=null!=r&&e in r?r[e]:o[e];"relatedTarget"===e&&(t=x(t)),a.push(t)}),i["init"+t].apply(i,a),i}function N(e){return"function"==typeof e?!0:e&&e.handleEvent}function L(e){this.impl=e}function C(t){return t instanceof I.ShadowRoot&&(t=e.getHostForShadowRoot(t)),x(t)}function H(e){D(e,rt)}function O(t,n,r,i){e.renderAllPending();for(var o=R(it.call(n.impl,r,i)),l=a(o,this),s=0;l.length>s;s++){var u=l[s];if(u.currentTarget===t)return u.target}return null}var D=e.forwardMethodsToWrapper,_=e.mixin,P=e.registerWrapper,x=e.unwrap,R=e.wrap,I=e.wrappers;new SideTable;var A=new SideTable,F=new SideTable,j=new SideTable,W=new SideTable,B=new SideTable,k=new SideTable,G=new SideTable,q=new SideTable;E.prototype={equals:function(e){return this.handler===e.handler&&this.type===e.type&&this.capture===e.capture},get removed(){return null===this.handler},remove:function(){this.handler=null}};var U=window.Event;y.prototype={get target(){return j.get(this)},get currentTarget(){return W.get(this)},get eventPhase(){return k.get(this)},stopPropagation:function(){G.set(this,!0)},stopImmediatePropagation:function(){G.set(this,!0),q.set(this,!0)}},P(U,y,document.createEvent("Event"));var $=b("UIEvent",y),V=b("CustomEvent",y),K={get relatedTarget(){return B.get(this)||R(x(this).relatedTarget)}},z=_({initMouseEvent:S("initMouseEvent",14)},K),X=_({initFocusEvent:S("initFocusEvent",5)},K),Y=b("MouseEvent",$,z),Q=b("FocusEvent",$,X),Z=b("MutationEvent",y,{initMutationEvent:S("initMutationEvent",3),get relatedNode(){return R(this.impl.relatedNode)}}),J=Object.create(null),et=function(){try{new window.MouseEvent("click")}catch(e){return!1}return!0}();if(!et){var tt=function(e,t,n){if(n){var r=J[n];t=_(_({},r),t)}J[e]=t};tt("Event",{bubbles:!1,cancelable:!1}),tt("CustomEvent",{detail:null},"Event"),tt("UIEvent",{view:null,detail:0},"Event"),tt("MouseEvent",{screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null},"UIEvent"),tt("FocusEvent",{relatedTarget:null},"UIEvent")}var nt=window.EventTarget,rt=["addEventListener","removeEventListener","dispatchEvent"];[Element,Window,Document].forEach(function(e){var t=e.prototype;rt.forEach(function(e){Object.defineProperty(t,e+"_",{value:t[e]})})}),L.prototype={addEventListener:function(e,t,n){if(N(t)){var r=new E(e,t,n),i=A.get(this);if(i){for(var o=0;i.length>o;o++)if(r.equals(i[o]))return}else i=[],A.set(this,i);i.push(r);var a=C(this);a.addEventListener_(e,f,!0)}},removeEventListener:function(e,t,n){n=Boolean(n);var r=A.get(this);if(r){for(var i=0,o=!1,a=0;r.length>a;a++)r[a].type===e&&r[a].capture===n&&(i++,r[a].handler===t&&(o=!0,r[a].remove()));if(o&&1===i){var l=C(this);l.removeEventListener_(e,f,!0)}}},dispatchEvent:function(t){e.renderAllPending();var n=C(this);return n.dispatchEvent_(x(t))}},nt&&P(nt,L);var it=document.elementFromPoint;e.adjustRelatedTarget=s,e.elementFromPoint=O,e.wrapEventTargetMethods=H,e.wrappers.CustomEvent=V,e.wrappers.Event=y,e.wrappers.EventTarget=L,e.wrappers.FocusEvent=Q,e.wrappers.MouseEvent=Y,e.wrappers.MutationEvent=Z,e.wrappers.UIEvent=$}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e,t){Object.defineProperty(e,t,{enumerable:!1})}function n(){this.length=0,t(this,"length")}function r(e){if(null==e)return e;for(var t=new n,r=0,i=e.length;i>r;r++)t[r]=o(e[r]);return t.length=i,t}function i(e,t){e.prototype[t]=function(){return r(this.impl[t].apply(this.impl,arguments))}}var o=e.wrap;n.prototype={item:function(e){return this[e]}},t(n.prototype,"item"),e.wrappers.NodeList=n,e.addWrapNodeListMethod=i,e.wrapNodeList=r}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){u(e instanceof o)}function n(e,t,n,r){if(e.nodeType!==o.DOCUMENT_FRAGMENT_NODE)return e.parentNode&&e.parentNode.removeChild(e),e.parentNode_=t,e.previousSibling_=n,e.nextSibling_=r,n&&(n.nextSibling_=e),r&&(r.previousSibling_=e),[e];for(var i,a=[];i=e.firstChild;)e.removeChild(i),a.push(i),i.parentNode_=t;for(var l=0;a.length>l;l++)a[l].previousSibling_=a[l-1]||n,a[l].nextSibling_=a[l+1]||r;return n&&(n.nextSibling_=a[0]),r&&(r.previousSibling_=a[a.length-1]),a}function r(e){if(1===e.length)return p(e[0]);for(var t=p(document.createDocumentFragment()),n=0;e.length>n;n++)t.appendChild(p(e[n]));return t}function i(e){for(var t=e.firstChild;t;){u(t.parentNode===e);var n=t.nextSibling,r=p(t),i=r.parentNode;i&&v.call(i,r),t.previousSibling_=t.nextSibling_=t.parentNode_=null,t=n}e.firstChild_=e.lastChild_=null}function o(e){u(e instanceof h),a.call(this,e),this.parentNode_=void 0,this.firstChild_=void 0,this.lastChild_=void 0,this.nextSibling_=void 0,this.previousSibling_=void 0}var a=e.wrappers.EventTarget,l=e.wrappers.NodeList,s=e.defineWrapGetter,u=e.assert,c=e.mixin,d=e.registerWrapper,p=e.unwrap,f=e.wrap,h=window.Node,m=h.prototype.appendChild,w=h.prototype.insertBefore,g=h.prototype.replaceChild,v=h.prototype.removeChild,E=h.prototype.compareDocumentPosition;o.prototype=Object.create(a.prototype),c(o.prototype,{appendChild:function(e){t(e),this.invalidateShadowRenderer();var i=this.lastChild,o=null,a=n(e,this,i,o);return this.lastChild_=a[a.length-1],i||(this.firstChild_=a[0]),m.call(this.impl,r(a)),e},insertBefore:function(e,i){if(!i)return this.appendChild(e);t(e),t(i),u(i.parentNode===this),this.invalidateShadowRenderer();var o=i.previousSibling,a=i,l=n(e,this,o,a);this.firstChild===i&&(this.firstChild_=l[0]);var s=p(i),c=s.parentNode;return c&&w.call(c,r(l),s),e},removeChild:function(e){if(t(e),e.parentNode!==this)throw new Error("NotFoundError");this.invalidateShadowRenderer();var n=this.firstChild,r=this.lastChild,i=e.nextSibling,o=e.previousSibling,a=p(e),l=a.parentNode;return l&&v.call(l,a),n===e&&(this.firstChild_=i),r===e&&(this.lastChild_=o),o&&(o.nextSibling_=i),i&&(i.previousSibling_=o),e.previousSibling_=e.nextSibling_=e.parentNode_=null,e},replaceChild:function(e,i){if(t(e),t(i),i.parentNode!==this)throw new Error("NotFoundError");this.invalidateShadowRenderer();var o=i.previousSibling,a=i.nextSibling;a===e&&(a=e.nextSibling);var l=n(e,this,o,a);this.firstChild===i&&(this.firstChild_=l[0]),this.lastChild===i&&(this.lastChild_=l[l.length-1]),i.previousSibling_=null,i.nextSibling_=null,i.parentNode_=null;var s=p(i);return s.parentNode&&g.call(s.parentNode,r(l),s),i},hasChildNodes:function(){return null===this.firstChild},get parentNode(){return void 0!==this.parentNode_?this.parentNode_:f(this.impl.parentNode)},get firstChild(){return void 0!==this.firstChild_?this.firstChild_:f(this.impl.firstChild)},get lastChild(){return void 0!==this.lastChild_?this.lastChild_:f(this.impl.lastChild)},get nextSibling(){return void 0!==this.nextSibling_?this.nextSibling_:f(this.impl.nextSibling)},get previousSibling(){return void 0!==this.previousSibling_?this.previousSibling_:f(this.impl.previousSibling)},get parentElement(){for(var e=this.parentNode;e&&e.nodeType!==o.ELEMENT_NODE;)e=e.parentNode;return e},get textContent(){for(var e="",t=this.firstChild;t;t=t.nextSibling)e+=t.textContent;return e},set textContent(e){if(i(this),this.invalidateShadowRenderer(),""!==e){var t=this.impl.ownerDocument.createTextNode(e);this.appendChild(t)}},get childNodes(){for(var e=new l,t=0,n=this.firstChild;n;n=n.nextSibling)e[t++]=n;return e.length=t,e},cloneNode:function(e){if(!this.invalidateShadowRenderer())return f(this.impl.cloneNode(e));var t=f(this.impl.cloneNode(!1));if(e)for(var n=this.firstChild;n;n=n.nextSibling)t.appendChild(n.cloneNode(!0));return t},contains:function(e){if(!e)return!1;if(e===this)return!0;var t=e.parentNode;return t?this.contains(t):!1},compareDocumentPosition:function(e){return E.call(this.impl,p(e))}}),s(o,"ownerDocument"),d(h,o,document.createDocumentFragment()),delete o.prototype.querySelector,delete o.prototype.querySelectorAll,o.prototype=c(Object.create(a.prototype),o.prototype),e.wrappers.Node=o}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e,n){for(var r,i=e.firstElementChild;i;){if(i.matches(n))return i;if(r=t(i,n))return r;i=i.nextElementSibling}return null}function n(e,t,r){for(var i=e.firstElementChild;i;)i.matches(t)&&(r[r.length++]=i),n(i,t,r),i=i.nextElementSibling;return r}var r={querySelector:function(e){return t(this,e)},querySelectorAll:function(e){return n(this,e,new NodeList)}},i={getElementsByTagName:function(e){return this.querySelectorAll(e)},getElementsByClassName:function(e){return this.querySelectorAll("."+e)},getElementsByTagNameNS:function(e,t){if("*"===e)return this.getElementsByTagName(t);for(var n=new NodeList,r=this.getElementsByTagName(t),i=0,o=0;r.length>i;i++)r[i].namespaceURI===e&&(n[o++]=r[i]);return n.length=o,n}};e.GetElementsByInterface=i,e.SelectorsInterface=r}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){for(;e&&e.nodeType!==Node.ELEMENT_NODE;)e=e.nextSibling;return e}function n(e){for(;e&&e.nodeType!==Node.ELEMENT_NODE;)e=e.previousSibling;return e}var r=e.wrappers.NodeList,i={get firstElementChild(){return t(this.firstChild)},get lastElementChild(){return n(this.lastChild)},get childElementCount(){for(var e=0,t=this.firstElementChild;t;t=t.nextElementSibling)e++;return e},get children(){for(var e=new r,t=0,n=this.firstElementChild;n;n=n.nextElementSibling)e[t++]=n;return e.length=t,e}},o={get nextElementSibling(){return t(this.nextSibling)},get previousElementSibling(){return n(this.nextSibling)}};e.ChildNodeInterface=o,e.ParentNodeInterface=i}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){r.call(this,e)}var n=e.ChildNodeInterface,r=e.wrappers.Node,i=e.mixin,o=e.registerWrapper,a=window.CharacterData;t.prototype=Object.create(r.prototype),i(t.prototype,{get textContent(){return this.data},set textContent(e){this.data=e}}),i(t.prototype,n),o(a,t,document.createTextNode("")),e.wrappers.CharacterData=t}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){i.call(this,e)}var n=e.ChildNodeInterface,r=e.GetElementsByInterface,i=e.wrappers.Node,o=e.ParentNodeInterface,a=e.SelectorsInterface;e.addWrapNodeListMethod;var l=e.mixin,s=e.registerWrapper,u=e.wrappers,c=new SideTable,d=window.Element,p=d.prototype.matches||d.prototype.mozMatchesSelector||d.prototype.msMatchesSelector||d.prototype.webkitMatchesSelector;t.prototype=Object.create(i.prototype),l(t.prototype,{createShadowRoot:function(){var t=new u.ShadowRoot(this);return c.set(this,t),e.getRendererForHost(this),this.invalidateShadowRenderer(!0),t},get shadowRoot(){return c.get(this)||null},setAttribute:function(e,t){this.impl.setAttribute(e,t),this.invalidateShadowRenderer()},matches:function(e){return p.call(this.impl,e)}}),l(t.prototype,n),l(t.prototype,r),l(t.prototype,o),l(t.prototype,a),s(d,t),e.wrappers.Element=t}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){switch(e){case"&":return"&amp;";case"<":return"&lt;";case'"':return"&quot;"}}function n(e){return e.replace(m,t)}function r(e){switch(e.nodeType){case Node.ELEMENT_NODE:for(var t,r=e.tagName.toLowerCase(),o="<"+r,a=e.attributes,l=0;t=a[l];l++)o+=" "+t.name+'="'+n(t.value)+'"';return o+=">",w[r]?o:o+i(e)+"</"+r+">";case Node.TEXT_NODE:return n(e.nodeValue);case Node.COMMENT_NODE:return"<!--"+n(e.nodeValue)+"-->";default:throw console.error(e),new Error("not implemented")}}function i(e){for(var t="",n=e.firstChild;n;n=n.nextSibling)t+=r(n);return t}function o(e,t,n){var r=n||"div";e.textContent="";var i=f(e.ownerDocument.createElement(r));i.innerHTML=t;for(var o;o=i.firstChild;)e.appendChild(h(o))}function a(e){u.call(this,e)}function l(t){c(a,t,function(){return e.renderAllPending(),this.impl[t]})}function s(t){Object.defineProperty(a.prototype,t,{value:function(){return e.renderAllPending(),this.impl[t].apply(this.impl,arguments)},configurable:!0,enumerable:!0})}var u=e.wrappers.Element,c=e.defineGetter,d=e.mixin,p=e.registerWrapper,f=e.unwrap,h=e.wrap,m=/&|<|"/g,w={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},g=window.HTMLElement;a.prototype=Object.create(u.prototype),d(a.prototype,{get innerHTML(){return i(this)},set innerHTML(e){o(this,e,this.tagName)},get outerHTML(){return r(this)},set outerHTML(e){if(this.invalidateShadowRenderer())throw new Error("not implemented");this.impl.outerHTML=e}}),["clientHeight","clientLeft","clientTop","clientWidth","offsetHeight","offsetLeft","offsetTop","offsetWidth","scrollHeight","scrollLeft","scrollTop","scrollWidth"].forEach(l),["getBoundingClientRect","getClientRects","scrollIntoView"].forEach(s),p(g,a,document.createElement("b")),e.wrappers.HTMLElement=a,e.getInnerHTML=i,e.setInnerHTML=o}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,i=e.registerWrapper,o=window.HTMLContentElement;t.prototype=Object.create(n.prototype),r(t.prototype,{get select(){return this.getAttribute("select")},set select(e){this.setAttribute("select",e)},setAttribute:function(e,t){n.prototype.setAttribute.call(this,e,t),"select"===String(e).toLowerCase()&&this.invalidateShadowRenderer(!0)}}),o&&i(o,t),e.wrappers.HTMLContentElement=t}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e),this.olderShadowRoot_=null}var n=e.wrappers.HTMLElement,r=e.mixin,i=e.registerWrapper,o=window.HTMLShadowElement;t.prototype=Object.create(n.prototype),r(t.prototype,{get olderShadowRoot(){return this.olderShadowRoot_},invalidateShadowRenderer:function(){n.prototype.invalidateShadowRenderer.call(this,!0)}}),o&&i(o,t),e.wrappers.HTMLShadowElement=t}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){if(!e.defaultView)return e;var t=d.get(e);if(!t){for(t=e.implementation.createHTMLDocument("");t.lastChild;)t.removeChild(t.lastChild);d.set(e,t)}return t}function n(e){for(var n,r=t(e.ownerDocument),i=r.createDocumentFragment();n=e.firstChild;)i.appendChild(n);return i}function r(e){i.call(this,e)}var i=e.wrappers.HTMLElement,o=e.getInnerHTML,a=e.mixin,l=e.registerWrapper,s=e.setInnerHTML,u=e.wrap,c=new SideTable,d=new SideTable,p=window.HTMLTemplateElement;r.prototype=Object.create(i.prototype),a(r.prototype,{get content(){if(p)return u(this.impl.content);var e=c.get(this);return e||(e=n(this),c.set(this,e)),e},get innerHTML(){return o(this.content)},set innerHTML(e){s(this.content,e),this.invalidateShadowRenderer()}}),p&&l(p,r),e.wrappers.HTMLTemplateElement=r}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){switch(e.localName){case"content":return new n(e);case"shadow":return new i(e);case"template":return new o(e)}r.call(this,e)}var n=e.wrappers.HTMLContentElement,r=e.wrappers.HTMLElement,i=e.wrappers.HTMLShadowElement,o=e.wrappers.HTMLTemplateElement;e.mixin;var a=e.registerWrapper,l=window.HTMLUnknownElement;t.prototype=Object.create(r.prototype),a(l,t),e.wrappers.HTMLUnknownElement=t}(this.ShadowDOMPolyfill),function(e){"use strict";var t=e.GetElementsByInterface,n=e.ParentNodeInterface,r=e.SelectorsInterface,i=e.mixin,o=e.registerObject,a=o(document.createDocumentFragment());i(a.prototype,n),i(a.prototype,r),i(a.prototype,t);var l=o(document.createTextNode("")),s=o(document.createComment(""));e.wrappers.Comment=s,e.wrappers.DocumentFragment=a,e.wrappers.Text=l}(this.ShadowDOMPolyfill),function(e){"use strict";function t(t){var r=s(t.impl.ownerDocument.createDocumentFragment());n.call(this,r),a(r,this);var i=t.shadowRoot;e.nextOlderShadowTreeTable.set(this,i),u.set(this,t)}var n=e.wrappers.DocumentFragment,r=e.elementFromPoint,i=e.getInnerHTML,o=e.mixin,a=e.rewrap,l=e.setInnerHTML,s=e.unwrap,u=new SideTable;t.prototype=Object.create(n.prototype),o(t.prototype,{get innerHTML(){return i(this)},set innerHTML(e){l(this,e),this.invalidateShadowRenderer()},invalidateShadowRenderer:function(){return u.get(this).invalidateShadowRenderer()},elementFromPoint:function(e,t){return r(this,this.ownerDocument,e,t)},getElementById:function(e){return this.querySelector("#"+e)}}),e.wrappers.ShadowRoot=t,e.getHostForShadowRoot=function(e){return u.get(e)}}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){e.previousSibling_=e.previousSibling,e.nextSibling_=e.nextSibling,e.parentNode_=e.parentNode}function n(e){e.firstChild_=e.firstChild,e.lastChild_=e.lastChild}function r(e){_(e instanceof D);for(var r=e.firstChild;r;r=r.nextSibling)t(r);n(e)}function i(e){var t=x(e);r(e),t.textContent=""}function o(e,n){var i=x(e),o=x(n);o.nodeType===D.DOCUMENT_FRAGMENT_NODE?r(n):(l(n),t(n)),e.lastChild_=e.lastChild,e.lastChild===e.firstChild&&(e.firstChild_=e.firstChild);var a=R(i.lastChild);a&&(a.nextSibling_=a.nextSibling),i.appendChild(o)}function a(e,n){var r=x(e),i=x(n);t(n),n.previousSibling&&(n.previousSibling.nextSibling_=n),n.nextSibling&&(n.nextSibling.previousSibling_=n),e.lastChild===n&&(e.lastChild_=n),e.firstChild===n&&(e.firstChild_=n),r.removeChild(i)}function l(e){var t=x(e),n=t.parentNode;n&&a(R(n),e)}function s(e,t){c(t).push(e),F.set(e,t);var n=A.get(e);n||A.set(e,n=[]),n.push(t)}function u(e){I.set(e,[])}function c(e){return I.get(e)}function d(e){for(var t=[],n=0,r=e.firstChild;r;r=r.nextSibling)t[n++]=r;return t}function p(e,t,n){for(var r=d(e),i=0;r.length>i;i++){var o=r[i];if(t(o)){if(n(o)===!1)return}else p(o,t,n)}}function f(e,t){var n=!1;return p(e,y,function(e){u(e);for(var r=0;t.length>r;r++){var i=t[r];void 0!==i&&m(i,e)&&(s(i,e),t[r]=void 0,n=!0)}}),n?t.filter(function(e){return void 0!==e}):t}function h(e,t){for(var n=0;t.length>n;n++)if(t[n]in e)return t[n]}function m(e,t){var n=t.getAttribute("select");if(!n)return!0;if(n=n.trim(),!n)return!0;if(e.nodeType!==D.ELEMENT_NODE)return!1;if(!k.test(n))return!1;if(":"===n[0]&&!G.test(n))return!1;try{return e.matches(n)}catch(r){return!1}}function w(){H=null,U.forEach(function(e){e.render()}),U=[]}function g(e){this.host=e,this.dirty=!1,this.associateNode(e)}function v(e){var t=W.get(e);return t||(t=new g(e),W.set(e,t)),t}function E(e){return"content"===e.localName}function y(e){return"content"===e.localName}function T(e){return"shadow"===e.localName}function b(e){return"shadow"===e.localName}function S(e){return!!e.shadowRoot}function M(e){return j.get(e)}function N(e){for(var t=[],n=e.shadowRoot;n;n=j.get(n))t.push(n);return t}function L(e,t){F.set(e,t)}function C(e){new g(e).render()}var H,O=e.wrappers.HTMLContentElement,D=e.wrappers.Node,_=e.assert,P=e.mixin,x=e.unwrap,R=e.wrap,I=new SideTable,A=new SideTable,F=new SideTable,j=new SideTable,W=new SideTable,B=new SideTable,k=/^[*.:#[a-zA-Z_|]/,G=new RegExp("^:("+["link","visited","target","enabled","disabled","checked","indeterminate","nth-child","nth-last-child","nth-of-type","nth-last-of-type","first-child","last-child","first-of-type","last-of-type","only-of-type"].join("|")+")"),q=h(window,["requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame","setTimeout"]),U=[];g.prototype={render:function(){if(this.dirty){var e=this.host;this.treeComposition();var t=e.shadowRoot;if(t){this.removeAllChildNodes(this.host);var n=d(t);n.forEach(function(n){this.renderNode(e,t,n,!1)},this),this.dirty=!1}}},invalidate:function(){if(!this.dirty){if(this.dirty=!0,U.push(this),H)return;H=window[q](w,0)}},renderNode:function(e,t,n,r){if(S(n)){this.appendChild(e,n);var i=v(n);i.dirty=!0,i.render()}else E(n)?this.renderInsertionPoint(e,t,n,r):T(n)?this.renderShadowInsertionPoint(e,t,n):this.renderAsAnyDomTree(e,t,n,r)},renderAsAnyDomTree:function(e,t,n,r){if(this.appendChild(e,n),S(n))C(n);else{var i=n,o=d(i);o.forEach(function(e){this.renderNode(i,t,e,r)},this)}},renderInsertionPoint:function(e,t,n,r){var i=c(n);i.length?(this.removeAllChildNodes(n),i.forEach(function(n){E(n)&&r?this.renderInsertionPoint(e,t,n,r):this.renderAsAnyDomTree(e,t,n,r)},this)):this.renderFallbackContent(e,n),this.remove(n)},renderShadowInsertionPoint:function(e,t,n){var r=M(t);if(r){F.set(r,n),n.olderShadowRoot_=r,this.remove(n);var i=d(r);i.forEach(function(t){this.renderNode(e,r,t,!0)},this)}else this.renderFallbackContent(e,n)},renderFallbackContent:function(e,t){var n=d(t);n.forEach(function(t){this.appendChild(e,t)},this)},treeComposition:function(){var e=this.host,t=e.shadowRoot,n=[],r=d(e);r.forEach(function(e){if(E(e)){var t=c(e);t&&t.length||(t=d(e)),n.push.apply(n,t)}else n.push(e)});for(var i,o;t;){if(i=void 0,p(t,b,function(e){return i=e,!1}),o=i,n=f(t,n),o){var a=M(t);if(a){t=a,L(t,o);continue}break}break}},appendChild:function(e,t){o(e,t),this.associateNode(t)},remove:function(e){l(e),this.associateNode(e)},removeAllChildNodes:function(e){i(e)},associateNode:function(e){B.set(e,this)}},D.prototype.invalidateShadowRenderer=function(e){var t=B.get(this);if(!t)return!1;var n;return(e||this.shadowRoot||(n=this.parentNode)&&(n.shadowRoot||n instanceof ShadowRoot))&&t.invalidate(),!0},O.prototype.getDistributedNodes=function(){return w(),c(this)},P(D.prototype,{get insertionParent(){return F.get(this)||null}}),e.eventParentsTable=A,e.getRendererForHost=v,e.getShadowTrees=N,e.nextOlderShadowTreeTable=j,e.renderAllPending=w,e.visual={removeAllChildNodes:i,appendChild:o,removeChild:a}}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){l.call(this,e)}function n(e){var n=document[e];t.prototype[e]=function(){return w(n.apply(this.impl,arguments))}}function r(e){this.impl=e}function i(e,t){var n=document.implementation[t];e.prototype[t]=function(){return w(n.apply(this.impl,arguments))}}function o(e,t){var n=document.implementation[t];e.prototype[t]=function(){return n.apply(this.impl,arguments)}}var a=e.GetElementsByInterface,l=e.wrappers.Node,s=e.ParentNodeInterface,u=e.SelectorsInterface,c=e.defineWrapGetter,d=e.elementFromPoint,p=e.forwardMethodsToWrapper,f=e.mixin,h=e.registerWrapper,m=e.unwrap,w=e.wrap,g=e.wrapEventTargetMethods;e.wrapNodeList;var v=new SideTable;t.prototype=Object.create(l.prototype),c(t,"documentElement"),c(t,"body"),c(t,"head"),["getElementById","createElement","createElementNS","createTextNode","createDocumentFragment","createEvent","createEventNS"].forEach(n);var E=document.adoptNode,y=document.write;f(t.prototype,{adoptNode:function(e){return E.call(this.impl,m(e)),e},elementFromPoint:function(e,t){return d(this,this,e,t)},write:function(e){for(var t=this.querySelectorAll("*"),n=t[t.length-1];n.nextSibling;)n=n.nextSibling;var r=n.parentNode;r.lastChild_=void 0,n.nextSibling_=void 0,y.call(this.impl,e)}}),p([window.HTMLBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadElement],["appendChild","compareDocumentPosition","getElementsByClassName","getElementsByTagName","getElementsByTagNameNS","insertBefore","querySelector","querySelectorAll","removeChild","replaceChild"]),p([window.HTMLDocument||window.Document],["adoptNode","createDocumentFragment","createElement","createElementNS","createEvent","createEventNS","createTextNode","elementFromPoint","getElementById","write"]),f(t.prototype,a),f(t.prototype,s),f(t.prototype,u),f(t.prototype,{get implementation(){var e=v.get(this);return e?e:(e=new r(m(this).implementation),v.set(this,e),e)}}),h(window.Document,t,document.implementation.createHTMLDocument("")),window.HTMLDocument&&h(window.HTMLDocument,t),g([window.HTMLBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadElement]),i(r,"createDocumentType"),i(r,"createDocument"),i(r,"createHTMLDocument"),o(r,"hasFeature"),h(window.DOMImplementation,r),p([window.DOMImplementation],["createDocumentType","createDocument","createHTMLDocument","hasFeature"]),e.wrappers.Document=t,e.wrappers.DOMImplementation=r}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.EventTarget,r=e.mixin,i=e.registerWrapper,o=e.unwrap,a=e.unwrapIfNeeded,l=e.wrap,s=window.Window;t.prototype=Object.create(n.prototype);var u=window.getComputedStyle;s.prototype.getComputedStyle=function(e,t){return u.call(this||window,a(e),t)},["addEventListener","removeEventListener","dispatchEvent"].forEach(function(e){s.prototype[e]=function(){var t=l(this||window);return t[e].apply(t,arguments)}}),r(t.prototype,{getComputedStyle:function(e,t){return u.call(o(this),a(e),t)}}),i(s,t),e.wrappers.Window=t}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){this.impl=e}function n(e){return new t(e)}function r(e){return e.map(n)}function i(e){var t=this;this.impl=new c(function(n){e.call(t,r(n),t)})}var o=e.defineGetter,a=e.defineWrapGetter,l=e.registerWrapper,s=e.unwrapIfNeeded,u=e.wrapNodeList;e.wrappers;var c=window.MutationObserver||window.WebKitMutationObserver;if(c){var d=window.MutationRecord;t.prototype={get addedNodes(){return u(this.impl.addedNodes)},get removedNodes(){return u(this.impl.removedNodes)}},["target","previousSibling","nextSibling"].forEach(function(e){a(t,e)}),["type","attributeName","attributeNamespace","oldValue"].forEach(function(e){o(t,e,function(){return this.impl[e]})}),d&&l(d,t),window.Node,i.prototype={observe:function(e,t){this.impl.observe(s(e),t)
-},disconnect:function(){this.impl.disconnect()},takeRecords:function(){return r(this.impl.takeRecords())}},e.wrappers.MutationObserver=i,e.wrappers.MutationRecord=t}}(this.ShadowDOMPolyfill),function(e){"use strict";function t(e){var t=n[e],r=window[t];if(r){var i=document.createElement(e),o=i.constructor;window[t]=o}}e.isWrapperFor;var n={a:"HTMLAnchorElement",applet:"HTMLAppletElement",area:"HTMLAreaElement",audio:"HTMLAudioElement",br:"HTMLBRElement",base:"HTMLBaseElement",body:"HTMLBodyElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElement",dl:"HTMLDListElement",datalist:"HTMLDataListElement",dir:"HTMLDirectoryElement",div:"HTMLDivElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSetElement",font:"HTMLFontElement",form:"HTMLFormElement",frame:"HTMLFrameElement",frameset:"HTMLFrameSetElement",hr:"HTMLHRElement",head:"HTMLHeadElement",h1:"HTMLHeadingElement",html:"HTMLHtmlElement",iframe:"HTMLIFrameElement",input:"HTMLInputElement",li:"HTMLLIElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",link:"HTMLLinkElement",map:"HTMLMapElement",menu:"HTMLMenuElement",menuitem:"HTMLMenuItemElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",del:"HTMLModElement",ol:"HTMLOListElement",object:"HTMLObjectElement",optgroup:"HTMLOptGroupElement",option:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",param:"HTMLParamElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQuoteElement",script:"HTMLScriptElement",select:"HTMLSelectElement",source:"HTMLSourceElement",span:"HTMLSpanElement",style:"HTMLStyleElement",caption:"HTMLTableCaptionElement",col:"HTMLTableColElement",table:"HTMLTableElement",tr:"HTMLTableRowElement",thead:"HTMLTableSectionElement",tbody:"HTMLTableSectionElement",textarea:"HTMLTextAreaElement",title:"HTMLTitleElement",ul:"HTMLUListElement",video:"HTMLVideoElement"};Object.keys(n).forEach(t),Object.getOwnPropertyNames(e.wrappers).forEach(function(t){window[t]=e.wrappers[t]}),e.knownElements=n}(this.ShadowDOMPolyfill),function(){var e=window.ShadowDOMPolyfill;e.wrap,Object.defineProperties(HTMLElement.prototype,{webkitShadowRoot:{get:function(){return this.shadowRoot}}}),HTMLElement.prototype.webkitCreateShadowRoot=HTMLElement.prototype.createShadowRoot,window.dartMainRunner=function(t){function n(e){var t;if(e instanceof i)t="NodeList";else if(e instanceof o)t="ShadowRoot";else if(e instanceof MutationRecord)t="MutationRecord";else if(e instanceof MutationObserver)t="MutationObserver";else{if(a(e)){e=l(e);var n=e.constructor;if(n&&!n.builtin$cls&&"GeneratedWrapper"==n.name){var r=Object.prototype.toString.call(e);r=r.substring(8,r.length-1),n.builtin$cls=r}}t=s.call$1(e)}return t}function r(e){var t,n;return null==e?"Null":(t=e.constructor,"function"==typeof t&&(n=t.builtin$cls,null!=n)?n:void 0)}var i=e.wrappers.NodeList,o=e.wrappers.ShadowRoot,a=e.isWrapper,l=e.unwrap,s=window.$.getFunctionForTypeNameOf();window.$.constructorNameFallback=r,window.$._getTypeNameOf={call$1:n},window.Isolate.$isolateProperties._getTypeNameOf=window.$._getTypeNameOf,t()}}()}
\ No newline at end of file
+if(!HTMLElement.prototype.createShadowRoot&&!HTMLElement.prototype.webkitCreateShadowRoot||window.__forceShadowDomPolyfill){!function(){Element.prototype.webkitCreateShadowRoot&&(Element.prototype.webkitCreateShadowRoot=function(){return window.ShadowDOMPolyfill.wrapIfNeeded(this).createShadowRoot()})}();var SideTable;"undefined"!=typeof WeakMap&&navigator.userAgent.indexOf("Firefox/")<0?SideTable=WeakMap:function(){var a=Object.defineProperty,b=Object.hasOwnProperty,c=(new Date).getTime()%1e9;SideTable=function(){this.name="__st"+(1e9*Math.random()>>>0)+(c++ +"__")},SideTable.prototype={set:function(b,c){a(b,this.name,{value:c,writable:!0})},get:function(a){return b.call(a,this.name)?a[this.name]:void 0},"delete":function(a){this.set(a,void 0)}}}();var ShadowDOMPolyfill={};!function(a){"use strict";function b(a){if(!a)throw new Error("Assertion failed")}function c(a,b){return Object.getOwnPropertyNames(b).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))}),a}function d(a,b){return Object.getOwnPropertyNames(b).forEach(function(c){switch(c){case"arguments":case"caller":case"length":case"name":case"prototype":case"toString":return}Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))}),a}function e(a){var b=a.__proto__||Object.getPrototypeOf(a),c=y.get(b);if(c)return c;var d=e(b),f=m(d);return j(b,f,a),f}function f(a,b){h(a,b,!0)}function g(a,b){h(b,a,!1)}function h(a,b,c){Object.getOwnPropertyNames(a).forEach(function(d){if(!(d in b)){A&&a.__lookupGetter__(d);var e;try{e=Object.getOwnPropertyDescriptor(a,d)}catch(f){e=B}var g,h;if(c&&"function"==typeof e.value)return b[d]=function(){return this.impl[d].apply(this.impl,arguments)},void 0;g=function(){return this.impl[d]},(e.writable||e.set)&&(h=function(a){this.impl[d]=a}),Object.defineProperty(b,d,{get:g,set:h,configurable:e.configurable,enumerable:e.enumerable})}})}function i(a,b,c){var e=a.prototype;j(e,b,c),d(b,a)}function j(a,c,d){var e=c.prototype;b(void 0===y.get(a)),y.set(a,c),f(a,e),d&&g(e,d)}function k(a,b){return y.get(b.prototype)===a}function l(a){var b=Object.getPrototypeOf(a),c=e(b),d=m(c);return j(b,d,a),d}function m(a){function b(b){a.call(this,b)}return b.prototype=Object.create(a.prototype),b.prototype.constructor=b,b._ShadowDOMPolyfill$isGeneratedWrapper=!0,b}function n(a){return a instanceof z.EventTarget||a instanceof z.Event||a instanceof z.DOMImplementation}function o(a){return a instanceof E||a instanceof D||a instanceof F||a instanceof C}function p(a){if(null===a)return null;b(o(a));var c=x.get(a);if(!c){var d=e(a);c=new d(a),x.set(a,c)}return c}function q(a){return null===a?null:(b(n(a)),a.impl)}function r(a){return a&&n(a)?q(a):a}function s(a){return a&&!n(a)?p(a):a}function t(a,c){null!==c&&(b(o(a)),b(void 0===c||n(c)),x.set(a,c))}function u(a,b,c){Object.defineProperty(a.prototype,b,{get:c,configurable:!0,enumerable:!0})}function v(a,b){u(a,b,function(){return p(this.impl[b])})}function w(a,b){a.forEach(function(a){b.forEach(function(b){a.prototype[b]=function(){var a=p(this);return a[b].apply(a,arguments)}})})}var x=new SideTable,y=new SideTable,z=Object.create(null);Object.getOwnPropertyNames(window);var A=/Firefox/.test(navigator.userAgent),B={get:function(){},set:function(){},configurable:!0,enumerable:!0},C=DOMImplementation,D=Event,E=Node,F=Window;a.assert=b,a.defineGetter=u,a.defineWrapGetter=v,a.forwardMethodsToWrapper=w,a.isWrapper=n,a.isWrapperFor=k,a.mixin=c,a.registerObject=l,a.registerWrapper=i,a.rewrap=t,a.unwrap=q,a.unwrapIfNeeded=r,a.wrap=p,a.wrapIfNeeded=s,a.wrappers=z}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){return a instanceof J.ShadowRoot}function c(a){var b=a.localName;return"content"===b||"shadow"===b}function d(a){return!!a.shadowRoot}function e(a){var b;return a.parentNode||(b=a.defaultView)&&I(b)||null}function f(f,g,h){if(h.length)return h.shift();if(b(f))return f.insertionParent||a.getHostForShadowRoot(f);var i=a.eventParentsTable.get(f);if(i){for(var j=1;j<i.length;j++)h[j-1]=i[j];return i[0]}if(g&&c(f)){var k=f.parentNode;if(k&&d(k))for(var l=a.getShadowTrees(k),m=g.insertionParent,j=0;j<l.length;j++)if(l[j].contains(m))return m}return e(f)}function g(a){for(var d=[],e=a,g=[],i=[];e;){var j=null;if(c(e)){j=h(d);var k=d[d.length-1]||e;d.push(k)}else d.length||d.push(e);var l=d[d.length-1];g.push({target:l,currentTarget:e}),b(e)&&d.pop(),e=f(e,j,i)}return g}function h(a){for(var b=a.length-1;b>=0;b--)if(!c(a[b]))return a[b];return null}function i(d,e){for(var g=[];d;){for(var i=[],k=e,m=void 0;k;){var n=null;if(i.length){if(c(k)&&(n=h(i),j(m))){var o=i[i.length-1];i.push(o)}}else i.push(k);if(l(k,d))return i[i.length-1];b(k)&&i.pop(),m=k,k=f(k,n,g)}d=b(d)?a.getHostForShadowRoot(d):d.parentNode}}function j(a){return a.insertionParent}function k(a){for(var b;b=a.parentNode;)a=b;return a}function l(a,b){return k(a)===k(b)}function m(a){switch(a){case"DOMAttrModified":case"DOMAttributeNameChanged":case"DOMCharacterDataModified":case"DOMElementNameChanged":case"DOMNodeInserted":case"DOMNodeInsertedIntoDocument":case"DOMNodeRemoved":case"DOMNodeRemovedFromDocument":case"DOMSubtreeModified":return!0}return!1}function n(b){if(!L.get(b)){L.set(b,!0),m(b.type)||a.renderAllPending();var c=I(b.target),d=I(b);return o(d,c)}}function o(a,b){var c=g(b);return"load"===a.type&&2===c.length&&c[0].target instanceof J.Document&&c.shift(),p(a,c)&&q(a,c)&&r(a,c),P.set(a,u.NONE),N.set(a,null),a.defaultPrevented}function p(a,b){for(var c,d=b.length-1;d>0;d--){var e=b[d].target,f=b[d].currentTarget;if(e!==f&&(c=u.CAPTURING_PHASE,!s(b[d],a,c)))return!1}return!0}function q(a,b){var c=u.AT_TARGET;return s(b[0],a,c)}function r(a,b){for(var c,d=a.bubbles,e=1;e<b.length;e++){var f=b[e].target,g=b[e].currentTarget;if(f===g)c=u.AT_TARGET;else{if(!d||R.get(a))continue;c=u.BUBBLING_PHASE}if(!s(b[e],a,c))return}}function s(a,b,c){var d=a.target,e=a.currentTarget,f=K.get(e);if(!f)return!0;if("relatedTarget"in b){var g=H(b),h=I(g.relatedTarget),j=i(e,h);if(j===d)return!0;O.set(b,j)}P.set(b,c);var k=b.type,l=!1;M.set(b,d),N.set(b,e);for(var m=0;m<f.length;m++){var n=f[m];if(n.removed)l=!0;else if(!(n.type!==k||!n.capture&&c===u.CAPTURING_PHASE||n.capture&&c===u.BUBBLING_PHASE))try{if("function"==typeof n.handler?n.handler.call(e,b):n.handler.handleEvent(b),R.get(b))return!1}catch(o){window.onerror?window.onerror(o.message):console.error(o)}}if(l){var p=f.slice();f.length=0;for(var m=0;m<p.length;m++)p[m].removed||f.push(p[m])}return!Q.get(b)}function t(a,b,c){this.type=a,this.handler=b,this.capture=Boolean(c)}function u(a,b){return a instanceof S?(this.impl=a,void 0):I(y(S,"Event",a,b))}function v(a){return a&&a.relatedTarget?Object.create(a,{relatedTarget:{value:H(a.relatedTarget)}}):a}function w(a,b,c){var d=window[a],e=function(b,c){return b instanceof d?(this.impl=b,void 0):I(y(d,a,b,c))};return e.prototype=Object.create(b.prototype),c&&F(e.prototype,c),d&&G(d,e,document.createEvent(a)),e}function x(a,b){return function(){arguments[b]=H(arguments[b]);var c=H(this);c[a].apply(c,arguments)}}function y(a,b,c,d){if(ab)return new a(c,v(d));var e=H(document.createEvent(b)),f=_[b],g=[c];return Object.keys(f).forEach(function(a){var b=null!=d&&a in d?d[a]:f[a];"relatedTarget"===a&&(b=H(b)),g.push(b)}),e["init"+b].apply(e,g),e}function z(a){return"function"==typeof a?!0:a&&a.handleEvent}function A(a){this.impl=a}function B(b){return b instanceof J.ShadowRoot&&(b=a.getHostForShadowRoot(b)),H(b)}function C(a){E(a,db)}function D(b,c,d,e){a.renderAllPending();for(var f=I(eb.call(c.impl,d,e)),h=g(f,this),i=0;i<h.length;i++){var j=h[i];if(j.currentTarget===b)return j.target}return null}var E=a.forwardMethodsToWrapper,F=a.mixin,G=a.registerWrapper,H=a.unwrap,I=a.wrap,J=a.wrappers;new SideTable;var K=new SideTable,L=new SideTable,M=new SideTable,N=new SideTable,O=new SideTable,P=new SideTable,Q=new SideTable,R=new SideTable;t.prototype={equals:function(a){return this.handler===a.handler&&this.type===a.type&&this.capture===a.capture},get removed(){return null===this.handler},remove:function(){this.handler=null}};var S=window.Event;u.prototype={get target(){return M.get(this)},get currentTarget(){return N.get(this)},get eventPhase(){return P.get(this)},stopPropagation:function(){Q.set(this,!0)},stopImmediatePropagation:function(){Q.set(this,!0),R.set(this,!0)}},G(S,u,document.createEvent("Event"));var T=w("UIEvent",u),U=w("CustomEvent",u),V={get relatedTarget(){return O.get(this)||I(H(this).relatedTarget)}},W=F({initMouseEvent:x("initMouseEvent",14)},V),X=F({initFocusEvent:x("initFocusEvent",5)},V),Y=w("MouseEvent",T,W),Z=w("FocusEvent",T,X),$=w("MutationEvent",u,{initMutationEvent:x("initMutationEvent",3),get relatedNode(){return I(this.impl.relatedNode)}}),_=Object.create(null),ab=function(){try{new window.MouseEvent("click")}catch(a){return!1}return!0}();if(!ab){var bb=function(a,b,c){if(c){var d=_[c];b=F(F({},d),b)}_[a]=b};bb("Event",{bubbles:!1,cancelable:!1}),bb("CustomEvent",{detail:null},"Event"),bb("UIEvent",{view:null,detail:0},"Event"),bb("MouseEvent",{screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null},"UIEvent"),bb("FocusEvent",{relatedTarget:null},"UIEvent")}var cb=window.EventTarget,db=["addEventListener","removeEventListener","dispatchEvent"];[Element,Window,Document].forEach(function(a){var b=a.prototype;db.forEach(function(a){Object.defineProperty(b,a+"_",{value:b[a]})})}),A.prototype={addEventListener:function(a,b,c){if(z(b)){var d=new t(a,b,c),e=K.get(this);if(e){for(var f=0;f<e.length;f++)if(d.equals(e[f]))return}else e=[],K.set(this,e);e.push(d);var g=B(this);g.addEventListener_(a,n,!0)}},removeEventListener:function(a,b,c){c=Boolean(c);var d=K.get(this);if(d){for(var e=0,f=!1,g=0;g<d.length;g++)d[g].type===a&&d[g].capture===c&&(e++,d[g].handler===b&&(f=!0,d[g].remove()));if(f&&1===e){var h=B(this);h.removeEventListener_(a,n,!0)}}},dispatchEvent:function(b){a.renderAllPending();var c=B(this);return c.dispatchEvent_(H(b))}},cb&&G(cb,A);var eb=document.elementFromPoint;a.adjustRelatedTarget=i,a.elementFromPoint=D,a.wrapEventTargetMethods=C,a.wrappers.CustomEvent=U,a.wrappers.Event=u,a.wrappers.EventTarget=A,a.wrappers.FocusEvent=Z,a.wrappers.MouseEvent=Y,a.wrappers.MutationEvent=$,a.wrappers.UIEvent=T}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a,b){Object.defineProperty(a,b,{enumerable:!1})}function c(){this.length=0,b(this,"length")}function d(a){if(null==a)return a;for(var b=new c,d=0,e=a.length;e>d;d++)b[d]=f(a[d]);return b.length=e,b}function e(a,b){a.prototype[b]=function(){return d(this.impl[b].apply(this.impl,arguments))}}var f=a.wrap;c.prototype={item:function(a){return this[a]}},b(c.prototype,"item"),a.wrappers.NodeList=c,a.addWrapNodeListMethod=e,a.wrapNodeList=d}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){j(a instanceof f)}function c(a,b,c,d){if(a.nodeType!==f.DOCUMENT_FRAGMENT_NODE)return a.parentNode&&a.parentNode.removeChild(a),a.parentNode_=b,a.previousSibling_=c,a.nextSibling_=d,c&&(c.nextSibling_=a),d&&(d.previousSibling_=a),[a];for(var e,g=[];e=a.firstChild;)a.removeChild(e),g.push(e),e.parentNode_=b;for(var h=0;h<g.length;h++)g[h].previousSibling_=g[h-1]||c,g[h].nextSibling_=g[h+1]||d;return c&&(c.nextSibling_=g[0]),d&&(d.previousSibling_=g[g.length-1]),g}function d(a){if(1===a.length)return m(a[0]);for(var b=m(document.createDocumentFragment()),c=0;c<a.length;c++)b.appendChild(m(a[c]));return b}function e(a){for(var b=a.firstChild;b;){j(b.parentNode===a);var c=b.nextSibling,d=m(b),e=d.parentNode;e&&s.call(e,d),b.previousSibling_=b.nextSibling_=b.parentNode_=null,b=c}a.firstChild_=a.lastChild_=null}function f(a){j(a instanceof o),g.call(this,a),this.parentNode_=void 0,this.firstChild_=void 0,this.lastChild_=void 0,this.nextSibling_=void 0,this.previousSibling_=void 0}var g=a.wrappers.EventTarget,h=a.wrappers.NodeList,i=a.defineWrapGetter,j=a.assert,k=a.mixin,l=a.registerWrapper,m=a.unwrap,n=a.wrap,o=window.Node,p=o.prototype.appendChild,q=o.prototype.insertBefore,r=o.prototype.replaceChild,s=o.prototype.removeChild,t=o.prototype.compareDocumentPosition;f.prototype=Object.create(g.prototype),k(f.prototype,{appendChild:function(a){b(a),this.invalidateShadowRenderer();var e=this.lastChild,f=null,g=c(a,this,e,f);return this.lastChild_=g[g.length-1],e||(this.firstChild_=g[0]),p.call(this.impl,d(g)),a},insertBefore:function(a,e){if(!e)return this.appendChild(a);b(a),b(e),j(e.parentNode===this),this.invalidateShadowRenderer();var f=e.previousSibling,g=e,h=c(a,this,f,g);this.firstChild===e&&(this.firstChild_=h[0]);var i=m(e),k=i.parentNode;return k&&q.call(k,d(h),i),a},removeChild:function(a){if(b(a),a.parentNode!==this)throw new Error("NotFoundError");this.invalidateShadowRenderer();var c=this.firstChild,d=this.lastChild,e=a.nextSibling,f=a.previousSibling,g=m(a),h=g.parentNode;return h&&s.call(h,g),c===a&&(this.firstChild_=e),d===a&&(this.lastChild_=f),f&&(f.nextSibling_=e),e&&(e.previousSibling_=f),a.previousSibling_=a.nextSibling_=a.parentNode_=null,a},replaceChild:function(a,e){if(b(a),b(e),e.parentNode!==this)throw new Error("NotFoundError");this.invalidateShadowRenderer();var f=e.previousSibling,g=e.nextSibling;g===a&&(g=a.nextSibling);var h=c(a,this,f,g);this.firstChild===e&&(this.firstChild_=h[0]),this.lastChild===e&&(this.lastChild_=h[h.length-1]),e.previousSibling_=null,e.nextSibling_=null,e.parentNode_=null;var i=m(e);return i.parentNode&&r.call(i.parentNode,d(h),i),e},hasChildNodes:function(){return null===this.firstChild},get parentNode(){return void 0!==this.parentNode_?this.parentNode_:n(this.impl.parentNode)},get firstChild(){return void 0!==this.firstChild_?this.firstChild_:n(this.impl.firstChild)},get lastChild(){return void 0!==this.lastChild_?this.lastChild_:n(this.impl.lastChild)},get nextSibling(){return void 0!==this.nextSibling_?this.nextSibling_:n(this.impl.nextSibling)},get previousSibling(){return void 0!==this.previousSibling_?this.previousSibling_:n(this.impl.previousSibling)},get parentElement(){for(var a=this.parentNode;a&&a.nodeType!==f.ELEMENT_NODE;)a=a.parentNode;return a},get textContent(){for(var a="",b=this.firstChild;b;b=b.nextSibling)a+=b.textContent;return a},set textContent(a){if(e(this),this.invalidateShadowRenderer(),""!==a){var b=this.impl.ownerDocument.createTextNode(a);this.appendChild(b)}},get childNodes(){for(var a=new h,b=0,c=this.firstChild;c;c=c.nextSibling)a[b++]=c;return a.length=b,a},cloneNode:function(a){if(!this.invalidateShadowRenderer())return n(this.impl.cloneNode(a));var b=n(this.impl.cloneNode(!1));if(a)for(var c=this.firstChild;c;c=c.nextSibling)b.appendChild(c.cloneNode(!0));return b},contains:function(a){if(!a)return!1;if(a===this)return!0;var b=a.parentNode;return b?this.contains(b):!1},compareDocumentPosition:function(a){return t.call(this.impl,m(a))}}),i(f,"ownerDocument"),l(o,f,document.createDocumentFragment()),delete f.prototype.querySelector,delete f.prototype.querySelectorAll,f.prototype=k(Object.create(g.prototype),f.prototype),a.wrappers.Node=f}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a,c){for(var d,e=a.firstElementChild;e;){if(e.matches(c))return e;if(d=b(e,c))return d;e=e.nextElementSibling}return null}function c(a,b,d){for(var e=a.firstElementChild;e;)e.matches(b)&&(d[d.length++]=e),c(e,b,d),e=e.nextElementSibling;return d}var d={querySelector:function(a){return b(this,a)},querySelectorAll:function(a){return c(this,a,new NodeList)}},e={getElementsByTagName:function(a){return this.querySelectorAll(a)},getElementsByClassName:function(a){return this.querySelectorAll("."+a)},getElementsByTagNameNS:function(a,b){if("*"===a)return this.getElementsByTagName(b);for(var c=new NodeList,d=this.getElementsByTagName(b),e=0,f=0;e<d.length;e++)d[e].namespaceURI===a&&(c[f++]=d[e]);return c.length=f,c}};a.GetElementsByInterface=e,a.SelectorsInterface=d}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){for(;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.nextSibling;return a}function c(a){for(;a&&a.nodeType!==Node.ELEMENT_NODE;)a=a.previousSibling;return a}var d=a.wrappers.NodeList,e={get firstElementChild(){return b(this.firstChild)},get lastElementChild(){return c(this.lastChild)},get childElementCount(){for(var a=0,b=this.firstElementChild;b;b=b.nextElementSibling)a++;return a},get children(){for(var a=new d,b=0,c=this.firstElementChild;c;c=c.nextElementSibling)a[b++]=c;return a.length=b,a}},f={get nextElementSibling(){return b(this.nextSibling)},get previousElementSibling(){return c(this.nextSibling)}};a.ChildNodeInterface=f,a.ParentNodeInterface=e}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){d.call(this,a)}var c=a.ChildNodeInterface,d=a.wrappers.Node,e=a.mixin,f=a.registerWrapper,g=window.CharacterData;b.prototype=Object.create(d.prototype),e(b.prototype,{get textContent(){return this.data},set textContent(a){this.data=a}}),e(b.prototype,c),f(g,b,document.createTextNode("")),a.wrappers.CharacterData=b}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){e.call(this,a)}var c=a.ChildNodeInterface,d=a.GetElementsByInterface,e=a.wrappers.Node,f=a.ParentNodeInterface,g=a.SelectorsInterface;a.addWrapNodeListMethod;var h=a.mixin,i=a.registerWrapper,j=a.wrappers,k=new SideTable,l=window.Element,m=l.prototype.matches||l.prototype.mozMatchesSelector||l.prototype.msMatchesSelector||l.prototype.webkitMatchesSelector;b.prototype=Object.create(e.prototype),h(b.prototype,{createShadowRoot:function(){var b=new j.ShadowRoot(this);return k.set(this,b),a.getRendererForHost(this),this.invalidateShadowRenderer(!0),b},get shadowRoot(){return k.get(this)||null},setAttribute:function(a,b){this.impl.setAttribute(a,b),this.invalidateShadowRenderer()},matches:function(a){return m.call(this.impl,a)}}),h(b.prototype,c),h(b.prototype,d),h(b.prototype,f),h(b.prototype,g),i(l,b),a.wrappers.Element=b}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){switch(a){case"&":return"&amp;";case"<":return"&lt;";case'"':return"&quot;"}}function c(a){return a.replace(p,b)}function d(a){switch(a.nodeType){case Node.ELEMENT_NODE:for(var b,d=a.tagName.toLowerCase(),f="<"+d,g=a.attributes,h=0;b=g[h];h++)f+=" "+b.name+'="'+c(b.value)+'"';return f+=">",q[d]?f:f+e(a)+"</"+d+">";case Node.TEXT_NODE:return c(a.nodeValue);case Node.COMMENT_NODE:return"<!--"+c(a.nodeValue)+"-->";default:throw console.error(a),new Error("not implemented")}}function e(a){for(var b="",c=a.firstChild;c;c=c.nextSibling)b+=d(c);return b}function f(a,b,c){var d=c||"div";a.textContent="";var e=n(a.ownerDocument.createElement(d));e.innerHTML=b;for(var f;f=e.firstChild;)a.appendChild(o(f))}function g(a){j.call(this,a)}function h(b){k(g,b,function(){return a.renderAllPending(),this.impl[b]})}function i(b){Object.defineProperty(g.prototype,b,{value:function(){return a.renderAllPending(),this.impl[b].apply(this.impl,arguments)},configurable:!0,enumerable:!0})}var j=a.wrappers.Element,k=a.defineGetter,l=a.mixin,m=a.registerWrapper,n=a.unwrap,o=a.wrap,p=/&|<|"/g,q={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},r=window.HTMLElement;g.prototype=Object.create(j.prototype),l(g.prototype,{get innerHTML(){return e(this)},set innerHTML(a){f(this,a,this.tagName)},get outerHTML(){return d(this)},set outerHTML(a){if(this.invalidateShadowRenderer())throw new Error("not implemented");this.impl.outerHTML=a}}),["clientHeight","clientLeft","clientTop","clientWidth","offsetHeight","offsetLeft","offsetTop","offsetWidth","scrollHeight","scrollLeft","scrollTop","scrollWidth"].forEach(h),["getBoundingClientRect","getClientRects","scrollIntoView"].forEach(i),m(r,g,document.createElement("b")),a.wrappers.HTMLElement=g,a.getInnerHTML=e,a.setInnerHTML=f}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.HTMLElement,d=a.mixin,e=a.registerWrapper,f=window.HTMLContentElement;b.prototype=Object.create(c.prototype),d(b.prototype,{get select(){return this.getAttribute("select")},set select(a){this.setAttribute("select",a)},setAttribute:function(a,b){c.prototype.setAttribute.call(this,a,b),"select"===String(a).toLowerCase()&&this.invalidateShadowRenderer(!0)}}),f&&e(f,b),a.wrappers.HTMLContentElement=b}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a),this.olderShadowRoot_=null}var c=a.wrappers.HTMLElement,d=a.mixin,e=a.registerWrapper,f=window.HTMLShadowElement;b.prototype=Object.create(c.prototype),d(b.prototype,{get olderShadowRoot(){return this.olderShadowRoot_},invalidateShadowRenderer:function(){c.prototype.invalidateShadowRenderer.call(this,!0)}}),f&&e(f,b),a.wrappers.HTMLShadowElement=b}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){if(!a.defaultView)return a;var b=l.get(a);if(!b){for(b=a.implementation.createHTMLDocument("");b.lastChild;)b.removeChild(b.lastChild);l.set(a,b)}return b}function c(a){for(var c,d=b(a.ownerDocument),e=d.createDocumentFragment();c=a.firstChild;)e.appendChild(c);return e}function d(a){e.call(this,a)}var e=a.wrappers.HTMLElement,f=a.getInnerHTML,g=a.mixin,h=a.registerWrapper,i=a.setInnerHTML,j=a.wrap,k=new SideTable,l=new SideTable,m=window.HTMLTemplateElement;d.prototype=Object.create(e.prototype),g(d.prototype,{get content(){if(m)return j(this.impl.content);var a=k.get(this);return a||(a=c(this),k.set(this,a)),a},get innerHTML(){return f(this.content)},set innerHTML(a){i(this.content,a),this.invalidateShadowRenderer()}}),m&&h(m,d),a.wrappers.HTMLTemplateElement=d}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){switch(a.localName){case"content":return new c(a);case"shadow":return new e(a);case"template":return new f(a)}d.call(this,a)}var c=a.wrappers.HTMLContentElement,d=a.wrappers.HTMLElement,e=a.wrappers.HTMLShadowElement,f=a.wrappers.HTMLTemplateElement;a.mixin;var g=a.registerWrapper,h=window.HTMLUnknownElement;b.prototype=Object.create(d.prototype),g(h,b),a.wrappers.HTMLUnknownElement=b}(this.ShadowDOMPolyfill),function(a){"use strict";var b=a.GetElementsByInterface,c=a.ParentNodeInterface,d=a.SelectorsInterface,e=a.mixin,f=a.registerObject,g=f(document.createDocumentFragment());e(g.prototype,c),e(g.prototype,d),e(g.prototype,b);var h=f(document.createTextNode("")),i=f(document.createComment(""));a.wrappers.Comment=i,a.wrappers.DocumentFragment=g,a.wrappers.Text=h}(this.ShadowDOMPolyfill),function(a){"use strict";function b(b){var d=i(b.impl.ownerDocument.createDocumentFragment());c.call(this,d),g(d,this);var e=b.shadowRoot;a.nextOlderShadowTreeTable.set(this,e),j.set(this,b)}var c=a.wrappers.DocumentFragment,d=a.elementFromPoint,e=a.getInnerHTML,f=a.mixin,g=a.rewrap,h=a.setInnerHTML,i=a.unwrap,j=new SideTable;b.prototype=Object.create(c.prototype),f(b.prototype,{get innerHTML(){return e(this)},set innerHTML(a){h(this,a),this.invalidateShadowRenderer()},invalidateShadowRenderer:function(){return j.get(this).invalidateShadowRenderer()},elementFromPoint:function(a,b){return d(this,this.ownerDocument,a,b)},getElementById:function(a){return this.querySelector("#"+a)}}),a.wrappers.ShadowRoot=b,a.getHostForShadowRoot=function(a){return j.get(a)}}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){a.previousSibling_=a.previousSibling,a.nextSibling_=a.nextSibling,a.parentNode_=a.parentNode}function c(a){a.firstChild_=a.firstChild,a.lastChild_=a.lastChild}function d(a){F(a instanceof E);for(var d=a.firstChild;d;d=d.nextSibling)b(d);c(a)}function e(a){var b=H(a);d(a),b.textContent=""}function f(a,c){var e=H(a),f=H(c);f.nodeType===E.DOCUMENT_FRAGMENT_NODE?d(c):(h(c),b(c)),a.lastChild_=a.lastChild,a.lastChild===a.firstChild&&(a.firstChild_=a.firstChild);var g=I(e.lastChild);g&&(g.nextSibling_=g.nextSibling),e.appendChild(f)}function g(a,c){var d=H(a),e=H(c);b(c),c.previousSibling&&(c.previousSibling.nextSibling_=c),c.nextSibling&&(c.nextSibling.previousSibling_=c),a.lastChild===c&&(a.lastChild_=c),a.firstChild===c&&(a.firstChild_=c),d.removeChild(e)}function h(a){var b=H(a),c=b.parentNode;c&&g(I(c),a)}function i(a,b){k(b).push(a),L.set(a,b);var c=K.get(a);c||K.set(a,c=[]),c.push(b)}function j(a){J.set(a,[])}function k(a){return J.get(a)}function l(a){for(var b=[],c=0,d=a.firstChild;d;d=d.nextSibling)b[c++]=d;return b}function m(a,b,c){for(var d=l(a),e=0;e<d.length;e++){var f=d[e];if(b(f)){if(c(f)===!1)return}else m(f,b,c)}}function n(a,b){var c=!1;return m(a,u,function(a){j(a);for(var d=0;d<b.length;d++){var e=b[d];void 0!==e&&p(e,a)&&(i(e,a),b[d]=void 0,c=!0)}}),c?b.filter(function(a){return void 0!==a}):b}function o(a,b){for(var c=0;c<b.length;c++)if(b[c]in a)return b[c]}function p(a,b){var c=b.getAttribute("select");if(!c)return!0;if(c=c.trim(),!c)return!0;if(a.nodeType!==E.ELEMENT_NODE)return!1;if(!P.test(c))return!1;if(":"===c[0]&&!Q.test(c))return!1;try{return a.matches(c)}catch(d){return!1}}function q(){C=null,S.forEach(function(a){a.render()}),S=[]}function r(a){this.host=a,this.dirty=!1,this.associateNode(a)}function s(a){var b=N.get(a);return b||(b=new r(a),N.set(a,b)),b}function t(a){return"content"===a.localName}function u(a){return"content"===a.localName}function v(a){return"shadow"===a.localName}function w(a){return"shadow"===a.localName}function x(a){return!!a.shadowRoot}function y(a){return M.get(a)}function z(a){for(var b=[],c=a.shadowRoot;c;c=M.get(c))b.push(c);return b}function A(a,b){L.set(a,b)}function B(a){new r(a).render()}var C,D=a.wrappers.HTMLContentElement,E=a.wrappers.Node,F=a.assert,G=a.mixin,H=a.unwrap,I=a.wrap,J=new SideTable,K=new SideTable,L=new SideTable,M=new SideTable,N=new SideTable,O=new SideTable,P=/^[*.:#[a-zA-Z_|]/,Q=new RegExp("^:("+["link","visited","target","enabled","disabled","checked","indeterminate","nth-child","nth-last-child","nth-of-type","nth-last-of-type","first-child","last-child","first-of-type","last-of-type","only-of-type"].join("|")+")"),R=o(window,["requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame","setTimeout"]),S=[];r.prototype={render:function(){if(this.dirty){var a=this.host;this.treeComposition();var b=a.shadowRoot;if(b){this.removeAllChildNodes(this.host);var c=l(b);c.forEach(function(c){this.renderNode(a,b,c,!1)},this),this.dirty=!1}}},invalidate:function(){if(!this.dirty){if(this.dirty=!0,S.push(this),C)return;C=window[R](q,0)}},renderNode:function(a,b,c,d){if(x(c)){this.appendChild(a,c);var e=s(c);e.dirty=!0,e.render()}else t(c)?this.renderInsertionPoint(a,b,c,d):v(c)?this.renderShadowInsertionPoint(a,b,c):this.renderAsAnyDomTree(a,b,c,d)},renderAsAnyDomTree:function(a,b,c,d){if(this.appendChild(a,c),x(c))B(c);else{var e=c,f=l(e);f.forEach(function(a){this.renderNode(e,b,a,d)},this)}},renderInsertionPoint:function(a,b,c,d){var e=k(c);e.length?(this.removeAllChildNodes(c),e.forEach(function(c){t(c)&&d?this.renderInsertionPoint(a,b,c,d):this.renderAsAnyDomTree(a,b,c,d)},this)):this.renderFallbackContent(a,c),this.remove(c)},renderShadowInsertionPoint:function(a,b,c){var d=y(b);if(d){L.set(d,c),c.olderShadowRoot_=d,this.remove(c);var e=l(d);e.forEach(function(b){this.renderNode(a,d,b,!0)},this)}else this.renderFallbackContent(a,c)},renderFallbackContent:function(a,b){var c=l(b);c.forEach(function(b){this.appendChild(a,b)},this)},treeComposition:function(){var a=this.host,b=a.shadowRoot,c=[],d=l(a);d.forEach(function(a){if(t(a)){var b=k(a);b&&b.length||(b=l(a)),c.push.apply(c,b)}else c.push(a)});for(var e,f;b;){if(e=void 0,m(b,w,function(a){return e=a,!1}),f=e,c=n(b,c),f){var g=y(b);if(g){b=g,A(b,f);continue}break}break}},appendChild:function(a,b){f(a,b),this.associateNode(b)},remove:function(a){h(a),this.associateNode(a)},removeAllChildNodes:function(a){e(a)},associateNode:function(a){O.set(a,this)}},E.prototype.invalidateShadowRenderer=function(a){var b=O.get(this);if(!b)return!1;var c;return(a||this.shadowRoot||(c=this.parentNode)&&(c.shadowRoot||c instanceof ShadowRoot))&&b.invalidate(),!0},D.prototype.getDistributedNodes=function(){return q(),k(this)},G(E.prototype,{get insertionParent(){return L.get(this)||null}}),a.eventParentsTable=K,a.getRendererForHost=s,a.getShadowTrees=z,a.nextOlderShadowTreeTable=M,a.renderAllPending=q,a.visual={removeAllChildNodes:e,appendChild:f,removeChild:g}}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){h.call(this,a)}function c(a){var c=document[a];b.prototype[a]=function(){return q(c.apply(this.impl,arguments))}}function d(a){this.impl=a}function e(a,b){var c=document.implementation[b];a.prototype[b]=function(){return q(c.apply(this.impl,arguments))}}function f(a,b){var c=document.implementation[b];a.prototype[b]=function(){return c.apply(this.impl,arguments)}}var g=a.GetElementsByInterface,h=a.wrappers.Node,i=a.ParentNodeInterface,j=a.SelectorsInterface,k=a.defineWrapGetter,l=a.elementFromPoint,m=a.forwardMethodsToWrapper,n=a.mixin,o=a.registerWrapper,p=a.unwrap,q=a.wrap,r=a.wrapEventTargetMethods;a.wrapNodeList;var s=new SideTable;b.prototype=Object.create(h.prototype),k(b,"documentElement"),k(b,"body"),k(b,"head"),["getElementById","createElement","createElementNS","createTextNode","createDocumentFragment","createEvent","createEventNS"].forEach(c);var t=document.adoptNode,u=document.write;n(b.prototype,{adoptNode:function(a){return t.call(this.impl,p(a)),a},elementFromPoint:function(a,b){return l(this,this,a,b)},write:function(a){for(var b=this.querySelectorAll("*"),c=b[b.length-1];c.nextSibling;)c=c.nextSibling;var d=c.parentNode;d.lastChild_=void 0,c.nextSibling_=void 0,u.call(this.impl,a)}}),m([window.HTMLBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadElement],["appendChild","compareDocumentPosition","getElementsByClassName","getElementsByTagName","getElementsByTagNameNS","insertBefore","querySelector","querySelectorAll","removeChild","replaceChild"]),m([window.HTMLDocument||window.Document],["adoptNode","createDocumentFragment","createElement","createElementNS","createEvent","createEventNS","createTextNode","elementFromPoint","getElementById","write"]),n(b.prototype,g),n(b.prototype,i),n(b.prototype,j),n(b.prototype,{get implementation(){var a=s.get(this);return a?a:(a=new d(p(this).implementation),s.set(this,a),a)}}),o(window.Document,b,document.implementation.createHTMLDocument("")),window.HTMLDocument&&o(window.HTMLDocument,b),r([window.HTMLBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadElement]),e(d,"createDocumentType"),e(d,"createDocument"),e(d,"createHTMLDocument"),f(d,"hasFeature"),o(window.DOMImplementation,d),m([window.DOMImplementation],["createDocumentType","createDocument","createHTMLDocument","hasFeature"]),a.wrappers.Document=b,a.wrappers.DOMImplementation=d}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){c.call(this,a)}var c=a.wrappers.EventTarget,d=a.mixin,e=a.registerWrapper,f=a.unwrap,g=a.unwrapIfNeeded,h=a.wrap,i=window.Window;b.prototype=Object.create(c.prototype);var j=window.getComputedStyle;i.prototype.getComputedStyle=function(a,b){return j.call(this||window,g(a),b)},["addEventListener","removeEventListener","dispatchEvent"].forEach(function(a){i.prototype[a]=function(){var b=h(this||window);return b[a].apply(b,arguments)}}),d(b.prototype,{getComputedStyle:function(a,b){return j.call(f(this),g(a),b)}}),e(i,b),a.wrappers.Window=b}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){this.impl=a}function c(a){return new b(a)}function d(a){return a.map(c)}function e(a){var b=this;this.impl=new k(function(c){a.call(b,d(c),b)})}var f=a.defineGetter,g=a.defineWrapGetter,h=a.registerWrapper,i=a.unwrapIfNeeded,j=a.wrapNodeList;a.wrappers;var k=window.MutationObserver||window.WebKitMutationObserver;if(k){var l=window.MutationRecord;b.prototype={get addedNodes(){return j(this.impl.addedNodes)},get removedNodes(){return j(this.impl.removedNodes)}},["target","previousSibling","nextSibling"].forEach(function(a){g(b,a)}),["type","attributeName","attributeNamespace","oldValue"].forEach(function(a){f(b,a,function(){return this.impl[a]})}),l&&h(l,b),window.Node,e.prototype={observe:function(a,b){this.impl.observe(i(a),b)
+},disconnect:function(){this.impl.disconnect()},takeRecords:function(){return d(this.impl.takeRecords())}},a.wrappers.MutationObserver=e,a.wrappers.MutationRecord=b}}(this.ShadowDOMPolyfill),function(a){"use strict";function b(a){var b=c[a],d=window[b];if(d){var e=document.createElement(a),f=e.constructor;window[b]=f}}a.isWrapperFor;var c={a:"HTMLAnchorElement",applet:"HTMLAppletElement",area:"HTMLAreaElement",audio:"HTMLAudioElement",br:"HTMLBRElement",base:"HTMLBaseElement",body:"HTMLBodyElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElement",dl:"HTMLDListElement",datalist:"HTMLDataListElement",dir:"HTMLDirectoryElement",div:"HTMLDivElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSetElement",font:"HTMLFontElement",form:"HTMLFormElement",frame:"HTMLFrameElement",frameset:"HTMLFrameSetElement",hr:"HTMLHRElement",head:"HTMLHeadElement",h1:"HTMLHeadingElement",html:"HTMLHtmlElement",iframe:"HTMLIFrameElement",input:"HTMLInputElement",li:"HTMLLIElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",link:"HTMLLinkElement",map:"HTMLMapElement",menu:"HTMLMenuElement",menuitem:"HTMLMenuItemElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",del:"HTMLModElement",ol:"HTMLOListElement",object:"HTMLObjectElement",optgroup:"HTMLOptGroupElement",option:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",param:"HTMLParamElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQuoteElement",script:"HTMLScriptElement",select:"HTMLSelectElement",source:"HTMLSourceElement",span:"HTMLSpanElement",style:"HTMLStyleElement",caption:"HTMLTableCaptionElement",col:"HTMLTableColElement",table:"HTMLTableElement",tr:"HTMLTableRowElement",thead:"HTMLTableSectionElement",tbody:"HTMLTableSectionElement",textarea:"HTMLTextAreaElement",title:"HTMLTitleElement",ul:"HTMLUListElement",video:"HTMLVideoElement"};Object.keys(c).forEach(b),Object.getOwnPropertyNames(a.wrappers).forEach(function(b){window[b]=a.wrappers[b]}),a.knownElements=c}(this.ShadowDOMPolyfill),function(){var a=window.ShadowDOMPolyfill;a.wrap,Object.defineProperties(HTMLElement.prototype,{webkitShadowRoot:{get:function(){return this.shadowRoot}}}),HTMLElement.prototype.webkitCreateShadowRoot=HTMLElement.prototype.createShadowRoot,window.dartExperimentalFixupGetTag=function(b){function c(a){if(a instanceof d)return"NodeList";if(a instanceof e)return"ShadowRoot";if(a instanceof MutationRecord)return"MutationRecord";if(a instanceof MutationObserver)return"MutationObserver";if(f(a)){a=g(a);var c=a.constructor;if(c&&c._ShadowDOMPolyfill$isGeneratedWrapper){var h=c._ShadowDOMPolyfill$cacheTag_;return h||(h=Object.prototype.toString.call(a),h=h.substring(8,h.length-1),c._ShadowDOMPolyfill$cacheTag_=h),h}}return b(a)}var d=a.wrappers.NodeList,e=a.wrappers.ShadowRoot,f=a.isWrapper,g=a.unwrap;return c}}()}
\ No newline at end of file
diff --git a/sdk/lib/_internal/lib/native_helper.dart b/sdk/lib/_internal/lib/native_helper.dart
index 56c098f..4c66f65 100644
--- a/sdk/lib/_internal/lib/native_helper.dart
+++ b/sdk/lib/_internal/lib/native_helper.dart
@@ -140,9 +140,33 @@
 }
 
 /**
- * Returns the function to use to get the type name of an object.
+ * Cached value for the function to use to get the type name of an
+ * object.
+ */
+Function _getTypeNameOf;
+
+/**
+ * Returns the type name of [obj].
+ */
+String getTypeNameOf(var obj) {
+  if (_getTypeNameOf == null) _getTypeNameOf = getFunctionForTypeNameOf();
+  return _getTypeNameOf(obj);
+}
+
+/**
+ * Returns the function to use to get the type name (i.e. dispatch tag) of an
+ * object.
  */
 Function getFunctionForTypeNameOf() {
+  var getTagFunction = _getFunctionForTypeNameOf();
+  if (JS('bool', 'typeof dartExperimentalFixupGetTag == "function"')) {
+    return _applyExperimentalFixup(
+        JS('', 'dartExperimentalFixupGetTag'), getTagFunction);
+  }
+  return getTagFunction;
+}
+
+Function _getFunctionForTypeNameOf() {
   // If we're not in the browser, we're almost certainly running on v8.
   if (!identical(JS('String', 'typeof(navigator)'), 'object')) return typeNameInChrome;
 
@@ -167,21 +191,28 @@
   }
 }
 
+Function _applyExperimentalFixup(fixupJSFunction,
+                                 Function originalGetTagFunction) {
+  // Since DART_CLOSURE_TO_JS works only for top level functions, store the
+  // closed over JavaScript function in a top level variable and use a top level
+  // function.  This is fine since we have only one instance of the 'closure'.
+  _getTagJSFunction = originalGetTagFunction;
+  var newGetTagJSFunction =
+      JS('', '#(#)',
+         fixupJSFunction, DART_CLOSURE_TO_JS(_callGetTagJSFunction));
 
-/**
- * Cached value for the function to use to get the type name of an
- * object.
- */
-Function _getTypeNameOf;
+  String newGetTagDartFunction(object) =>
+      JS('', '#(#)', newGetTagJSFunction, object);
 
-/**
- * Returns the type name of [obj].
- */
-String getTypeNameOf(var obj) {
-  if (_getTypeNameOf == null) _getTypeNameOf = getFunctionForTypeNameOf();
-  return _getTypeNameOf(obj);
+  return newGetTagDartFunction;
 }
 
+var _getTagJSFunction;
+_callGetTagJSFunction(object) => _getTagJSFunction(object);
+
+
+
+
 String toStringForNativeObject(var obj) {
   String name = JS('String', '#', getTypeNameOf(obj));
   return 'Instance of $name';
diff --git a/tests/compiler/dart2js_native/fixup_get_tag_test.dart b/tests/compiler/dart2js_native/fixup_get_tag_test.dart
new file mode 100644
index 0000000..fbf9e3a
--- /dev/null
+++ b/tests/compiler/dart2js_native/fixup_get_tag_test.dart
@@ -0,0 +1,50 @@
+// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+
+// Test for dartExperimentalFixupGetTag.
+
+class Foo native "A" {  // There is one native class with dispatch tag 'A'.
+  token() native;
+}
+
+void setup() native r"""
+
+dartExperimentalFixupGetTag = function (originalGetTag) {
+  function fixedGetTag(obj) {
+    // Local JS 'class' B is made to be another implementation of the native
+    // class with tag 'A'.
+    if (obj instanceof B) return 'A';
+    // Other classes behave as before.
+    return originalGetTag(obj);
+  }
+  return fixedGetTag;
+};
+
+function A(){ }
+A.prototype.token = function () { return 'isA'; }
+
+function B(){ }
+B.prototype.token = function () { return 'isB'; }
+
+makeA = function() { return new A; };
+makeB = function() { return new B; };
+""";
+
+makeA() native;
+makeB() native;
+
+main() {
+  setup();
+
+  var a = makeA();
+  var b = makeB();
+
+  Expect.equals('isA', a.token());
+
+  // This call succeeds because the fixed-up 'getTag' method returns Foo's
+  // dispatch tag, and B is a faithful polyfil for Foo/A.
+  Expect.equals('isB', b.token());
+}
diff --git a/tools/VERSION b/tools/VERSION
index 0655e7f..3e1b001 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -1,4 +1,4 @@
 MAJOR 0
 MINOR 6
 BUILD 9
-PATCH 0
+PATCH 1