/*! arqamAR — TypeScript declarations for dist/arqamAR.mjs. MIT licence.
 *  Copied to dist/ by tools/build_dist.py; tests/dist.test.js checks that every option, currency attribute
 *  and export of the engine is declared here. 
 *  @author: Mohsen Alyafei */

/** A number: text ("1234.56", Arabic-Eastern numbers too, "-" before and "%" after allowed), a JS number or a BigInt.
 *  Pass amounts as text: a JS number keeps only about 16 significant digits. */
export type ArqamNumber = string | number | bigint;

/** A switch: "on" or "off" ("" is off); true and false are accepted too. */
export type ArqamSwitch = "on" | "off" | "" | boolean;
/** Arabic-Eastern (١٢٣) "on" or "eastern"; Arabic-Western (123) "off" or "western". Default: by the locale's region, else Arabic-Western. */
export type ArqamDigits = ArqamSwitch | "eastern" | "western";

/** The tashkeel values: the readable names and the short codes */
export type ArqamTashkeelValue = "alif" | "none" | "fatha" | "tanween" | "endings" | "full" | "" | "a" | "n" | "h" | "t" | "p" | "f";
/** arqamAR.optionNames: for each coded option, its readable names and the short code each one stands for */
export interface ArqamOptionNames {
  tashkeel : {none: "n"; alif: "a"; fatha: "h"; tanween: "t"; endings: "p"; full: "f"};
  ierab    : {raf: "r"; nasb: "n"; jarr: "j"};
  legal    : {none: "n"; auto: "a"; full: "f"};
  numSymbol: {code: "i"; symbol: "s"; latin: "l"; name: "c"; none: "sub"; sign: "g"; english: "l"; native: "s"};
  decFormat: {auto: ""; words: "w"; figures: "n"; digits: "sw"; "words-words": "ww"; "words-figures": "wn";
              "figures-words": "nw"; "figures-figures": "nn"; decimal: "d"; slash: "/"};
  ordinal  : {masculine: "m"; feminine: "f"};
}
/** Options for config() and for one call of toWords() / toParts(). Unknown names and bad values throw a TypeError. */
export interface ArqamOptions {
  /** "" for numbers, or a currency code (built in, or added with registerCurrency); the name Intl gives it. */
  currency?: string;
  /** "alif"/"a"/"": tanween on an alif ending only (the default: ريالًا) · "none"/"n": no marks · "fatha"/"h": every fatha tanween ·
   *  "tanween"/"t": all three tanween · "endings"/"p": tanween and the last vowel of each word · "full"/"f": full tashkeel.
   *  The name or the short code, in any letter case */
  tashkeel?: ArqamTashkeelValue;
  /** "raf"/"r": nominative (default) · "nasb"/"n": accusative · "jarr"/"j": genitive · "": the default */
  ierab?: "raf" | "nasb" | "jarr" | "r" | "n" | "j" | "";
  /** Legal form (ثلاثمائة ألف وألفان): "none"/"" (default) · "auto"/"a": hundreds followed by 1 or 2 only ·
   *  "full"/"f": every group with hundreds */
  /** The legal form: "auto" ("" or not given, the default) «مائة ألف وألف», "none" «مائة وألف», "full" every group */
  legal?: "none" | "auto" | "full" | "" | "a" | "f" | "n";
  /** مليار/تريليون (arabic, default) · بليون/تريليون (short) · long scale */
  scale?: "arabic" | "short" | "long" | "a" | "s" | "l";
  /** The figure in brackets after (end) or before (start) the words, or the fraction in brackets (decimals) */
  brackets?: "" | "end" | "start" | "decimals" | "e" | "s" | "d";
  /** The bracket characters, e.g. "[]" or "«»" (default "()") */
  bracketsType?: string;
  /** Label in the brackets: "code"/"i": the ISO code, QAR (default) · "symbol"/"s": ر.ق. · "latin"/"l": QR ·
   *  "name"/"c": the currency's name · "none"/"sub": the figure only · any other text: a symbol of your own */
  /** In the brackets: ISO code (default) · "english"/"latin": QR, else Native, else the code · "native"/"symbol": ر.ق.,
   *  else English, else the code · "sign": the Symbol, one Unicode character (⃁ SAR, € EUR, $ USD), else Native, else the code ·
   *  name · none · or a symbol of your own */
  numSymbol?: "code" | "english" | "native" | "symbol" | "latin" | "name" | "none" | "sign" | "i" | "s" | "l" | "c" | "sub" | "g" | (string & {});
  /** The fraction's form: "auto"/"" (default: currencies their minor unit, numbers words-words) ·
   *  "words"/"w" · "figures"/"n" · "digits"/"sw" · "words-words"/"ww" · "words-figures"/"wn" · "figures-words"/"nw" ·
   *  "figures-figures"/"nn" · "decimal"/"d" · "slash"/"/" */
  decFormat?: "auto" | "words" | "figures" | "digits" | "words-words" | "words-figures" | "figures-words" | "figures-figures" |
              "decimal" | "slash" | "" | "w" | "n" | "sw" | "ww" | "wn" | "nw" | "nn" | "d" | "/";
  /** Decimal places kept in numbers mode (cut, or rounded with rounding:"on"); "" (the default) keeps every decimal */
  decRound?: number | string;
  /** Separators in the brackets only: a character, or a locale tag such as "fr" */
  sepDecimal?: string;
  sepThousands?: string;
  /** Words before and after, e.g. فقط … لا غير */
  prefix?: string;
  suffix?: string;
  /** Returned for a number that cannot be written (default ""); see strict */
  isNaN?: unknown;
  /** The words of a zero amount instead of «صفر ريال قطري», e.g. "لا شيء" (default "": صفر); prefix and suffix are kept */
  zeroWords?: string;
  /** The language of the error messages: "" or "en" English (the default), "ar" Arabic; the call's name stays as it is. The English message is kept in the error's property english */
  errorLanguage?: "" | "en" | "ar";
  /** Figures for groups, words for scale names: مليون، و234 ألفا */
  compact?: ArqamSwitch;
  /** Tanween on the letter before the final alif (ريالاً) */
  tanweenAlif?: ArqamSwitch;
  /** مائة (on, default) or مئة (off) */
  miah?: ArqamSwitch;
  /** ثلاث مائة written apart */
  miahSplit?: ArqamSwitch;
  /** The Arabic comma before و between groups (default on) */
  comma?: ArqamSwitch;
  /** صفر before a fraction of one */
  addZero?: ArqamSwitch;
  /** Arabic-Eastern numbers (٠١٢٣٤٥٦٧٨٩) in the brackets instead of Arabic-Western numbers (0123456789). With no separator
   *  given they use the Arabic separators: the Arabic decimal separator ٫ (U+066B), used in formal and typeset
   *  Arabic numbers, e.g. ٣٫١; the Arabic thousands separator ٬ (U+066C), which groups large numbers into thousands,
   *  e.g. ١٬٠٠٠٬٠٠٠ */
  arabicNumbers?: ArqamDigits;
  /** The word جزء in fractions (default on) */
  decJuz?: ArqamSwitch;
  /** فاصلة instead of و before the fraction */
  decFaslah?: ArqamSwitch;
  /** The whole part only */
  decIgnore?: ArqamSwitch;
  /** الـ in fractions: من المائة (on, default) or من مائة */
  decAL?: ArqamSwitch;
  /** ريال instead of ريال قطري (a qualifier is never dropped) */
  ignoreCountry?: ArqamSwitch;
  /** The figure in brackets shows the currency's places: 1,234.00 (default on) */
  currDecForce?: ArqamSwitch;
  /** Colour markers in the words (|p punctuation, |c currency names, |f fraction, | groups) */
  split?: ArqamSwitch;
  /** Round extra decimal digits half up instead of cutting them */
  rounding?: ArqamSwitch;
  /** Throw a TypeError or RangeError that says why a number cannot be written, instead of returning isNaN */
  strict?: ArqamSwitch;
  /** Read the number as a percentage: خمسة وعشرون بالمائة ("25%" as input does the same) */
  percent?: ArqamSwitch;
  /** The ordinal, masculine or feminine, of a whole number from 1 to 999,999: الحادي عشر / الحادية عشرة */
  ordinal?: "masculine" | "feminine" | "" | "m" | "f";
  /** "off": the ordinal without الـ: أول، ثانٍ، حادٍ وعشرون، خامس عشر; default "on" */
  ordinalDefinite?: "on" | "off" | boolean;
  /** «واحد/اثنان» after the counted noun: "" (default) none (ريال قطري، ريالان قطريان) but in the legal form and the
   *  cheque form (فقط … لا غير), where the number is said twice · "on" always · "off" never */
  emphasisOneTwo?: "" | "on" | "off" | boolean;
  /** An approximate quantity: "about" قرابةَ ألفِ ريالٍ · "over" ما يزيد على · "under" أقلّ من · "atLeast" ما لا يقل عن ·
   *  "atMost" ما لا يزيد على (the number in the genitive after them) · "few" بضعةُ آلافٍ (3-9, whole numbers) ·
   *  "plus" نيّفٌ وعشرون، مائةُ ريالٍ ونيّفٌ (1-9, whole numbers); "" or "none": the exact number (default) */
  approx?: "" | "none" | "about" | "over" | "under" | "atLeast" | "atMost" | "few" | "plus" | "atleast" | "atmost";
  /** The word of approx "about": "qurabah" قرابة (default), "nahw" نحو, "zuhaa" زهاء, "hawali" حوالَيْ */
  approxWord?: "" | "qurabah" | "nahw" | "zuhaa" | "hawali";
  /** With approx, round first to this many significant digits (987450 with 1: قرابة مليون); "" as given */
  approxRound?: number | string;
  /** "small": the smallest part first, as in classical Arabic: خمسون ومائتان، وألفُ ريالٍ; "" or "large": largest first */
  wordOrder?: "" | "large" | "small";
  /** The region, e.g. "ar-QA": its currency (toWords with no code), month names, digits, separators
   *  (1.234,5 in ar-LY, ar-TN, ar-DZ, ar-MA) and time zone, for every method; options given in the call or later win.
   *  The 22 Arab League locales are known (arqamAR.regions); "ar" with another country keeps only its currency in
   *  NumberFormat. */
  locale?: string;
  /** The clock of an exact moment (ISO with Z or an offset, or a Date): "" (the locale's zone, else as written),
   *  "asWritten", "local" (the computer's) or an IANA name such as "Asia/Qatar"; an unknown name is a RangeError */
  timeZone?: string;
  /** How the zone is named after the time: "" or "city" (بتوقيت الدوحة) · "country" (بتوقيت قطر) · "offset"
   *  (بتوقيت غرينتش +3) · "both" (بتوقيت الدوحة (غرينتش +3)) · "off" */
  /** The offset carries a direction mark before its sign: LRM (U+200E), or ALM (U+061C) with Arabic-Eastern numbers. */
  zoneName?: "" | "city" | "country" | "offset" | "both" | "off";
  /** Names for a one-off custom currency (registerCurrency is the better way) */
  currDecimal?: number | string;
  majorSingle?: string; majorSingleC?: string; majorPlural?: string; majorPluralC?: string;
  minorSingle?: string; minorSingleC?: string; minorPlural?: string; minorPluralC?: string;
  majorSingleT?: string; majorSingleCT?: string; majorPluralT?: string; majorPluralCT?: string;
  minorSingleT?: string; minorSingleCT?: string; minorPluralT?: string; minorPluralCT?: string;
  /** 1: feminine. With a code: the custom currency's gender; without one: numbers for a feminine noun (ست وعشرون) */
  majorGender?: 0 | 1 | "0" | "1" | boolean | "";
  minorGender?: 0 | 1 | "0" | "1" | boolean | "";
}

