").addClass(errClass).css("position", "absolute")
+ .css("top", el.offsetTop)
+ .css("left", el.offsetLeft)
+ // setting width can push out the page size, forcing otherwise
+ // unnecessary scrollbars to appear and making it impossible for
+ // the element to shrink; so use max-width instead
+ .css("maxWidth", el.offsetWidth)
+ .css("height", el.offsetHeight);
+ errorDiv.text(err.message);
+ $el.after(errorDiv);
+
+ // Really dumb way to keep the size/position of the error in sync with
+ // the parent element as the window is resized or whatever.
+ var intId = setInterval(function() {
+ if (!errorDiv[0].parentElement) {
+ clearInterval(intId);
+ return;
+ }
+ errorDiv
+ .css("top", el.offsetTop)
+ .css("left", el.offsetLeft)
+ .css("maxWidth", el.offsetWidth)
+ .css("height", el.offsetHeight);
+ }, 500);
+ }
+ }
+ },
+ clearError: function(el) {
+ var $el = $(el);
+ var display = $el.data("restore-display-mode");
+ $el.data("restore-display-mode", null);
+
+ if (display === "inline" || display === "inline-block") {
+ if (display)
+ $el.css("display", display);
+ $(el.nextSibling).filter(".htmlwidgets-error").remove();
+ } else if (display === "block"){
+ $el.css("visibility", "inherit");
+ $(el.nextSibling).filter(".htmlwidgets-error").remove();
+ }
+ },
+ sizing: {}
+ };
+
+ // Called by widget bindings to register a new type of widget. The definition
+ // object can contain the following properties:
+ // - name (required) - A string indicating the binding name, which will be
+ // used by default as the CSS classname to look for.
+ // - initialize (optional) - A function(el) that will be called once per
+ // widget element; if a value is returned, it will be passed as the third
+ // value to renderValue.
+ // - renderValue (required) - A function(el, data, initValue) that will be
+ // called with data. Static contexts will cause this to be called once per
+ // element; Shiny apps will cause this to be called multiple times per
+ // element, as the data changes.
+ window.HTMLWidgets.widget = function(definition) {
+ if (!definition.name) {
+ throw new Error("Widget must have a name");
+ }
+ if (!definition.type) {
+ throw new Error("Widget must have a type");
+ }
+ // Currently we only support output widgets
+ if (definition.type !== "output") {
+ throw new Error("Unrecognized widget type '" + definition.type + "'");
+ }
+ // TODO: Verify that .name is a valid CSS classname
+
+ // Support new-style instance-bound definitions. Old-style class-bound
+ // definitions have one widget "object" per widget per type/class of
+ // widget; the renderValue and resize methods on such widget objects
+ // take el and instance arguments, because the widget object can't
+ // store them. New-style instance-bound definitions have one widget
+ // object per widget instance; the definition that's passed in doesn't
+ // provide renderValue or resize methods at all, just the single method
+ // factory(el, width, height)
+ // which returns an object that has renderValue(x) and resize(w, h).
+ // This enables a far more natural programming style for the widget
+ // author, who can store per-instance state using either OO-style
+ // instance fields or functional-style closure variables (I guess this
+ // is in contrast to what can only be called C-style pseudo-OO which is
+ // what we required before).
+ if (definition.factory) {
+ definition = createLegacyDefinitionAdapter(definition);
+ }
+
+ if (!definition.renderValue) {
+ throw new Error("Widget must have a renderValue function");
+ }
+
+ // For static rendering (non-Shiny), use a simple widget registration
+ // scheme. We also use this scheme for Shiny apps/documents that also
+ // contain static widgets.
+ window.HTMLWidgets.widgets = window.HTMLWidgets.widgets || [];
+ // Merge defaults into the definition; don't mutate the original definition.
+ var staticBinding = extend({}, defaults, definition);
+ overrideMethod(staticBinding, "find", function(superfunc) {
+ return function(scope) {
+ var results = superfunc(scope);
+ // Filter out Shiny outputs, we only want the static kind
+ return filterByClass(results, "html-widget-output", false);
+ };
+ });
+ window.HTMLWidgets.widgets.push(staticBinding);
+
+ if (shinyMode) {
+ // Shiny is running. Register the definition with an output binding.
+ // The definition itself will not be the output binding, instead
+ // we will make an output binding object that delegates to the
+ // definition. This is because we foolishly used the same method
+ // name (renderValue) for htmlwidgets definition and Shiny bindings
+ // but they actually have quite different semantics (the Shiny
+ // bindings receive data that includes lots of metadata that it
+ // strips off before calling htmlwidgets renderValue). We can't
+ // just ignore the difference because in some widgets it's helpful
+ // to call this.renderValue() from inside of resize(), and if
+ // we're not delegating, then that call will go to the Shiny
+ // version instead of the htmlwidgets version.
+
+ // Merge defaults with definition, without mutating either.
+ var bindingDef = extend({}, defaults, definition);
+
+ // This object will be our actual Shiny binding.
+ var shinyBinding = new Shiny.OutputBinding();
+
+ // With a few exceptions, we'll want to simply use the bindingDef's
+ // version of methods if they are available, otherwise fall back to
+ // Shiny's defaults. NOTE: If Shiny's output bindings gain additional
+ // methods in the future, and we want them to be overrideable by
+ // HTMLWidget binding definitions, then we'll need to add them to this
+ // list.
+ delegateMethod(shinyBinding, bindingDef, "getId");
+ delegateMethod(shinyBinding, bindingDef, "onValueChange");
+ delegateMethod(shinyBinding, bindingDef, "onValueError");
+ delegateMethod(shinyBinding, bindingDef, "renderError");
+ delegateMethod(shinyBinding, bindingDef, "clearError");
+ delegateMethod(shinyBinding, bindingDef, "showProgress");
+
+ // The find, renderValue, and resize are handled differently, because we
+ // want to actually decorate the behavior of the bindingDef methods.
+
+ shinyBinding.find = function(scope) {
+ var results = bindingDef.find(scope);
+
+ // Only return elements that are Shiny outputs, not static ones
+ var dynamicResults = results.filter(".html-widget-output");
+
+ // It's possible that whatever caused Shiny to think there might be
+ // new dynamic outputs, also caused there to be new static outputs.
+ // Since there might be lots of different htmlwidgets bindings, we
+ // schedule execution for later--no need to staticRender multiple
+ // times.
+ if (results.length !== dynamicResults.length)
+ scheduleStaticRender();
+
+ return dynamicResults;
+ };
+
+ // Wrap renderValue to handle initialization, which unfortunately isn't
+ // supported natively by Shiny at the time of this writing.
+
+ shinyBinding.renderValue = function(el, data) {
+ Shiny.renderDependencies(data.deps);
+ // Resolve strings marked as javascript literals to objects
+ if (!(data.evals instanceof Array)) data.evals = [data.evals];
+ for (var i = 0; data.evals && i < data.evals.length; i++) {
+ window.HTMLWidgets.evaluateStringMember(data.x, data.evals[i]);
+ }
+ if (!bindingDef.renderOnNullValue) {
+ if (data.x === null) {
+ el.style.visibility = "hidden";
+ return;
+ } else {
+ el.style.visibility = "inherit";
+ }
+ }
+ if (!elementData(el, "initialized")) {
+ initSizing(el);
+
+ elementData(el, "initialized", true);
+ if (bindingDef.initialize) {
+ var result = bindingDef.initialize(el, el.offsetWidth,
+ el.offsetHeight);
+ elementData(el, "init_result", result);
+ }
+ }
+ bindingDef.renderValue(el, data.x, elementData(el, "init_result"));
+ evalAndRun(data.jsHooks.render, elementData(el, "init_result"), [el, data.x]);
+ };
+
+ // Only override resize if bindingDef implements it
+ if (bindingDef.resize) {
+ shinyBinding.resize = function(el, width, height) {
+ // Shiny can call resize before initialize/renderValue have been
+ // called, which doesn't make sense for widgets.
+ if (elementData(el, "initialized")) {
+ bindingDef.resize(el, width, height, elementData(el, "init_result"));
+ }
+ };
+ }
+
+ Shiny.outputBindings.register(shinyBinding, bindingDef.name);
+ }
+ };
+
+ var scheduleStaticRenderTimerId = null;
+ function scheduleStaticRender() {
+ if (!scheduleStaticRenderTimerId) {
+ scheduleStaticRenderTimerId = setTimeout(function() {
+ scheduleStaticRenderTimerId = null;
+ window.HTMLWidgets.staticRender();
+ }, 1);
+ }
+ }
+
+ // Render static widgets after the document finishes loading
+ // Statically render all elements that are of this widget's class
+ window.HTMLWidgets.staticRender = function() {
+ var bindings = window.HTMLWidgets.widgets || [];
+ forEach(bindings, function(binding) {
+ var matches = binding.find(document.documentElement);
+ forEach(matches, function(el) {
+ var sizeObj = initSizing(el, binding);
+
+ if (hasClass(el, "html-widget-static-bound"))
+ return;
+ el.className = el.className + " html-widget-static-bound";
+
+ var initResult;
+ if (binding.initialize) {
+ initResult = binding.initialize(el,
+ sizeObj ? sizeObj.getWidth() : el.offsetWidth,
+ sizeObj ? sizeObj.getHeight() : el.offsetHeight
+ );
+ elementData(el, "init_result", initResult);
+ }
+
+ if (binding.resize) {
+ var lastSize = {
+ w: sizeObj ? sizeObj.getWidth() : el.offsetWidth,
+ h: sizeObj ? sizeObj.getHeight() : el.offsetHeight
+ };
+ var resizeHandler = function(e) {
+ var size = {
+ w: sizeObj ? sizeObj.getWidth() : el.offsetWidth,
+ h: sizeObj ? sizeObj.getHeight() : el.offsetHeight
+ };
+ if (size.w === 0 && size.h === 0)
+ return;
+ if (size.w === lastSize.w && size.h === lastSize.h)
+ return;
+ lastSize = size;
+ binding.resize(el, size.w, size.h, initResult);
+ };
+
+ on(window, "resize", resizeHandler);
+
+ // This is needed for cases where we're running in a Shiny
+ // app, but the widget itself is not a Shiny output, but
+ // rather a simple static widget. One example of this is
+ // an rmarkdown document that has runtime:shiny and widget
+ // that isn't in a render function. Shiny only knows to
+ // call resize handlers for Shiny outputs, not for static
+ // widgets, so we do it ourselves.
+ if (window.jQuery) {
+ window.jQuery(document).on(
+ "shown.htmlwidgets shown.bs.tab.htmlwidgets shown.bs.collapse.htmlwidgets",
+ resizeHandler
+ );
+ window.jQuery(document).on(
+ "hidden.htmlwidgets hidden.bs.tab.htmlwidgets hidden.bs.collapse.htmlwidgets",
+ resizeHandler
+ );
+ }
+
+ // This is needed for the specific case of ioslides, which
+ // flips slides between display:none and display:block.
+ // Ideally we would not have to have ioslide-specific code
+ // here, but rather have ioslides raise a generic event,
+ // but the rmarkdown package just went to CRAN so the
+ // window to getting that fixed may be long.
+ if (window.addEventListener) {
+ // It's OK to limit this to window.addEventListener
+ // browsers because ioslides itself only supports
+ // such browsers.
+ on(document, "slideenter", resizeHandler);
+ on(document, "slideleave", resizeHandler);
+ }
+ }
+
+ var scriptData = document.querySelector("script[data-for='" + el.id + "'][type='application/json']");
+ if (scriptData) {
+ var data = JSON.parse(scriptData.textContent || scriptData.text);
+ // Resolve strings marked as javascript literals to objects
+ if (!(data.evals instanceof Array)) data.evals = [data.evals];
+ for (var k = 0; data.evals && k < data.evals.length; k++) {
+ window.HTMLWidgets.evaluateStringMember(data.x, data.evals[k]);
+ }
+ binding.renderValue(el, data.x, initResult);
+ evalAndRun(data.jsHooks.render, initResult, [el, data.x]);
+ }
+ });
+ });
+
+ invokePostRenderHandlers();
+ }
+
+
+ function has_jQuery3() {
+ if (!window.jQuery) {
+ return false;
+ }
+ var $version = window.jQuery.fn.jquery;
+ var $major_version = parseInt($version.split(".")[0]);
+ return $major_version >= 3;
+ }
+
+ /*
+ / Shiny 1.4 bumped jQuery from 1.x to 3.x which means jQuery's
+ / on-ready handler (i.e., $(fn)) is now asyncronous (i.e., it now
+ / really means $(setTimeout(fn)).
+ / https://jquery.com/upgrade-guide/3.0/#breaking-change-document-ready-handlers-are-now-asynchronous
+ /
+ / Since Shiny uses $() to schedule initShiny, shiny>=1.4 calls initShiny
+ / one tick later than it did before, which means staticRender() is
+ / called renderValue() earlier than (advanced) widget authors might be expecting.
+ / https://github.com/rstudio/shiny/issues/2630
+ /
+ / For a concrete example, leaflet has some methods (e.g., updateBounds)
+ / which reference Shiny methods registered in initShiny (e.g., setInputValue).
+ / Since leaflet is privy to this life-cycle, it knows to use setTimeout() to
+ / delay execution of those methods (until Shiny methods are ready)
+ / https://github.com/rstudio/leaflet/blob/18ec981/javascript/src/index.js#L266-L268
+ /
+ / Ideally widget authors wouldn't need to use this setTimeout() hack that
+ / leaflet uses to call Shiny methods on a staticRender(). In the long run,
+ / the logic initShiny should be broken up so that method registration happens
+ / right away, but binding happens later.
+ */
+ function maybeStaticRenderLater() {
+ if (shinyMode && has_jQuery3()) {
+ window.jQuery(window.HTMLWidgets.staticRender);
+ } else {
+ window.HTMLWidgets.staticRender();
+ }
+ }
+
+ if (document.addEventListener) {
+ document.addEventListener("DOMContentLoaded", function() {
+ document.removeEventListener("DOMContentLoaded", arguments.callee, false);
+ maybeStaticRenderLater();
+ }, false);
+ } else if (document.attachEvent) {
+ document.attachEvent("onreadystatechange", function() {
+ if (document.readyState === "complete") {
+ document.detachEvent("onreadystatechange", arguments.callee);
+ maybeStaticRenderLater();
+ }
+ });
+ }
+
+
+ window.HTMLWidgets.getAttachmentUrl = function(depname, key) {
+ // If no key, default to the first item
+ if (typeof(key) === "undefined")
+ key = 1;
+
+ var link = document.getElementById(depname + "-" + key + "-attachment");
+ if (!link) {
+ throw new Error("Attachment " + depname + "/" + key + " not found in document");
+ }
+ return link.getAttribute("href");
+ };
+
+ window.HTMLWidgets.dataframeToD3 = function(df) {
+ var names = [];
+ var length;
+ for (var name in df) {
+ if (df.hasOwnProperty(name))
+ names.push(name);
+ if (typeof(df[name]) !== "object" || typeof(df[name].length) === "undefined") {
+ throw new Error("All fields must be arrays");
+ } else if (typeof(length) !== "undefined" && length !== df[name].length) {
+ throw new Error("All fields must be arrays of the same length");
+ }
+ length = df[name].length;
+ }
+ var results = [];
+ var item;
+ for (var row = 0; row < length; row++) {
+ item = {};
+ for (var col = 0; col < names.length; col++) {
+ item[names[col]] = df[names[col]][row];
+ }
+ results.push(item);
+ }
+ return results;
+ };
+
+ window.HTMLWidgets.transposeArray2D = function(array) {
+ if (array.length === 0) return array;
+ var newArray = array[0].map(function(col, i) {
+ return array.map(function(row) {
+ return row[i]
+ })
+ });
+ return newArray;
+ };
+ // Split value at splitChar, but allow splitChar to be escaped
+ // using escapeChar. Any other characters escaped by escapeChar
+ // will be included as usual (including escapeChar itself).
+ function splitWithEscape(value, splitChar, escapeChar) {
+ var results = [];
+ var escapeMode = false;
+ var currentResult = "";
+ for (var pos = 0; pos < value.length; pos++) {
+ if (!escapeMode) {
+ if (value[pos] === splitChar) {
+ results.push(currentResult);
+ currentResult = "";
+ } else if (value[pos] === escapeChar) {
+ escapeMode = true;
+ } else {
+ currentResult += value[pos];
+ }
+ } else {
+ currentResult += value[pos];
+ escapeMode = false;
+ }
+ }
+ if (currentResult !== "") {
+ results.push(currentResult);
+ }
+ return results;
+ }
+ // Function authored by Yihui/JJ Allaire
+ window.HTMLWidgets.evaluateStringMember = function(o, member) {
+ var parts = splitWithEscape(member, '.', '\\');
+ for (var i = 0, l = parts.length; i < l; i++) {
+ var part = parts[i];
+ // part may be a character or 'numeric' member name
+ if (o !== null && typeof o === "object" && part in o) {
+ if (i == (l - 1)) { // if we are at the end of the line then evalulate
+ if (typeof o[part] === "string")
+ o[part] = tryEval(o[part]);
+ } else { // otherwise continue to next embedded object
+ o = o[part];
+ }
+ }
+ }
+ };
+
+ // Retrieve the HTMLWidget instance (i.e. the return value of an
+ // HTMLWidget binding's initialize() or factory() function)
+ // associated with an element, or null if none.
+ window.HTMLWidgets.getInstance = function(el) {
+ return elementData(el, "init_result");
+ };
+
+ // Finds the first element in the scope that matches the selector,
+ // and returns the HTMLWidget instance (i.e. the return value of
+ // an HTMLWidget binding's initialize() or factory() function)
+ // associated with that element, if any. If no element matches the
+ // selector, or the first matching element has no HTMLWidget
+ // instance associated with it, then null is returned.
+ //
+ // The scope argument is optional, and defaults to window.document.
+ window.HTMLWidgets.find = function(scope, selector) {
+ if (arguments.length == 1) {
+ selector = scope;
+ scope = document;
+ }
+
+ var el = scope.querySelector(selector);
+ if (el === null) {
+ return null;
+ } else {
+ return window.HTMLWidgets.getInstance(el);
+ }
+ };
+
+ // Finds all elements in the scope that match the selector, and
+ // returns the HTMLWidget instances (i.e. the return values of
+ // an HTMLWidget binding's initialize() or factory() function)
+ // associated with the elements, in an array. If elements that
+ // match the selector don't have an associated HTMLWidget
+ // instance, the returned array will contain nulls.
+ //
+ // The scope argument is optional, and defaults to window.document.
+ window.HTMLWidgets.findAll = function(scope, selector) {
+ if (arguments.length == 1) {
+ selector = scope;
+ scope = document;
+ }
+
+ var nodes = scope.querySelectorAll(selector);
+ var results = [];
+ for (var i = 0; i < nodes.length; i++) {
+ results.push(window.HTMLWidgets.getInstance(nodes[i]));
+ }
+ return results;
+ };
+
+ var postRenderHandlers = [];
+ function invokePostRenderHandlers() {
+ while (postRenderHandlers.length) {
+ var handler = postRenderHandlers.shift();
+ if (handler) {
+ handler();
+ }
+ }
+ }
+
+ // Register the given callback function to be invoked after the
+ // next time static widgets are rendered.
+ window.HTMLWidgets.addPostRenderHandler = function(callback) {
+ postRenderHandlers.push(callback);
+ };
+
+ // Takes a new-style instance-bound definition, and returns an
+ // old-style class-bound definition. This saves us from having
+ // to rewrite all the logic in this file to accomodate both
+ // types of definitions.
+ function createLegacyDefinitionAdapter(defn) {
+ var result = {
+ name: defn.name,
+ type: defn.type,
+ initialize: function(el, width, height) {
+ return defn.factory(el, width, height);
+ },
+ renderValue: function(el, x, instance) {
+ return instance.renderValue(x);
+ },
+ resize: function(el, width, height, instance) {
+ return instance.resize(width, height);
+ }
+ };
+
+ if (defn.find)
+ result.find = defn.find;
+ if (defn.renderError)
+ result.renderError = defn.renderError;
+ if (defn.clearError)
+ result.clearError = defn.clearError;
+
+ return result;
+ }
+})();
+
diff --git a/docs/libs/r2d3-binding-0.2.6/r2d3.js b/docs/libs/r2d3-binding-0.2.6/r2d3.js
new file mode 100644
index 0000000..800334f
--- /dev/null
+++ b/docs/libs/r2d3-binding-0.2.6/r2d3.js
@@ -0,0 +1,18 @@
+HTMLWidgets.widget({
+ name: 'r2d3',
+ type: 'output',
+ factory: function(el, width, height) {
+
+ var r2d3 = new R2D3(el, width, height);
+
+ return {
+ renderValue: function(x) {
+ r2d3.widgetRender(x);
+ },
+
+ resize: function(width, height) {
+ r2d3.widgetResize(width, height);
+ }
+ };
+ }
+});
diff --git a/docs/libs/r2d3-render-0.1.0/r2d3-render.js b/docs/libs/r2d3-render-0.1.0/r2d3-render.js
new file mode 100644
index 0000000..4f09545
--- /dev/null
+++ b/docs/libs/r2d3-render-0.1.0/r2d3-render.js
@@ -0,0 +1,618 @@
+function R2D3(el, width, height) {
+ var self = this;
+ var x = null;
+ var version = null;
+
+ self.data = null;
+ self.shadow = null;
+ self.root = self.svg = self.canvas = null;
+ self.width = width;
+ self.height = height;
+ self.options = null;
+ self.resizer = null;
+ self.renderer = null;
+ self.rendererDefaut = true;
+ self.captureErrors = null;
+ self.theme = {};
+ self.style = null;
+ self.useShadow = true;
+
+ self.setX = function(newX) {
+ x = newX;
+ self.data = x.data;
+
+ if (x.type == "data.frame") {
+ self.data = HTMLWidgets.dataframeToD3(self.data);
+ }
+
+ if (x.theme) {
+ self.theme = themeCapable() ? x.theme.runtime : x.theme.default;
+ }
+
+ self.options = x.options;
+
+ if (!x.useShadow) {
+ self.useShadow = false;
+ }
+ };
+
+ self.setContainer = function(container) {
+ self.container = container;
+ };
+
+ self.setRoot = function(root) {
+ self.root = self.svg = self.canvas = root;
+ };
+
+ var createContainer = function() {
+ if (self.container == "svg")
+ return document.createElementNS("http://www.w3.org/2000/svg", "svg");
+ else
+ return document.createElement(self.container);
+ };
+
+ self.createRoot = function() {
+ if (self.shadow === null) {
+ if (self.useShadow && el.attachShadow) {
+ self.shadow = el.attachShadow({
+ mode: "open"
+ });
+ }
+ else {
+ self.shadow = el;
+ }
+ }
+
+ if (self.root !== null) {
+ self.d3().select(self.shadow).select(self.container).remove();
+ self.setRoot(null);
+ }
+
+ var container = createContainer();
+ self.shadow.appendChild(container);
+ var root = self.d3().select(container)
+ .attr("width", self.width)
+ .attr("height", self.height);
+
+ if (self.theme.background) root.style("background", self.theme.background);
+ if (self.theme.foreground) {
+ root.style("fill", self.theme.foreground);
+ root.style("color", self.theme.foreground);
+ }
+
+ self.setRoot(root);
+ self.addStyle();
+ };
+
+ self.setWidth = function(width) {
+ self.width = width;
+ };
+
+ self.setHeight = function(height) {
+ self.height = height;
+ };
+
+ self.onRender = function(renderer) {
+ self.renderer = renderer;
+ self.rendererDefaut = false;
+ };
+
+ self.onResize = function(resizer) {
+ self.resizer = resizer;
+ };
+
+ self.render = function() {
+ if (self.renderer === null) return;
+
+ try {
+ self.renderer(self.data, self.root, self.width, self.height, self.options);
+ }
+ catch (err) {
+ self.showError(err, null, null);
+ }
+ };
+
+ self.resize = function() {
+ if (self.resizer === null) return;
+ try {
+ self.resizer(self.width, self.height);
+ }
+ catch (err) {
+ self.showError(err, null, null);
+ }
+ };
+
+ var simpleHash = function(data) {
+ var step = Math.max(1, Math.floor(data.length / 1000));
+
+ var hash = 0;
+ for (var idx = 0; idx < data.length; idx += step) {
+ hash = ((hash << 5) - hash) + data.charCodeAt(idx);
+ hash = hash & hash;
+ }
+
+ return Math.abs(hash) % 1000;
+ };
+
+ self.addScript = function(script) {
+ var el = document.createElement("script");
+ el.type = "text/javascript";
+
+ var debugHeader = "//# sourceURL=r2d3-script-" + simpleHash(script) + "\n";
+ el.text = debugHeader + script;
+
+ self.captureErrors = function(msg, url, lineNo, columnNo, error) {
+ self.showError({
+ message: msg,
+ stack: null
+ }, lineNo, columnNo);
+ };
+
+ document.head.appendChild(el);
+ self.captureErrors = null;
+ };
+
+ self.setStyle = function(style) {
+ self.style = style;
+ };
+
+ self.addStyle = function() {
+ if (!self.style) return;
+
+ var el = document.createElement("style");
+
+ el.type = "text/css";
+ if (el.styleSheet) {
+ el.styleSheet.cssText = self.style;
+ } else {
+ el.appendChild(document.createTextNode(self.style));
+ }
+
+ self.root.node().appendChild(el);
+ };
+
+ self.setVersion = function(newVersion) {
+ version = newVersion;
+ };
+
+ self.d3 = function() {
+ switch(version) {
+ case 3:
+ return window.d3;
+ case 4:
+ return window.d3v4;
+ case 5:
+ return window.d3v5;
+ case 6:
+ return window.d3v6;
+ }
+ };
+
+ var consoleLog = function(data) {
+ console.log(data);
+
+ var entry = document.createElement("div");
+ lastConsoleEntry = entry;
+ entry.style.bottom = "0";
+ entry.style.left = "0";
+ entry.style.right = "0";
+ entry.style.background = "rgb(244, 248, 249)";
+ entry.style.border = "1px solid #d6dadc";
+ entry.style.padding = "8px 15px 8px 15px";
+ entry.style.position = "absolute";
+ entry.style.fontFamily = "'Lucida Sans', 'DejaVu Sans', 'Lucida Grande', 'Segoe UI', Verdana, Helvetica, sans-serif, serif";
+ entry.style.fontSize = "9pt";
+ self.shadow.appendChild(entry);
+
+ entry.style.transform = "translateY(40px)";
+ entry.style.opacity = "0";
+ entry.style.transition = "all 0.25s";
+
+ entry.onmouseenter = function(e) {
+ consoleHovering = true;
+ };
+
+ entry.onmouseleave = function(e) {
+ if (lastConsoleEntry == e.target) consoleHovering = false;
+ };
+
+ setTimeout(function() {
+ entry.style.transform = "translateY(0)";
+ entry.style.opacity = "1";
+ entry.style.transition = "all 0.5s";
+ }, 50);
+
+ entry.innerText = data;
+
+ (function(entry) {
+ setTimeout(function() {
+ var hideConsole = function() {
+ entry.style.opacity = "0";
+ entry.addEventListener("transitionend", function(event) {
+ event.target.parentNode.removeChild(event.target);
+ });
+ };
+
+ var retryHide = function() {
+ if (consoleHovering && lastConsoleEntry == entry) {
+ setTimeout(retryHide, 100);
+ }
+ else {
+ hideConsole();
+ }
+ };
+
+ retryHide();
+ }, 3000);
+ })(entry);
+ };
+
+ var consoleHovering = false;
+ var lastConsoleEntry = null;
+ var createConsoleOverride = function(type) {
+ return function(data) {
+ consoleLog(type + data);
+ };
+ };
+
+ self.console = {
+ assert: console.assert,
+ clear: console.clear,
+ count: console.count,
+ error: createConsoleOverride("Error: "),
+ group: console.group,
+ groupCollapsed: console.groupCollapsed,
+ groupEnd: console.groupEnd,
+ info: createConsoleOverride("Info: "),
+ log: createConsoleOverride(""),
+ table: console.table,
+ time: console.time,
+ timeEnd: console.timeEnd,
+ trace: console.trace,
+ warn: console.warn
+ };
+
+ self.callD3Script = function() {
+ var d3Script = self.d3Script;
+
+ try {
+ d3Script(self.d3(), self, self.data, self.root, self.width, self.height, self.options, self.theme, self.console);
+ }
+ catch (err) {
+ self.showError(err, null, null);
+ }
+ };
+
+ self.widgetRender = function(x) {
+ self.setX(x);
+
+ if (!self.root) {
+ self.setVersion(x.version);
+ self.setStyle(x.style);
+ self.addScript(x.script);
+ self.d3Script = d3Script;
+ self.setContainer(x.container);
+
+ self.createRoot();
+
+ self.callD3Script();
+ }
+
+ self.render();
+
+ if (self.renderer === null) {
+ self.renderer = function(data, container, width, height, options) {
+ self.callD3Script();
+ };
+ }
+
+ if (self.resizer === null) {
+ self.resizer = function(width, height) {
+ self.createRoot();
+ self.callD3Script();
+ if (!self.rendererDefaut) self.render();
+ };
+ }
+ };
+
+ self.debounce = function(f, wait) {
+ var timeout = null;
+ return function() {
+ if (timeout) window.clearTimeout(timeout);
+ timeout = window.setTimeout(f, wait);
+ };
+ };
+
+ self.resizeDebounce = self.debounce(self.resize, 100);
+
+ self.widgetResize = function(width, height) {
+ self.root
+ .attr("width", width)
+ .attr("height", height);
+
+ self.setWidth(width);
+ self.setHeight(height);
+
+ self.resizeDebounce();
+ };
+
+ var openSource = function(filename, line, column, domain, highlight) {
+ if (window.parent.postMessage) {
+ window.parent.postMessage({
+ message: "openfile",
+ source: "r2d3",
+ file: filename,
+ line: line,
+ column: column,
+ highlight: highlight
+ }, domain);
+ }
+ };
+
+ var themesLoaded = false;
+ var registerTheme = function(domain) {
+ domain = domain ? domain : window.location.origin;
+ if (window.parent.postMessage) {
+ window.addEventListener('message', function(event) {
+ if (typeof event.data != 'object')
+ return;
+ if (event.origin !== domain)
+ return;
+ if (event.data.message !== "ontheme")
+ return;
+
+ document.body.style.background = event.data.background;
+
+ self.theme.background = event.data.background;
+ self.theme.foreground = event.data.foreground;
+
+ // resize to give script chance to pick new theme
+ if (themesLoaded) self.resize();
+ themesLoaded = true;
+ }, false);
+
+ window.parent.postMessage({
+ message: "ontheme",
+ source: "r2d3"
+ }, domain);
+ }
+ };
+
+ var errorObject = null;
+ var errorLine = null;
+ var errorColumn = null;
+ var errorFile = null;
+ var errorHighlightOnce = false;
+ var hostDomain = null;
+
+ var queryParameter = function(param) {
+ var query = window.location.search.substring(1);
+ var entries = query.split('&');
+
+ for (var idxEntry = 0; idxEntry < entries.length; idxEntry++) {
+ var params = entries[idxEntry].split('=');
+ if (decodeURIComponent(params[0]) == param) {
+ return decodeURIComponent(params[1]);
+ }
+ }
+
+ return null;
+ };
+
+ var themeCapable = function() {
+ return queryParameter("capabilities") === "1";
+ };
+
+ var registerMessageListeners = function(event) {
+ if (!themeCapable()) {
+ hostDomain = null;
+ } else {
+ hostDomain = queryParameter("host");
+ registerTheme(hostDomain);
+ }
+ };
+
+ var cleanStackTrace = function(stack) {
+ var cleaned = stack.substr(0, stack.indexOf("at d3Script"));
+ cleaned = cleaned.replace(new RegExp("\\(.*/session/view[^/]*/lib/[^/]+/", "g"), "(");
+ cleaned = cleaned.replace(new RegExp("\\(.*/session/view[^/]*/", "g"), "(");
+
+ return cleaned;
+ };
+
+ var parseLineFileRef = function(line) {
+ var lines = x.script.split("\n");
+ line = Math.min(lines.length - 1, line);
+
+ var header = "/* R2D3 Source File: ";
+ var file = null;
+ for (var maybe = line; line && maybe >= 0; maybe--) {
+ if (lines[maybe].includes(header)) {
+ var data = lines[maybe].split(header)[1];
+ var source = data.split("*/")[0].trim();
+
+ line = line - (maybe + 2);
+ file = source;
+
+ break;
+ }
+ }
+
+ return {
+ file: file,
+ line: line
+ };
+ };
+
+ var parseCallstackRef = function(callstack) {
+ var reg = new RegExp("at [^\\n]+ \\((
|r2d3-script-[0-9]+):([0-9]+):([0-9]+)\\)");
+ var matches = reg.exec(callstack);
+ if (matches && matches.length === 4) {
+
+ var line = parseInt(matches[2]);
+ var column = parseInt(matches[3]);
+ var file = null;
+ var lineRef = parseLineFileRef(line);
+ if (lineRef) {
+ file = lineRef.file;
+ line = lineRef.line;
+ }
+
+ return {
+ file: file,
+ line: line,
+ column: column
+ };
+ }
+ else {
+ return null;
+ }
+ };
+
+ var createSourceLink = function(path, line, column, domain) {
+ var name = baseName(path);
+ var linkEl = document.createElement("a");
+ linkEl.innerText = "(" + name + "#" + line + ":" + column + ")";
+ linkEl.href = "#";
+ linkEl.color = "#4531d6";
+ linkEl.style.display = "inline-block";
+ linkEl.style.textDecoration = "none";
+ linkEl.onclick = function() {
+ openSource(path, line, column, domain, false);
+ };
+
+ return linkEl;
+ };
+
+ var baseName = function(path) {
+ var parts = path.split(new RegExp("/|\\\\"));
+ return parts[parts.length - 1];
+ };
+
+ var showErrorImpl = function() {
+ var message = errorObject, callstack = "";
+
+ if (errorObject.message) message = errorObject.message;
+ if (errorObject.stack) callstack = errorObject.stack;
+
+ if (errorLine === null || errorColumn === null) {
+ var parseResult = parseCallstackRef(callstack);
+ if (parseResult) {
+ errorFile = parseResult.file;
+ errorLine = parseResult.line;
+ errorColumn = parseResult.column;
+ }
+ }
+ else {
+ var parseLineResult = parseLineFileRef(errorLine);
+ if (parseLineResult) {
+ errorFile = parseLineResult.file;
+ errorLine = parseLineResult.line;
+ }
+ }
+
+ if (errorFile) {
+ message = message + " in ";
+ }
+
+ var container = document.getElementById("r2d3-error-container");
+ if (!container) {
+ container = document.createElement("div");
+ self.shadow.appendChild(container);
+ }
+ else {
+ container.innerHTML = "";
+ }
+
+ container.id = "r2d3-error-container";
+ container.style.fontFamily = "'Lucida Sans', 'DejaVu Sans', 'Lucida Grande', 'Segoe UI', Verdana, Helvetica, sans-serif, serif";
+ container.style.fontSize = "9pt";
+ container.style.color = "#444";
+ container.style.position = "absolute";
+ container.style.top = "0";
+ container.style.left = "8px";
+ container.style.right = "8px";
+ container.style.overflow = "scroll";
+ container.style.lineHeight = "16px";
+
+ var header = document.createElement("div");
+ header.innerText = "Error: " + message.replace("\n", "");
+ header.style.marginTop = "8px";
+ header.style.background = "rgb(244, 248, 249)";
+ header.style.border = "1px solid #d6dadc";
+ header.style.padding = "8px 15px 8px 15px";
+ header.style.lineHeight = "24px";
+ container.appendChild(header);
+
+ if (errorFile) {
+ if (hostDomain) {
+ if (!errorHighlightOnce) {
+ openSource(errorFile, errorLine, errorColumn, hostDomain, true);
+ errorHighlightOnce = true;
+ }
+
+ var linkEl = createSourceLink(errorFile, errorLine, errorColumn, hostDomain);
+ header.appendChild(linkEl);
+ }
+ else {
+ header.innerText = "Error: " + message.replace("\n", "") + " " + errorFile + "#" + errorLine + ":" + errorColumn;
+ }
+ }
+
+ if (callstack) {
+ var stack = document.createElement("div");
+ var cleanStack = cleanStackTrace(callstack);
+ stack.style.display = "block";
+ stack.style.border = "1px solid #d6dadc";
+ stack.style.padding = "12px 15px 12px 15px";
+ stack.style.background = "#FFFFFF";
+ stack.style.borderTop = "0";
+
+ var allEmpty = true;
+ var entries = cleanStack.split("\n");
+ for (var idxEntry in entries) {
+ var entry = entries[idxEntry];
+ var stackEl = document.createElement("div");
+
+ var stackRes = parseCallstackRef(entry);
+ if (idxEntry === "0") {
+ header.appendChild(document.createElement("br"));
+ header.appendChild(document.createTextNode(entry));
+ } else if (hostDomain && stackRes) {
+ stackEl.innerText = entry.substr(
+ 0,
+ Math.max(entry.indexOf("( 0) stack.appendChild(stackEl);
+ }
+
+ if (stack.childElementCount > 0)
+ container.appendChild(stack);
+ }
+ };
+
+ self.showError = function(error, line, column) {
+ errorObject = error;
+ errorLine = line;
+ errorColumn = column;
+
+ showErrorImpl();
+ };
+
+ window.onerror = function (msg, url, lineNo, columnNo, error) {
+ if (self.captureErrors) {
+ self.captureErrors(msg, url, lineNo, columnNo, error);
+ }
+
+ return false;
+ };
+
+ registerMessageListeners();
+}
\ No newline at end of file
diff --git a/docs/libs/webcomponents-2.0.0/webcomponents.js b/docs/libs/webcomponents-2.0.0/webcomponents.js
new file mode 100644
index 0000000..6883e0e
--- /dev/null
+++ b/docs/libs/webcomponents-2.0.0/webcomponents.js
@@ -0,0 +1,236 @@
+// webcomponents.js requires Set api which is not available in all browsers
+if (typeof(Set) !== "undefined") {
+/**
+@license @nocompile
+Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
+This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
+The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
+The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
+Code distributed by Google as part of the polymer project is also
+subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
+*/
+(function(){/*
+
+ Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
+ This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
+ The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
+ The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
+ Code distributed by Google as part of the polymer project is also
+ subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
+*/
+'use strict';var q,aa="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this,ba="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};function ca(){ca=function(){};aa.Symbol||(aa.Symbol=da)}var da=function(){var a=0;return function(b){return"jscomp_symbol_"+(b||"")+a++}}();
+function ea(){ca();var a=aa.Symbol.iterator;a||(a=aa.Symbol.iterator=aa.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&ba(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return fa(this)}});ea=function(){}}function fa(a){var b=0;return ha(function(){return b"+this.innerHTML+""},set:function(a){if(this.parentNode){U.body.innerHTML=a;for(a=this.ownerDocument.createDocumentFragment();U.body.firstChild;)m.call(a,U.body.firstChild);
+n.call(this.parentNode,a,this)}else throw Error("Failed to set the 'outerHTML' property on 'Element': This element has no parent node.");},configurable:!0})};p(a.prototype);Fc(a.prototype);a.b=function(c){c=b(c,"template");for(var d=0,e=c.length,f;d]/g,
+l=function(a){switch(a){case "&":return"&";case "<":return"<";case ">":return">";case '"':return""";case "\u00a0":return" "}};xa=function(a){for(var b={},c=0;c";h=F[n]?v:v+Gc(h,m)+""+n+">";break a;case Node.TEXT_NODE:h=h.data;h=k&&of[k.localName]?h:h.replace(kb,l);break a;case Node.COMMENT_NODE:h="\x3c!--"+h.data+"--\x3e";break a;default:throw window.console.error(h),Error("not implemented");}}c+=h}return c}}if(c||v){a.a=function(a,b){var c=f.call(a,!1);
+this.R&&this.R(c);b&&(m.call(c.content,f.call(a.content,!0)),lb(c.content,a.content));return c};var lb=function(c,d){if(d.querySelectorAll&&(d=b(d,"template"),0!==d.length)){c=b(c,"template");for(var e=0,f=c.length,g,h;e]/g;function mc(a){switch(a){case "&":return"&";case "<":return"<";case ">":return">";case '"':return""";case "\u00a0":return" "}}function nc(a){for(var b={},c=0;c";h=oc[n]?r:r+qc(h,m)+""+n+">";break a;case Node.TEXT_NODE:h=h.data;h=k&&pc[k.localName]?h:h.replace(lc,mc);break a;case Node.COMMENT_NODE:h="\x3c!--"+h.data+"--\x3e";break a;default:throw window.console.error(h),
+Error("not implemented");}}c+=h}return c};var E={},H=document.createTreeWalker(document,NodeFilter.SHOW_ALL,null,!1),I=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT,null,!1);function rc(a){var b=[];H.currentNode=a;for(a=H.firstChild();a;)b.push(a),a=H.nextSibling();return b}E.parentNode=function(a){H.currentNode=a;return H.parentNode()};E.firstChild=function(a){H.currentNode=a;return H.firstChild()};E.lastChild=function(a){H.currentNode=a;return H.lastChild()};E.previousSibling=function(a){H.currentNode=a;return H.previousSibling()};
+E.nextSibling=function(a){H.currentNode=a;return H.nextSibling()};E.childNodes=rc;E.parentElement=function(a){I.currentNode=a;return I.parentNode()};E.firstElementChild=function(a){I.currentNode=a;return I.firstChild()};E.lastElementChild=function(a){I.currentNode=a;return I.lastChild()};E.previousElementSibling=function(a){I.currentNode=a;return I.previousSibling()};E.nextElementSibling=function(a){I.currentNode=a;return I.nextSibling()};
+E.children=function(a){var b=[];I.currentNode=a;for(a=I.firstChild();a;)b.push(a),a=I.nextSibling();return b};E.innerHTML=function(a){return qc(a,function(a){return rc(a)})};E.textContent=function(a){switch(a.nodeType){case Node.ELEMENT_NODE:case Node.DOCUMENT_FRAGMENT_NODE:a=document.createTreeWalker(a,NodeFilter.SHOW_TEXT,null,!1);for(var b="",c;c=a.nextNode();)b+=c.nodeValue;return b;default:return a.nodeValue}};var J={},sc=B.I,tc=[Node.prototype,Element.prototype,HTMLElement.prototype];function K(a){var b;a:{for(b=0;bd.assignedNodes.length&&(d.da=!0)}d.da&&(d.da=!1,Nd(this,b))}a=this.m;b=[];for(d=0;db.indexOf(c))||b.push(c);for(a=0;a "+b}))}a=a.replace(og,function(a,b,c){return'[dir="'+c+'"] '+b+", "+b+'[dir="'+c+'"]'});return{value:a,Sa:b,stop:f}}function mg(a,b){a=a.split(pg);a[0]+=b;return a.join(pg)}
+function lg(a,b){var c=a.match(qg);return(c=c&&c[2].trim()||"")?c[0].match(rg)?a.replace(qg,function(a,c,f){return b+f}):c.split(rg)[0]===b?c:sg:a.replace(hg,b)}function tg(a){a.selector===ug&&(a.selector="html")}Tf.prototype.c=function(a){return a.match(kg)?this.b(a,vg):mg(a.trim(),vg)};aa.Object.defineProperties(Tf.prototype,{a:{configurable:!0,enumerable:!0,get:function(){return"style-scope"}}});
+var fg=/:(nth[-\w]+)\(([^)]+)\)/,vg=":not(.style-scope)",dg=",",ig=/(^|[\s>+~]+)((?:\[.+?\]|[^\s>+~=[])+)/g,rg=/[[.:#*]/,hg=":host",ug=":root",kg="::slotted",gg=new RegExp("^("+kg+")"),qg=/(:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,ng=/(?:::slotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/,og=/(.*):dir\((?:(ltr|rtl))\)/,bg=".",pg=":",Yf="class",sg="should_not_match",Vf=new Tf;function wg(a,b,c,d){this.K=a||null;this.b=b||null;this.sa=c||[];this.T=null;this.X=d||"";this.a=this.H=this.O=null}function xg(a){return a?a.__styleInfo:null}function yg(a,b){return a.__styleInfo=b}wg.prototype.c=function(){return this.K};wg.prototype._getStyleRules=wg.prototype.c;function zg(a){var b=this.matches||this.matchesSelector||this.mozMatchesSelector||this.msMatchesSelector||this.oMatchesSelector||this.webkitMatchesSelector;return b&&b.call(this,a)}var Ag=navigator.userAgent.match("Trident");function Bg(){}function Cg(a){var b={},c=[],d=0;Kf(a,function(a){Dg(a);a.index=d++;a=a.B.cssText;for(var c;c=Ef.exec(a);){var e=c[1];":"!==c[2]&&(b[e]=!0)}},function(a){c.push(a)});a.b=c;a=[];for(var e in b)a.push(e);return a}
+function Dg(a){if(!a.B){var b={},c={};Eg(a,c)&&(b.J=c,a.rules=null);b.cssText=a.parsedCssText.replace(Hf,"").replace(Cf,"");a.B=b}}function Eg(a,b){var c=a.B;if(c){if(c.J)return Object.assign(b,c.J),!0}else{c=a.parsedCssText;for(var d;a=Cf.exec(c);){d=(a[2]||a[3]).trim();if("inherit"!==d||"unset"!==d)b[a[1].trim()]=d;d=!0}return d}}
+function Fg(a,b,c){b&&(b=0<=b.indexOf(";")?Gg(a,b,c):Qf(b,function(b,e,f,g){if(!e)return b+g;(e=Fg(a,c[e],c))&&"initial"!==e?"apply-shim-inherit"===e&&(e="inherit"):e=Fg(a,c[f]||f,c)||f;return b+(e||"")+g}));return b&&b.trim()||""}
+function Gg(a,b,c){b=b.split(";");for(var d=0,e,f;d *"===f||"html"===f,h=0===f.indexOf(":host")&&!g;"shady"===c&&(g=f===e+" > *."+e||-1!==f.indexOf("html"),h=!g&&0===f.indexOf(e));"shadow"===c&&(g=":host > *"===f||"html"===f,h=h&&!g);if(g||h)c=e,h&&(b.G||(b.G=cg(Vf,b,Vf.b,a?bg+a:"",e)),c=b.G||e),d({Za:c,Wa:h,wb:g})}}
+function Jg(a,b){var c={},d={},e=b&&b.__cssBuild;Kf(b,function(b){Ig(a,b,e,function(e){zg.call(a.kb||a,e.Za)&&(e.Wa?Eg(b,c):Eg(b,d))})},null,!0);return{Ya:d,Va:c}}
+function Kg(a,b,c,d){var e=Sf(b),f=ag(e.is,e.X),g=new RegExp("(?:^|[^.#[:])"+(b.extends?"\\"+f.slice(0,-1)+"\\]":f)+"($|[.:[\\s>+~])");e=xg(b).K;var h=Lg(e,d);return Zf(b,e,function(b){var e="";b.B||Dg(b);b.B.cssText&&(e=Gg(a,b.B.cssText,c));b.cssText=e;if(!T&&!Mf(b)&&b.cssText){var k=e=b.cssText;null==b.za&&(b.za=Ff.test(e));if(b.za)if(null==b.ea){b.ea=[];for(var r in h)k=h[r],k=k(e),e!==k&&(e=k,b.ea.push(r))}else{for(r=0;r=m._useCount&&m.parentNode&&m.parentNode.removeChild(m));T?f.a?(f.a.textContent=e,d=f.a):e&&(d=Nf(e,h,a.shadowRoot,f.b)):d?d.parentNode||
+(Ag&&-1b&&-1==[34,35,60,62,63,96].indexOf(b)?a:encodeURIComponent(a)}function d(a){var b=a.charCodeAt(0);return 32b&&-1==[34,35,60,62,96].indexOf(b)?a:encodeURIComponent(a)}function e(a,e,g){function h(a){kb.push(a)}var k=e||"scheme start",v=0,p="",x=!1,U=!1,kb=[];a:for(;(void 0!=a[v-1]||0==v)&&!this.h;){var l=a[v];switch(k){case "scheme start":if(l&&r.test(l))p+=
+l.toLowerCase(),k="scheme";else if(e){h("Invalid scheme.");break a}else{p="";k="no scheme";continue}break;case "scheme":if(l&&G.test(l))p+=l.toLowerCase();else if(":"==l){this.g=p;p="";if(e)break a;void 0!==m[this.g]&&(this.D=!0);k="file"==this.g?"relative":this.D&&g&&g.g==this.g?"relative or authority":this.D?"authority first slash":"scheme data"}else if(e){void 0!=l&&h("Code point not allowed in scheme: "+l);break a}else{p="";v=0;k="no scheme";continue}break;case "scheme data":"?"==l?(this.u="?",
+k="query"):"#"==l?(this.C="#",k="fragment"):void 0!=l&&"\t"!=l&&"\n"!=l&&"\r"!=l&&(this.qa+=c(l));break;case "no scheme":if(g&&void 0!==m[g.g]){k="relative";continue}else h("Missing scheme."),f.call(this),this.h=!0;break;case "relative or authority":if("/"==l&&"/"==a[v+1])k="authority ignore slashes";else{h("Expected /, got: "+l);k="relative";continue}break;case "relative":this.D=!0;"file"!=this.g&&(this.g=g.g);if(void 0==l){this.i=g.i;this.s=g.s;this.j=g.j.slice();this.u=g.u;this.v=g.v;this.f=g.f;
+break a}else if("/"==l||"\\"==l)"\\"==l&&h("\\ is an invalid code point."),k="relative slash";else if("?"==l)this.i=g.i,this.s=g.s,this.j=g.j.slice(),this.u="?",this.v=g.v,this.f=g.f,k="query";else if("#"==l)this.i=g.i,this.s=g.s,this.j=g.j.slice(),this.u=g.u,this.C="#",this.v=g.v,this.f=g.f,k="fragment";else{k=a[v+1];var F=a[v+2];if("file"!=this.g||!r.test(l)||":"!=k&&"|"!=k||void 0!=F&&"/"!=F&&"\\"!=F&&"?"!=F&&"#"!=F)this.i=g.i,this.s=g.s,this.v=g.v,this.f=g.f,this.j=g.j.slice(),this.j.pop();k=
+"relative path";continue}break;case "relative slash":if("/"==l||"\\"==l)"\\"==l&&h("\\ is an invalid code point."),k="file"==this.g?"file host":"authority ignore slashes";else{"file"!=this.g&&(this.i=g.i,this.s=g.s,this.v=g.v,this.f=g.f);k="relative path";continue}break;case "authority first slash":if("/"==l)k="authority second slash";else{h("Expected '/', got: "+l);k="authority ignore slashes";continue}break;case "authority second slash":k="authority ignore slashes";if("/"!=l){h("Expected '/', got: "+
+l);continue}break;case "authority ignore slashes":if("/"!=l&&"\\"!=l){k="authority";continue}else h("Expected authority, got: "+l);break;case "authority":if("@"==l){x&&(h("@ already seen."),p+="%40");x=!0;for(l=0;l
-
+
@@ -69,13 +69,13 @@