UNPKG

cloudinary-video-player

Version:
771 lines (607 loc) 20.1 kB
import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers.js'; var window_1; var hasRequiredWindow; function requireWindow () { if (hasRequiredWindow) return window_1; hasRequiredWindow = 1; var win; if (typeof window !== "undefined") { win = window; } else if (typeof commonjsGlobal !== "undefined") { win = commonjsGlobal; } else if (typeof self !== "undefined"){ win = self; } else { win = {}; } window_1 = win; return window_1; } var windowExports = requireWindow(); var window$1 = /*@__PURE__*/getDefaultExportFromCjs(windowExports); var domWalk; var hasRequiredDomWalk; function requireDomWalk () { if (hasRequiredDomWalk) return domWalk; hasRequiredDomWalk = 1; var slice = Array.prototype.slice; domWalk = iterativelyWalk; function iterativelyWalk(nodes, cb) { if (!('length' in nodes)) { nodes = [nodes]; } nodes = slice.call(nodes); while(nodes.length) { var node = nodes.shift(), ret = cb(node); if (ret) { return ret } if (node.childNodes && node.childNodes.length) { nodes = slice.call(node.childNodes).concat(nodes); } } } return domWalk; } var domComment; var hasRequiredDomComment; function requireDomComment () { if (hasRequiredDomComment) return domComment; hasRequiredDomComment = 1; domComment = Comment; function Comment(data, owner) { if (!(this instanceof Comment)) { return new Comment(data, owner) } this.data = data; this.nodeValue = data; this.length = data.length; this.ownerDocument = owner || null; } Comment.prototype.nodeType = 8; Comment.prototype.nodeName = "#comment"; Comment.prototype.toString = function _Comment_toString() { return "[object Comment]" }; return domComment; } var domText; var hasRequiredDomText; function requireDomText () { if (hasRequiredDomText) return domText; hasRequiredDomText = 1; domText = DOMText; function DOMText(value, owner) { if (!(this instanceof DOMText)) { return new DOMText(value) } this.data = value || ""; this.length = this.data.length; this.ownerDocument = owner || null; } DOMText.prototype.type = "DOMTextNode"; DOMText.prototype.nodeType = 3; DOMText.prototype.nodeName = "#text"; DOMText.prototype.toString = function _Text_toString() { return this.data }; DOMText.prototype.replaceData = function replaceData(index, length, value) { var current = this.data; var left = current.substring(0, index); var right = current.substring(index + length, current.length); this.data = left + value + right; this.length = this.data.length; }; return domText; } var dispatchEvent_1; var hasRequiredDispatchEvent; function requireDispatchEvent () { if (hasRequiredDispatchEvent) return dispatchEvent_1; hasRequiredDispatchEvent = 1; dispatchEvent_1 = dispatchEvent; function dispatchEvent(ev) { var elem = this; var type = ev.type; if (!ev.target) { ev.target = elem; } if (!elem.listeners) { elem.listeners = {}; } var listeners = elem.listeners[type]; if (listeners) { return listeners.forEach(function (listener) { ev.currentTarget = elem; if (typeof listener === 'function') { listener(ev); } else { listener.handleEvent(ev); } }) } if (elem.parentNode) { elem.parentNode.dispatchEvent(ev); } } return dispatchEvent_1; } var addEventListener_1; var hasRequiredAddEventListener; function requireAddEventListener () { if (hasRequiredAddEventListener) return addEventListener_1; hasRequiredAddEventListener = 1; addEventListener_1 = addEventListener; function addEventListener(type, listener) { var elem = this; if (!elem.listeners) { elem.listeners = {}; } if (!elem.listeners[type]) { elem.listeners[type] = []; } if (elem.listeners[type].indexOf(listener) === -1) { elem.listeners[type].push(listener); } } return addEventListener_1; } var removeEventListener_1; var hasRequiredRemoveEventListener; function requireRemoveEventListener () { if (hasRequiredRemoveEventListener) return removeEventListener_1; hasRequiredRemoveEventListener = 1; removeEventListener_1 = removeEventListener; function removeEventListener(type, listener) { var elem = this; if (!elem.listeners) { return } if (!elem.listeners[type]) { return } var list = elem.listeners[type]; var index = list.indexOf(listener); if (index !== -1) { list.splice(index, 1); } } return removeEventListener_1; } var serialize; var hasRequiredSerialize; function requireSerialize () { if (hasRequiredSerialize) return serialize; hasRequiredSerialize = 1; serialize = serializeNode; var voidElements = ["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"]; function serializeNode(node) { switch (node.nodeType) { case 3: return escapeText(node.data) case 8: return "<!--" + node.data + "-->" default: return serializeElement(node) } } function serializeElement(elem) { var strings = []; var tagname = elem.tagName; if (elem.namespaceURI === "http://www.w3.org/1999/xhtml") { tagname = tagname.toLowerCase(); } strings.push("<" + tagname + properties(elem) + datasetify(elem)); if (voidElements.indexOf(tagname) > -1) { strings.push(" />"); } else { strings.push(">"); if (elem.childNodes.length) { strings.push.apply(strings, elem.childNodes.map(serializeNode)); } else if (elem.textContent || elem.innerText) { strings.push(escapeText(elem.textContent || elem.innerText)); } else if (elem.innerHTML) { strings.push(elem.innerHTML); } strings.push("</" + tagname + ">"); } return strings.join("") } function isProperty(elem, key) { var type = typeof elem[key]; if (key === "style" && Object.keys(elem.style).length > 0) { return true } return elem.hasOwnProperty(key) && (type === "string" || type === "boolean" || type === "number") && key !== "nodeName" && key !== "className" && key !== "tagName" && key !== "textContent" && key !== "innerText" && key !== "namespaceURI" && key !== "innerHTML" } function stylify(styles) { if (typeof styles === 'string') return styles var attr = ""; Object.keys(styles).forEach(function (key) { var value = styles[key]; key = key.replace(/[A-Z]/g, function(c) { return "-" + c.toLowerCase(); }); attr += key + ":" + value + ";"; }); return attr } function datasetify(elem) { var ds = elem.dataset; var props = []; for (var key in ds) { props.push({ name: "data-" + key, value: ds[key] }); } return props.length ? stringify(props) : "" } function stringify(list) { var attributes = []; list.forEach(function (tuple) { var name = tuple.name; var value = tuple.value; if (name === "style") { value = stylify(value); } attributes.push(name + "=" + "\"" + escapeAttributeValue(value) + "\""); }); return attributes.length ? " " + attributes.join(" ") : "" } function properties(elem) { var props = []; for (var key in elem) { if (isProperty(elem, key)) { props.push({ name: key, value: elem[key] }); } } for (var ns in elem._attributes) { for (var attribute in elem._attributes[ns]) { var prop = elem._attributes[ns][attribute]; var name = (prop.prefix ? prop.prefix + ":" : "") + attribute; props.push({ name: name, value: prop.value }); } } if (elem.className) { props.push({ name: "class", value: elem.className }); } return props.length ? stringify(props) : "" } function escapeText(s) { var str = ''; if (typeof(s) === 'string') { str = s; } else if (s) { str = s.toString(); } return str .replace(/&/g, "&amp;") .replace(/</g, "&lt;") .replace(/>/g, "&gt;") } function escapeAttributeValue(str) { return escapeText(str).replace(/"/g, "&quot;") } return serialize; } var domElement; var hasRequiredDomElement; function requireDomElement () { if (hasRequiredDomElement) return domElement; hasRequiredDomElement = 1; var domWalk = requireDomWalk(); var dispatchEvent = requireDispatchEvent(); var addEventListener = requireAddEventListener(); var removeEventListener = requireRemoveEventListener(); var serializeNode = requireSerialize(); var htmlns = "http://www.w3.org/1999/xhtml"; domElement = DOMElement; function DOMElement(tagName, owner, namespace) { if (!(this instanceof DOMElement)) { return new DOMElement(tagName) } var ns = namespace === undefined ? htmlns : (namespace || null); this.tagName = ns === htmlns ? String(tagName).toUpperCase() : tagName; this.nodeName = this.tagName; this.className = ""; this.dataset = {}; this.childNodes = []; this.parentNode = null; this.style = {}; this.ownerDocument = owner || null; this.namespaceURI = ns; this._attributes = {}; if (this.tagName === 'INPUT') { this.type = 'text'; } } DOMElement.prototype.type = "DOMElement"; DOMElement.prototype.nodeType = 1; DOMElement.prototype.appendChild = function _Element_appendChild(child) { if (child.parentNode) { child.parentNode.removeChild(child); } this.childNodes.push(child); child.parentNode = this; return child }; DOMElement.prototype.replaceChild = function _Element_replaceChild(elem, needle) { // TODO: Throw NotFoundError if needle.parentNode !== this if (elem.parentNode) { elem.parentNode.removeChild(elem); } var index = this.childNodes.indexOf(needle); needle.parentNode = null; this.childNodes[index] = elem; elem.parentNode = this; return needle }; DOMElement.prototype.removeChild = function _Element_removeChild(elem) { // TODO: Throw NotFoundError if elem.parentNode !== this var index = this.childNodes.indexOf(elem); this.childNodes.splice(index, 1); elem.parentNode = null; return elem }; DOMElement.prototype.insertBefore = function _Element_insertBefore(elem, needle) { // TODO: Throw NotFoundError if referenceElement is a dom node // and parentNode !== this if (elem.parentNode) { elem.parentNode.removeChild(elem); } var index = needle === null || needle === undefined ? -1 : this.childNodes.indexOf(needle); if (index > -1) { this.childNodes.splice(index, 0, elem); } else { this.childNodes.push(elem); } elem.parentNode = this; return elem }; DOMElement.prototype.setAttributeNS = function _Element_setAttributeNS(namespace, name, value) { var prefix = null; var localName = name; var colonPosition = name.indexOf(":"); if (colonPosition > -1) { prefix = name.substr(0, colonPosition); localName = name.substr(colonPosition + 1); } if (this.tagName === 'INPUT' && name === 'type') { this.type = value; } else { var attributes = this._attributes[namespace] || (this._attributes[namespace] = {}); attributes[localName] = {value: value, prefix: prefix}; } }; DOMElement.prototype.getAttributeNS = function _Element_getAttributeNS(namespace, name) { var attributes = this._attributes[namespace]; var value = attributes && attributes[name] && attributes[name].value; if (this.tagName === 'INPUT' && name === 'type') { return this.type; } if (typeof value !== "string") { return null } return value }; DOMElement.prototype.removeAttributeNS = function _Element_removeAttributeNS(namespace, name) { // Prevent prototype pollution by checking if namespace is a direct property if (!Object.prototype.hasOwnProperty.call(this._attributes, namespace)) { return; } var attributes = this._attributes[namespace]; if (attributes && Object.prototype.hasOwnProperty.call(attributes, name)) { delete attributes[name]; } }; DOMElement.prototype.hasAttributeNS = function _Element_hasAttributeNS(namespace, name) { var attributes = this._attributes[namespace]; return !!attributes && name in attributes; }; DOMElement.prototype.setAttribute = function _Element_setAttribute(name, value) { return this.setAttributeNS(null, name, value) }; DOMElement.prototype.getAttribute = function _Element_getAttribute(name) { return this.getAttributeNS(null, name) }; DOMElement.prototype.removeAttribute = function _Element_removeAttribute(name) { return this.removeAttributeNS(null, name) }; DOMElement.prototype.hasAttribute = function _Element_hasAttribute(name) { return this.hasAttributeNS(null, name) }; DOMElement.prototype.removeEventListener = removeEventListener; DOMElement.prototype.addEventListener = addEventListener; DOMElement.prototype.dispatchEvent = dispatchEvent; // Un-implemented DOMElement.prototype.focus = function _Element_focus() { return void 0 }; DOMElement.prototype.toString = function _Element_toString() { return serializeNode(this) }; DOMElement.prototype.getElementsByClassName = function _Element_getElementsByClassName(classNames) { var classes = classNames.split(" "); var elems = []; domWalk(this, function (node) { if (node.nodeType === 1) { var nodeClassName = node.className || ""; var nodeClasses = nodeClassName.split(" "); if (classes.every(function (item) { return nodeClasses.indexOf(item) !== -1 })) { elems.push(node); } } }); return elems }; DOMElement.prototype.getElementsByTagName = function _Element_getElementsByTagName(tagName) { tagName = tagName.toLowerCase(); var elems = []; domWalk(this.childNodes, function (node) { if (node.nodeType === 1 && (tagName === '*' || node.tagName.toLowerCase() === tagName)) { elems.push(node); } }); return elems }; DOMElement.prototype.contains = function _Element_contains(element) { return domWalk(this, function (node) { return element === node }) || false }; return domElement; } var domFragment; var hasRequiredDomFragment; function requireDomFragment () { if (hasRequiredDomFragment) return domFragment; hasRequiredDomFragment = 1; var DOMElement = requireDomElement(); domFragment = DocumentFragment; function DocumentFragment(owner) { if (!(this instanceof DocumentFragment)) { return new DocumentFragment() } this.childNodes = []; this.parentNode = null; this.ownerDocument = owner || null; } DocumentFragment.prototype.type = "DocumentFragment"; DocumentFragment.prototype.nodeType = 11; DocumentFragment.prototype.nodeName = "#document-fragment"; DocumentFragment.prototype.appendChild = DOMElement.prototype.appendChild; DocumentFragment.prototype.replaceChild = DOMElement.prototype.replaceChild; DocumentFragment.prototype.removeChild = DOMElement.prototype.removeChild; DocumentFragment.prototype.toString = function _DocumentFragment_toString() { return this.childNodes.map(function (node) { return String(node) }).join("") }; return domFragment; } var event; var hasRequiredEvent; function requireEvent () { if (hasRequiredEvent) return event; hasRequiredEvent = 1; event = Event; function Event(family) {} Event.prototype.initEvent = function _Event_initEvent(type, bubbles, cancelable) { this.type = type; this.bubbles = bubbles; this.cancelable = cancelable; }; Event.prototype.preventDefault = function _Event_preventDefault() { }; return event; } var document$2; var hasRequiredDocument$1; function requireDocument$1 () { if (hasRequiredDocument$1) return document$2; hasRequiredDocument$1 = 1; var domWalk = requireDomWalk(); var Comment = requireDomComment(); var DOMText = requireDomText(); var DOMElement = requireDomElement(); var DocumentFragment = requireDomFragment(); var Event = requireEvent(); var dispatchEvent = requireDispatchEvent(); var addEventListener = requireAddEventListener(); var removeEventListener = requireRemoveEventListener(); document$2 = Document; function Document() { if (!(this instanceof Document)) { return new Document(); } this.head = this.createElement("head"); this.body = this.createElement("body"); this.documentElement = this.createElement("html"); this.documentElement.appendChild(this.head); this.documentElement.appendChild(this.body); this.childNodes = [this.documentElement]; this.nodeType = 9; } var proto = Document.prototype; proto.createTextNode = function createTextNode(value) { return new DOMText(value, this) }; proto.createElementNS = function createElementNS(namespace, tagName) { var ns = namespace === null ? null : String(namespace); return new DOMElement(tagName, this, ns) }; proto.createElement = function createElement(tagName) { return new DOMElement(tagName, this) }; proto.createDocumentFragment = function createDocumentFragment() { return new DocumentFragment(this) }; proto.createEvent = function createEvent(family) { return new Event(family) }; proto.createComment = function createComment(data) { return new Comment(data, this) }; proto.getElementById = function getElementById(id) { id = String(id); var result = domWalk(this.childNodes, function (node) { if (String(node.id) === id) { return node } }); return result || null }; proto.getElementsByClassName = DOMElement.prototype.getElementsByClassName; proto.getElementsByTagName = DOMElement.prototype.getElementsByTagName; proto.contains = DOMElement.prototype.contains; proto.removeEventListener = removeEventListener; proto.addEventListener = addEventListener; proto.dispatchEvent = dispatchEvent; return document$2; } var minDocument; var hasRequiredMinDocument; function requireMinDocument () { if (hasRequiredMinDocument) return minDocument; hasRequiredMinDocument = 1; var Document = requireDocument$1(); minDocument = new Document(); return minDocument; } var document_1; var hasRequiredDocument; function requireDocument () { if (hasRequiredDocument) return document_1; hasRequiredDocument = 1; var topLevel = typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : typeof window !== 'undefined' ? window : {}; var minDoc = requireMinDocument(); var doccy; if (typeof document !== 'undefined') { doccy = document; } else { doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4']; if (!doccy) { doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc; } } document_1 = doccy; return document_1; } var documentExports = requireDocument(); var document$1 = /*@__PURE__*/getDefaultExportFromCjs(documentExports); export { document$1 as d, window$1 as w };