/** Attributes for registerCurrency(). A new code needs majorSingle and majorPlural; a singular and its plural go together. */
export interface ArqamCurrencyAttributes {
  /** Decimal places, 0 to 18 */
  currDecimal?: number | string;
  majorSingle?: string; majorPlural?: string; majorSingleC?: string; majorPluralC?: string;
  minorSingle?: string; minorPlural?: string; minorSingleC?: string; minorPluralC?: string;
  /** The same names with full tashkeel, used with tashkeel:"f" */
  majorSingleT?: string; majorPluralT?: string; majorSingleCT?: string; majorPluralCT?: string;
  minorSingleT?: string; minorPluralT?: string; minorSingleCT?: string; minorPluralCT?: string;
  /** 0 masculine (default), 1 feminine */
  majorGender?: 0 | 1 | "0" | "1" | boolean;
  minorGender?: 0 | 1 | "0" | "1" | boolean;
  symbolLatin?: string;
  symbolNative?: string;
  /** The currency's Symbol, one Unicode character, for numSymbol "sign", e.g. "\u20C1"; "" removes it */
  symbol?: string;
  /** The same as symbol (an older name) */
  sign?: string;
  /** Decimals written as given (crypto); with currDecimal 0: any number of decimals, read as typed */
  openDecimals?: boolean;
  /** A fixed phrase after the noun and its number word, never declined: كيلومتر واحد في الساعة */
  qualifier?: string;
  qualifierT?: string;
  /** The second term of an iḍāfa, right after the noun: ملعقةُ شايٍ واحدةٌ، ملعقتا شايٍ */
  idafa?: string;
  idafaT?: string;
  /** The place name; the adjective (majorSingleC) is made from it with nisba() unless given: قطر -> قطري */
  country?: string;
}

