"use strict";

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

(function (f) {
  if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === "object" && typeof module !== "undefined") {
    module.exports = f();
  } else if (typeof define === "function" && define.amd) {
    define([], f);
  } else {
    var g;if (typeof window !== "undefined") {
      g = window;
    } else if (typeof global !== "undefined") {
      g = global;
    } else if (typeof self !== "undefined") {
      g = self;
    } else {
      g = this;
    }g.h = f();
  }
})(function () {
  var define, module, exports;return function e(t, n, r) {
    function s(o, u) {
      if (!n[o]) {
        if (!t[o]) {
          var a = typeof require == "function" && require;if (!u && a) return a(o, !0);if (i) return i(o, !0);var f = new Error("Cannot find module '" + o + "'");throw f.code = "MODULE_NOT_FOUND", f;
        }var l = n[o] = { exports: {} };t[o][0].call(l.exports, function (e) {
          var n = t[o][1][e];return s(n ? n : e);
        }, l, l.exports, e, t, n, r);
      }return n[o].exports;
    }var i = typeof require == "function" && require;for (var o = 0; o < r.length; o++) {
      s(r[o]);
    }return s;
  }({ 1: [function (require, module, exports) {
      var VNode = require('./vnode');
      var is = require('./is');

      function addNS(data, children) {
        data.ns = 'http://www.w3.org/2000/svg';
        if (children !== undefined) {
          for (var i = 0; i < children.length; ++i) {
            addNS(children[i].data, children[i].children);
          }
        }
      }

      module.exports = function h(sel, b, c) {
        var data = {},
            children,
            text,
            i;
        if (c !== undefined) {
          data = b;
          if (is.array(c)) {
            children = c;
          } else if (is.primitive(c)) {
            text = c;
          }
        } else if (b !== undefined) {
          if (is.array(b)) {
            children = b;
          } else if (is.primitive(b)) {
            text = b;
          } else {
            data = b;
          }
        }
        if (is.array(children)) {
          for (i = 0; i < children.length; ++i) {
            if (is.primitive(children[i])) children[i] = VNode(undefined, undefined, undefined, children[i]);
          }
        }
        if (sel[0] === 's' && sel[1] === 'v' && sel[2] === 'g') {
          addNS(data, children);
        }
        return VNode(sel, data, children, text, undefined);
      };
    }, { "./is": 2, "./vnode": 3 }], 2: [function (require, module, exports) {
      module.exports = {
        array: Array.isArray,
        primitive: function primitive(s) {
          return typeof s === 'string' || typeof s === 'number';
        }
      };
    }, {}], 3: [function (require, module, exports) {
      module.exports = function (sel, data, children, text, elm) {
        var key = data === undefined ? undefined : data.key;
        return { sel: sel, data: data, children: children,
          text: text, elm: elm, key: key };
      };
    }, {}] }, {}, [1])(1);
});