plugin.min.js 39.0 KB
Newer Older
Five-菜鸟级's avatar
init  
Five-菜鸟级 已提交
1 2 3 4 5 6 7 8 9
/*! 
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
* 
*  Version: 5.7.0 (2021-02-10)
*  */
!function(r){var t={};function a(n){if(t[n])return t[n].exports;var e=t[n]={i:n,l:!1,exports:{}};return r[n].call(e.exports,e,e.exports,a),e.l=!0,e.exports}a.m=r,a.c=t,a.d=function(n,e,r){a.o(n,e)||Object.defineProperty(n,e,{configurable:!1,enumerable:!0,get:r})},a.r=function(n){Object.defineProperty(n,"__esModule",{value:!0})},a.n=function(n){var e=n&&n.__esModule?function(){return n["default"]}:function(){return n};return a.d(e,"a",e),e},a.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},a.p="",a(a.s="./src/js/plugins/charmap/plugin.js")}({"./src/js/plugins/charmap/plugin.js":function(module,exports){eval("/**\n  * Copyright (c) Tiny Technologies, Inc. All rights reserved.\n  * Licensed under the LGPL or a commercial license.\n  * For LGPL see License.txt in the project root for license information.\n  * For commercial licenses see https://www.tiny.cloud/\n  *\n  * Version: 5.7.0 (2021-02-10)\n  */\n (function () {\n    'use strict';\n\n    var global = tinymce.util.Tools.resolve('tinymce.PluginManager');\n\n    var fireInsertCustomChar = function (editor, chr) {\n      return editor.fire('insertCustomChar', { chr: chr });\n    };\n\n    var insertChar = function (editor, chr) {\n      var evtChr = fireInsertCustomChar(editor, chr).chr;\n      editor.execCommand('mceInsertContent', false, evtChr);\n    };\n\n    var noop = function () {\n    };\n    var constant = function (value) {\n      return function () {\n        return value;\n      };\n    };\n    var never = constant(false);\n    var always = constant(true);\n\n    var none = function () {\n      return NONE;\n    };\n    var NONE = function () {\n      var eq = function (o) {\n        return o.isNone();\n      };\n      var call = function (thunk) {\n        return thunk();\n      };\n      var id = function (n) {\n        return n;\n      };\n      var me = {\n        fold: function (n, _s) {\n          return n();\n        },\n        is: never,\n        isSome: never,\n        isNone: always,\n        getOr: id,\n        getOrThunk: call,\n        getOrDie: function (msg) {\n          throw new Error(msg || 'error: getOrDie called on none.');\n        },\n        getOrNull: constant(null),\n        getOrUndefined: constant(undefined),\n        or: id,\n        orThunk: call,\n        map: none,\n        each: noop,\n        bind: none,\n        exists: never,\n        forall: always,\n        filter: none,\n        equals: eq,\n        equals_: eq,\n        toArray: function () {\n          return [];\n        },\n        toString: constant('none()')\n      };\n      return me;\n    }();\n    var some = function (a) {\n      var constant_a = constant(a);\n      var self = function () {\n        return me;\n      };\n      var bind = function (f) {\n        return f(a);\n      };\n      var me = {\n        fold: function (n, s) {\n          return s(a);\n        },\n        is: function (v) {\n          return a === v;\n        },\n        isSome: always,\n        isNone: never,\n        getOr: constant_a,\n        getOrThunk: constant_a,\n        getOrDie: constant_a,\n        getOrNull: constant_a,\n        getOrUndefined: constant_a,\n        or: self,\n        orThunk: self,\n        map: function (f) {\n          return some(f(a));\n        },\n        each: function (f) {\n          f(a);\n        },\n        bind: bind,\n        exists: bind,\n        forall: bind,\n        filter: function (f) {\n          return f(a) ? me : NONE;\n        },\n        toArray: function () {\n          return [a];\n        },\n        toString: function () {\n          return 'some(' + a + ')';\n        },\n        equals: function (o) {\n          return o.is(a);\n        },\n        equals_: function (o, elementEq) {\n          return o.fold(never, function (b) {\n            return elementEq(a, b);\n          });\n        }\n      };\n      return me;\n    };\n    var from = function (value) {\n      return value === null || value === undefined ? NONE : some(value);\n    };\n    var Optional = {\n      some: some,\n      none: none,\n      from: from\n    };\n\n    var typeOf = function (x) {\n      var t = typeof x;\n      if (x === null) {\n        return 'null';\n      } else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {\n        return 'array';\n      } else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {\n        return 'string';\n      } else {\n        return t;\n      }\n    };\n    var isType = function (type) {\n      return function (value) {\n        return typeOf(value) === type;\n      };\n    };\n    var isArray = isType('array');\n\n    var nativePush = Array.prototype.push;\n    var map = function (xs, f) {\n      var len = xs.length;\n      var r = new Array(len);\n      for (var i = 0; i < len; i++) {\n        var x = xs[i];\n        r[i] = f(x, i);\n      }\n      return r;\n    };\n    var each = function (xs, f) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        f(x, i);\n      }\n    };\n    var findUntil = function (xs, pred, until) {\n      for (var i = 0, len = xs.length; i < len; i++) {\n        var x = xs[i];\n        if (pred(x, i)) {\n          return Optional.some(x);\n        } else if (until(x, i)) {\n          break;\n        }\n      }\n      return Optional.none();\n    };\n    var find = function (xs, pred) {\n      return findUntil(xs, pred, never);\n    };\n    var flatten = function (xs) {\n      var r = [];\n      for (var i = 0, len = xs.length; i < len; ++i) {\n        if (!isArray(xs[i])) {\n          throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);\n        }\n        nativePush.apply(r, xs[i]);\n      }\n      return r;\n    };\n    var bind = function (xs, f) {\n      return flatten(map(xs, f));\n    };\n\n    var global$1 = tinymce.util.Tools.resolve('tinymce.util.Tools');\n\n    var getCharMap = function (editor) {\n      return editor.getParam('charmap');\n    };\n    var getCharMapAppend = function (editor) {\n      return editor.getParam('charmap_append');\n    };\n\n    var isArray$1 = global$1.isArray;\n    var UserDefined = 'User Defined';\n    var getDefaultCharMap = function () {\n      return [\n        {\n          name: 'Currency',\n          characters: [\n            [\n              36,\n              'dollar sign'\n            ],\n            [\n              162,\n              'cent sign'\n            ],\n            [\n              8364,\n              'euro sign'\n            ],\n            [\n              163,\n              'pound sign'\n            ],\n            [\n              165,\n              'yen sign'\n            ],\n            [\n              164,\n              'currency sign'\n            ],\n            [\n              8352,\n              'euro-currency sign'\n            ],\n            [\n              8353,\n              'colon sign'\n            ],\n            [\n              8354,\n              'cruzeiro sign'\n            ],\n            [\n              8355,\n              'french franc sign'\n            ],\n            [\n              8356,\n              'lira sign'\n            ],\n            [\n              8357,\n              'mill sign'\n            ],\n            [\n              8358,\n              'naira sign'\n            ],\n            [\n              8359,\n              'peseta sign'\n            ],\n            [\n              8360,\n              'rupee sign'\n            ],\n            [\n              8361,\n              'won sign'\n            ],\n            [\n              8362,\n              'new sheqel sign'\n            ],\n            [\n              8363,\n              'dong sign'\n            ],\n            [\n              8365,\n              'kip sign'\n            ],\n            [\n              8366,\n              'tugrik sign'\n            ],\n            [\n              8367,\n              'drachma sign'\n            ],\n            [\n              8368,\n              'german penny symbol'\n            ],\n            [\n              8369,\n              'peso sign'\n            ],\n            [\n              8370,\n              'guarani sign'\n            ],\n            [\n              8371,\n              'austral sign'\n            ],\n            [\n              8372,\n              'hryvnia sign'\n            ],\n            [\n              8373,\n              'cedi sign'\n            ],\n            [\n              8374,\n              'livre tournois sign'\n            ],\n            [\n              8375,\n              'spesmilo sign'\n            ],\n            [\n              8376,\n              'tenge sign'\n            ],\n            [\n              8377,\n              'indian rupee sign'\n            ],\n            [\n              8378,\n              'turkish lira sign'\n            ],\n            [\n              8379,\n              'nordic mark sign'\n            ],\n            [\n              8380,\n              'manat sign'\n            ],\n            [\n              8381,\n              'ruble sign'\n            ],\n            [\n              20870,\n              'yen character'\n            ],\n            [\n              20803,\n              'yuan character'\n            ],\n            [\n              22291,\n              'yuan character, in hong kong and taiwan'\n            ],\n            [\n              22278,\n              'yen/yuan character variant one'\n            ]\n          ]\n        },\n        {\n          name: 'Text',\n          characters: [\n            [\n              169,\n              'copyright sign'\n            ],\n            [\n              174,\n              'registered sign'\n            ],\n            [\n              8482,\n              'trade mark sign'\n            ],\n            [\n              8240,\n              'per mille sign'\n            ],\n            [\n              181,\n              'micro sign'\n            ],\n            [\n              183,\n              'middle dot'\n            ],\n            [\n              8226,\n              'bullet'\n            ],\n            [\n              8230,\n              'three dot leader'\n            ],\n            [\n              8242,\n              'minutes / feet'\n            ],\n            [\n              8243,\n              'seconds / inches'\n            ],\n            [\n              167,\n              'section sign'\n            ],\n            [\n              182,\n              'paragraph sign'\n            ],\n            [\n              223,\n              'sharp s / ess-zed'\n            ]\n          ]\n        },\n        {\n          name: 'Quotations',\n          characters: [\n            [\n              8249,\n              'single left-pointing angle quotation mark'\n            ],\n            [\n              8250,\n              'single right-pointing angle quotation mark'\n            ],\n            [\n              171,\n              'left pointing guillemet'\n            ],\n            [\n              187,\n              'right pointing guillemet'\n            ],\n            [\n              8216,\n              'left single quotation mark'\n            ],\n            [\n              8217,\n              'right single quotation mark'\n            ],\n            [\n              8220,\n              'left double quotation mark'\n            ],\n            [\n              8221,\n              'right double quotation mark'\n            ],\n            [\n              8218,\n              'single low-9 quotation mark'\n            ],\n            [\n              8222,\n              'double low-9 quotation mark'\n            ],\n            [\n              60,\n              'less-than sign'\n            ],\n            [\n              62,\n              'greater-than sign'\n            ],\n            [\n              8804,\n              'less-than or equal to'\n            ],\n            [\n              8805,\n              'greater-than or equal to'\n            ],\n            [\n              8211,\n              'en dash'\n            ],\n            [\n              8212,\n              'em dash'\n            ],\n            [\n              175,\n              'macron'\n            ],\n            [\n              8254,\n              'overline'\n            ],\n            [\n              164,\n              'currency sign'\n            ],\n            [\n              166,\n              'broken bar'\n            ],\n            [\n              168,\n              'diaeresis'\n            ],\n            [\n              161,\n              'inverted exclamation mark'\n            ],\n            [\n              191,\n              'turned question mark'\n            ],\n            [\n              710,\n              'circumflex accent'\n            ],\n            [\n              732,\n              'small tilde'\n            ],\n            [\n              176,\n              'degree sign'\n            ],\n            [\n              8722,\n              'minus sign'\n            ],\n            [\n              177,\n              'plus-minus sign'\n            ],\n            [\n              247,\n              'division sign'\n            ],\n            [\n              8260,\n              'fraction slash'\n            ],\n            [\n              215,\n              'multiplication sign'\n            ],\n            [\n              185,\n              'superscript one'\n            ],\n            [\n              178,\n              'superscript two'\n            ],\n            [\n              179,\n              'superscript three'\n            ],\n            [\n              188,\n              'fraction one quarter'\n            ],\n            [\n              189,\n              'fraction one half'\n            ],\n            [\n              190,\n              'fraction three quarters'\n            ]\n          ]\n        },\n        {\n          name: 'Mathematical',\n          characters: [\n            [\n              402,\n              'function / florin'\n            ],\n            [\n              8747,\n              'integral'\n            ],\n            [\n              8721,\n              'n-ary sumation'\n            ],\n            [\n              8734,\n              'infinity'\n            ],\n            [\n              8730,\n              'square root'\n            ],\n            [\n              8764,\n              'similar to'\n            ],\n            [\n              8773,\n              'approximately equal to'\n            ],\n            [\n              8776,\n              'almost equal to'\n            ],\n            [\n              8800,\n              'not equal to'\n            ],\n            [\n              8801,\n              'identical to'\n            ],\n            [\n              8712,\n              'element of'\n            ],\n            [\n              8713,\n              'not an element of'\n            ],\n            [\n              8715,\n              'contains as member'\n            ],\n            [\n              8719,\n              'n-ary product'\n            ],\n            [\n              8743,\n              'logical and'\n            ],\n            [\n              8744,\n              'logical or'\n            ],\n            [\n              172,\n              'not sign'\n            ],\n            [\n              8745,\n              'intersection'\n            ],\n            [\n              8746,\n              'union'\n            ],\n            [\n              8706,\n              'partial differential'\n            ],\n            [\n              8704,\n              'for all'\n            ],\n            [\n              8707,\n              'there exists'\n            ],\n            [\n              8709,\n              'diameter'\n            ],\n            [\n              8711,\n              'backward difference'\n            ],\n            [\n              8727,\n              'asterisk operator'\n            ],\n            [\n              8733,\n              'proportional to'\n            ],\n            [\n              8736,\n              'angle'\n            ]\n          ]\n        },\n        {\n          name: 'Extended Latin',\n          characters: [\n            [\n              192,\n              'A - grave'\n            ],\n            [\n              193,\n              'A - acute'\n            ],\n            [\n              194,\n              'A - circumflex'\n            ],\n            [\n              195,\n              'A - tilde'\n            ],\n            [\n              196,\n              'A - diaeresis'\n            ],\n            [\n              197,\n              'A - ring above'\n            ],\n            [\n              256,\n              'A - macron'\n            ],\n            [\n              198,\n              'ligature AE'\n            ],\n            [\n              199,\n              'C - cedilla'\n            ],\n            [\n              200,\n              'E - grave'\n            ],\n            [\n              201,\n              'E - acute'\n            ],\n            [\n              202,\n              'E - circumflex'\n            ],\n            [\n              203,\n              'E - diaeresis'\n            ],\n            [\n              274,\n              'E - macron'\n            ],\n            [\n              204,\n              'I - grave'\n            ],\n            [\n              205,\n              'I - acute'\n            ],\n            [\n              206,\n              'I - circumflex'\n            ],\n            [\n              207,\n              'I - diaeresis'\n            ],\n            [\n              298,\n              'I - macron'\n            ],\n            [\n              208,\n              'ETH'\n            ],\n            [\n              209,\n              'N - tilde'\n            ],\n            [\n              210,\n              'O - grave'\n            ],\n            [\n              211,\n              'O - acute'\n            ],\n            [\n              212,\n              'O - circumflex'\n            ],\n            [\n              213,\n              'O - tilde'\n            ],\n            [\n              214,\n              'O - diaeresis'\n            ],\n            [\n              216,\n              'O - slash'\n            ],\n            [\n              332,\n              'O - macron'\n            ],\n            [\n              338,\n              'ligature OE'\n            ],\n            [\n              352,\n              'S - caron'\n            ],\n            [\n              217,\n              'U - grave'\n            ],\n            [\n              218,\n              'U - acute'\n            ],\n            [\n              219,\n              'U - circumflex'\n            ],\n            [\n              220,\n              'U - diaeresis'\n            ],\n            [\n              362,\n              'U - macron'\n            ],\n            [\n              221,\n              'Y - acute'\n            ],\n            [\n              376,\n              'Y - diaeresis'\n            ],\n            [\n              562,\n              'Y - macron'\n            ],\n            [\n              222,\n              'THORN'\n            ],\n            [\n              224,\n              'a - grave'\n            ],\n            [\n              225,\n              'a - acute'\n            ],\n            [\n              226,\n              'a - circumflex'\n            ],\n            [\n              227,\n              'a - tilde'\n            ],\n            [\n              228,\n              'a - diaeresis'\n            ],\n            [\n              229,\n              'a - ring above'\n            ],\n            [\n              257,\n              'a - macron'\n            ],\n            [\n              230,\n              'ligature ae'\n            ],\n            [\n              231,\n              'c - cedilla'\n            ],\n            [\n              232,\n              'e - grave'\n            ],\n            [\n              233,\n              'e - acute'\n            ],\n            [\n              234,\n              'e - circumflex'\n            ],\n            [\n              235,\n              'e - diaeresis'\n            ],\n            [\n              275,\n              'e - macron'\n            ],\n            [\n              236,\n              'i - grave'\n            ],\n            [\n              237,\n              'i - acute'\n            ],\n            [\n              238,\n              'i - circumflex'\n            ],\n            [\n              239,\n              'i - diaeresis'\n            ],\n            [\n              299,\n              'i - macron'\n            ],\n            [\n              240,\n              'eth'\n            ],\n            [\n              241,\n              'n - tilde'\n            ],\n            [\n              242,\n              'o - grave'\n            ],\n            [\n              243,\n              'o - acute'\n            ],\n            [\n              244,\n              'o - circumflex'\n            ],\n            [\n              245,\n              'o - tilde'\n            ],\n            [\n              246,\n              'o - diaeresis'\n            ],\n            [\n              248,\n              'o slash'\n            ],\n            [\n              333,\n              'o macron'\n            ],\n            [\n              339,\n              'ligature oe'\n            ],\n            [\n              353,\n              's - caron'\n            ],\n            [\n              249,\n              'u - grave'\n            ],\n            [\n              250,\n              'u - acute'\n            ],\n            [\n              251,\n              'u - circumflex'\n            ],\n            [\n              252,\n              'u - diaeresis'\n            ],\n            [\n              363,\n              'u - macron'\n            ],\n            [\n              253,\n              'y - acute'\n            ],\n            [\n              254,\n              'thorn'\n            ],\n            [\n              255,\n              'y - diaeresis'\n            ],\n            [\n              563,\n              'y - macron'\n            ],\n            [\n              913,\n              'Alpha'\n            ],\n            [\n              914,\n              'Beta'\n            ],\n            [\n              915,\n              'Gamma'\n            ],\n            [\n              916,\n              'Delta'\n            ],\n            [\n              917,\n              'Epsilon'\n            ],\n            [\n              918,\n              'Zeta'\n            ],\n            [\n              919,\n              'Eta'\n            ],\n            [\n              920,\n              'Theta'\n            ],\n            [\n              921,\n              'Iota'\n            ],\n            [\n              922,\n              'Kappa'\n            ],\n            [\n              923,\n              'Lambda'\n            ],\n            [\n              924,\n              'Mu'\n            ],\n            [\n              925,\n              'Nu'\n            ],\n            [\n              926,\n              'Xi'\n            ],\n            [\n              927,\n              'Omicron'\n            ],\n            [\n              928,\n              'Pi'\n            ],\n            [\n              929,\n              'Rho'\n            ],\n            [\n              931,\n              'Sigma'\n            ],\n            [\n              932,\n              'Tau'\n            ],\n            [\n              933,\n              'Upsilon'\n            ],\n            [\n              934,\n              'Phi'\n            ],\n            [\n              935,\n              'Chi'\n            ],\n            [\n              936,\n              'Psi'\n            ],\n            [\n              937,\n              'Omega'\n            ],\n            [\n              945,\n              'alpha'\n            ],\n            [\n              946,\n              'beta'\n            ],\n            [\n              947,\n              'gamma'\n            ],\n            [\n              948,\n              'delta'\n            ],\n            [\n              949,\n              'epsilon'\n            ],\n            [\n              950,\n              'zeta'\n            ],\n            [\n              951,\n              'eta'\n            ],\n            [\n              952,\n              'theta'\n            ],\n            [\n              953,\n              'iota'\n            ],\n            [\n              954,\n              'kappa'\n            ],\n            [\n              955,\n              'lambda'\n            ],\n            [\n              956,\n              'mu'\n            ],\n            [\n              957,\n              'nu'\n            ],\n            [\n              958,\n              'xi'\n            ],\n            [\n              959,\n              'omicron'\n            ],\n            [\n              960,\n              'pi'\n            ],\n            [\n              961,\n              'rho'\n            ],\n            [\n              962,\n              'final sigma'\n            ],\n            [\n              963,\n              'sigma'\n            ],\n            [\n              964,\n              'tau'\n            ],\n            [\n              965,\n              'upsilon'\n            ],\n            [\n              966,\n              'phi'\n            ],\n            [\n              967,\n              'chi'\n            ],\n            [\n              968,\n              'psi'\n            ],\n            [\n              969,\n              'omega'\n            ]\n          ]\n        },\n        {\n          name: 'Symbols',\n          characters: [\n            [\n              8501,\n              'alef symbol'\n            ],\n            [\n              982,\n              'pi symbol'\n            ],\n            [\n              8476,\n              'real part symbol'\n            ],\n            [\n              978,\n              'upsilon - hook symbol'\n            ],\n            [\n              8472,\n              'Weierstrass p'\n            ],\n            [\n              8465,\n              'imaginary part'\n            ]\n          ]\n        },\n        {\n          name: 'Arrows',\n          characters: [\n            [\n              8592,\n              'leftwards arrow'\n            ],\n            [\n              8593,\n              'upwards arrow'\n            ],\n            [\n              8594,\n              'rightwards arrow'\n            ],\n            [\n              8595,\n              'downwards arrow'\n            ],\n            [\n              8596,\n              'left right arrow'\n            ],\n            [\n              8629,\n              'carriage return'\n            ],\n            [\n              8656,\n              'leftwards double arrow'\n            ],\n            [\n              8657,\n              'upwards double arrow'\n            ],\n            [\n              8658,\n              'rightwards double arrow'\n            ],\n            [\n              8659,\n              'downwards double arrow'\n            ],\n            [\n              8660,\n              'left right double arrow'\n            ],\n            [\n              8756,\n              'therefore'\n            ],\n            [\n              8834,\n              'subset of'\n            ],\n            [\n              8835,\n              'superset of'\n            ],\n            [\n              8836,\n              'not a subset of'\n            ],\n            [\n              8838,\n              'subset of or equal to'\n            ],\n            [\n              8839,\n              'superset of or equal to'\n            ],\n            [\n              8853,\n              'circled plus'\n            ],\n            [\n              8855,\n              'circled times'\n            ],\n            [\n              8869,\n              'perpendicular'\n            ],\n            [\n              8901,\n              'dot operator'\n            ],\n            [\n              8968,\n              'left ceiling'\n            ],\n            [\n              8969,\n              'right ceiling'\n            ],\n            [\n              8970,\n              'left floor'\n            ],\n            [\n              8971,\n              'right floor'\n            ],\n            [\n              9001,\n              'left-pointing angle bracket'\n            ],\n            [\n              9002,\n              'right-pointing angle bracket'\n            ],\n            [\n              9674,\n              'lozenge'\n            ],\n            [\n              9824,\n              'black spade suit'\n            ],\n            [\n              9827,\n              'black club suit'\n            ],\n            [\n              9829,\n              'black heart suit'\n            ],\n            [\n              9830,\n              'black diamond suit'\n            ],\n            [\n              8194,\n              'en space'\n            ],\n            [\n              8195,\n              'em space'\n            ],\n            [\n              8201,\n              'thin space'\n            ],\n            [\n              8204,\n              'zero width non-joiner'\n            ],\n            [\n              8205,\n              'zero width joiner'\n            ],\n            [\n              8206,\n              'left-to-right mark'\n            ],\n            [\n              8207,\n              'right-to-left mark'\n            ]\n          ]\n        }\n      ];\n    };\n    var charmapFilter = function (charmap) {\n      return global$1.grep(charmap, function (item) {\n        return isArray$1(item) && item.length === 2;\n      });\n    };\n    var getCharsFromSetting = function (settingValue) {\n      if (isArray$1(settingValue)) {\n        return [].concat(charmapFilter(settingValue));\n      }\n      if (typeof settingValue === 'function') {\n        return settingValue();\n      }\n      return [];\n    };\n    var extendCharMap = function (editor, charmap) {\n      var userCharMap = getCharMap(editor);\n      if (userCharMap) {\n        charmap = [{\n            name: UserDefined,\n            characters: getCharsFromSetting(userCharMap)\n          }];\n      }\n      var userCharMapAppend = getCharMapAppend(editor);\n      if (userCharMapAppend) {\n        var userDefinedGroup = global$1.grep(charmap, function (cg) {\n          return cg.name === UserDefined;\n        });\n        if (userDefinedGroup.length) {\n          userDefinedGroup[0].characters = [].concat(userDefinedGroup[0].characters).concat(getCharsFromSetting(userCharMapAppend));\n          return charmap;\n        }\n        return [].concat(charmap).concat({\n          name: UserDefined,\n          characters: getCharsFromSetting(userCharMapAppend)\n        });\n      }\n      return charmap;\n    };\n    var getCharMap$1 = function (editor) {\n      var groups = extendCharMap(editor, getDefaultCharMap());\n      return groups.length > 1 ? [{\n          name: 'All',\n          characters: bind(groups, function (g) {\n            return g.characters;\n          })\n        }].concat(groups) : groups;\n    };\n\n    var get = function (editor) {\n      var getCharMap = function () {\n        return getCharMap$1(editor);\n      };\n      var insertChar$1 = function (chr) {\n        insertChar(editor, chr);\n      };\n      return {\n        getCharMap: getCharMap,\n        insertChar: insertChar$1\n      };\n    };\n\n    var Cell = function (initial) {\n      var value = initial;\n      var get = function () {\n        return value;\n      };\n      var set = function (v) {\n        value = v;\n      };\n      return {\n        get: get,\n        set: set\n      };\n    };\n\n    var last = function (fn, rate) {\n      var timer = null;\n      var cancel = function () {\n        if (timer !== null) {\n          clearTimeout(timer);\n          timer = null;\n        }\n      };\n      var throttle = function () {\n        var args = [];\n        for (var _i = 0; _i < arguments.length; _i++) {\n          args[_i] = arguments[_i];\n        }\n        if (timer !== null) {\n          clearTimeout(timer);\n        }\n        timer = setTimeout(function () {\n          fn.apply(null, args);\n          timer = null;\n        }, rate);\n      };\n      return {\n        cancel: cancel,\n        throttle: throttle\n      };\n    };\n\n    var nativeFromCodePoint = String.fromCodePoint;\n    var contains = function (str, substr) {\n      return str.indexOf(substr) !== -1;\n    };\n    var fromCodePoint = function () {\n      var codePoints = [];\n      for (var _i = 0; _i < arguments.length; _i++) {\n        codePoints[_i] = arguments[_i];\n      }\n      if (nativeFromCodePoint) {\n        return nativeFromCodePoint.apply(void 0, codePoints);\n      } else {\n        var codeUnits = [];\n        var codeLen = 0;\n        var result = '';\n        for (var index = 0, len = codePoints.length; index !== len; ++index) {\n          var codePoint = +codePoints[index];\n          if (!(codePoint < 1114111 && codePoint >>> 0 === codePoint)) {\n            throw RangeError('Invalid code point: ' + codePoint);\n          }\n          if (codePoint <= 65535) {\n            codeLen = codeUnits.push(codePoint);\n          } else {\n            codePoint -= 65536;\n            codeLen = codeUnits.push((codePoint >> 10) + 55296, codePoint % 1024 + 56320);\n          }\n          if (codeLen >= 16383) {\n            result += String.fromCharCode.apply(null, codeUnits);\n            codeUnits.length = 0;\n          }\n        }\n        return result + String.fromCharCode.apply(null, codeUnits);\n      }\n    };\n\n    var charMatches = function (charCode, name, lowerCasePattern) {\n      if (contains(fromCodePoint(charCode).toLowerCase(), lowerCasePattern)) {\n        return true;\n      } else {\n        return contains(name.toLowerCase(), lowerCasePattern) || contains(name.toLowerCase().replace(/\\s+/g, ''), lowerCasePattern);\n      }\n    };\n    var scan = function (group, pattern) {\n      var matches = [];\n      var lowerCasePattern = pattern.toLowerCase();\n      each(group.characters, function (g) {\n        if (charMatches(g[0], g[1], lowerCasePattern)) {\n          matches.push(g);\n        }\n      });\n      return map(matches, function (m) {\n        return {\n          text: m[1],\n          value: fromCodePoint(m[0]),\n          icon: fromCodePoint(m[0])\n        };\n      });\n    };\n\n    var patternName = 'pattern';\n    var open = function (editor, charMap) {\n      var makeGroupItems = function () {\n        return [\n          {\n            label: 'Search',\n            type: 'input',\n            name: patternName\n          },\n          {\n            type: 'collection',\n            name: 'results'\n          }\n        ];\n      };\n      var makeTabs = function () {\n        return map(charMap, function (charGroup) {\n          return {\n            title: charGroup.name,\n            name: charGroup.name,\n            items: makeGroupItems()\n          };\n        });\n      };\n      var makePanel = function () {\n        return {\n          type: 'panel',\n          items: makeGroupItems()\n        };\n      };\n      var makeTabPanel = function () {\n        return {\n          type: 'tabpanel',\n          tabs: makeTabs()\n        };\n      };\n      var currentTab = charMap.length === 1 ? Cell(UserDefined) : Cell('All');\n      var scanAndSet = function (dialogApi, pattern) {\n        find(charMap, function (group) {\n          return group.name === currentTab.get();\n        }).each(function (f) {\n          var items = scan(f, pattern);\n          dialogApi.setData({ results: items });\n        });\n      };\n      var SEARCH_DELAY = 40;\n      var updateFilter = last(function (dialogApi) {\n        var pattern = dialogApi.getData().pattern;\n        scanAndSet(dialogApi, pattern);\n      }, SEARCH_DELAY);\n      var body = charMap.length === 1 ? makePanel() : makeTabPanel();\n      var initialData = {\n        pattern: '',\n        results: scan(charMap[0], '')\n      };\n      var bridgeSpec = {\n        title: 'Special Character',\n        size: 'normal',\n        body: body,\n        buttons: [{\n            type: 'cancel',\n            name: 'close',\n            text: 'Close',\n            primary: true\n          }],\n        initialData: initialData,\n        onAction: function (api, details) {\n          if (details.name === 'results') {\n            insertChar(editor, details.value);\n            api.close();\n          }\n        },\n        onTabChange: function (dialogApi, details) {\n          currentTab.set(details.newTabName);\n          updateFilter.throttle(dialogApi);\n        },\n        onChange: function (dialogApi, changeData) {\n          if (changeData.name === patternName) {\n            updateFilter.throttle(dialogApi);\n          }\n        }\n      };\n      var dialogApi = editor.windowManager.open(bridgeSpec);\n      dialogApi.focus(patternName);\n    };\n\n    var register = function (editor, charMap) {\n      editor.addCommand('mceShowCharmap', function () {\n        open(editor, charMap);\n      });\n    };\n\n    var global$2 = tinymce.util.Tools.resolve('tinymce.util.Promise');\n\n    var init = function (editor, all) {\n      editor.ui.registry.addAutocompleter('charmap', {\n        ch: ':',\n        columns: 'auto',\n        minChars: 2,\n        fetch: function (pattern, _maxResults) {\n          return new global$2(function (resolve, _reject) {\n            resolve(scan(all, pattern));\n          });\n        },\n        onAction: function (autocompleteApi, rng, value) {\n          editor.selection.setRng(rng);\n          editor.insertContent(value);\n          autocompleteApi.hide();\n        }\n      });\n    };\n\n    var register$1 = function (editor) {\n      editor.ui.registry.addButton('charmap', {\n        icon: 'insert-character',\n        tooltip: 'Special character',\n        onAction: function () {\n          return editor.execCommand('mceShowCharmap');\n        }\n      });\n      editor.ui.registry.addMenuItem('charmap', {\n        icon: 'insert-character',\n        text: 'Special character...',\n        onAction: function () {\n          return editor.execCommand('mceShowCharmap');\n        }\n      });\n    };\n\n    function Plugin () {\n      global.add('charmap', function (editor) {\n        var charMap = getCharMap$1(editor);\n        register(editor, charMap);\n        register$1(editor);\n        init(editor, charMap[0]);\n        return get(editor);\n      });\n    }\n\n    Plugin();\n\n}());\n\n\n//# sourceURL=webpack:///./src/js/plugins/charmap/plugin.js?")}});