/** ToParts(): the words in their parts. Without colours,
 *  text = [prefix, [sign, whole + fraction] joined by " ", suffix] joined by " ", with brackets before or after. */
export interface ArqamParts {
  /** The same words as toWords() */
  text: string;
  /** false when the number could not be written (text is then the isNaN option) */
  valid: boolean;
  negative: boolean;
  percent: boolean;
  /** "m" or "f" for an ordinal, else "" */
  ordinal: "" | "m" | "f";
  prefix: string;
  /** The negative word (سالب) as written, or "" */
  sign: string;
  /** The whole part with its currency name; all the words of a percentage or an ordinal */
  whole: string;
  /** The fraction with its joiner, e.g. "، وخمسون درهما" */
  fraction: string;
  suffix: string;
  /** The brackets as written, e.g. "(-1,250.50 QAR)", or "" */
  brackets: string;
  /** The brackets' content, e.g. "-1,250.50 QAR", or "" */
  figure: string;
  /** The approximate words before the number (قرابة، ما يزيد على), or "" */
  approx?: string;
  /** «ونيّف» after the number, or "" */
  approxTrail?: string;
}

/** A date for toDate(): text ("18/11/2026", "2026-11-18", "2026-11-18T10:30", "18 نوفمبر 2026", "November 18, 2026",
 *  Arabic-Eastern numbers, the separator ؍) or a Date (its own calendar day). With input:"h" text is a Hijri date ("8/6/1448"). */
export type ArqamDate = string | Date;
/** A date with a time for toDateTime(): ISO text ("2026-11-24T06:15:00Z", "2026-11-24T09:15:00+03:00", the compact
 *  "20261124T061500Z", or with no zone: as written) or a Date. */
export type ArqamDateTime = string | Date;

/** Options for toDate(). Unknown names and bad values throw a TypeError. */
export interface ArqamDateOptions {
  /** The region (its month names; with timeZone, the day of a moment in its zone) */
  locale?: string;
  /** An exact moment (ISO with Z or an offset, or a Date) is written as its day in this zone */
  timeZone?: string;
  /** G: Gregorian · h: Hijri (Umm al-Qura) · b: both, joined by «الموافق». Default: the calendar the date was read in: Gregorian, or Hijri for a Hijri date. */
  calendar?: "" | "g" | "h" | "b" | "gregorian" | "hijri" | "both";
  /** The calendar of the date given: g or h (Hijri, e.g. "8/6/1448", "8 جمادى الآخرة 1448"). Not needed when the year is followed by «هـ», «هجري», AH (Hijri) or «م», «ميلادي», AD, CE (Gregorian), or the month is a Hijri month by name; otherwise Gregorian. A mark that contradicts it is an error. */
  input?: "" | "g" | "h" | "gregorian" | "hijri";
  /** words: الثامن عشر من شهر نوفمبر لعام ألفين وستة وعشرين للميلاد (default) · ordinal: … سنة 2026 ميلادية · compact: 18 نوفمبر 2026م */
  style?: "" | "words" | "ordinal" | "compact";
  /** Gregorian month names: gulf يناير (default) · levant كانون الثاني · both يناير/كانون الثاني · maghreb جانفي · morocco يناير/غشت/دجنبر */
  months?: "" | "gulf" | "levant" | "both" | "maghreb" | "morocco";
  /** The word before the year: liaam لعام (words) · sana سنة (ordinal) · aam عام · none (compact) */
  year?: "" | "none" | "liaam" | "sana" | "aam";
  /** long: للميلاد / ميلادية / ميلادي, agreeing with the year word · short: م / هـ (compact) · none */
  era?: "" | "long" | "short" | "none";
  /** غرة instead of the first day */
  gora?: ArqamSwitch;
  /** dmy (default): 05/06/2026 is 5 June · mdy: month/day/year */
  order?: "" | "dmy" | "mdy";
  /** The case of the date's day, given in the call (a standing config() ierab does not apply): raf السادسُ والعشرون
   *  (default) · nasb السادسَ والعشرين (an adverb of time) · jarr السادسِ والعشرين (after في، بتاريخ …) */
  ierab?: ArqamOptions["ierab"];
  /** Shared with the number options */
  tashkeel?: ArqamOptions["tashkeel"];
  arabicNumbers?: ArqamDigits;
  miah?: ArqamSwitch;
  strict?: ArqamSwitch;
  isNaN?: unknown;
  /** The year in words smallest part first: سنة ست وعشرين وألفين */
  wordOrder?: ArqamOptions["wordOrder"];
}

/** A time for toTime(): text ("15:45", "3:15 pm", "3:15 م", "07:05:30", Arabic-Eastern numbers) or a Date (its
 *  local time). A duration may have more than 23 hours (up to 999). */
export type ArqamTime = string | Date;

