/*
Turn any data into element
7141
function anyToElem(data, ind) {
  // const type = typeof data;
  return (<span
      key={ind}
      style={defaultItemStyle}
    >
      <Inspector
        theme={{
          ...chromeDark,
          BASE_BACKGROUND_COLOR: '#4e4e4e',
          OBJECT_VALUE_NUMBER_COLOR: '#8c85bd',
          OBJECT_VALUE_STRING_COLOR: '#c39480',
          OBJECT_VALUE_REGEXP_COLOR: '#c39480',
          OBJECT_VALUE_SYMBOL_COLOR: '#c39480',
        }}
        key={ind}
        data={data}
      />
    </span>);
}
854902
function serializeArray(element, options = { disabled: false, button: false }) {
  // Resolve all form elements from either forms or collections of form elements
  return (
    element
      .map((i, elem) => {
        const $elem = cheerio(elem);
        if (elem.name === 'form') {
          return $elem.find(submittableSelector).toArray();
        }
        return $elem.filter(submittableSelector).toArray();
      })
      // Verify elements have a name (`attr.name`)
      // and are not disabled (`:disabled`) if `options.disabled === false`
      // and cannot be clicked (`[type=submit]`) if `options.button === true`
      // are used in 'x-www-form-urlencoded' ('[type=file]')
      // and are either checked/don't have a checkable state
      // Convert each of the elements to its value(s)
      .filter(`[name!=""]${options.disabled ? '' : ':not(:disabled)'}:not(${
        options.button ? '' : ':submit, :button, '
      }:image, :reset, :file):matches([checked], :not(:checkbox, :radio))`)
      .map((i, elem) => {
        const $elem = cheerio(elem);
        const name = $elem.attr('name');
        let value = $elem.val();

        // If there is no value set (e.g. `undefined`, `null`), then default value to empty
        if (value == null) {
          value = $elem.attr('type') === 'checkbox' ? 'on' : '';
        }

        // If we have an array of values (e.g. `<select multiple>`),
        // return an array of key/value pairs
        if (Array.isArray(value)) {
          return value.map(val => ({ name, value: val.replace(rCRLF, '\r\n') })); //   These can occur inside of `<textarea>'s` // to guarantee consistency across platforms // We trim replace any line endings (e.g. `\r` or `\r\n` with `\r\n`)
          // Otherwise (e.g. `<input type="text">`, return only one key/value pair
        }
        return { name, value: value.replace(rCRLF, '\r\n') };

        // Convert our result to an array
      })
      .get()
  );
}
390174
function ( type, data ) {
            var el = this.element();
    
            if ( typeof type === 'string' ) {
                $B.event.trigger( el, type, data );
            }
        }
975214
protected function processGenerate($element, $data)
    {
        $this->prepareElementName($element);

        /** setRootName(null) support */
        if('' === (string) $element)
        {
            $element = array_keys($data)[0];

            return $this->processGenerate($element, $data[$element]);
        }

        /** @var \DOMElement $node */
        $node = $this->getDomDocument()->createElement($element);

        if(is_array($data))
        {
            $this->applyAttributes($data, $node);

            if(isset($data['@value']))
            {
                $this->applyValue($data, $node);

                return $node;
            }
            elseif(isset($data['@cdata']))
            {
                $this->applyCData($data, $node);

                return $node;
            }
            elseif(isset($data['@ns']))
            {
                $this->applyNamespace($data, $node);
            }
        }

        if(is_array($data))
        {
            foreach($data as $key => $value)
            {
                $this->prepareElementName($key);

                if('' === $key || false === $this->isValidElementName($key))
                {
                    continue;
                }

                if(is_array($value) && is_numeric(key($value)))
                {
                    foreach($value as $k => $v)
                    {
                        $node->appendChild($this->processGenerate($key, $v));
                    }
                }
                else
                {
                    $node->appendChild($this->processGenerate($key, $value));
                }

                unset($data[$key]);
            }
        }

        if(!is_array($data))
        {
            $data = $this->getBooleanAsString($data);

            $node->appendChild(
                $this->getDomDocument()->createTextNode($data)
            );
        }

        return $node;
    }
663437
function( data ){

            // interpred data as either dom node or event data
            var el = (data.nodeType && data) || (data.body && data.body.view)
                ,par = el && el.parentNode
                ;

            if ( el && par ){
                // remove view from dom
                par.removeChild( el );
            }

            return this;
        }
970684
function createTodoElement(item) {
        var template = $('#todo-item-template').html();
        var element = $(template);
        element.find(':checkbox')[0].checked = item.done;
        element.find('span').text(item.name);
        return element;
    }
10629
function(bindingString, data, children, callback, containerless) {
            container = document.createElement("div");
            if (!containerless) {
                container.setAttribute("data-bind", bindingString);
                container.innerHTML = children || "";
            }
            else {
                var opening = document.createComment("ko " + bindingString),
                   closing = document.createComment("/ko"),
                    dummy = document.createTextNode("   \n  ");

                container.appendChild(opening);
                container.appendChild(dummy);
                container.appendChild(closing);
            }

            sandbox.appendChild(container);

            ko.cleanNode(sandbox);

            ko.applyBindings(data, sandbox);

            setTimeout(callback, 50);
        }
326664
function fixdata(data) {
		var o = '',
			l = 0,
			w = 10240;
		for (; l < data.byteLength / w; ++l)
			o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w, l * w + w)));
		o += String.fromCharCode.apply(null, new Uint8Array(data.slice(l * w)));
		return o;
	}
