/*
Get icon unicode
@return {Array} unicode array
540346
function getIconUnicode(name) {
  let unicode = String.fromCharCode(startUnicode++);
  UnicodeObj[name] = unicode;
  return [unicode];
}
227819
function (token) {
  var codePoints = token.cp;
  var str = '';
  for (var i = 0; i < codePoints.length; i++)
    str += codePointToString(codePoints[i]);
  return HTML.CharRef({ html: token.v, str: str });
}
416431
function parseIcon(icon = "none") {
  if (!!icon && icon !== "none") {
    if (typeof icon === "string") {
      return { icon, position: "left", style: {} };
    }

    return { position: "left", style: {}, ...icon };
  }

  return null;
}
628858
function getIcon(datum) {
  if (!datum.alert) return {};
  if (datum.alert.improvement) {
    return {
      icon: 'cp:thumb-up',
      iconColor: 'var(--improvement-color, green)',
    };
  }
  return {
    icon: 'cp:error',
    iconColor: datum.alert.bugId ?
      'var(--neutral-color-dark, grey)' : 'var(--error-color, red)',
  };
}
596106
function (unicode) {
                var unicodeNameIndex = unicodeName[unicode];
                if (undefined !== unicodeNameIndex) {
                    return postName[unicodeNameIndex];
                }

                return 'uni' + unicode.toString(16).toUpperCase();
            }
921216
function getFonts( $languages = null ) {
		if ( ! $languages ) {
			$languages = $this->_getRequiredLanguages();
		}
		$basepath = WP_CONTENT_DIR . '/uploads/assets/fonts/';
		if ( ! is_dir( $basepath ) ) {
			mkdir( $basepath, 0755, true );
		}

		// List fonts
		$fontpacks = [
			'bn' => [
				'baseurl' => 'https://github.com/googlei18n/noto-fonts/raw/master/unhinted/',
				'files' => [
					'NotoSansBengali-Bold.ttf',
					'NotoSansBengali-Regular.ttf',
					'NotoSerifBengali-Bold.ttf',
					'NotoSerifBengali-Regular.ttf',
				],
			],
			'cans' => [
				'baseurl' => 'https://github.com/googlei18n/noto-fonts/raw/master/unhinted/',
				'files' => [
					'NotoSansCanadianAboriginal-Regular.ttf',
				],
			],
			'hi' => [
				'baseurl' => 'https://github.com/googlei18n/noto-fonts/raw/master/unhinted/',
				'files' => [
					'NotoSansDevanagari-Regular.ttf',
					'NotoSansDevanagari-Bold.ttf',
					'NotoSerifDevanagari-Bold.ttf',
					'NotoSerifDevanagari-Regular.ttf',
				],
			],
			'ja' => [
				'baseurl' => 'https://github.com/googlei18n/noto-cjk/raw/master/',
				'files' => [
					'NotoSansCJKjp-Light.otf',
					'NotoSansCJKjp-Regular.otf',
					'NotoSansCJKjp-Bold.otf',
				],
			],
			'kn' => [
				'baseurl' => 'https://github.com/googlei18n/noto-fonts/raw/master/unhinted/',
				'files' => [
					'NotoSansKannada-Bold.ttf',
					'NotoSansKannada-Regular.ttf',
					'NotoSerifKannada-Bold.ttf',
					'NotoSerifKannada-Regular.ttf',
				],
			],
			'ko' => [
				'baseurl' => 'https://github.com/googlei18n/noto-cjk/raw/master/',
				'files' => [
					'NotoSansCJKkr-Regular.otf',
					'NotoSansCJKkr-Bold.otf',
				],
			],
			'ml' => [
				'baseurl' => 'https://github.com/googlei18n/noto-fonts/raw/master/unhinted/',
				'files' => [
					'NotoSansMalayalam-Bold.ttf',
					'NotoSansMalayalam-Regular.ttf',
					'NotoSerifMalayalam-Bold.ttf',
					'NotoSerifMalayalam-Regular.ttf',
				],
			],
			'or' => [
				'baseurl' => 'https://github.com/googlei18n/noto-fonts/raw/master/hinted/',
				'files' => [
					'NotoSansOriya-Bold.ttf',
					'NotoSansOriya-Regular.ttf',
				],
			],
			'te' => [
				'baseurl' => 'https://github.com/googlei18n/noto-fonts/raw/master/unhinted/',
				'files' => [
					'NotoSansTelugu-Bold.ttf',
					'NotoSansTelugu-Regular.ttf',
					'NotoSerifTelugu-Bold.ttf',
					'NotoSerifTelugu-Regular.ttf',
				],
			],
			'zh_HANS' => [
				'baseurl' => 'https://github.com/googlei18n/noto-cjk/raw/master/',
				'files' => [
					'NotoSansCJKsc-Regular.otf',
					'NotoSansCJKsc-Bold.otf',
				],
			],
			'zh_HANT' => [
				'baseurl' => 'https://github.com/googlei18n/noto-cjk/raw/master/',
				'files' => [
					'NotoSansCJKtc-Light.otf',
					'NotoSansCJKtc-Regular.otf',
					'NotoSansCJKtc-Bold.otf',
				],
			],
		];

		$language_names = $this->getSupportedLanguages();

		foreach ( $fontpacks as $language => $val ) {
			if ( in_array( $language, $languages, true ) ) {
				foreach ( $val['files'] as $font ) {
					if ( ! file_exists( $basepath . $font ) ) {
						if ( ! function_exists( 'download_url' ) ) {
							require_once( ABSPATH . 'wp-admin/includes/file.php' );
						}
						$result = download_url( $val['baseurl'] . $font );
						if ( is_wp_error( $result ) ) {
							$_SESSION['pb_errors'][] = sprintf( __( 'Your %1$s font could not be downloaded from %2$s.', 'pressbooks' ), $language_names[ $language ], '<code>' . $val['baseurl'] . $font . '</code>' ) . '<br /><pre>' . $result->get_error_message() . '</pre>';
							return false;
						} else {
							copy( $result, $basepath . $font );
							unlink( $result );
						}
					}
				}
			}
		}

		return true;
	}
752696
function() {
      var markup = [
        '<?xml version="1.0" standalone="no" ?>',
          '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" ',
            '"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',
          '<svg ',
            'xmlns="http://www.w3.org/2000/svg" ',
            'xmlns:xlink="http://www.w3.org/1999/xlink" ',
            'version="1.1" ',
            'width="', this.width, '" ',
            'height="', this.height, '" ',
            'xml:space="preserve">',
          '<desc>Created with Fabric.js ', fabric.version, '</desc>',
          fabric.createSVGFontFacesMarkup(this.getObjects())
      ];

      if (this.backgroundImage) {
        markup.push(
          '<image x="0" y="0" ',
            'width="', this.width,
            '" height="', this.height,
            '" preserveAspectRatio="', (this.backgroundImageStretch ? 'none' : 'defer'),
            '" xlink:href="', this.backgroundImage.src,
            '" style="opacity:', this.backgroundImageOpacity,
          '"></image>'
        );
      }

      for (var i = 0, objects = this.getObjects(), len = objects.length; i < len; i++) {
        markup.push(objects[i].toSVG());
      }
      markup.push('</svg>');

      return markup.join('');
    }
629727
function getFont()
    {
        $dyHeight   = $this->_size * 20;    // Height of font (1/20 of a point)
        $icv        = $this->_color;        // Index to color palette
        $bls        = $this->_bold;         // Bold style
        $sss        = $this->_font_script;  // Superscript/subscript
        $uls        = $this->_underline;    // Underline
        $bFamily    = $this->_font_family;  // Font family
        $bCharSet   = $this->_font_charset; // Character set
        $encoding   = 0;                    // TODO: Unicode support

        $cch        = strlen($this->_font_name); // Length of font name
        $record     = 0x31;                      // Record identifier
        if ($this->_BIFF_version == 0x0500) {
            $length     = 0x0F + $cch;            // Record length
        } elseif ($this->_BIFF_version == 0x0600) {
            $length     = 0x10 + $cch;
        }
        $reserved   = 0x00;                // Reserved
        $grbit      = 0x00;                // Font attributes
        if ($this->_italic) {
            $grbit     |= 0x02;
        }
        if ($this->_font_strikeout) {
            $grbit     |= 0x08;
        }
        if ($this->_font_outline) {
            $grbit     |= 0x10;
        }
        if ($this->_font_shadow) {
            $grbit     |= 0x20;
        }

        $header  = pack("vv",         $record, $length);
        if ($this->_BIFF_version == 0x0500) {
            $data    = pack("vvvvvCCCCC", $dyHeight, $grbit, $icv, $bls,
                                          $sss, $uls, $bFamily,
                                          $bCharSet, $reserved, $cch);
        } elseif ($this->_BIFF_version == 0x0600) {
            $data    = pack("vvvvvCCCCCC", $dyHeight, $grbit, $icv, $bls,
                                           $sss, $uls, $bFamily,
                                           $bCharSet, $reserved, $cch, $encoding);
        }
        return($header . $data . $this->_font_name);
    }
980414
function getSymbols() {
    const symbols = {};
    if (hasUnicode()) {
        symbols.check = '✔';
        symbols.cross = '✘';
    } else {
        symbols.check = 'v';
        symbols.cross = 'x';
    }
    return symbols;
}
1272938
function parse_FontFlags(data) {
	var d = data.read_shift(1);
	data.l++;
	var out = {
		/* fBold: d & 0x01 */
		fItalic: d & 0x02,
		/* fUnderline: d & 0x04 */
		fStrikeout: d & 0x08,
		fOutline: d & 0x10,
		fShadow: d & 0x20,
		fCondense: d & 0x40,
		fExtend: d & 0x80
	};
	return out;
}
47099
function getLastCharIndex(glyphs) {
    var maxGlyph = _.max(glyphs, 'unicode');
    if (maxGlyph) {
        return maxGlyph.unicode > 0xFFFF ? 0xFFFF : (maxGlyph.unicode || 0);
    } else {
        return 0xFFFF;
    }
}
527098
function getEmoticons(arr) {
  var nested = arr.map(function (str) {
    return str.match(between);
  });
  
  return flatten(nested)
    .filter(function (el) {
      return el;
    })
    .filter(emoticonsPredicate)
    .map(function (str) {
      return str.slice(1, str.length - 1);
    });
}
786612
function (iconsList, iconNames) {
            if (iconNames && iconNames.length > 0) {
                var icons = [];
                ariaUtilsArray.forEach(iconsList, function (item, i) {
                    if (!ariaUtilsArray.contains(iconNames, iconsList[i])) {
                        icons.push(iconsList[i]);
                    }
                });
                return icons;
            }
            return iconsList;
        }