/** Options for toTime(). Unknown names and bad values throw a TypeError. */
export interface ArqamTimeOptions {
  /** common: الساعة الثالثة وخمس وأربعون دقيقة عصرًا (default) · exact: الساعة الثالثة وخمس وأربعون دقيقة مساءً ·
   *  h24: الساعة الخامسة عشرة وخمس وأربعون دقيقة · duration: 2:30 -> ساعتان ونصف */
  timeStyle?: "" | "common" | "exact" | "h24" | "duration";
  /** The part of the day (default on). 0:01-0:59 is «بعد منتصف الليل» in every clock style. common: ليلًا، فجرًا،
   *  صباحًا، ظهرًا، عصرًا، مساءً · exact: صباحًا (1:00-11:59), ظهرًا (12:00), مساءً (12:01-23:59) · h24: none */
  timePeriod?: ArqamSwitch;
  /** The hour's parts in "common" only: الساعة الرابعة إلا الربع عصرًا (default off: the minutes are counted).
   *  With another timeStyle it throws a TypeError. */
  timeParts?: ArqamSwitch;
  /** The seconds when they are not 00 (default on) */
  timeSeconds?: ArqamSwitch;
  /** The case of the time, given in the call: raf الساعةُ العاشرةُ (default) · nasb الساعةَ العاشرةَ ·
   *  jarr الساعةِ العاشرةِ (في الساعةِ …); a duration: ساعتان ونصف · ساعتين ونصفًا · ساعتين ونصفٍ */
  ierab?: ArqamOptions["ierab"];
  /** «الساعة» first (default on) */
  timeWord?: ArqamSwitch;
  /** Shared with the number options */
  tashkeel?: ArqamOptions["tashkeel"];
  tanweenAlif?: ArqamSwitch;
  miah?: ArqamSwitch;
  strict?: ArqamSwitch;
  isNaN?: unknown;
  /** Arabic-Eastern numbers in the zone's offset (غرينتش +٣) */
  arabicNumbers?: ArqamDigits;
  /** The region, the zone of a moment and how it is named (see ArqamOptions) */
  locale?: string;
  timeZone?: string;
  zoneName?: ArqamOptions["zoneName"];
}

/** Options of toDateTime(): those of toDate and of toTime (not timeStyle "duration"). */
export interface ArqamDateTimeOptions extends Omit<ArqamDateOptions, "locale" | "timeZone">, Omit<ArqamTimeOptions, "tashkeel" | "miah" | "strict" | "isNaN" | "timeStyle"> {
  timeStyle?: "" | "common" | "exact" | "h24";
}

/** One of the 22 Arab locales in arqamAR.regions */
export interface ArqamRegion {
  timeZone: string; currency: string; months: "gulf" | "levant" | "maghreb" | "morocco";
  digits: "arab" | "latn"; separators: string; city: string; cityT: string; country: string; countryT: string;
}
/** One named zone in arqamAR.timeZones (own: the name given with registerTimeZone) */
export interface ArqamZoneName {
  city?: string; cityT?: string; country?: string; countryT?: string; hub?: boolean; own?: string;
}

/** A fraction for toFraction(): text ("3/4", "3 1/2", "3½", "¾", "11/4", "٣/٤", a whole number "5" or a decimal "2.5")
 *  or a JS number. */
export type ArqamFraction = string | number;

/** Options for toFraction(). Unknown names and bad values throw a TypeError. */
export interface ArqamFractionOptions {
  /** named: ثلاثة أرباع (default; halves to tenths, else «أجزاء من») · parts: ثلاثة أجزاء من أربعة · math: ثلاثة على أربعة */
  fractionForm?: "" | "named" | "parts" | "math";
  /** An improper fraction as a whole number and a fraction: 11/4 -> اثنان وثلاثة أرباع (default on; off: أحد عشر ربعًا) */
  fractionMixed?: ArqamSwitch;
  /** Simplify first: 2/4 -> نصف (default off; a decimal is always simplified) */
  fractionSimplify?: ArqamSwitch;
  /** With a currency or unit, «واحد/اثنان» after the noun: default off («كيلومتر ونصف»); on: «كيلومتر واحد ونصف» */
  emphasisOneTwo?: ArqamSwitch;
  /** The case of the fraction, given in the call: raf ثلثٌ (default) · nasb ثلثًا، ثلثَ ريالٍ · jarr ثلثٍ، ثلثَيْ ريالٍ */
  ierab?: ArqamOptions["ierab"];
  /** With a code: minor (default): the minor unit when the amount is exact (2 1/2 QAR -> ريالان قطريان اثنان، وخمسون درهمًا) ·
   *  named: the fraction word (ريالان قطريان اثنان ونصف، نصف ريال قطري) */
  fractionUnit?: "" | "minor" | "named";
  /** Shared with the number options */
  tashkeel?: ArqamOptions["tashkeel"];
  tanweenAlif?: ArqamSwitch;
  currency?: string;
  miah?: ArqamSwitch;
  strict?: ArqamSwitch;
  isNaN?: unknown;
  ignoreCountry?: ArqamSwitch;
  comma?: ArqamSwitch;
}

/** The styles of arqamAR.NumberFormat. decimal, percent, currency and unit as in Intl; ordinal,
 *  fraction, time and date are Arqam's own (toWords with ordinal, toFraction, toTime, toDate). */
export type ArqamNumberFormatStyle = "decimal" | "percent" | "currency" | "unit" | "ordinal" | "fraction" | "time" | "date" | "dateTime";

/** Options of arqamAR.NumberFormat: the Intl names below and every Arqam option (Arqam's name wins when both are
 *  given). The options of toFraction (fraction...), toTime (time...) and toDate (calendar, months, year, era, order,
 *  gora, input; and dateForm for toDate's style) go with their style only. Intl options for figures (useGrouping,
 *  notation, minimumFractionDigits …) are refused with a RangeError. */
