diff options
Diffstat (limited to 'srcs/wordpress/wp-includes/js/tinymce/plugins/paste')
| -rw-r--r-- | srcs/wordpress/wp-includes/js/tinymce/plugins/paste/plugin.js | 2379 | ||||
| -rw-r--r-- | srcs/wordpress/wp-includes/js/tinymce/plugins/paste/plugin.min.js | 1 |
2 files changed, 0 insertions, 2380 deletions
diff --git a/srcs/wordpress/wp-includes/js/tinymce/plugins/paste/plugin.js b/srcs/wordpress/wp-includes/js/tinymce/plugins/paste/plugin.js deleted file mode 100644 index 2bf48f7..0000000 --- a/srcs/wordpress/wp-includes/js/tinymce/plugins/paste/plugin.js +++ /dev/null @@ -1,2379 +0,0 @@ -(function () { -var paste = (function (domGlobals) { - 'use strict'; - - var Cell = function (initial) { - var value = initial; - var get = function () { - return value; - }; - var set = function (v) { - value = v; - }; - var clone = function () { - return Cell(get()); - }; - return { - get: get, - set: set, - clone: clone - }; - }; - - var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager'); - - var hasProPlugin = function (editor) { - if (/(^|[ ,])powerpaste([, ]|$)/.test(editor.settings.plugins) && global$1.get('powerpaste')) { - if (typeof domGlobals.window.console !== 'undefined' && domGlobals.window.console.log) { - domGlobals.window.console.log('PowerPaste is incompatible with Paste plugin! Remove \'paste\' from the \'plugins\' option.'); - } - return true; - } else { - return false; - } - }; - var DetectProPlugin = { hasProPlugin: hasProPlugin }; - - var get = function (clipboard, quirks) { - return { - clipboard: clipboard, - quirks: quirks - }; - }; - var Api = { get: get }; - - var firePastePreProcess = function (editor, html, internal, isWordHtml) { - return editor.fire('PastePreProcess', { - content: html, - internal: internal, - wordContent: isWordHtml - }); - }; - var firePastePostProcess = function (editor, node, internal, isWordHtml) { - return editor.fire('PastePostProcess', { - node: node, - internal: internal, - wordContent: isWordHtml - }); - }; - var firePastePlainTextToggle = function (editor, state) { - return editor.fire('PastePlainTextToggle', { state: state }); - }; - var firePaste = function (editor, ieFake) { - return editor.fire('paste', { ieFake: ieFake }); - }; - var Events = { - firePastePreProcess: firePastePreProcess, - firePastePostProcess: firePastePostProcess, - firePastePlainTextToggle: firePastePlainTextToggle, - firePaste: firePaste - }; - - var shouldPlainTextInform = function (editor) { - return editor.getParam('paste_plaintext_inform', true); - }; - var shouldBlockDrop = function (editor) { - return editor.getParam('paste_block_drop', false); - }; - var shouldPasteDataImages = function (editor) { - return editor.getParam('paste_data_images', false); - }; - var shouldFilterDrop = function (editor) { - return editor.getParam('paste_filter_drop', true); - }; - var getPreProcess = function (editor) { - return editor.getParam('paste_preprocess'); - }; - var getPostProcess = function (editor) { - return editor.getParam('paste_postprocess'); - }; - var getWebkitStyles = function (editor) { - return editor.getParam('paste_webkit_styles'); - }; - var shouldRemoveWebKitStyles = function (editor) { - return editor.getParam('paste_remove_styles_if_webkit', true); - }; - var shouldMergeFormats = function (editor) { - return editor.getParam('paste_merge_formats', true); - }; - var isSmartPasteEnabled = function (editor) { - return editor.getParam('smart_paste', true); - }; - var isPasteAsTextEnabled = function (editor) { - return editor.getParam('paste_as_text', false); - }; - var getRetainStyleProps = function (editor) { - return editor.getParam('paste_retain_style_properties'); - }; - var getWordValidElements = function (editor) { - var defaultValidElements = '-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,' + '-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,' + 'td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody'; - return editor.getParam('paste_word_valid_elements', defaultValidElements); - }; - var shouldConvertWordFakeLists = function (editor) { - return editor.getParam('paste_convert_word_fake_lists', true); - }; - var shouldUseDefaultFilters = function (editor) { - return editor.getParam('paste_enable_default_filters', true); - }; - var Settings = { - shouldPlainTextInform: shouldPlainTextInform, - shouldBlockDrop: shouldBlockDrop, - shouldPasteDataImages: shouldPasteDataImages, - shouldFilterDrop: shouldFilterDrop, - getPreProcess: getPreProcess, - getPostProcess: getPostProcess, - getWebkitStyles: getWebkitStyles, - shouldRemoveWebKitStyles: shouldRemoveWebKitStyles, - shouldMergeFormats: shouldMergeFormats, - isSmartPasteEnabled: isSmartPasteEnabled, - isPasteAsTextEnabled: isPasteAsTextEnabled, - getRetainStyleProps: getRetainStyleProps, - getWordValidElements: getWordValidElements, - shouldConvertWordFakeLists: shouldConvertWordFakeLists, - shouldUseDefaultFilters: shouldUseDefaultFilters - }; - - var shouldInformUserAboutPlainText = function (editor, userIsInformedState) { - return userIsInformedState.get() === false && Settings.shouldPlainTextInform(editor); - }; - var displayNotification = function (editor, message) { - editor.notificationManager.open({ - text: editor.translate(message), - type: 'info' - }); - }; - var togglePlainTextPaste = function (editor, clipboard, userIsInformedState) { - if (clipboard.pasteFormat.get() === 'text') { - clipboard.pasteFormat.set('html'); - Events.firePastePlainTextToggle(editor, false); - } else { - clipboard.pasteFormat.set('text'); - Events.firePastePlainTextToggle(editor, true); - if (shouldInformUserAboutPlainText(editor, userIsInformedState)) { - displayNotification(editor, 'Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.'); - userIsInformedState.set(true); - } - } - editor.focus(); - }; - var Actions = { togglePlainTextPaste: togglePlainTextPaste }; - - var register = function (editor, clipboard, userIsInformedState) { - editor.addCommand('mceTogglePlainTextPaste', function () { - Actions.togglePlainTextPaste(editor, clipboard, userIsInformedState); - }); - editor.addCommand('mceInsertClipboardContent', function (ui, value) { - if (value.content) { - clipboard.pasteHtml(value.content, value.internal); - } - if (value.text) { - clipboard.pasteText(value.text); - } - }); - }; - var Commands = { register: register }; - - var global$2 = tinymce.util.Tools.resolve('tinymce.Env'); - - var global$3 = tinymce.util.Tools.resolve('tinymce.util.Delay'); - - var global$4 = tinymce.util.Tools.resolve('tinymce.util.Tools'); - - var global$5 = tinymce.util.Tools.resolve('tinymce.util.VK'); - - var internalMimeType = 'x-tinymce/html'; - var internalMark = '<!-- ' + internalMimeType + ' -->'; - var mark = function (html) { - return internalMark + html; - }; - var unmark = function (html) { - return html.replace(internalMark, ''); - }; - var isMarked = function (html) { - return html.indexOf(internalMark) !== -1; - }; - var InternalHtml = { - mark: mark, - unmark: unmark, - isMarked: isMarked, - internalHtmlMime: function () { - return internalMimeType; - } - }; - - var global$6 = tinymce.util.Tools.resolve('tinymce.html.Entities'); - - var isPlainText = function (text) { - return !/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(text); - }; - var toBRs = function (text) { - return text.replace(/\r?\n/g, '<br>'); - }; - var openContainer = function (rootTag, rootAttrs) { - var key; - var attrs = []; - var tag = '<' + rootTag; - if (typeof rootAttrs === 'object') { - for (key in rootAttrs) { - if (rootAttrs.hasOwnProperty(key)) { - attrs.push(key + '="' + global$6.encodeAllRaw(rootAttrs[key]) + '"'); - } - } - if (attrs.length) { - tag += ' ' + attrs.join(' '); - } - } - return tag + '>'; - }; - var toBlockElements = function (text, rootTag, rootAttrs) { - var blocks = text.split(/\n\n/); - var tagOpen = openContainer(rootTag, rootAttrs); - var tagClose = '</' + rootTag + '>'; - var paragraphs = global$4.map(blocks, function (p) { - return p.split(/\n/).join('<br />'); - }); - var stitch = function (p) { - return tagOpen + p + tagClose; - }; - return paragraphs.length === 1 ? paragraphs[0] : global$4.map(paragraphs, stitch).join(''); - }; - var convert = function (text, rootTag, rootAttrs) { - return rootTag ? toBlockElements(text, rootTag, rootAttrs) : toBRs(text); - }; - var Newlines = { - isPlainText: isPlainText, - convert: convert, - toBRs: toBRs, - toBlockElements: toBlockElements - }; - - var global$7 = tinymce.util.Tools.resolve('tinymce.html.DomParser'); - - var global$8 = tinymce.util.Tools.resolve('tinymce.html.Node'); - - var global$9 = tinymce.util.Tools.resolve('tinymce.html.Schema'); - - var global$a = tinymce.util.Tools.resolve('tinymce.html.Serializer'); - - function filter(content, items) { - global$4.each(items, function (v) { - if (v.constructor === RegExp) { - content = content.replace(v, ''); - } else { - content = content.replace(v[0], v[1]); - } - }); - return content; - } - function innerText(html) { - var schema = global$9(); - var domParser = global$7({}, schema); - var text = ''; - var shortEndedElements = schema.getShortEndedElements(); - var ignoreElements = global$4.makeMap('script noscript style textarea video audio iframe object', ' '); - var blockElements = schema.getBlockElements(); - function walk(node) { - var name = node.name, currentNode = node; - if (name === 'br') { - text += '\n'; - return; - } - if (name === 'wbr') { - return; - } - if (shortEndedElements[name]) { - text += ' '; - } - if (ignoreElements[name]) { - text += ' '; - return; - } - if (node.type === 3) { - text += node.value; - } - if (!node.shortEnded) { - if (node = node.firstChild) { - do { - walk(node); - } while (node = node.next); - } - } - if (blockElements[name] && currentNode.next) { - text += '\n'; - if (name === 'p') { - text += '\n'; - } - } - } - html = filter(html, [/<!\[[^\]]+\]>/g]); - walk(domParser.parse(html)); - return text; - } - function trimHtml(html) { - function trimSpaces(all, s1, s2) { - if (!s1 && !s2) { - return ' '; - } - return '\xA0'; - } - html = filter(html, [ - /^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/ig, - /<!--StartFragment-->|<!--EndFragment-->/g, - [ - /( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g, - trimSpaces - ], - /<br class="Apple-interchange-newline">/g, - /<br>$/i - ]); - return html; - } - function createIdGenerator(prefix) { - var count = 0; - return function () { - return prefix + count++; - }; - } - var isMsEdge = function () { - return domGlobals.navigator.userAgent.indexOf(' Edge/') !== -1; - }; - var Utils = { - filter: filter, - innerText: innerText, - trimHtml: trimHtml, - createIdGenerator: createIdGenerator, - isMsEdge: isMsEdge - }; - - function isWordContent(content) { - return /<font face="Times New Roman"|class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i.test(content) || /class="OutlineElement/.test(content) || /id="?docs\-internal\-guid\-/.test(content); - } - function isNumericList(text) { - var found, patterns; - patterns = [ - /^[IVXLMCD]{1,2}\.[ \u00a0]/, - /^[ivxlmcd]{1,2}\.[ \u00a0]/, - /^[a-z]{1,2}[\.\)][ \u00a0]/, - /^[A-Z]{1,2}[\.\)][ \u00a0]/, - /^[0-9]+\.[ \u00a0]/, - /^[\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]+\.[ \u00a0]/, - /^[\u58f1\u5f10\u53c2\u56db\u4f0d\u516d\u4e03\u516b\u4e5d\u62fe]+\.[ \u00a0]/ - ]; - text = text.replace(/^[\u00a0 ]+/, ''); - global$4.each(patterns, function (pattern) { - if (pattern.test(text)) { - found = true; - return false; - } - }); - return found; - } - function isBulletList(text) { - return /^[\s\u00a0]*[\u2022\u00b7\u00a7\u25CF]\s*/.test(text); - } - function convertFakeListsToProperLists(node) { - var currentListNode, prevListNode, lastLevel = 1; - function getText(node) { - var txt = ''; - if (node.type === 3) { - return node.value; - } - if (node = node.firstChild) { - do { - txt += getText(node); - } while (node = node.next); - } - return txt; - } - function trimListStart(node, regExp) { - if (node.type === 3) { - if (regExp.test(node.value)) { - node.value = node.value.replace(regExp, ''); - return false; - } - } - if (node = node.firstChild) { - do { - if (!trimListStart(node, regExp)) { - return false; - } - } while (node = node.next); - } - return true; - } - function removeIgnoredNodes(node) { - if (node._listIgnore) { - node.remove(); - return; - } - if (node = node.firstChild) { - do { - removeIgnoredNodes(node); - } while (node = node.next); - } - } - function convertParagraphToLi(paragraphNode, listName, start) { - var level = paragraphNode._listLevel || lastLevel; - if (level !== lastLevel) { - if (level < lastLevel) { - if (currentListNode) { - currentListNode = currentListNode.parent.parent; - } - } else { - prevListNode = currentListNode; - currentListNode = null; - } - } - if (!currentListNode || currentListNode.name !== listName) { - prevListNode = prevListNode || currentListNode; - currentListNode = new global$8(listName, 1); - if (start > 1) { - currentListNode.attr('start', '' + start); - } - paragraphNode.wrap(currentListNode); - } else { - currentListNode.append(paragraphNode); - } - paragraphNode.name = 'li'; - if (level > lastLevel && prevListNode) { - prevListNode.lastChild.append(currentListNode); - } - lastLevel = level; - removeIgnoredNodes(paragraphNode); - trimListStart(paragraphNode, /^\u00a0+/); - trimListStart(paragraphNode, /^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/); - trimListStart(paragraphNode, /^\u00a0+/); - } - var elements = []; - var child = node.firstChild; - while (typeof child !== 'undefined' && child !== null) { - elements.push(child); - child = child.walk(); - if (child !== null) { - while (typeof child !== 'undefined' && child.parent !== node) { - child = child.walk(); - } - } - } - for (var i = 0; i < elements.length; i++) { - node = elements[i]; - if (node.name === 'p' && node.firstChild) { - var nodeText = getText(node); - if (isBulletList(nodeText)) { - convertParagraphToLi(node, 'ul'); - continue; - } - if (isNumericList(nodeText)) { - var matches = /([0-9]+)\./.exec(nodeText); - var start = 1; - if (matches) { - start = parseInt(matches[1], 10); - } - convertParagraphToLi(node, 'ol', start); - continue; - } - if (node._listLevel) { - convertParagraphToLi(node, 'ul', 1); - continue; - } - currentListNode = null; - } else { - prevListNode = currentListNode; - currentListNode = null; - } - } - } - function filterStyles(editor, validStyles, node, styleValue) { - var outputStyles = {}, matches; - var styles = editor.dom.parseStyle(styleValue); - global$4.each(styles, function (value, name) { - switch (name) { - case 'mso-list': - matches = /\w+ \w+([0-9]+)/i.exec(styleValue); - if (matches) { - node._listLevel = parseInt(matches[1], 10); - } - if (/Ignore/i.test(value) && node.firstChild) { - node._listIgnore = true; - node.firstChild._listIgnore = true; - } - break; - case 'horiz-align': - name = 'text-align'; - break; - case 'vert-align': - name = 'vertical-align'; - break; - case 'font-color': - case 'mso-foreground': - name = 'color'; - break; - case 'mso-background': - case 'mso-highlight': - name = 'background'; - break; - case 'font-weight': - case 'font-style': - if (value !== 'normal') { - outputStyles[name] = value; - } - return; - case 'mso-element': - if (/^(comment|comment-list)$/i.test(value)) { - node.remove(); - return; - } - break; - } - if (name.indexOf('mso-comment') === 0) { - node.remove(); - return; - } - if (name.indexOf('mso-') === 0) { - return; - } - if (Settings.getRetainStyleProps(editor) === 'all' || validStyles && validStyles[name]) { - outputStyles[name] = value; - } - }); - if (/(bold)/i.test(outputStyles['font-weight'])) { - delete outputStyles['font-weight']; - node.wrap(new global$8('b', 1)); - } - if (/(italic)/i.test(outputStyles['font-style'])) { - delete outputStyles['font-style']; - node.wrap(new global$8('i', 1)); - } - outputStyles = editor.dom.serializeStyle(outputStyles, node.name); - if (outputStyles) { - return outputStyles; - } - return null; - } - var filterWordContent = function (editor, content) { - var retainStyleProperties, validStyles; - retainStyleProperties = Settings.getRetainStyleProps(editor); - if (retainStyleProperties) { - validStyles = global$4.makeMap(retainStyleProperties.split(/[, ]/)); - } - content = Utils.filter(content, [ - /<br class="?Apple-interchange-newline"?>/gi, - /<b[^>]+id="?docs-internal-[^>]*>/gi, - /<!--[\s\S]+?-->/gi, - /<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi, - [ - /<(\/?)s>/gi, - '<$1strike>' - ], - [ - / /gi, - '\xA0' - ], - [ - /<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi, - function (str, spaces) { - return spaces.length > 0 ? spaces.replace(/./, ' ').slice(Math.floor(spaces.length / 2)).split('').join('\xA0') : ''; - } - ] - ]); - var validElements = Settings.getWordValidElements(editor); - var schema = global$9({ - valid_elements: validElements, - valid_children: '-li[p]' - }); - global$4.each(schema.elements, function (rule) { - if (!rule.attributes.class) { - rule.attributes.class = {}; - rule.attributesOrder.push('class'); - } - if (!rule.attributes.style) { - rule.attributes.style = {}; - rule.attributesOrder.push('style'); - } - }); - var domParser = global$7({}, schema); - domParser.addAttributeFilter('style', function (nodes) { - var i = nodes.length, node; - while (i--) { - node = nodes[i]; - node.attr('style', filterStyles(editor, validStyles, node, node.attr('style'))); - if (node.name === 'span' && node.parent && !node.attributes.length) { - node.unwrap(); - } - } - }); - domParser.addAttributeFilter('class', function (nodes) { - var i = nodes.length, node, className; - while (i--) { - node = nodes[i]; - className = node.attr('class'); - if (/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(className)) { - node.remove(); - } - node.attr('class', null); - } - }); - domParser.addNodeFilter('del', function (nodes) { - var i = nodes.length; - while (i--) { - nodes[i].remove(); - } - }); - domParser.addNodeFilter('a', function (nodes) { - var i = nodes.length, node, href, name; - while (i--) { - node = nodes[i]; - href = node.attr('href'); - name = node.attr('name'); - if (href && href.indexOf('#_msocom_') !== -1) { - node.remove(); - continue; - } - if (href && href.indexOf('file://') === 0) { - href = href.split('#')[1]; - if (href) { - href = '#' + href; - } - } - if (!href && !name) { - node.unwrap(); - } else { - if (name && !/^_?(?:toc|edn|ftn)/i.test(name)) { - node.unwrap(); - continue; - } - node.attr({ - href: href, - name: name - }); - } - } - }); - var rootNode = domParser.parse(content); - if (Settings.shouldConvertWordFakeLists(editor)) { - convertFakeListsToProperLists(rootNode); - } - content = global$a({ validate: editor.settings.validate }, schema).serialize(rootNode); - return content; - }; - var preProcess = function (editor, content) { - return Settings.shouldUseDefaultFilters(editor) ? filterWordContent(editor, content) : content; - }; - var WordFilter = { - preProcess: preProcess, - isWordContent: isWordContent - }; - - var processResult = function (content, cancelled) { - return { - content: content, - cancelled: cancelled - }; - }; - var postProcessFilter = function (editor, html, internal, isWordHtml) { - var tempBody = editor.dom.create('div', { style: 'display:none' }, html); - var postProcessArgs = Events.firePastePostProcess(editor, tempBody, internal, isWordHtml); - return processResult(postProcessArgs.node.innerHTML, postProcessArgs.isDefaultPrevented()); - }; - var filterContent = function (editor, content, internal, isWordHtml) { - var preProcessArgs = Events.firePastePreProcess(editor, content, internal, isWordHtml); - if (editor.hasEventListeners('PastePostProcess') && !preProcessArgs.isDefaultPrevented()) { - return postProcessFilter(editor, preProcessArgs.content, internal, isWordHtml); - } else { - return processResult(preProcessArgs.content, preProcessArgs.isDefaultPrevented()); - } - }; - var process = function (editor, html, internal) { - var isWordHtml = WordFilter.isWordContent(html); - var content = isWordHtml ? WordFilter.preProcess(editor, html) : html; - return filterContent(editor, content, internal, isWordHtml); - }; - var ProcessFilters = { process: process }; - - var removeMeta = function (editor, html) { - var body = editor.dom.create('body', {}, html); - global$4.each(body.querySelectorAll('meta'), function (elm) { - return elm.parentNode.removeChild(elm); - }); - return body.innerHTML; - }; - var pasteHtml = function (editor, html) { - editor.insertContent(removeMeta(editor, html), { - merge: Settings.shouldMergeFormats(editor), - paste: true - }); - return true; - }; - var isAbsoluteUrl = function (url) { - return /^https?:\/\/[\w\?\-\/+=.&%@~#]+$/i.test(url); - }; - var isImageUrl = function (url) { - return isAbsoluteUrl(url) && /.(gif|jpe?g|png)$/.test(url); - }; - var createImage = function (editor, url, pasteHtmlFn) { - editor.undoManager.extra(function () { - pasteHtmlFn(editor, url); - }, function () { - editor.insertContent('<img src="' + url + '">'); - }); - return true; - }; - var createLink = function (editor, url, pasteHtmlFn) { - editor.undoManager.extra(function () { - pasteHtmlFn(editor, url); - }, function () { - editor.execCommand('mceInsertLink', false, url); - }); - return true; - }; - var linkSelection = function (editor, html, pasteHtmlFn) { - return editor.selection.isCollapsed() === false && isAbsoluteUrl(html) ? createLink(editor, html, pasteHtmlFn) : false; - }; - var insertImage = function (editor, html, pasteHtmlFn) { - return isImageUrl(html) ? createImage(editor, html, pasteHtmlFn) : false; - }; - var smartInsertContent = function (editor, html) { - global$4.each([ - linkSelection, - insertImage, - pasteHtml - ], function (action) { - return action(editor, html, pasteHtml) !== true; - }); - }; - var insertContent = function (editor, html) { - if (Settings.isSmartPasteEnabled(editor) === false) { - pasteHtml(editor, html); - } else { - smartInsertContent(editor, html); - } - }; - var SmartPaste = { - isImageUrl: isImageUrl, - isAbsoluteUrl: isAbsoluteUrl, - insertContent: insertContent - }; - - var constant = function (value) { - return function () { - return value; - }; - }; - function curry(fn) { - var initialArgs = []; - for (var _i = 1; _i < arguments.length; _i++) { - initialArgs[_i - 1] = arguments[_i]; - } - return function () { - var restArgs = []; - for (var _i = 0; _i < arguments.length; _i++) { - restArgs[_i] = arguments[_i]; - } - var all = initialArgs.concat(restArgs); - return fn.apply(null, all); - }; - } - var never = constant(false); - var always = constant(true); - - var never$1 = never; - var always$1 = always; - var none = function () { - return NONE; - }; - var NONE = function () { - var eq = function (o) { - return o.isNone(); - }; - var call = function (thunk) { - return thunk(); - }; - var id = function (n) { - return n; - }; - var noop = function () { - }; - var nul = function () { - return null; - }; - var undef = function () { - return undefined; - }; - var me = { - fold: function (n, s) { - return n(); - }, - is: never$1, - isSome: never$1, - isNone: always$1, - getOr: id, - getOrThunk: call, - getOrDie: function (msg) { - throw new Error(msg || 'error: getOrDie called on none.'); - }, - getOrNull: nul, - getOrUndefined: undef, - or: id, - orThunk: call, - map: none, - ap: none, - each: noop, - bind: none, - flatten: none, - exists: never$1, - forall: always$1, - filter: none, - equals: eq, - equals_: eq, - toArray: function () { - return []; - }, - toString: constant('none()') - }; - if (Object.freeze) { - Object.freeze(me); - } - return me; - }(); - var some = function (a) { - var constant_a = function () { - return a; - }; - var self = function () { - return me; - }; - var map = function (f) { - return some(f(a)); - }; - var bind = function (f) { - return f(a); - }; - var me = { - fold: function (n, s) { - return s(a); - }, - is: function (v) { - return a === v; - }, - isSome: always$1, - isNone: never$1, - getOr: constant_a, - getOrThunk: constant_a, - getOrDie: constant_a, - getOrNull: constant_a, - getOrUndefined: constant_a, - or: self, - orThunk: self, - map: map, - ap: function (optfab) { - return optfab.fold(none, function (fab) { - return some(fab(a)); - }); - }, - each: function (f) { - f(a); - }, - bind: bind, - flatten: constant_a, - exists: bind, - forall: bind, - filter: function (f) { - return f(a) ? me : NONE; - }, - equals: function (o) { - return o.is(a); - }, - equals_: function (o, elementEq) { - return o.fold(never$1, function (b) { - return elementEq(a, b); - }); - }, - toArray: function () { - return [a]; - }, - toString: function () { - return 'some(' + a + ')'; - } - }; - return me; - }; - var from = function (value) { - return value === null || value === undefined ? NONE : some(value); - }; - var Option = { - some: some, - none: none, - from: from - }; - - var typeOf = function (x) { - if (x === null) { - return 'null'; - } - var t = typeof x; - if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) { - return 'array'; - } - if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) { - return 'string'; - } - return t; - }; - var isType = function (type) { - return function (value) { - return typeOf(value) === type; - }; - }; - var isFunction = isType('function'); - - var slice = Array.prototype.slice; - var map = function (xs, f) { - var len = xs.length; - var r = new Array(len); - for (var i = 0; i < len; i++) { - var x = xs[i]; - r[i] = f(x, i, xs); - } - return r; - }; - var each = function (xs, f) { - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - f(x, i, xs); - } - }; - var filter$1 = function (xs, pred) { - var r = []; - for (var i = 0, len = xs.length; i < len; i++) { - var x = xs[i]; - if (pred(x, i, xs)) { - r.push(x); - } - } - return r; - }; - var from$1 = isFunction(Array.from) ? Array.from : function (x) { - return slice.call(x); - }; - - var exports$1 = {}, module = { exports: exports$1 }; - (function (define, exports, module, require) { - (function (f) { - if (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.EphoxContactWrapper = f(); - } - }(function () { - return function () { - function r(e, n, t) { - function o(i, f) { - if (!n[i]) { - if (!e[i]) { - var c = 'function' == typeof require && require; - if (!f && c) - return c(i, !0); - if (u) - return u(i, !0); - var a = new Error('Cannot find module \'' + i + '\''); - throw a.code = 'MODULE_NOT_FOUND', a; - } - var p = n[i] = { exports: {} }; - e[i][0].call(p.exports, function (r) { - var n = e[i][1][r]; - return o(n || r); - }, p, p.exports, r, e, n, t); - } - return n[i].exports; - } - for (var u = 'function' == typeof require && require, i = 0; i < t.length; i++) - o(t[i]); - return o; - } - return r; - }()({ - 1: [ - function (require, module, exports) { - var process = module.exports = {}; - var cachedSetTimeout; - var cachedClearTimeout; - function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); - } - function defaultClearTimeout() { - throw new Error('clearTimeout has not been defined'); - } - (function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } - }()); - function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - return setTimeout(fun, 0); - } - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - return cachedSetTimeout(fun, 0); - } catch (e) { - try { - return cachedSetTimeout.call(null, fun, 0); - } catch (e) { - return cachedSetTimeout.call(this, fun, 0); - } - } - } - function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - return clearTimeout(marker); - } - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - return cachedClearTimeout(marker); - } catch (e) { - try { - return cachedClearTimeout.call(null, marker); |