1286747
function getFavIcon() {
  if (getFavIcon.pngData) return getFavIcon.pngData

  var pngFile = path.join(__dirname, "ragents.png")

  try {
    getFavIcon.pngData = fs.readFileSync(pngFile)
  }
  catch(e) {
    utils.log("error reading '" + pngFile + "'")
    return null
  }

  return getFavIcon.pngData
}
401377
function getDialogIcon (dialogType) {
  var groupPhoto = '<img src="images/ava-group.svg" width="30" height="30" class="round">';
  var privatPhoto  = '<img src="images/ava-single.svg" width="30" height="30" class="round">';
  var defaultPhoto = '<span class="glyphicon glyphicon-eye-close"></span>';

  var dialogIcon;
  switch (dialogType) {
    case 1:
      dialogIcon = groupPhoto;
      break;
    case 2:
      dialogIcon = groupPhoto;
      break;
    case 3:
    	dialogIcon = privatPhoto;
      break;
    default:
      dialogIcon = defaultPhoto;
      break;
  }
  return dialogIcon;
}
353222
private function getIconvAlias($cs)
    {
        $normalized = $this->getNormalizedCharset($cs);
        if (array_key_exists($normalized, self::$iconvAliases)) {
            return static::$iconvAliases[$normalized];
        }
        return $cs;
    }
535342
function getNames(names) {
    var result = [];

    ['copyright', 'fontFamily', 'uniqueID', 'fontSubfamily', 'licence'].forEach(function(n) {
        if(names[n]) {
            result.push.apply(result, getStrings(names[n], TTF_NAMES[n]));
        }
    });

    result.push.apply(result, getStrings('Generated by node-freetype.', TTF_NAMES.description));
    result.push.apply(result, getStrings('https://github.com/YuhangGe/node-freetype', TTF_NAMES.url));

    result.sort(function (a, b) {
        var orderFields = ['platformID', 'encodingID', 'languageID', 'id'];
        var i;
        for (i = 0; i < orderFields.length; i++) {
            if (a[orderFields[i]] !== b[orderFields[i]]) {
                return a[orderFields[i]] < b[orderFields[i]] ? -1 : 1;
            }
        }
        return 0;
    });

    return result;
}