export interface ArqamNumberFormatOptions extends Omit<ArqamOptions, "locale">,
    Omit<ArqamTimeOptions, keyof ArqamOptions>, Omit<ArqamFractionOptions, keyof ArqamOptions>, Omit<ArqamDateOptions, "style" | "calendar" | keyof ArqamOptions> {
  /** default "decimal" */
  style?: ArqamNumberFormatStyle;
  /** style "currency" (and "fraction", for an amount): an ISO code ("QAR"); default: the currency of the locale's country (ar-QA -> QAR) */
  currency?: string;
  /** style "currency": the figure's sign in brackets: code · symbol and narrowSymbol (the Symbol, $) · name · sign (= symbol) ·
   *  native (ر.ق.) · english (QR). Arqam: numSymbol */
  currencyDisplay?: "code" | "symbol" | "narrowSymbol" | "name" | "sign" | "native" | "english";
  /** style "unit" (with the units add-on): an Intl name ("kilometer", "kilometer-per-hour"), an Arqam key ("A05") or
   *  the Arabic name ("كيلومتر") */
  unit?: string;
  /** style "unit": "long" only (the unit's name in words) */
  unitDisplay?: "long";
  /** "arab": Arabic-Eastern numbers, as -u-nu-arab in the locale; "latn": Western. Arqam: arabicNumbers */
  numberingSystem?: "arab" | "latn";
  /** style "date": gregory · islamic / islamic-umalqura (Umm al-Qura) · or Arqam's gregorian, hijri, both (g, h, b) */
  calendar?: "gregory" | "islamic" | "islamic-umalqura" | "" | "g" | "h" | "b" | "gregorian" | "hijri" | "both";
  /** style "date": toDate's style: words (default), ordinal, compact */
  dateForm?: "" | "words" | "ordinal" | "compact";
  /** styles decimal, percent, currency and unit: the places of the number (0-100). Default, as Intl: 3 for a decimal
   *  and a unit, 0 for a percentage; a currency rounds to its minor unit */
  maximumFractionDigits?: number;
  /** halfExpand (round half up, the default, as Intl) or trunc (cut) */
  roundingMode?: "halfExpand" | "trunc";
  /** auto / negative: «سالب» before a negative number (default) · always: «موجب» before a number that is not negative ·
   *  exceptZero: «موجب» before a number above zero · never: no sign */
  signDisplay?: "auto" | "always" | "exceptZero" | "negative" | "never";
  /** taken for Intl's sake; there is one locale to choose */
  localeMatcher?: "lookup" | "best fit";
}

/** What resolvedOptions() gives: the locale, the style and the options in force (readable names: tashkeel "full"). */
export interface ArqamResolvedOptions extends ArqamNumberFormatOptions {
  locale: string;
  style: ArqamNumberFormatStyle;
}

/** The type of a part of the words. The Intl names where Intl has one; Arqam's own: minorCurrency, minorUnit,
 *  denominator («جزءا من المائة»), ordinal, prefix, suffix and figure. Scale words stay in integer. */
export type ArqamPartType = "literal" | "integer" | "fraction" | "currency" | "minorCurrency" | "unit" | "minorUnit" |
  "denominator" | "decimal" | "percentSign" | "minusSign" | "ordinal" | "prefix" | "suffix" | "figure" | "approx" |
  "day" | "month" | "year" | "era" | "hour" | "minute" | "second" | "dayPeriod" | "timeZone";

/** A part of the figure in brackets, as Intl cuts figures: (-1,250.50 QAR). */
export interface ArqamFigurePart {
  type: "literal" | "minusSign" | "integer" | "group" | "decimal" | "fraction" | "percentSign" | "currency" | "unit";
  value: string;
  /** True when the currency part is a new Unicode sign (give it a font that has the sign) */
  sign?: true;
  /** The sign's code point, e.g. "U+20C1" */
  codepoint?: string;
}

/** One part of formatToParts(). Joining every value gives format() exactly. */
export interface ArqamPart {
  type: ArqamPartType;
  value: string;
  /** only on a part of type "figure": the figure cut as Intl would cut it */
  parts?: ArqamFigurePart[];
}

/** One part of formatRangeToParts(): which value it belongs to, as in Intl. */
export interface ArqamRangePart extends ArqamPart {
  source: "startRange" | "endRange" | "shared";
}

/** A formatter: format() and formatToParts() are bound, so list.map(nf.format) works; the object is frozen. */
export interface ArqamNumberFormatInstance {
  format(x: ArqamNumber | ArqamTime | ArqamFraction | ArqamDate): string;
  format(x: Array<ArqamNumber | ArqamTime | ArqamFraction | ArqamDate>): string[];
  /** The words of format(x) as a list of {type, value}, in order; a value that cannot be written gives [] (or the isNaN text) */
  formatToParts(x: ArqamNumber | ArqamTime | ArqamFraction | ArqamDate): ArqamPart[];
  formatToParts(x: Array<ArqamNumber | ArqamTime | ArqamFraction | ArqamDate>): ArqamPart[][];
  /** «من A إلى B», both values in the genitive; equal values give one value; a start after the end is a RangeError */
  formatRange(start: ArqamNumber | ArqamTime | ArqamFraction | ArqamDate, end: ArqamNumber | ArqamTime | ArqamFraction | ArqamDate): string;
  /** How the formatter writes x: the method, the value it passes and the options (for arqamExplain's explain.range) */
  plan(x: ArqamNumber | ArqamTime | ArqamFraction | ArqamDate): {method: "toWords" | "toTime" | "toFraction" | "toDate" | "toDateTime"; value: unknown; options: Record<string, unknown>};
  /** The parts of formatRange(), each with source "startRange", "endRange" or "shared" */
  formatRangeToParts(start: ArqamNumber | ArqamTime | ArqamFraction | ArqamDate, end: ArqamNumber | ArqamTime | ArqamFraction | ArqamDate): ArqamRangePart[];
  resolvedOptions(): ArqamResolvedOptions;
}

/** arqamAR.NumberFormat: with or without new; the locale is optional ("ar", or the standing option locale), and
 *  an object first is the options: NumberFormat({tashkeel: "full"}). Only Arabic locales ("ar", "ar-QA", "ar-SA-u-nu-arab"). */
export interface ArqamNumberFormatConstructor {
  new (locales?: string | string[], options?: ArqamNumberFormatOptions): ArqamNumberFormatInstance;
  new (options?: ArqamNumberFormatOptions): ArqamNumberFormatInstance;
  (locales?: string | string[], options?: ArqamNumberFormatOptions): ArqamNumberFormatInstance;
  (options?: ArqamNumberFormatOptions): ArqamNumberFormatInstance;
  /** The Arabic locales of the list, in their canonical form */
  supportedLocalesOf(locales?: string | string[]): string[];
  readonly styles: ArqamNumberFormatStyle[];
}