699687
public function onGetData()
    {
        $iElementID = Input::get('element_id');
        $obElementItem = $this->makeItem($iElementID);

        return $obElementItem->toArray();
    }
846566
function createElement(nodeName) {
  var elem = document.createElement(nodeName);
  elem.className = [].join.call(arguments, ' ');
  return elem;
}
303225
function (data) {
            // already a xml
            if (data.documentElement) {
                return data;
            }
            var xml;
            try {
                // Standard
                if (win['DOMParser']) {
                    xml = new DOMParser().parseFromString(data, 'text/xml');
                } else { // IE
                    xml = new ActiveXObject('Microsoft.XMLDOM');
                    xml.async = false;
                    xml.loadXML(data);
                }
            } catch (e) {
                logger.error('parseXML error :');
                logger.error(e);
                xml = undefined;
            }
            if (!xml || !xml.documentElement || xml.getElementsByTagName('parsererror').length) {
                S.error('Invalid XML: ' + data);
            }
            return xml;
        }
146664
function convertDomToJyt(dom) {
    var i, elems, tempElem;

    // if just one element in the array, bump it up a level
    if (utils.isArray(dom) && dom.length === 1) {
        dom = dom[0];
    }
    // if multiple, then we create a sibling array of elems and return it
    else if (utils.isArray(dom)) {
        elems = [];
        for (i = 0; i < dom.length; i++) {
            tempElem = convertDomToJyt(dom[i]);
            if (tempElem !== null) {
                elems.push(tempElem);
            }
        }

        return runtime.naked(elems, null);
    }

    // if type is string, then just return it
    if (dom.type === 'text') {
        return dom.data;
    }
    // if no dom name, then just return empty string since it is likely a comment
    if (!dom.name) {
        return null;
    }

    // if we get here then we have just one element
    var elem = runtime.elem(dom.name);
    var childCount = dom.children && dom.children.length;

    // attributes should be the same
    elem.attributes = dom.attribs;

    // recursively add children
    if (dom.children && dom.children.length) {
        elem.children = [];
        for (i = 0; i < childCount; i++) {
            tempElem = convertDomToJyt(dom.children[i]);
            if (tempElem !== null) {
                elem.children.push(tempElem);
            }
        }

        // if one child that is a string, bring it up a level
        if (elem.children.length === 1 && utils.isString(elem.children[0])) {
            elem.text = elem.children[0];
            delete elem.children;
        }
        // if no children, remove it
        else if (elem.children.length === 0) {
            delete elem.children;
        }
    }

    return elem;
}
254135
function(data, options, add_to_container) {
		
		TL.Util.setData(this, data);
		
		// Merge Options
		TL.Util.mergeData(this.options, options);
		
		this._el.container = TL.Dom.create("div", "tl-text");
		this._el.container.id = this.data.unique_id;
		
		this._initLayout();
		
		if (add_to_container) {
			add_to_container.appendChild(this._el.container);
		};
		
	}
670767
function(type, data) {
		var test = 'HTML' + (type || '').replace(
			/^[a-z]/,
			function(m) {
				return m.toUpperCase();
			}

		) + 'Element';

		if (!data) {
			return false;
		}

		if (window[test]) {
			return data instanceof window[test];
		}
		else if (window.Element) {
			return data instanceof window.Element && (!type || (data.tagName && data.tagName.toLowerCase() === type));
		}
		else {
			return (!(data instanceof Object || data instanceof Array || data instanceof String || data instanceof Number) && data.tagName && data.tagName.toLowerCase() === type);
		}
	}
785949
function convertElement (el, self) {
  if (el instanceof Schema) {
    return el.toObject(self);
  }

  if (isObject(el)) {
    return convertObject(el, self);
  }

  if (Array.isArray(el)) {
    return el.map(function (item) {
      return convertElement(item, self);
    })
  }

  return el;
}
1022384
function makeElementFromObj(obj, addClass) {
  let tag = null;
  let cla = [];
  let element = null;

  if (typeof addClass !== "undefined") {
    cla = addClass;
  }

  if (obj.hasOwnProperty("tag")) {
    tag = obj.tag;
  } else {
    return null;
  }
  if (obj.hasOwnProperty("class")) {
    cla = cla.concat(obj.class);
  }
  element = createElementWithClass(tag, cla);
  if (obj.hasOwnProperty("id")) {
    element.id = obj.id;
  }
  if (obj.hasOwnProperty("textContent")) {
    element.textContent = obj.textContent;
  }
  if (obj.hasOwnProperty("innerHTML")) {
    element.innerHTML = obj.innerHTML;
  }
  if (obj.hasOwnProperty("tabIndex")) {
    element.tabIndex = obj.tabIndex;
  } else {
    element.tabIndex = -1;
  }
  if (obj.hasOwnProperty("children")) {
    for (let ele of obj.children) {
      element.appendChild(ele);
    }
  }
  return element;
}
62941
function parseObject(tag, attrs, content, indentStr, indentLevel) {
    if (TEXT in content) {
        let args = [tag, attrs, content[TEXT], indentStr, indentLevel];
        return getType(content[TEXT])==='array' ? parseArray.apply(this, args) : renderElement.apply(this, args);
    } else {
        content = isNested(content) ? content : '';
        return renderElement(tag, attrs, content, indentStr, indentLevel);
    }
}