// newNumFmt generate a xlsxNumFmt according the format code. When the FormatCode is built in, it will return a xlsxNumFmt with the NumFmtId defined in ECMA document, otherwise it will generate a new NumFmtId greater than 164.
977993
func (styles *xlsxStyleSheet) newNumFmt(formatCode string) xlsxNumFmt {
	if compareFormatString(formatCode, "general") {
		return xlsxNumFmt{NumFmtId: 0, FormatCode: "general"}
	}
	// built in NumFmts in xmlStyle.go, traverse from the const.
	numFmtId, ok := builtInNumFmtInv[formatCode]
	if ok {
		return xlsxNumFmt{NumFmtId: numFmtId, FormatCode: formatCode}
	}

	// find the exist xlsxNumFmt
	for _, numFmt := range styles.NumFmts.NumFmt {
		if formatCode == numFmt.FormatCode {
			return numFmt
		}
	}

	// The user define NumFmtId. The one less than 164 in built in.
	numFmtId = builtinNumFmtsCount + 1
	styles.Lock()
	defer styles.Unlock()
	for {
		// get a unused NumFmtId
		if _, ok = styles.numFmtRefTable[numFmtId]; ok {
			numFmtId++
		} else {
			styles.addNumFmt(xlsxNumFmt{NumFmtId: numFmtId, FormatCode: formatCode})
			break
		}
	}
	return xlsxNumFmt{NumFmtId: numFmtId, FormatCode: formatCode}
}
379671
func NewFMSketch(maxSize int) *FMSketch {
	return &FMSketch{
		hashset:  make(map[uint64]bool),
		maxSize:  maxSize,
		hashFunc: murmur3.New64(),
	}
}
958061
func NewFormatter(fraction int, decimal, thousand, grapheme, template string) *Formatter {
	return &Formatter{
		Fraction: fraction,
		Decimal:  decimal,
		Thousand: thousand,
		Grapheme: grapheme,
		Template: template,
	}
}
1149631
func (m *symbol) numEmptyModules() int {
	var count int
	for y := 0; y < m.symbolSize; y++ {
		for x := 0; x < m.symbolSize; x++ {
			if !m.isUsed[y+m.quietZoneSize][x+m.quietZoneSize] {
				count++
			}
		}
	}

	return count
}
683480
func (c *Chunk) AppendMyDecimal(colIdx int, dec *types.MyDecimal) {
	c.columns[colIdx].appendMyDecimal(dec)
}
1341030
func NewFormatter() *Formatter {
	return &Formatter{
		KeyColor:        color.New(color.FgBlue, color.Bold),
		StringColor:     color.New(color.FgGreen, color.Bold),
		BoolColor:       color.New(color.FgYellow, color.Bold),
		NumberColor:     color.New(color.FgCyan, color.Bold),
		NullColor:       color.New(color.FgBlack, color.Bold),
		StringMaxLength: 0,
		DisabledColor:   false,
		Indent:          2,
		Newline:         "\n",
	}
}
696206
func NewAddMetricCommand(ctx Context) (cmd.Command, error) {
	return &AddMetricCommand{ctx: ctx}, nil
}
1114546
func (t *Translator) parseFormat(pattern string, includeDecimalDigits bool) *numberFormat {

	processed := false
	if includeDecimalDigits {
		_, processed = numberFormats[pattern]
	} else {
		_, processed = numberFormatsNoDecimals[pattern]
	}

	if !processed {

		format := new(numberFormat)
		patterns := strings.Split(pattern, ";")

		matches := prefixSuffixRegex.FindAllStringSubmatch(patterns[0], -1)
		if len(matches) > 0 {
			if len(matches[0]) > 1 {
				format.positivePrefix = matches[0][1]
			}
			if len(matches[0]) > 2 {
				format.positiveSuffix = matches[0][2]
			}
		}

		// default values for negative prefix & suffix
		format.negativePrefix = string(t.rules.Numbers.Symbols.Negative) + string(format.positivePrefix)
		format.negativeSuffix = format.positiveSuffix

		// see if they are in the pattern
		if len(patterns) > 1 {
			matches = prefixSuffixRegex.FindAllStringSubmatch(patterns[1], -1)

			if len(matches) > 0 {
				if len(matches[0]) > 1 {
					format.negativePrefix = matches[0][1]
				}
				if len(matches[0]) > 2 {
					format.negativeSuffix = matches[0][2]
				}
			}
		}

		pat := patterns[0]

		if strings.Index(pat, "%") != -1 {
			format.multiplier = 100
		} else if strings.Index(pat, "‰") != -1 {
			format.multiplier = 1000
		} else {
			format.multiplier = 1
		}

		pos := strings.Index(pat, ".")

		if pos != -1 {
			pos2 := strings.LastIndex(pat, "0")
			if pos2 > pos {
				format.minDecimalDigits = pos2 - pos
			}

			pos3 := strings.LastIndex(pat, "#")
			if pos3 >= pos2 {
				format.maxDecimalDigits = pos3 - pos
			} else {
				format.maxDecimalDigits = format.minDecimalDigits
			}

			pat = pat[0:pos]
		}

		p := strings.Replace(pat, ",", "", -1)
		pos = strings.Index(p, "0")
		if pos != -1 {
			format.minIntegerDigits = strings.LastIndex(p, "0") - pos + 1
		}

		p = strings.Replace(pat, "#", "0", -1)
		pos = strings.LastIndex(pat, ",")
		if pos != -1 {
			format.groupSizeFinal = strings.LastIndex(p, "0") - pos
			pos2 := strings.LastIndex(p[0:pos], ",")
			if pos2 != -1 {
				format.groupSizeMain = pos - pos2 - 1
			} else {
				format.groupSizeMain = format.groupSizeFinal
			}
		}

		if includeDecimalDigits {
			numberFormats[pattern] = format
		} else {
			format.maxDecimalDigits = 0
			format.minDecimalDigits = 0
			numberFormatsNoDecimals[pattern] = format
		}

	}

	if includeDecimalDigits {
		return numberFormats[pattern]
	}

	return numberFormatsNoDecimals[pattern]
}
1166095
func gofmt(src []byte) []byte {
	formatted, err := format.Source(src)
	if err != nil {
		// Should never happen, but can arise when developing this code.
		// The user can compile the output to see the error.
		log.Printf("warning: internal error: invalid Go generated: %s", err)
		log.Printf("warning: compile the package to analyze the error")
		return src
	}
	return formatted
}
636729
func NewNumberInRangeQuestion(key string, text string, min int, max int) *Question {
	return &Question{
		Text:           text,
		AnswerKind:     reflect.Int,
		ValidateMinMax: true,
		Minimum:        min,
		Maximum:        max,
		InvalidMessage: fmt.Sprintf("You must enter a number between %d and %d.", min, max),
	}
}
94824
func NewMem(cfg config.Provider) *Fs {
	fs := &afero.MemMapFs{}
	return newFs(fs, cfg)
}
1269809
func newXLMetaFromXLMeta(meta xlMetaV1) xlMetaV1 {
	xlMeta := meta
	xlMeta.Erasure.Checksums = nil
	xlMeta.Parts = nil
	return xlMeta
}
80418
func (n Number) FmtNumber(number float64) string {
	return n.formatNumber(n.parseFormat(n.Formats.Decimal, true), number)
}
1050880
func NewConstImag(i string) (*ConstNumber, bool) {
	z := new(ConstNumber)
	z.Type = ConstComplex
	ok := i[len(i)-1] == 'i'
	if ok {
		_, ok = z.Value.Im.SetString(i[:len(i)-1])
	}
	return z, ok
}
544516
func NewEfm(errorformat string) (*Efm, error) {
	var regpat bytes.Buffer
	var efmp byte
	var i = 0
	var incefmp = func() {
		i++
		efmp = errorformat[i]
	}
	efm := &Efm{}
	regpat.WriteRune('^')
	for ; i < len(errorformat); i++ {
		efmp = errorformat[i]
		if efmp == '%' {
			incefmp()
			// - do not support %>
			if re, ok := fmtpattern[efmp]; ok {
				regpat.WriteString(re)
			} else if efmp == '*' {
				incefmp()
				if efmp == '[' || efmp == '\\' {
					regpat.WriteByte(efmp)
					if efmp == '[' { // %*[^a-z0-9] etc.
						incefmp()
						for efmp != ']' {
							regpat.WriteByte(efmp)
							if i == len(errorformat)-1 {
								return nil, errors.New("E374: Missing ] in format string")
							}
							incefmp()
						}
						regpat.WriteByte(efmp)
					} else { // %*\D, %*\s etc.
						incefmp()
						regpat.WriteByte(efmp)
					}
					regpat.WriteRune('+')
				} else {
					return nil, fmt.Errorf("E375: Unsupported %%%v in format string", string(efmp))
				}
			} else if (efmp == '+' || efmp == '-') &&
				i < len(errorformat)-1 &&
				strchar("DXAEWICZGOPQ", errorformat[i+1]) {
				if efmp == '+' {
					efm.flagplus = true
					incefmp()
				} else if efmp == '-' {
					efm.flagminus = true
					incefmp()
				}
				efm.prefix = efmp
			} else if strchar(`%\.^$?+[`, efmp) {
				// regexp magic characters
				regpat.WriteByte(efmp)
			} else if efmp == '#' {
				regpat.WriteRune('*')
			} else {
				if strchar("DXAEWICZGOPQ", efmp) {
					efm.prefix = efmp
				} else {
					return nil, fmt.Errorf("E376: Invalid %%%v in format string prefix", string(efmp))
				}
			}
		} else { // copy normal character
			if efmp == '\\' && i < len(errorformat)-1 {
				incefmp()
			} else if strchar(`.+*()|[{^$`, efmp) { // escape regexp atoms
				regpat.WriteRune('\\')
			}
			regpat.WriteByte(efmp)
		}
	}
	regpat.WriteRune('$')
	re, err := regexp.Compile(regpat.String())
	if err != nil {
		return nil, err
	}
	efm.regex = re
	return efm, nil
}
184774
func New() locales.Translator {
	return &bm_ML{
		locale:                 "bm_ML",
		pluralsCardinal:        []locales.PluralRule{6},
		pluralsOrdinal:         nil,
		pluralsRange:           nil,
		timeSeparator:          ":",
		currencies:             []string{"ADP", "AED", "AFA", "AFN", "ALK", "ALL", "AMD", "ANG", "AOA", "AOK", "AON", "AOR", "ARA", "ARL", "ARM", "ARP", "ARS", "ATS", "AUD", "AWG", "AZM", "AZN", "BAD", "BAM", "BAN", "BBD", "BDT", "BEC", "BEF", "BEL", "BGL", "BGM", "BGN", "BGO", "BHD", "BIF", "BMD", "BND", "BOB", "BOL", "BOP", "BOV", "BRB", "BRC", "BRE", "BRL", "BRN", "BRR", "BRZ", "BSD", "BTN", "BUK", "BWP", "BYB", "BYN", "BYR", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLE", "CLF", "CLP", "CNH", "CNX", "CNY", "COP", "COU", "CRC", "CSD", "CSK", "CUC", "CUP", "CVE", "CYP", "CZK", "DDM", "DEM", "DJF", "DKK", "DOP", "DZD", "ECS", "ECV", "EEK", "EGP", "ERN", "ESA", "ESB", "ESP", "ETB", "EUR", "FIM", "FJD", "FKP", "FRF", "GBP", "GEK", "GEL", "GHC", "GHS", "GIP", "GMD", "GNF", "GNS", "GQE", "GRD", "GTQ", "GWE", "GWP", "GYD", "HKD", "HNL", "HRD", "HRK", "HTG", "HUF", "IDR", "IEP", "ILP", "ILR", "ILS", "INR", "IQD", "IRR", "ISJ", "ISK", "ITL", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRH", "KRO", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LTT", "LUC", "LUF", "LUL", "LVL", "LVR", "LYD", "MAD", "MAF", "MCF", "MDC", "MDL", "MGA", "MGF", "MKD", "MKN", "MLF", "MMK", "MNT", "MOP", "MRO", "MTL", "MTP", "MUR", "MVP", "MVR", "MWK", "MXN", "MXP", "MXV", "MYR", "MZE", "MZM", "MZN", "NAD", "NGN", "NIC", "NIO", "NLG", "NOK", "NPR", "NZD", "OMR", "PAB", "PEI", "PEN", "PES", "PGK", "PHP", "PKR", "PLN", "PLZ", "PTE", "PYG", "QAR", "RHD", "ROL", "RON", "RSD", "RUB", "RUR", "RWF", "SAR", "SBD", "SCR", "SDD", "SDG", "SDP", "SEK", "SGD", "SHP", "SIT", "SKK", "SLL", "SOS", "SRD", "SRG", "SSP", "STD", "STN", "SUR", "SVC", "SYP", "SZL", "THB", "TJR", "TJS", "TMM", "TMT", "TND", "TOP", "TPE", "TRL", "TRY", "TTD", "TWD", "TZS", "UAH", "UAK", "UGS", "UGX", "USD", "USN", "USS", "UYI", "UYP", "UYU", "UZS", "VEB", "VEF", "VND", "VNN", "VUV", "WST", "XAF", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XEU", "XFO", "XFU", "XOF", "XPD", "XPF", "XPT", "XRE", "XSU", "XTS", "XUA", "XXX", "YDD", "YER", "YUD", "YUM", "YUN", "YUR", "ZAL", "ZAR", "ZMK", "ZMW", "ZRN", "ZRZ", "ZWD", "ZWL", "ZWR"},
		currencyNegativePrefix: "(",
		currencyNegativeSuffix: ")",
		monthsAbbreviated:      []string{"", "zan", "feb", "mar", "awi", "mɛ", "zuw", "zul", "uti", "sɛt", "ɔku", "now", "des"},
		monthsNarrow:           []string{"", "Z", "F", "M", "A", "M", "Z", "Z", "U", "S", "Ɔ", "N", "D"},
		monthsWide:             []string{"", "zanwuye", "feburuye", "marisi", "awirili", "mɛ", "zuwɛn", "zuluye", "uti", "sɛtanburu", "ɔkutɔburu", "nowanburu", "desanburu"},
		daysAbbreviated:        []string{"kar", "ntɛ", "tar", "ara", "ala", "jum", "sib"},
		daysNarrow:             []string{"K", "N", "T", "A", "A", "J", "S"},
		daysWide:               []string{"kari", "ntɛnɛ", "tarata", "araba", "alamisa", "juma", "sibiri"},
		erasAbbreviated:        []string{"J.-C. ɲɛ", "ni J.-C."},
		erasNarrow:             []string{"", ""},
		erasWide:               []string{"jezu krisiti ɲɛ", "jezu krisiti minkɛ"},
		timezones:              map[string]string{"CHAST": "CHAST", "WAST": "WAST", "JDT": "JDT", "SGT": "SGT", "HKT": "HKT", "COT": "COT", "GYT": "GYT", "AKDT": "AKDT", "WART": "WART", "AWDT": "AWDT", "AST": "AST", "WESZ": "WESZ", "UYST": "UYST", "HEPMX": "HEPMX", "MYT": "MYT", "NZST": "NZST", "ACWST": "ACWST", "COST": "COST", "HAST": "HAST", "WIT": "WIT", "AWST": "AWST", "CDT": "CDT", "BOT": "BOT", "HEEG": "HEEG", "EST": "EST", "EDT": "EDT", "MST": "MST", "GFT": "GFT", "ChST": "ChST", "BT": "BT", "ECT": "ECT", "HNPMX": "HNPMX", "AEST": "AEST", "NZDT": "NZDT", "AKST": "AKST", "HKST": "HKST", "CAT": "CAT", "SAST": "SAST", "CLT": "CLT", "HNCU": "HNCU", "ADT": "ADT", "HNOG": "HNOG", "WARST": "WARST", "GMT": "GMT", "CHADT": "CHADT", "HECU": "HECU", "∅∅∅": "∅∅∅", "UYT": "UYT", "CST": "CST", "PST": "PST", "AEDT": "AEDT", "MEZ": "MEZ", "SRT": "SRT", "ARST": "ARST", "HADT": "HADT", "LHST": "LHST", "MDT": "MDT", "EAT": "EAT", "OEZ": "OEZ", "WIB": "WIB", "TMST": "TMST", "ART": "ART", "OESZ": "OESZ", "JST": "JST", "ACWDT": "ACWDT", "MESZ": "MESZ", "HNNOMX": "HNNOMX", "HENOMX": "HENOMX", "WEZ": "WEZ", "WAT": "WAT", "LHDT": "LHDT", "HNPM": "HNPM", "HNT": "HNT", "HAT": "HAT", "CLST": "CLST", "TMT": "TMT", "PDT": "PDT", "ACST": "ACST", "IST": "IST", "HEPM": "HEPM", "WITA": "WITA", "VET": "VET", "HNEG": "HNEG", "HEOG": "HEOG", "ACDT": "ACDT"},
	}
}
137411
func NewMfType(s string) (mfType, error) {
	var e mfType
	err := e.FromString(s)
	if err != nil {
		return 0, err
	}
	return e, nil
}