/** The currency table: code -> its row of up to 24 slots (see the developer manual, §2.5). */
export type ArqamCurrencyTable = Record<string, unknown[]>;

/** Nisba() options: feminine gives قطرية، كورية شمالية. */
export interface ArqamNisbaOptions {
  feminine?: boolean;
}
/** RemoveTashkeel() options: "on" also removes tatweel ـ / the hamza from the alif only, آ أ إ ٱ -> ا. */
export interface ArqamTashkeelOptions {
  tatweel?: "on" | "off";
  hamza?: "on" | "off";
}

/** An instance from createArqam(): its own options, untouched by the global arqamAR and other instances.
 *  registerCurrency() writes the shared currency table. */
export interface ArqamInstance {
  toWords(n: ArqamNumber, options?: ArqamOptions | string): string;
  toWords(n: ArqamNumber[], options?: ArqamOptions | string): string[];
  toParts(n: ArqamNumber, options?: ArqamOptions | string): ArqamParts;
  toParts(n: ArqamNumber[], options?: ArqamOptions | string): ArqamParts[];
  toDate(d: ArqamDate, options?: ArqamDateOptions): string;
  toDate(d: ArqamDate[], options?: ArqamDateOptions): string[];
  toTime(t: ArqamTime, options?: ArqamTimeOptions): string;
  toTime(t: ArqamTime[], options?: ArqamTimeOptions): string[];
  toFraction(f: ArqamFraction, options?: ArqamFractionOptions): string;
  toFraction(f: ArqamFraction[], options?: ArqamFractionOptions): string[];
  toDateTime(x: ArqamDateTime, options?: ArqamDateTimeOptions): string;
  toDateTime(x: ArqamDateTime[], options?: ArqamDateTimeOptions): string[];
  registerTimeZone(zone: string, name: string | null): string | null;
  config(options?: ArqamOptions): void;
  options(): ArqamOptions;
  reset(): void;
  registerCurrency(code: string, attributes: ArqamCurrencyAttributes): unknown[];
  removeTashkeel(text: string, options?: ArqamTashkeelOptions): string;
  removeTashkeel(text: string[], options?: ArqamTashkeelOptions): string[];
  /** The نسبة adjective of a place name: قطر -> قطري، كوريا الشمالية -> كوري شمالي */
  nisba(name: string, options?: ArqamNisbaOptions): string;
}

export interface Arqam {
  /** The words; a 2nd parameter that is text is a currency code. */
  toWords(n: ArqamNumber, options?: ArqamOptions | string): string;
  toWords(n: ArqamNumber[], options?: ArqamOptions | string): string[];
  toParts(n: ArqamNumber, options?: ArqamOptions | string): ArqamParts;
  toParts(n: ArqamNumber[], options?: ArqamOptions | string): ArqamParts[];
  /** A date in words; an array gives an array. */
  toDate(d: ArqamDate, options?: ArqamDateOptions): string;
  toDate(d: ArqamDate[], options?: ArqamDateOptions): string[];
  /** A time in words: الساعة الرابعة إلا الربع عصرًا; an array gives an array. */
  toTime(t: ArqamTime, options?: ArqamTimeOptions): string;
  toTime(t: ArqamTime[], options?: ArqamTimeOptions): string[];
  /** A typed fraction in words: 3/4 -> ثلاثة أرباع، 3 1/2 -> ثلاثة ونصف; an array gives an array. */
  toFraction(f: ArqamFraction, options?: ArqamFractionOptions): string;
  toFraction(f: ArqamFraction[], options?: ArqamFractionOptions): string[];
  /** The date, «، », the time and its zone: …، الساعة التاسعة وخمس عشرة دقيقة صباحا بتوقيت الدوحة */
  toDateTime(x: ArqamDateTime, options?: ArqamDateTimeOptions): string;
  toDateTime(x: ArqamDateTime[], options?: ArqamDateTimeOptions): string[];
  /** Your own Arabic name for any IANA zone (or instead of the built-in one); null takes it away */
  registerTimeZone(zone: string, name: string | null): string | null;
  /** The 22 Arab locales and what each gives */
  readonly regions: Record<string, ArqamRegion>;
  /** Every zone with an Arabic name: the 22, the 35 hubs and your own */
  readonly timeZones: Record<string, ArqamZoneName>;
  /** The engine's building blocks (cardinal, ordinal, count, parseDate, hijri, toCase, normalize, …) */
  readonly utils: ArqamUtils;
  /** A new instance with its own options, starting from the defaults. */
  createArqam(options?: ArqamOptions): ArqamInstance;
  /** Standing options for the calls that follow. */
  config(options?: ArqamOptions): void;
  /** Adds or modifies a currency for the session; returns a copy of its row. Throws a TypeError on a mistake. */
  registerCurrency(code: string, attributes: ArqamCurrencyAttributes): unknown[];
  /** Back to the default options (registered currencies stay). */
  reset(): void;
  /** A copy of the current options. */
  options(): ArqamOptions;
  /** Any text without its tashkeel: the 113 Arabic marks; an array gives an array. */
  removeTashkeel(text: string, options?: ArqamTashkeelOptions): string;
  removeTashkeel(text: string[], options?: ArqamTashkeelOptions): string[];
  /** The نسبة adjective of a place name: قطر -> قطري، كوريا الشمالية -> كوري شمالي */
  nisba(name: string, options?: ArqamNisbaOptions): string;
  readonly version: string;
  readonly currencies: ArqamCurrencyTable;
  /** The Symbol of every currency that has one, by code: {SAR: "\u20C1", USD: "$", EUR: "€", …} */
  readonly symbols: Record<string, string>;
  /** The same as symbols (an older name) */
  readonly signs: Record<string, string>;
  readonly defaults: ArqamOptions;
  /** The readable name of each coded value, e.g. optionNames.tashkeel.full === "f" */
  readonly optionNames: ArqamOptionNames;
  /** The Intl-style formatter: new arqamAR.NumberFormat("ar-QA", {style: "currency"}).format(1234.5) */
  readonly NumberFormat: ArqamNumberFormatConstructor;
  /** With the units add-on loaded (arqamUnits.js / "arqam/units"): the units for NumberFormat style "unit" */
  units?: import("./arqamUnits.mjs").ArqamUnits;
  /** With arqamWordsToNumbers loaded: the number in the words, or null (the reader's value()) */
  fromWords?(text: string, options?: object): string | null;
  /** With arqamWordsToNumbers loaded: a date toDate() wrote, back to "YYYY-MM-DD" ("… هـ" for Hijri), or null */
  fromDate?(text: string): string | null;
  /** With arqamWordsToNumbers loaded: a time toTime() wrote, back to "HH:MM", or null */
  fromTime?(text: string): string | null;
  /** With arqamWordsToNumbers loaded: every number in a text (the reader's find()) */
  findNumbers?(text: string, options?: object): object[];
  /** With arqamWordsToNumbers loaded: do the words say the number? (the reader's verify()) */
  verify?(words: string, number: string | number | bigint, options?: object): {ok: boolean; reason: string; read: string | null; expected: string; currency: string | null};
  /** With arqamExplain loaded: the grammar of the words, word by word (see arqamExplain.d.mts for the result). */
  explain?: ((number: ArqamNumber, options?: ArqamOptions) => import("./arqamExplain.mjs").ArqamExplanation) &
            ((numbers: ArqamNumber[], options?: ArqamOptions) => import("./arqamExplain.mjs").ArqamExplanation[]) &
            {date(input: ArqamDate, options?: ArqamDateOptions): import("./arqamExplain.mjs").ArqamExplanation};
}

/** The Gregorian and Hijri day of a parsed date. */
export interface ArqamDay { year: number; month: number; day: number; }
/** arqamAR.utils, the engine's building blocks for developers. Each one that writes words takes the
 *  toWords options (tashkeel, ierab, …). A mistake throws a TypeError or RangeError named arqamAR.utils.<name>. */
export interface ArqamUtils {
  /** The number words alone: cardinal(13, {gender: "feminine"}) -> ثلاث عشرة */
  cardinal(n: ArqamNumber, options?: ArqamOptions & {gender?: "masculine" | "feminine" | "m" | "f"}): string;
  /** The ordinal: ordinal(21, {gender: "feminine", definite: false}) -> حادية وعشرون */
  ordinal(n: ArqamNumber, options?: ArqamOptions & {gender?: "masculine" | "feminine" | "m" | "f"; definite?: boolean | "on" | "off"}): string;
  /** Any counted noun with the engine's grammar: count(11, {single: "سيارة", plural: "سيارات", gender: "feminine"}) ->
   *  إحدى عشرة سيارة. singleT / pluralT: the vowelled forms for full tashkeel (the plural in the genitive). 1 and 2 are the
   *  noun alone (كتاب، كتابان) unless keepOne. Whole numbers only (a RangeError otherwise). */
  count(n: ArqamNumber, options: ArqamOptions & {single: string; plural: string; gender?: "masculine" | "feminine" | "m" | "f";
        singleT?: string; pluralT?: string; keepOne?: boolean}): string;
  /** The scale word of 10^(3 × power): scaleName(3) -> مليار */
  scaleName(power: number | bigint, options?: {plural?: boolean; tashkeel?: boolean; scale?: "arabic" | "short" | "long"}): string;
  /** A percentage: percent(25) -> خمسة وعشرون بالمائة */
  percent(n: ArqamNumber, options?: ArqamOptions): string;
  /** A date as Arqam reads it (or a TypeError/RangeError that says why) */
  parseDate(text: ArqamDate, options?: {input?: "g" | "h" | "gregorian" | "hijri"; order?: "dmy" | "mdy"}): ArqamDay & {hijri: ArqamDay | null; date: Date};
  /** A time of day, or a duration */
  parseTime(text: ArqamTime, options?: {duration?: boolean}): {hour: number; minute: number; second: number};
  /** A typed fraction: "3 1/2", "¾", "2.5" */
  parseFraction(text: ArqamFraction): {whole: string; numerator: number; denominator: number};
  /** The Hijri (Umm al-Qura) day of a date */
  hijri(date: Date | string): ArqamDay;
  /** The Gregorian day of a Hijri date (a RangeError if that day does not exist) */
  fromHijri(year: number, month: number, day: number): ArqamDay & {date: Date};
  /** Number words in another case: toCase("السادسُ والعشرون", "jarr") -> السادسِ والعشرين */
  toCase(words: string, ierab: "raf" | "nasb" | "jarr" | "r" | "n" | "j"): string;
  /** Text made comparable: no tashkeel or tatweel; أ إ آ ٱ -> ا، ى -> ي، ة -> ه، ؤ -> و، ئ -> ي */
  normalize(text: string): string;
  /** Arabic-Eastern or Persian digits to Arabic-Western ("western", the default), or Arabic-Western to Arabic-Eastern */
  digits(text: string, to?: "western" | "eastern"): string;
  /** The marks in Unicode's standard order (a letter, its vowel, then the shadda) */
  markOrder(text: string): string;
  /** "Did you mean": the nearest name of the list, or "" */
  suggest(word: string, list: string[], options?: {distance?: number}): string;
  /** Every option once, and what toDate, toTime, toFraction and toDateTime take */
  readonly options: {options: Record<string, {default: string | number | null; kind: "switch" | "choice" | "text"; values: string[] | null; names: Record<string, string> | null}>;
                     calls: Record<"toDate" | "toTime" | "toFraction" | "toDateTime", {own?: string[]; shared: string[]}>};
}

declare const arqamAR: Arqam;
/** A language engine of the library: the words of a number or an amount in its language. */
export interface ArqamLanguage {
  version: string;
  toWords(n: ArqamNumber, options?: object | string): string;
  config(options?: object): unknown;
  registerCurrency(code: string, attributes: unknown): unknown;
  [name: string]: unknown;
}
/** The library's NumberFormat, as Intl's one NumberFormat: the first locale whose language is loaded decides (ar, en …),
 *  and the call goes to that engine's NumberFormat with its own options; no locale: Arabic. */
export interface ArqamLibraryNumberFormat {
  new (locales: string | string[], options?: ArqamNumberFormatOptions | import("./arqamEN.mjs").ArqamENNumberFormatOptions): ArqamNumberFormatInstance | import("./arqamEN.mjs").ArqamENNumberFormat;
  new (options?: ArqamNumberFormatOptions): ArqamNumberFormatInstance;
  (locales: string | string[], options?: ArqamNumberFormatOptions | import("./arqamEN.mjs").ArqamENNumberFormatOptions): ArqamNumberFormatInstance | import("./arqamEN.mjs").ArqamENNumberFormat;
  (options?: ArqamNumberFormatOptions): ArqamNumberFormatInstance;
  /** The locales of the list in a language Arqam has loaded */
  supportedLocalesOf(locales?: string | string[]): string[];
  readonly styles: ArqamNumberFormatStyle[];
}
/** The library, shaped as Intl: the locale chooses the language (Arabic by default); the other methods are Arabic. */
export interface ArqamLibrary extends Omit<Arqam, "NumberFormat" | "toWords"> {
  /** arqam(n, locales, options) is arqam.toWords(n, locales, options) */
  (n: ArqamNumber, locales?: string | string[], options?: ArqamNumberFormatOptions | import("./arqamEN.mjs").ArqamENNumberFormatOptions): string;
  (n: ArqamNumber, options?: ArqamNumberFormatOptions): string;
  /** Every language, chosen by the locale */
  readonly NumberFormat: ArqamLibraryNumberFormat;
  /** As n.toLocaleString(locales, options): the words of new arqam.NumberFormat(locales, options).format(n).
   *  The options may come second when there is no locale. */
  toWords(n: ArqamNumber, locales?: string | string[], options?: ArqamNumberFormatOptions | import("./arqamEN.mjs").ArqamENNumberFormatOptions): string;
  toWords(n: ArqamNumber, options?: ArqamNumberFormatOptions): string;
  toWords(n: ArqamNumber[], locales?: string | string[], options?: ArqamNumberFormatOptions | import("./arqamEN.mjs").ArqamENNumberFormatOptions): string[];
  toWords(n: ArqamNumber[], options?: ArqamNumberFormatOptions): string[];
  /** The amount in Arabic and English, with the figure (needs "arqam/en"). */
  toBilingual(n: ArqamNumber, code: string, options?: ArqamJoinOptions): {ar: string; en: string; figure: string};
  /** The amount in each language asked for, with the figure. */
  toLanguages(n: ArqamNumber, code: string, languages: string[], options?: ArqamJoinOptions): {[language: string]: string; figure: string};
  /** The wording of a cheque, invoice, receipt or contract article, in one language or several. */
  toClause: {
    (kind: ArqamDocument, n: ArqamNumber, code: string, options?: ArqamClauseOptions & {lang?: string}): ArqamClause;
    (kind: ArqamDocument, n: ArqamNumber, code: string, options: ArqamClauseOptions & {lang: string[]}): {[language: string]: ArqamClause} & {text: string};
    readonly wording: {[language: string]: {[kind: string]: {[label: string]: string}}};
    readonly kinds: ArqamDocument[];
  };
}
export type ArqamDocument = "cheque" | "invoice" | "receipt" | "contract";
/** Options of toBilingual() and toLanguages(). */
export interface ArqamJoinOptions {
  /** "off" leaves out «فقط … لا غير» and "Only". */
  only?: "on" | "off" | boolean;
  /** Where "Only" goes in English (default "end"). */
  onlyEn?: "end" | "start";
  /** The Arabic tashkeel (default "a": the tanween on the alif, as on cheques). */
  tashkeel?: string;
  /** The English style (default "uk": One Thousand Two Hundred and Fifty). */
  style?: "uk" | "us";
}
/** Options of toClause(). */
export interface ArqamClauseOptions extends ArqamJoinOptions {
  payee?: string; for?: string; ref?: string;
  date?: string | Date;
  /** The Hijri date beside the date. */
  hijri?: boolean;
  /** The article number of a contract (default 1). */
  clause?: number | string;
}
export interface ArqamClause { text: string; lines: string[]; words: string; figure: string; }
declare const arqam: ArqamLibrary;
export default arqam;
export {arqam, arqamAR};
export declare const version: string;
export declare const currencies: ArqamCurrencyTable;
/** arqam.toWords: (n, locales, options), as n.toLocaleString; a currency alone is an amount */
export declare const toWords: ArqamLibrary["toWords"];
export declare function toParts(n: ArqamNumber, options?: ArqamOptions | string): ArqamParts;
export declare function toParts(n: ArqamNumber[], options?: ArqamOptions | string): ArqamParts[];
export declare function toDate(d: ArqamDate, options?: ArqamDateOptions): string;
export declare function toDate(d: ArqamDate[], options?: ArqamDateOptions): string[];
export declare function toTime(t: ArqamTime, options?: ArqamTimeOptions): string;
export declare function toTime(t: ArqamTime[], options?: ArqamTimeOptions): string[];
export declare function toFraction(f: ArqamFraction, options?: ArqamFractionOptions): string;
export declare function toFraction(f: ArqamFraction[], options?: ArqamFractionOptions): string[];
export declare function createArqam(options?: ArqamOptions): ArqamInstance;
export declare function config(options?: ArqamOptions): void;
export declare function registerCurrency(code: string, attributes: ArqamCurrencyAttributes): unknown[];
export declare function reset(): void;
export declare function options(): ArqamOptions;
export declare function removeTashkeel(text: string, options?: ArqamTashkeelOptions): string;
export declare function removeTashkeel(text: string[], options?: ArqamTashkeelOptions): string[];
export declare function nisba(name: string, options?: ArqamNisbaOptions): string;
/** arqam.NumberFormat: the locale chooses the language */
export declare const NumberFormat: ArqamLibraryNumberFormat;
export declare function toDateTime(x: ArqamDateTime, options?: ArqamDateTimeOptions): string;
export declare function toDateTime(x: ArqamDateTime[], options?: ArqamDateTimeOptions): string[];
export declare function registerTimeZone(zone: string, name: string | null): string | null;
/** The engine's building blocks */
export declare const utils: ArqamUtils;
