<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang xml:lang>
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="mpark/wg21" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
  <meta name="dcterms.date" content="2024-11-15" />
  <title>Quantities and units library</title>
  <style>
      code{white-space: pre-wrap;}
      span.smallcaps{font-variant: small-caps;}
      span.underline{text-decoration: underline;}
      div.column{display: inline-block; vertical-align: top; width: 50%;}
      div.csl-block{margin-left: 1.5em;}
      ul.task-list{list-style: none;}
      pre > code.sourceCode { white-space: pre; position: relative; }
      pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
      pre > code.sourceCode > span:empty { height: 1.2em; }
      .sourceCode { overflow: visible; }
      code.sourceCode > span { color: inherit; text-decoration: inherit; }
      div.sourceCode { margin: 1em 0; }
      pre.sourceCode { margin: 0; }
      @media screen {
      div.sourceCode { overflow: auto; }
      }
      @media print {
      pre > code.sourceCode { white-space: pre-wrap; }
      pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
      }
      pre.numberSource code
        { counter-reset: source-line 0; }
      pre.numberSource code > span
        { position: relative; left: -4em; counter-increment: source-line; }
      pre.numberSource code > span > a:first-child::before
        { content: counter(source-line);
          position: relative; left: -1em; text-align: right; vertical-align: baseline;
          border: none; display: inline-block;
          -webkit-touch-callout: none; -webkit-user-select: none;
          -khtml-user-select: none; -moz-user-select: none;
          -ms-user-select: none; user-select: none;
          padding: 0 4px; width: 4em;
          color: #aaaaaa;
        }
      pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa;  padding-left: 4px; }
      div.sourceCode
        {  background-color: #f6f8fa; }
      @media screen {
      pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
      }
      code span { } /* Normal */
      code span.al { color: #ff0000; } /* Alert */
      code span.an { } /* Annotation */
      code span.at { } /* Attribute */
      code span.bn { color: #9f6807; } /* BaseN */
      code span.bu { color: #9f6807; } /* BuiltIn */
      code span.cf { color: #00607c; } /* ControlFlow */
      code span.ch { color: #9f6807; } /* Char */
      code span.cn { } /* Constant */
      code span.co { color: #008000; font-style: italic; } /* Comment */
      code span.cv { color: #008000; font-style: italic; } /* CommentVar */
      code span.do { color: #008000; } /* Documentation */
      code span.dt { color: #00607c; } /* DataType */
      code span.dv { color: #9f6807; } /* DecVal */
      code span.er { color: #ff0000; font-weight: bold; } /* Error */
      code span.ex { } /* Extension */
      code span.fl { color: #9f6807; } /* Float */
      code span.fu { } /* Function */
      code span.im { } /* Import */
      code span.in { color: #008000; } /* Information */
      code span.kw { color: #00607c; } /* Keyword */
      code span.op { color: #af1915; } /* Operator */
      code span.ot { } /* Other */
      code span.pp { color: #6f4e37; } /* Preprocessor */
      code span.re { } /* RegionMarker */
      code span.sc { color: #9f6807; } /* SpecialChar */
      code span.ss { color: #9f6807; } /* SpecialString */
      code span.st { color: #9f6807; } /* String */
      code span.va { } /* Variable */
      code span.vs { color: #9f6807; } /* VerbatimString */
      code span.wa { color: #008000; font-weight: bold; } /* Warning */
      code.diff {color: #898887}
      code.diff span.va {color: #006e28}
      code.diff span.st {color: #bf0303}
  </style>
  <style type="text/css">
body {
margin: 5em;
font-family: serif;

hyphens: auto;
line-height: 1.35;
text-align: justify;
}
@media screen and (max-width: 30em) {
body {
margin: 1.5em;
}
}
div.wrapper {
max-width: 60em;
margin: auto;
}
ul {
list-style-type: none;
padding-left: 2em;
margin-top: -0.2em;
margin-bottom: -0.2em;
}
a {
text-decoration: none;
color: #4183C4;
}
a.hidden_link {
text-decoration: none;
color: inherit;
}
li {
margin-top: 0.6em;
margin-bottom: 0.6em;
}
h1, h2, h3, h4 {
position: relative;
line-height: 1;
}
a.self-link {
position: absolute;
top: 0;
left: calc(-1 * (3.5rem - 26px));
width: calc(3.5rem - 26px);
height: 2em;
text-align: center;
border: none;
transition: opacity .2s;
opacity: .5;
font-family: sans-serif;
font-weight: normal;
font-size: 83%;
}
a.self-link:hover { opacity: 1; }
a.self-link::before { content: "§"; }
ul > li:before {
content: "\2014";
position: absolute;
margin-left: -1.5em;
}
:target { background-color: #C9FBC9; }
:target .codeblock { background-color: #C9FBC9; }
:target ul { background-color: #C9FBC9; }
.abbr_ref { float: right; }
.folded_abbr_ref { float: right; }
:target .folded_abbr_ref { display: none; }
:target .unfolded_abbr_ref { float: right; display: inherit; }
.unfolded_abbr_ref { display: none; }
.secnum { display: inline-block; min-width: 35pt; }
.header-section-number { display: inline-block; min-width: 35pt; }
.annexnum { display: block; }
div.sourceLinkParent {
float: right;
}
a.sourceLink {
position: absolute;
opacity: 0;
margin-left: 10pt;
}
a.sourceLink:hover {
opacity: 1;
}
a.itemDeclLink {
position: absolute;
font-size: 75%;
text-align: right;
width: 5em;
opacity: 0;
}
a.itemDeclLink:hover { opacity: 1; }
span.marginalizedparent {
position: relative;
left: -5em;
}
li span.marginalizedparent { left: -7em; }
li ul > li span.marginalizedparent { left: -9em; }
li ul > li ul > li span.marginalizedparent { left: -11em; }
li ul > li ul > li ul > li span.marginalizedparent { left: -13em; }
div.footnoteNumberParent {
position: relative;
left: -4.7em;
}
a.marginalized {
position: absolute;
font-size: 75%;
text-align: right;
width: 5em;
}
a.enumerated_item_num {
position: relative;
left: -3.5em;
display: inline-block;
margin-right: -3em;
text-align: right;
width: 3em;
}
div.para { margin-bottom: 0.6em; margin-top: 0.6em; text-align: justify; }
div.section { text-align: justify; }
div.sentence { display: inline; }
span.indexparent {
display: inline;
position: relative;
float: right;
right: -1em;
}
a.index {
position: absolute;
display: none;
}
a.index:before { content: "⟵"; }

a.index:target {
display: inline;
}
.indexitems {
margin-left: 2em;
text-indent: -2em;
}
div.itemdescr {
margin-left: 3em;
}
.bnf {
font-family: serif;
margin-left: 40pt;
margin-top: 0.5em;
margin-bottom: 0.5em;
}
.ncbnf {
font-family: serif;
margin-top: 0.5em;
margin-bottom: 0.5em;
margin-left: 40pt;
}
.ncsimplebnf {
font-family: serif;
font-style: italic;
margin-top: 0.5em;
margin-bottom: 0.5em;
margin-left: 40pt;
background: inherit; 
}
span.textnormal {
font-style: normal;
font-family: serif;
white-space: normal;
display: inline-block;
}
span.rlap {
display: inline-block;
width: 0px;
}
span.descr { font-style: normal; font-family: serif; }
span.grammarterm { font-style: italic; }
span.term { font-style: italic; }
span.terminal { font-family: monospace; font-style: normal; }
span.nonterminal { font-style: italic; }
span.tcode { font-family: monospace; font-style: normal; }
span.textbf { font-weight: bold; }
span.textsc { font-variant: small-caps; }
a.nontermdef { font-style: italic; font-family: serif; }
span.emph { font-style: italic; }
span.techterm { font-style: italic; }
span.mathit { font-style: italic; }
span.mathsf { font-family: sans-serif; }
span.mathrm { font-family: serif; font-style: normal; }
span.textrm { font-family: serif; }
span.textsl { font-style: italic; }
span.mathtt { font-family: monospace; font-style: normal; }
span.mbox { font-family: serif; font-style: normal; }
span.ungap { display: inline-block; width: 2pt; }
span.textit { font-style: italic; }
span.texttt { font-family: monospace; }
span.tcode_in_codeblock { font-family: monospace; font-style: normal; }
span.phantom { color: white; }

span.math { font-style: normal; }
span.mathblock {
display: block;
margin-left: auto;
margin-right: auto;
margin-top: 1.2em;
margin-bottom: 1.2em;
text-align: center;
}
span.mathalpha {
font-style: italic;
}
span.synopsis {
font-weight: bold;
margin-top: 0.5em;
display: block;
}
span.definition {
font-weight: bold;
display: block;
}
.codeblock {
margin-left: 1.2em;
line-height: 127%;
}
.outputblock {
margin-left: 1.2em;
line-height: 127%;
}
div.itemdecl {
margin-top: 2ex;
}
code.itemdeclcode {
white-space: pre;
display: block;
}
span.textsuperscript {
vertical-align: super;
font-size: smaller;
line-height: 0;
}
.footnotenum { vertical-align: super; font-size: smaller; line-height: 0; }
.footnote {
font-size: small;
margin-left: 2em;
margin-right: 2em;
margin-top: 0.6em;
margin-bottom: 0.6em;
}
div.minipage {
display: inline-block;
margin-right: 3em;
}
div.numberedTable {
text-align: center;
margin: 2em;
}
div.figure {
text-align: center;
margin: 2em;
}
table {
border: 1px solid black;
border-collapse: collapse;
margin-left: auto;
margin-right: auto;
margin-top: 0.8em;
text-align: left;
hyphens: none; 
}
td, th {
padding-left: 1em;
padding-right: 1em;
vertical-align: top;
}
td.empty {
padding: 0px;
padding-left: 1px;
}
td.left {
text-align: left;
}
td.right {
text-align: right;
}
td.center {
text-align: center;
}
td.justify {
text-align: justify;
}
td.border {
border-left: 1px solid black;
}
tr.rowsep, td.cline {
border-top: 1px solid black;
}
tr.even, tr.odd {
border-bottom: 1px solid black;
}
tr.capsep {
border-top: 3px solid black;
border-top-style: double;
}
tr.header {
border-bottom: 3px solid black;
border-bottom-style: double;
}
th {
border-bottom: 1px solid black;
}
span.centry {
font-weight: bold;
}
div.table {
display: block;
margin-left: auto;
margin-right: auto;
text-align: center;
width: 90%;
}
span.indented {
display: block;
margin-left: 2em;
margin-bottom: 1em;
margin-top: 1em;
}
ol.enumeratea { list-style-type: none; background: inherit; }
ol.enumerate { list-style-type: none; background: inherit; }

code.sourceCode > span { display: inline; }
</style>
  <link href="data:image/x-icon;base64,AAABAAIAEBAAAAEAIABoBAAAJgAAACAgAAABACAAqBAAAI4EAAAoAAAAEAAAACAAAAABACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AIJEAACCRAAAgkQAAIJEAACCRAAAgkQAVoJEAN6CRADegkQAWIJEAACCRAAAgkQAAIJEAACCRAAA////AP///wCCRAAAgkQAAIJEAACCRAAsgkQAvoJEAP+CRAD/gkQA/4JEAP+CRADAgkQALoJEAACCRAAAgkQAAP///wD///8AgkQAAIJEABSCRACSgkQA/IJEAP99PQD/dzMA/3czAP99PQD/gkQA/4JEAPyCRACUgkQAFIJEAAD///8A////AHw+AFiBQwDqgkQA/4BBAP9/PxP/uZd6/9rJtf/bybX/upd7/39AFP+AQQD/gkQA/4FDAOqAQgBc////AP///wDKklv4jlEa/3o7AP+PWC//8+3o///////////////////////z7un/kFox/35AAP+GRwD/mVYA+v///wD///8A0Zpk+NmibP+0d0T/8evj///////+/fv/1sKz/9bCs//9/fr//////+/m2/+NRwL/nloA/5xYAPj///8A////ANKaZPjRmGH/5cKh////////////k149/3UwAP91MQD/lmQ//86rhv+USg3/m1YA/5hSAP+bVgD4////AP///wDSmmT4zpJY/+/bx///////8+TV/8mLT/+TVx//gkIA/5lVAP+VTAD/x6B//7aEVv/JpH7/s39J+P///wD///8A0ppk+M6SWP/u2sf///////Pj1f/Nj1T/2KFs/8mOUv+eWhD/lEsA/8aee/+0glT/x6F7/7J8Rvj///8A////ANKaZPjRmGH/48Cf///////+/v7/2qt//82PVP/OkFX/37KJ/86siv+USg7/mVQA/5hRAP+bVgD4////AP///wDSmmT40ppk/9CVXP/69O////////7+/v/x4M//8d/P//7+/f//////9u7n/6tnJf+XUgD/nFgA+P///wD///8A0ppk+NKaZP/RmWL/1qNy//r07///////////////////////+vXw/9akdP/Wnmn/y5FY/6JfFvj///8A////ANKaZFTSmmTo0ppk/9GYYv/Ql1//5cWm//Hg0P/x4ND/5cWm/9GXYP/RmGH/0ppk/9KaZOjVnmpY////AP///wDSmmQA0ppkEtKaZI7SmmT60ppk/9CWX//OkVb/zpFW/9CWX//SmmT/0ppk/NKaZJDSmmQS0ppkAP///wD///8A0ppkANKaZADSmmQA0ppkKtKaZLrSmmT/0ppk/9KaZP/SmmT/0ppkvNKaZCrSmmQA0ppkANKaZAD///8A////ANKaZADSmmQA0ppkANKaZADSmmQA0ppkUtKaZNzSmmTc0ppkVNKaZADSmmQA0ppkANKaZADSmmQA////AP5/AAD4HwAA4AcAAMADAACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAMADAADgBwAA+B8AAP5/AAAoAAAAIAAAAEAAAAABACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AP///wCCRAAAgkQAAIJEAACCRAAAgkQAAIJEAACCRAAAgkQAAIJEAACCRAAAgkQAAIJEAAyCRACMgkQA6oJEAOqCRACQgkQAEIJEAACCRAAAgkQAAIJEAACCRAAAgkQAAIJEAACCRAAAgkQAAIJEAACCRAAA////AP///wD///8A////AIJEAACCRAAAgkQAAIJEAACCRAAAgkQAAIJEAACCRAAAgkQAAIJEAACCRABigkQA5oJEAP+CRAD/gkQA/4JEAP+CRADqgkQAZoJEAACCRAAAgkQAAIJEAACCRAAAgkQAAIJEAACCRAAAgkQAAIJEAAD///8A////AP///wD///8AgkQAAIJEAACCRAAAgkQAAIJEAACCRAAAgkQAAIJEAACCRAA4gkQAwoJEAP+CRAD/gkQA/4JEAP+CRAD/gkQA/4JEAP+CRAD/gkQAxIJEADyCRAAAgkQAAIJEAACCRAAAgkQAAIJEAACCRAAAgkQAAP///wD///8A////AP///wCCRAAAgkQAAIJEAACCRAAAgkQAAIJEAACCRAAWgkQAmIJEAP+CRAD/gkQA/4JEAP+CRAD/gkQA/4JEAP+CRAD/gkQA/4JEAP+CRAD/gkQA/4JEAJyCRAAYgkQAAIJEAACCRAAAgkQAAIJEAACCRAAA////AP///wD///8A////AIJEAACCRAAAgkQAAIJEAACCRAAAgkQAdIJEAPCCRAD/gkQA/4JEAP+CRAD/gkQA/4JEAP+CRAD/gkQA/4JEAP+CRAD/gkQA/4JEAP+CRAD/gkQA/4JEAPSCRAB4gkQAAIJEAACCRAAAgkQAAIJEAAD///8A////AP///wD///8AgkQAAIJEAACCRAAAgkQASoJEANKCRAD/gkQA/4JEAP+CRAD/g0YA/39AAP9zLgD/bSQA/2shAP9rIQD/bSQA/3MuAP9/PwD/g0YA/4JEAP+CRAD/gkQA/4JEAP+CRADUgkQAToJEAACCRAAAgkQAAP///wD///8A////AP///wB+PwAAgkUAIoJEAKiCRAD/gkQA/4JEAP+CRAD/hEcA/4BBAP9sIwD/dTAA/5RfKv+viF7/vp56/76ee/+wiF7/lWAr/3YxAP9sIwD/f0AA/4RHAP+CRAD/gkQA/4JEAP+CRAD/gkQArIJEACaBQwAA////AP///wD///8A////AIBCAEBzNAD6f0EA/4NFAP+CRAD/gkQA/4VIAP92MwD/bSUA/6N1Tv/ezsL/////////////////////////////////38/D/6V3Uv9uJgD/dTEA/4VJAP+CRAD/gkQA/4JEAP+BQwD/fUAA/4FDAEj///8A////AP///wD///8AzJRd5qBlKf91NgD/dDUA/4JEAP+FSQD/cy4A/3YyAP/PuKP//////////////////////////////////////////////////////9K7qP94NQD/ciwA/4VJAP+CRAD/fkEA/35BAP+LSwD/mlYA6v///wD///8A////AP///wDdpnL/4qx3/8KJUv+PUhf/cTMA/3AsAP90LgD/4dK+/////////////////////////////////////////////////////////////////+TYxf91MAD/dTIA/31CAP+GRwD/llQA/6FcAP+gWwD8////AP///wD///8A////ANGZY/LSm2X/4ap3/92mcP+wdT3/byQA/8mwj////////////////////////////////////////////////////////////////////////////+LYxv9zLgP/jUoA/59bAP+hXAD/nFgA/5xYAPL///8A////AP///wD///8A0ppk8tKaZP/RmWL/1p9q/9ubXv/XqXj////////////////////////////7+fD/vZyG/6BxS/+gcUr/vJuE//r37f//////////////////////3MOr/5dQBf+dVQD/nVkA/5xYAP+cWAD/nFgA8v///wD///8A////AP///wDSmmTy0ppk/9KaZP/SmWP/yohJ//jo2P//////////////////////4NTG/4JDFf9lGAD/bSQA/20kAP9kGAD/fz8S/+Xb0f//////5NG9/6txN/+LOgD/m1QA/51aAP+cWAD/m1cA/5xYAP+cWADy////AP///wD///8A////ANKaZPLSmmT/0ppk/8+TWf/Unmv//v37//////////////////////+TWRr/VwsA/35AAP+ERgD/g0UA/4JGAP9lHgD/kFga/8KXX/+TRwD/jT4A/49CAP+VTQD/n10A/5xYAP+OQQD/lk4A/55cAPL///8A////AP///wD///8A0ppk8tKaZP/SmmT/y4tO/92yiP//////////////////////8NnE/8eCQP+rcTT/ez0A/3IyAP98PgD/gEMA/5FSAP+USwD/jj8A/5lUAP+JNwD/yqV2/694Mf+HNQD/jkAA/82rf/+laBj/jT4A8v///wD///8A////AP///wDSmmTy0ppk/9KaZP/LiUr/4byY///////////////////////gupX/0I5P/+Wuev/Lklz/l1sj/308AP+QSwD/ol0A/59aAP+aVQD/k0oA/8yoh///////+fXv/6pwO//Lp3v///////Pr4f+oay7y////AP///wD///8A////ANKaZPLSmmT/0ppk/8uJSv/hvJj//////////////////////+G7l//Jhkb/0ppk/96nc//fqXX/x4xO/6dkFP+QSQD/llEA/5xXAP+USgD/yaOA///////38uv/qG05/8ijdv//////8efb/6ZpLPL///8A////AP///wD///8A0ppk8tKaZP/SmmT/zIxO/9yxh///////////////////////7dbA/8iEQf/Sm2X/0Zlj/9ScZv/eqHf/2KJv/7yAQf+XTgD/iToA/5lSAP+JNgD/yKFv/611LP+HNQD/jT8A/8qmeP+kZRT/jT4A8v///wD///8A////AP///wDSmmTy0ppk/9KaZP/Pk1n/1J5q//78+//////////////////+/fv/1aFv/8iEQv/Tm2b/0ppl/9GZY//Wn2z/1pZc/9eldf/Bl2b/kUcA/4w9AP+OQAD/lUwA/59eAP+cWQD/jT8A/5ZOAP+eXADy////AP///wD///8A////ANKaZPLSmmT/0ppk/9KZY//KiEn/8d/P///////////////////////47+f/05tm/8iCP//KiEj/yohJ/8eCP//RmGH//vfy///////n1sP/rXQ7/4k4AP+TTAD/nVoA/5xYAP+cVwD/nFgA/5xYAPL///8A////AP///wD///8A0ppk8tKaZP/SmmT/0ptl/8uLTf/aq37////////////////////////////+/fz/6c2y/961jv/etY7/6Myx//78+v//////////////////////3MWv/5xXD/+ORAD/mFQA/51ZAP+cWAD/nFgA8v///wD///8A////AP///wDSmmTy0ppk/9KaZP/SmmT/0ppk/8mFRP/s1b//////////////////////////////////////////////////////////////////////////////+PD/0JFU/7NzMv+WUQD/kUsA/5tXAP+dWQDy////AP///wD///8A////ANKaZP/SmmT/0ppk/9KaZP/Sm2X/z5NZ/8yMT//z5NX/////////////////////////////////////////////////////////////////9Ofa/8yNUP/UmGH/36p5/8yTWv+qaSD/kksA/5ROAPz///8A////AP///wD///8A0ppk5NKaZP/SmmT/0ppk/9KaZP/TnGf/zY9T/82OUv/t1sD//////////////////////////////////////////////////////+7Yw//OkFX/zI5R/9OcZ//SmmP/26V0/9ymdf/BhUf/ol8R6P///wD///8A////AP///wDSmmQ80ppk9tKaZP/SmmT/0ppk/9KaZP/TnGj/zpFW/8qJSv/dson/8uHS//////////////////////////////////Lj0//etIv/y4lL/86QVf/TnGj/0ppk/9KaZP/RmWP/05xn/9ymdfjUnWdC////AP///wD///8A////ANKaZADSmmQc0ppkotKaZP/SmmT/0ppk/9KaZP/Tm2b/0Zli/8qJSf/NjlH/16Z3/+G8mP/myKr/5siq/+G8mP/Xp3f/zY5S/8qISf/RmGH/05tm/9KaZP/SmmT/0ppk/9KaZP/SmmSm0pljINWdaQD///8A////AP///wD///8A0ppkANKaZADSmmQA0ppkQtKaZMrSmmT/0ppk/9KaZP/SmmT/0ptl/9GYYf/Nj1P/y4lL/8qISP/KiEj/y4lK/82PU//RmGH/0ptl/9KaZP/SmmT/0ppk/9KaZP/SmmTO0ppkRtKaZADSmmQA0ppkAP///wD///8A////AP///wDSmmQA0ppkANKaZADSmmQA0ppkANKaZGzSmmTu0ppk/9KaZP/SmmT/0ppk/9KaZP/SmmT/0ppk/9KaZP/SmmT/0ppk/9KaZP/SmmT/0ppk/9KaZP/SmmTw0ppkcNKaZADSmmQA0ppkANKaZADSmmQA////AP///wD///8A////ANKaZADSmmQA0ppkANKaZADSmmQA0ppkANKaZBLSmmSQ0ppk/9KaZP/SmmT/0ppk/9KaZP/SmmT/0ppk/9KaZP/SmmT/0ppk/9KaZP/SmmT/0ppklNKaZBTSmmQA0ppkANKaZADSmmQA0ppkANKaZAD///8A////AP///wD///8A0ppkANKaZADSmmQA0ppkANKaZADSmmQA0ppkANKaZADSmmQy0ppkutKaZP/SmmT/0ppk/9KaZP/SmmT/0ppk/9KaZP/SmmT/0ppkvtKaZDbSmmQA0ppkANKaZADSmmQA0ppkANKaZADSmmQA0ppkAP///wD///8A////AP///wDSmmQA0ppkANKaZADSmmQA0ppkANKaZADSmmQA0ppkANKaZADSmmQA0ppkXNKaZODSmmT/0ppk/9KaZP/SmmT/0ppk5NKaZGDSmmQA0ppkANKaZADSmmQA0ppkANKaZADSmmQA0ppkANKaZADSmmQA////AP///wD///8A////ANKaZADSmmQA0ppkANKaZADSmmQA0ppkANKaZADSmmQA0ppkANKaZADSmmQA0ppkBtKaZIbSmmTo0ppk6tKaZIrSmmQK0ppkANKaZADSmmQA0ppkANKaZADSmmQA0ppkANKaZADSmmQA0ppkANKaZAD///8A////AP/8P///+B///+AH//+AAf//AAD//AAAP/AAAA/gAAAHwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA+AAAAfwAAAP/AAAP/8AAP//gAH//+AH///4H////D//" rel="icon" />
  
  <script type="text/javascript">(function(){"use strict";var __webpack_modules__={351:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},s=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},l=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.AssistiveMmlHandler=e.AssistiveMmlMathDocumentMixin=e.AssistiveMmlMathItemMixin=e.LimitedMmlVisitor=void 0;var c=r(4474),u=r(9259),p=r(7233),h=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.getAttributes=function(e){return t.prototype.getAttributes.call(this,e).replace(/ ?id=".*?"/,"")},e}(u.SerializedMmlVisitor);function d(t){return function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.assistiveMml=function(t,e){if(void 0===e&&(e=!1),!(this.state()>=c.STATE.ASSISTIVEMML)){if(!this.isEscaped&&(t.options.enableAssistiveMml||e)){var r=t.adaptor,n=t.toMML(this.root).replace(/\n */g,"").replace(/<!--.*?-->/g,""),o=r.firstChild(r.body(r.parse(n,"text/html"))),i=r.node("mjx-assistive-mml",{unselectable:"on",display:this.display?"block":"inline"},[o]);r.setAttribute(r.firstChild(this.typesetRoot),"aria-hidden","true"),r.setStyle(this.typesetRoot,"position","relative"),r.append(this.typesetRoot,i)}this.state(c.STATE.ASSISTIVEMML)}},e}(t)}function f(t){var e;return e=function(t){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=t.apply(this,s([],a(e),!1))||this,o=n.constructor,i=o.ProcessBits;return i.has("assistive-mml")||i.allocate("assistive-mml"),n.visitor=new h(n.mmlFactory),n.options.MathItem=d(n.options.MathItem),"addStyles"in n&&n.addStyles(o.assistiveStyles),n}return o(e,t),e.prototype.toMML=function(t){return this.visitor.visitTree(t)},e.prototype.assistiveMml=function(){var t,e;if(!this.processed.isSet("assistive-mml")){try{for(var r=l(this.math),n=r.next();!n.done;n=r.next()){n.value.assistiveMml(this)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}this.processed.set("assistive-mml")}return this},e.prototype.state=function(e,r){return void 0===r&&(r=!1),t.prototype.state.call(this,e,r),e<c.STATE.ASSISTIVEMML&&this.processed.clear("assistive-mml"),this},e}(t),e.OPTIONS=i(i({},t.OPTIONS),{enableAssistiveMml:!0,renderActions:(0,p.expandable)(i(i({},t.OPTIONS.renderActions),{assistiveMml:[c.STATE.ASSISTIVEMML]}))}),e.assistiveStyles={"mjx-assistive-mml":{position:"absolute !important",top:"0px",left:"0px",clip:"rect(1px, 1px, 1px, 1px)",padding:"1px 0px 0px 0px !important",border:"0px !important",display:"block !important",width:"auto !important",overflow:"hidden !important","-webkit-touch-callout":"none","-webkit-user-select":"none","-khtml-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"},'mjx-assistive-mml[display="block"]':{width:"100% !important"}},e}e.LimitedMmlVisitor=h,(0,c.newState)("ASSISTIVEMML",153),e.AssistiveMmlMathItemMixin=d,e.AssistiveMmlMathDocumentMixin=f,e.AssistiveMmlHandler=function(t){return t.documentClass=f(t.documentClass),t}},5282:function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var r=new Map;e.default=r},5445:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e},a=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{l(n.next(t))}catch(t){i(t)}}function s(t){try{l(n.throw(t))}catch(t){i(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}l((n=n.apply(t,e||[])).next())}))},s=this&&this.__generator||function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},l=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.sreReady=e.Sre=void 0;var c,u=i(r(2998)),p=i(r(3362)),h=i(r(9552)),d=i(r(4440)),f=l(r(5897)),m=r(8504),y=i(r(3090)),g=r(1377),b=l(r(5282));!function(t){t.locales=g.Variables.LOCALES,t.sreReady=u.engineReady,t.setupEngine=u.setupEngine,t.engineSetup=u.engineSetup,t.toEnriched=u.toEnriched,t.toSpeech=u.toSpeech,t.clearspeakPreferences=m.ClearspeakPreferences,t.getHighlighter=y.highlighter,t.getSpeechGenerator=h.generator,t.getWalker=p.walker,t.clearspeakStyle=function(){return d.DOMAIN_TO_STYLES.clearspeak},t.preloadLocales=function(t){return a(this,void 0,void 0,(function(){var e;return s(this,(function(r){return[2,(e=b.default.get(t))?new Promise((function(t,r){return t(JSON.stringify(e))})):u.localeLoader()(t)]}))}))}}(c=e.Sre||(e.Sre={})),e.sreReady=c.sreReady,f.default.getInstance().delay=!0,e.default=c},444:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.HTMLAdaptor=void 0;var a=function(t){function e(e){var r=t.call(this,e.document)||this;return r.window=e,r.parser=new e.DOMParser,r}return o(e,t),e.prototype.parse=function(t,e){return void 0===e&&(e="text/html"),this.parser.parseFromString(t,e)},e.prototype.create=function(t,e){return e?this.document.createElementNS(e,t):this.document.createElement(t)},e.prototype.text=function(t){return this.document.createTextNode(t)},e.prototype.head=function(t){return t.head||t},e.prototype.body=function(t){return t.body||t},e.prototype.root=function(t){return t.documentElement||t},e.prototype.doctype=function(t){return t.doctype?"<!DOCTYPE ".concat(t.doctype.name,">"):""},e.prototype.tags=function(t,e,r){void 0===r&&(r=null);var n=r?t.getElementsByTagNameNS(r,e):t.getElementsByTagName(e);return Array.from(n)},e.prototype.getElements=function(t,e){var r,n,o=[];try{for(var a=i(t),s=a.next();!s.done;s=a.next()){var l=s.value;"string"==typeof l?o=o.concat(Array.from(this.document.querySelectorAll(l))):Array.isArray(l)||l instanceof this.window.NodeList||l instanceof this.window.HTMLCollection?o=o.concat(Array.from(l)):o.push(l)}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return o},e.prototype.contains=function(t,e){return t.contains(e)},e.prototype.parent=function(t){return t.parentNode},e.prototype.append=function(t,e){return t.appendChild(e)},e.prototype.insert=function(t,e){return this.parent(e).insertBefore(t,e)},e.prototype.remove=function(t){return this.parent(t).removeChild(t)},e.prototype.replace=function(t,e){return this.parent(e).replaceChild(t,e)},e.prototype.clone=function(t){return t.cloneNode(!0)},e.prototype.split=function(t,e){return t.splitText(e)},e.prototype.next=function(t){return t.nextSibling},e.prototype.previous=function(t){return t.previousSibling},e.prototype.firstChild=function(t){return t.firstChild},e.prototype.lastChild=function(t){return t.lastChild},e.prototype.childNodes=function(t){return Array.from(t.childNodes)},e.prototype.childNode=function(t,e){return t.childNodes[e]},e.prototype.kind=function(t){var e=t.nodeType;return 1===e||3===e||8===e?t.nodeName.toLowerCase():""},e.prototype.value=function(t){return t.nodeValue||""},e.prototype.textContent=function(t){return t.textContent},e.prototype.innerHTML=function(t){return t.innerHTML},e.prototype.outerHTML=function(t){return t.outerHTML},e.prototype.serializeXML=function(t){return(new this.window.XMLSerializer).serializeToString(t)},e.prototype.setAttribute=function(t,e,r,n){return void 0===n&&(n=null),n?(e=n.replace(/.*\//,"")+":"+e.replace(/^.*:/,""),t.setAttributeNS(n,e,r)):t.setAttribute(e,r)},e.prototype.getAttribute=function(t,e){return t.getAttribute(e)},e.prototype.removeAttribute=function(t,e){return t.removeAttribute(e)},e.prototype.hasAttribute=function(t,e){return t.hasAttribute(e)},e.prototype.allAttributes=function(t){return Array.from(t.attributes).map((function(t){return{name:t.name,value:t.value}}))},e.prototype.addClass=function(t,e){t.classList?t.classList.add(e):t.className=(t.className+" "+e).trim()},e.prototype.removeClass=function(t,e){t.classList?t.classList.remove(e):t.className=t.className.split(/ /).filter((function(t){return t!==e})).join(" ")},e.prototype.hasClass=function(t,e){return t.classList?t.classList.contains(e):t.className.split(/ /).indexOf(e)>=0},e.prototype.setStyle=function(t,e,r){t.style[e]=r},e.prototype.getStyle=function(t,e){return t.style[e]},e.prototype.allStyles=function(t){return t.style.cssText},e.prototype.insertRules=function(t,e){var r,n;try{for(var o=i(e.reverse()),a=o.next();!a.done;a=o.next()){var s=a.value;try{t.sheet.insertRule(s,0)}catch(t){console.warn("MathJax: can't insert css rule '".concat(s,"': ").concat(t.message))}}}catch(t){r={error:t}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},e.prototype.fontSize=function(t){var e=this.window.getComputedStyle(t);return parseFloat(e.fontSize)},e.prototype.fontFamily=function(t){return this.window.getComputedStyle(t).fontFamily||""},e.prototype.nodeSize=function(t,e,r){if(void 0===e&&(e=1),void 0===r&&(r=!1),r&&t.getBBox){var n=t.getBBox();return[n.width/e,n.height/e]}return[t.offsetWidth/e,t.offsetHeight/e]},e.prototype.nodeBBox=function(t){var e=t.getBoundingClientRect();return{left:e.left,right:e.right,top:e.top,bottom:e.bottom}},e}(r(5009).AbstractDOMAdaptor);e.HTMLAdaptor=a},6191:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.browserAdaptor=void 0;var n=r(444);e.browserAdaptor=function(){return new n.HTMLAdaptor(window)}},9515:function(t,e,r){var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.MathJax=e.combineWithMathJax=e.combineDefaults=e.combineConfig=e.isObject=void 0;var o=r(3282);function i(t){return"object"==typeof t&&null!==t}function a(t,e){var r,o;try{for(var s=n(Object.keys(e)),l=s.next();!l.done;l=s.next()){var c=l.value;"__esModule"!==c&&(!i(t[c])||!i(e[c])||e[c]instanceof Promise?null!==e[c]&&void 0!==e[c]&&(t[c]=e[c]):a(t[c],e[c]))}}catch(t){r={error:t}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}return t}e.isObject=i,e.combineConfig=a,e.combineDefaults=function t(e,r,o){var a,s;e[r]||(e[r]={}),e=e[r];try{for(var l=n(Object.keys(o)),c=l.next();!c.done;c=l.next()){var u=c.value;i(e[u])&&i(o[u])?t(e,u,o[u]):null==e[u]&&null!=o[u]&&(e[u]=o[u])}}catch(t){a={error:t}}finally{try{c&&!c.done&&(s=l.return)&&s.call(l)}finally{if(a)throw a.error}}return e},e.combineWithMathJax=function(t){return a(e.MathJax,t)},void 0===r.g.MathJax&&(r.g.MathJax={}),r.g.MathJax.version||(r.g.MathJax={version:o.VERSION,_:{},config:r.g.MathJax}),e.MathJax=r.g.MathJax},235:function(t,e,r){var n,o,i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.CONFIG=e.MathJax=e.Loader=e.PathFilters=e.PackageError=e.Package=void 0;var a=r(9515),s=r(265),l=r(265);Object.defineProperty(e,"Package",{enumerable:!0,get:function(){return l.Package}}),Object.defineProperty(e,"PackageError",{enumerable:!0,get:function(){return l.PackageError}});var c,u=r(7525);if(e.PathFilters={source:function(t){return e.CONFIG.source.hasOwnProperty(t.name)&&(t.name=e.CONFIG.source[t.name]),!0},normalize:function(t){var e=t.name;return e.match(/^(?:[a-z]+:\/)?\/|[a-z]:\\|\[/i)||(t.name="[mathjax]/"+e.replace(/^\.\//,"")),t.addExtension&&!e.match(/\.[^\/]+$/)&&(t.name+=".js"),!0},prefix:function(t){for(var r;(r=t.name.match(/^\[([^\]]*)\]/))&&e.CONFIG.paths.hasOwnProperty(r[1]);)t.name=e.CONFIG.paths[r[1]]+t.name.substr(r[0].length);return!0}},function(t){var r=a.MathJax.version;t.versions=new Map,t.ready=function(){for(var t,e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];0===r.length&&(r=Array.from(s.Package.packages.keys()));var o=[];try{for(var a=i(r),l=a.next();!l.done;l=a.next()){var c=l.value,u=s.Package.packages.get(c)||new s.Package(c,!0);o.push(u.promise)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}return Promise.all(o)},t.load=function(){for(var r,n,o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];if(0===o.length)return Promise.resolve();var l=[],c=function(r){var n=s.Package.packages.get(r);n||(n=new s.Package(r)).provides(e.CONFIG.provides[r]),n.checkNoLoad(),l.push(n.promise.then((function(){e.CONFIG.versionWarnings&&n.isLoaded&&!t.versions.has(s.Package.resolvePath(r))&&console.warn("No version information available for component ".concat(r))})))};try{for(var u=i(o),p=u.next();!p.done;p=u.next()){var h=p.value;c(h)}}catch(t){r={error:t}}finally{try{p&&!p.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}return s.Package.loadAll(),Promise.all(l)},t.preLoad=function(){for(var t,r,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];try{for(var a=i(n),l=a.next();!l.done;l=a.next()){var c=l.value,u=s.Package.packages.get(c);u||(u=new s.Package(c,!0)).provides(e.CONFIG.provides[c]),u.loaded()}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}},t.defaultReady=function(){void 0!==e.MathJax.startup&&e.MathJax.config.startup.ready()},t.getRoot=function(){var t="//../../es5";if("undefined"!=typeof document){var e=document.currentScript||document.getElementById("MathJax-script");e&&(t=e.src.replace(/\/[^\/]*$/,""))}return t},t.checkVersion=function(n,o,i){return t.versions.set(s.Package.resolvePath(n),r),!(!e.CONFIG.versionWarnings||o===r)&&(console.warn("Component ".concat(n," uses ").concat(o," of MathJax; version in use is ").concat(r)),!0)},t.pathFilters=new u.FunctionList,t.pathFilters.add(e.PathFilters.source,0),t.pathFilters.add(e.PathFilters.normalize,10),t.pathFilters.add(e.PathFilters.prefix,20)}(c=e.Loader||(e.Loader={})),e.MathJax=a.MathJax,void 0===e.MathJax.loader){(0,a.combineDefaults)(e.MathJax.config,"loader",{paths:{mathjax:c.getRoot()},source:{},dependencies:{},provides:{},load:[],ready:c.defaultReady.bind(c),failed:function(t){return console.log("MathJax(".concat(t.package||"?","): ").concat(t.message))},require:null,pathFilters:[],versionWarnings:!0}),(0,a.combineWithMathJax)({loader:c});try{for(var p=i(e.MathJax.config.loader.pathFilters),h=p.next();!h.done;h=p.next()){var d=h.value;Array.isArray(d)?c.pathFilters.add(d[0],d[1]):c.pathFilters.add(d)}}catch(t){n={error:t}}finally{try{h&&!h.done&&(o=p.return)&&o.call(p)}finally{if(n)throw n.error}}}e.CONFIG=e.MathJax.config.loader},265:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},s=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.Package=e.PackageError=void 0;var l=r(235),c=function(t){function e(e,r){var n=t.call(this,e)||this;return n.package=r,n}return o(e,t),e}(Error);e.PackageError=c;var u=function(){function t(e,r){void 0===r&&(r=!1),this.isLoaded=!1,this.isLoading=!1,this.hasFailed=!1,this.dependents=[],this.dependencies=[],this.dependencyCount=0,this.provided=[],this.name=e,this.noLoad=r,t.packages.set(e,this),this.promise=this.makePromise(this.makeDependencies())}return Object.defineProperty(t.prototype,"canLoad",{get:function(){return 0===this.dependencyCount&&!this.noLoad&&!this.isLoading&&!this.hasFailed},enumerable:!1,configurable:!0}),t.resolvePath=function(t,e){void 0===e&&(e=!0);var r={name:t,original:t,addExtension:e};return l.Loader.pathFilters.execute(r),r.name},t.loadAll=function(){var t,e;try{for(var r=i(this.packages.values()),n=r.next();!n.done;n=r.next()){var o=n.value;o.canLoad&&o.load()}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},t.prototype.makeDependencies=function(){var e,r,n=[],o=t.packages,c=this.noLoad,u=this.name,p=[];l.CONFIG.dependencies.hasOwnProperty(u)?p.push.apply(p,s([],a(l.CONFIG.dependencies[u]),!1)):"core"!==u&&p.push("core");try{for(var h=i(p),d=h.next();!d.done;d=h.next()){var f=d.value,m=o.get(f)||new t(f,c);this.dependencies.indexOf(m)<0&&(m.addDependent(this,c),this.dependencies.push(m),m.isLoaded||(this.dependencyCount++,n.push(m.promise)))}}catch(t){e={error:t}}finally{try{d&&!d.done&&(r=h.return)&&r.call(h)}finally{if(e)throw e.error}}return n},t.prototype.makePromise=function(t){var e=this,r=new Promise((function(t,r){e.resolve=t,e.reject=r})),n=l.CONFIG[this.name]||{};return n.ready&&(r=r.then((function(t){return n.ready(e.name)}))),t.length&&(t.push(r),r=Promise.all(t).then((function(t){return t.join(", ")}))),n.failed&&r.catch((function(t){return n.failed(new c(t,e.name))})),r},t.prototype.load=function(){if(!this.isLoaded&&!this.isLoading&&!this.noLoad){this.isLoading=!0;var e=t.resolvePath(this.name);l.CONFIG.require?this.loadCustom(e):this.loadScript(e)}},t.prototype.loadCustom=function(t){var e=this;try{var r=l.CONFIG.require(t);r instanceof Promise?r.then((function(){return e.checkLoad()})).catch((function(r){return e.failed("Can't load \""+t+'"\n'+r.message.trim())})):this.checkLoad()}catch(t){this.failed(t.message)}},t.prototype.loadScript=function(t){var e=this,r=document.createElement("script");r.src=t,r.charset="UTF-8",r.onload=function(t){return e.checkLoad()},r.onerror=function(r){return e.failed("Can't load \""+t+'"')},document.head.appendChild(r)},t.prototype.loaded=function(){var t,e,r,n;this.isLoaded=!0,this.isLoading=!1;try{for(var o=i(this.dependents),a=o.next();!a.done;a=o.next()){a.value.requirementSatisfied()}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}try{for(var s=i(this.provided),l=s.next();!l.done;l=s.next()){l.value.loaded()}}catch(t){r={error:t}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}this.resolve(this.name)},t.prototype.failed=function(t){this.hasFailed=!0,this.isLoading=!1,this.reject(new c(t,this.name))},t.prototype.checkLoad=function(){var t=this;((l.CONFIG[this.name]||{}).checkReady||function(){return Promise.resolve()})().then((function(){return t.loaded()})).catch((function(e){return t.failed(e)}))},t.prototype.requirementSatisfied=function(){this.dependencyCount&&(this.dependencyCount--,this.canLoad&&this.load())},t.prototype.provides=function(e){var r,n;void 0===e&&(e=[]);try{for(var o=i(e),a=o.next();!a.done;a=o.next()){var s=a.value,c=t.packages.get(s);c||(l.CONFIG.dependencies[s]||(l.CONFIG.dependencies[s]=[]),l.CONFIG.dependencies[s].push(s),(c=new t(s,!0)).isLoading=!0),this.provided.push(c)}}catch(t){r={error:t}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},t.prototype.addDependent=function(t,e){this.dependents.push(t),e||this.checkNoLoad()},t.prototype.checkNoLoad=function(){var t,e;if(this.noLoad){this.noLoad=!1;try{for(var r=i(this.dependencies),n=r.next();!n.done;n=r.next()){n.value.checkNoLoad()}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}}},t.packages=new Map,t}();e.Package=u},2388:function(t,e,r){var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},n.apply(this,arguments)},o=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.CONFIG=e.MathJax=e.Startup=void 0;var s,l=r(9515),c=r(8666),u=r(7233);!function(t){var s,l,u=new c.PrioritizedList;function h(e){return s.visitTree(e,t.document)}function d(){s=new e.MathJax._.core.MmlTree.SerializedMmlVisitor.SerializedMmlVisitor,l=e.MathJax._.mathjax.mathjax,t.input=v(),t.output=_(),t.adaptor=S(),t.handler&&l.handlers.unregister(t.handler),t.handler=x(),t.handler&&(l.handlers.register(t.handler),t.document=M())}function f(){var e,r;t.input&&t.output&&m();var n=t.output?t.output.name.toLowerCase():"";try{for(var i=o(t.input),a=i.next();!a.done;a=i.next()){var s=a.value,l=s.name.toLowerCase();g(l,s),b(l,s),t.output&&y(l,n,s)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}}function m(){e.MathJax.typeset=function(e){void 0===e&&(e=null),t.document.options.elements=e,t.document.reset(),t.document.render()},e.MathJax.typesetPromise=function(e){return void 0===e&&(e=null),t.document.options.elements=e,t.document.reset(),l.handleRetriesFor((function(){t.document.render()}))},e.MathJax.typesetClear=function(e){void 0===e&&(e=null),e?t.document.clearMathItemsWithin(e):t.document.clear()}}function y(r,n,o){var i=r+"2"+n;e.MathJax[i]=function(e,r){return void 0===r&&(r={}),r.format=o.name,t.document.convert(e,r)},e.MathJax[i+"Promise"]=function(e,r){return void 0===r&&(r={}),r.format=o.name,l.handleRetriesFor((function(){return t.document.convert(e,r)}))},e.MathJax[n+"Stylesheet"]=function(){return t.output.styleSheet(t.document)},"getMetricsFor"in t.output&&(e.MathJax.getMetricsFor=function(e,r){return t.output.getMetricsFor(e,r)})}function g(r,n){var o=e.MathJax._.core.MathItem.STATE;e.MathJax[r+"2mml"]=function(e,r){return void 0===r&&(r={}),r.end=o.CONVERT,r.format=n.name,h(t.document.convert(e,r))},e.MathJax[r+"2mmlPromise"]=function(e,r){return void 0===r&&(r={}),r.end=o.CONVERT,r.format=n.name,l.handleRetriesFor((function(){return h(t.document.convert(e,r))}))}}function b(t,r){e.MathJax[t+"Reset"]=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return r.reset.apply(r,a([],i(t),!1))}}function v(){var r,n,i=[];try{for(var a=o(e.CONFIG.input),s=a.next();!s.done;s=a.next()){var l=s.value,c=t.constructors[l];if(!c)throw Error('Input Jax "'+l+'" is not defined (has it been loaded?)');i.push(new c(e.MathJax.config[l]))}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return i}function _(){var r=e.CONFIG.output;if(!r)return null;var n=t.constructors[r];if(!n)throw Error('Output Jax "'+r+'" is not defined (has it been loaded?)');return new n(e.MathJax.config[r])}function S(){var r=e.CONFIG.adaptor;if(!r||"none"===r)return null;var n=t.constructors[r];if(!n)throw Error('DOMAdaptor "'+r+'" is not defined (has it been loaded?)');return n(e.MathJax.config[r])}function x(){var r,n,i=e.CONFIG.handler;if(!i||"none"===i||!t.adaptor)return null;var a=t.constructors[i];if(!a)throw Error('Handler "'+i+'" is not defined (has it been loaded?)');var s=new a(t.adaptor,5);try{for(var l=o(u),c=l.next();!c.done;c=l.next()){s=c.value.item(s)}}catch(t){r={error:t}}finally{try{c&&!c.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}return s}function M(r){return void 0===r&&(r=null),l.document(r||e.CONFIG.document,n(n({},e.MathJax.config.options),{InputJax:t.input,OutputJax:t.output}))}t.constructors={},t.input=[],t.output=null,t.handler=null,t.adaptor=null,t.elements=null,t.document=null,t.promise=new Promise((function(e,r){t.promiseResolve=e,t.promiseReject=r})),t.pagePromise=new Promise((function(t,e){var n=r.g.document;if(n&&n.readyState&&"complete"!==n.readyState&&"interactive"!==n.readyState){var o=function(){return t()};n.defaultView.addEventListener("load",o,!0),n.defaultView.addEventListener("DOMContentLoaded",o,!0)}else t()})),t.toMML=h,t.registerConstructor=function(e,r){t.constructors[e]=r},t.useHandler=function(t,r){void 0===r&&(r=!1),e.CONFIG.handler&&!r||(e.CONFIG.handler=t)},t.useAdaptor=function(t,r){void 0===r&&(r=!1),e.CONFIG.adaptor&&!r||(e.CONFIG.adaptor=t)},t.useInput=function(t,r){void 0===r&&(r=!1),p&&!r||e.CONFIG.input.push(t)},t.useOutput=function(t,r){void 0===r&&(r=!1),e.CONFIG.output&&!r||(e.CONFIG.output=t)},t.extendHandler=function(t,e){void 0===e&&(e=10),u.add(t,e)},t.defaultReady=function(){d(),f(),t.pagePromise.then((function(){return e.CONFIG.pageReady()})).then((function(){return t.promiseResolve()})).catch((function(e){return t.promiseReject(e)}))},t.defaultPageReady=function(){return e.CONFIG.typeset&&e.MathJax.typesetPromise?e.MathJax.typesetPromise(e.CONFIG.elements):Promise.resolve()},t.getComponents=d,t.makeMethods=f,t.makeTypesetMethods=m,t.makeOutputMethods=y,t.makeMmlMethods=g,t.makeResetMethod=b,t.getInputJax=v,t.getOutputJax=_,t.getAdaptor=S,t.getHandler=x,t.getDocument=M}(s=e.Startup||(e.Startup={})),e.MathJax=l.MathJax,void 0===e.MathJax._.startup&&((0,l.combineDefaults)(e.MathJax.config,"startup",{input:[],output:"",handler:null,adaptor:null,document:"undefined"==typeof document?"":document,elements:null,typeset:!0,ready:s.defaultReady.bind(s),pageReady:s.defaultPageReady.bind(s)}),(0,l.combineWithMathJax)({startup:s,options:{}}),e.MathJax.config.startup.invalidOption&&(u.OPTIONS.invalidOption=e.MathJax.config.startup.invalidOption),e.MathJax.config.startup.optionError&&(u.OPTIONS.optionError=e.MathJax.config.startup.optionError)),e.CONFIG=e.MathJax.config.startup;var p=0!==e.CONFIG.input.length},3282:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.VERSION=void 0,e.VERSION="3.2.2"},5009:function(t,e){var r=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractDOMAdaptor=void 0;var n=function(){function t(t){void 0===t&&(t=null),this.document=t}return t.prototype.node=function(t,e,n,o){var i,a;void 0===e&&(e={}),void 0===n&&(n=[]);var s=this.create(t,o);this.setAttributes(s,e);try{for(var l=r(n),c=l.next();!c.done;c=l.next()){var u=c.value;this.append(s,u)}}catch(t){i={error:t}}finally{try{c&&!c.done&&(a=l.return)&&a.call(l)}finally{if(i)throw i.error}}return s},t.prototype.setAttributes=function(t,e){var n,o,i,a,s,l;if(e.style&&"string"!=typeof e.style)try{for(var c=r(Object.keys(e.style)),u=c.next();!u.done;u=c.next()){var p=u.value;this.setStyle(t,p.replace(/-([a-z])/g,(function(t,e){return e.toUpperCase()})),e.style[p])}}catch(t){n={error:t}}finally{try{u&&!u.done&&(o=c.return)&&o.call(c)}finally{if(n)throw n.error}}if(e.properties)try{for(var h=r(Object.keys(e.properties)),d=h.next();!d.done;d=h.next()){t[p=d.value]=e.properties[p]}}catch(t){i={error:t}}finally{try{d&&!d.done&&(a=h.return)&&a.call(h)}finally{if(i)throw i.error}}try{for(var f=r(Object.keys(e)),m=f.next();!m.done;m=f.next()){"style"===(p=m.value)&&"string"!=typeof e.style||"properties"===p||this.setAttribute(t,p,e[p])}}catch(t){s={error:t}}finally{try{m&&!m.done&&(l=f.return)&&l.call(f)}finally{if(s)throw s.error}}},t.prototype.replace=function(t,e){return this.insert(t,e),this.remove(e),e},t.prototype.childNode=function(t,e){return this.childNodes(t)[e]},t.prototype.allClasses=function(t){var e=this.getAttribute(t,"class");return e?e.replace(/  +/g," ").replace(/^ /,"").replace(/ $/,"").split(/ /):[]},t}();e.AbstractDOMAdaptor=n},3494:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractFindMath=void 0;var n=r(7233),o=function(){function t(t){var e=this.constructor;this.options=(0,n.userOptions)((0,n.defaultOptions)({},e.OPTIONS),t)}return t.OPTIONS={},t}();e.AbstractFindMath=o},3670:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractHandler=void 0;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(r(5722).AbstractMathDocument),a=function(){function t(t,e){void 0===e&&(e=5),this.documentClass=i,this.adaptor=t,this.priority=e}return Object.defineProperty(t.prototype,"name",{get:function(){return this.constructor.NAME},enumerable:!1,configurable:!0}),t.prototype.handlesDocument=function(t){return!1},t.prototype.create=function(t,e){return new this.documentClass(t,this.adaptor,e)},t.NAME="generic",t}();e.AbstractHandler=a},805:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.HandlerList=void 0;var a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.register=function(t){return this.add(t,t.priority)},e.prototype.unregister=function(t){this.remove(t)},e.prototype.handlesDocument=function(t){var e,r;try{for(var n=i(this),o=n.next();!o.done;o=n.next()){var a=o.value.item;if(a.handlesDocument(t))return a}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}throw new Error("Can't find handler for document")},e.prototype.document=function(t,e){return void 0===e&&(e=null),this.handlesDocument(t).create(t,e)},e}(r(8666).PrioritizedList);e.HandlerList=a},9206:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractInputJax=void 0;var n=r(7233),o=r(7525),i=function(){function t(t){void 0===t&&(t={}),this.adaptor=null,this.mmlFactory=null;var e=this.constructor;this.options=(0,n.userOptions)((0,n.defaultOptions)({},e.OPTIONS),t),this.preFilters=new o.FunctionList,this.postFilters=new o.FunctionList}return Object.defineProperty(t.prototype,"name",{get:function(){return this.constructor.NAME},enumerable:!1,configurable:!0}),t.prototype.setAdaptor=function(t){this.adaptor=t},t.prototype.setMmlFactory=function(t){this.mmlFactory=t},t.prototype.initialize=function(){},t.prototype.reset=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},Object.defineProperty(t.prototype,"processStrings",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.findMath=function(t,e){return[]},t.prototype.executeFilters=function(t,e,r,n){var o={math:e,document:r,data:n};return t.execute(o),o.data},t.NAME="generic",t.OPTIONS={},t}();e.AbstractInputJax=i},5722:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},s=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractMathDocument=e.resetAllOptions=e.resetOptions=e.RenderList=void 0;var l=r(7233),c=r(9206),u=r(2975),p=r(9e3),h=r(4474),d=r(3909),f=r(6751),m=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.create=function(t){var e,r,n=new this;try{for(var o=i(Object.keys(t)),s=o.next();!s.done;s=o.next()){var l=s.value,c=a(this.action(l,t[l]),2),u=c[0],p=c[1];p&&n.add(u,p)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return n},e.action=function(t,e){var r,n,o,i,s,l,c=!0,u=e[0];if(1===e.length||"boolean"==typeof e[1])2===e.length&&(c=e[1]),s=(r=a(this.methodActions(t),2))[0],l=r[1];else if("string"==typeof e[1])if("string"==typeof e[2]){4===e.length&&(c=e[3]);var p=a(e.slice(1),2),h=p[0],d=p[1];s=(n=a(this.methodActions(h,d),2))[0],l=n[1]}else 3===e.length&&(c=e[2]),s=(o=a(this.methodActions(e[1]),2))[0],l=o[1];else 4===e.length&&(c=e[3]),s=(i=a(e.slice(1),2))[0],l=i[1];return[{id:t,renderDoc:s,renderMath:l,convert:c},u]},e.methodActions=function(t,e){return void 0===e&&(e=t),[function(e){return t&&e[t](),!1},function(t,r){return e&&t[e](r),!1}]},e.prototype.renderDoc=function(t,e){var r,n;void 0===e&&(e=h.STATE.UNPROCESSED);try{for(var o=i(this.items),a=o.next();!a.done;a=o.next()){var s=a.value;if(s.priority>=e&&s.item.renderDoc(t))return}}catch(t){r={error:t}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},e.prototype.renderMath=function(t,e,r){var n,o;void 0===r&&(r=h.STATE.UNPROCESSED);try{for(var a=i(this.items),s=a.next();!s.done;s=a.next()){var l=s.value;if(l.priority>=r&&l.item.renderMath(t,e))return}}catch(t){n={error:t}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}},e.prototype.renderConvert=function(t,e,r){var n,o;void 0===r&&(r=h.STATE.LAST);try{for(var a=i(this.items),s=a.next();!s.done;s=a.next()){var l=s.value;if(l.priority>r)return;if(l.item.convert&&l.item.renderMath(t,e))return}}catch(t){n={error:t}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}},e.prototype.findID=function(t){var e,r;try{for(var n=i(this.items),o=n.next();!o.done;o=n.next()){var a=o.value;if(a.item.id===t)return a.item}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return null},e}(r(8666).PrioritizedList);e.RenderList=m,e.resetOptions={all:!1,processed:!1,inputJax:null,outputJax:null},e.resetAllOptions={all:!0,processed:!0,inputJax:[],outputJax:[]};var y=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.compile=function(t){return null},e}(c.AbstractInputJax),g=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.typeset=function(t,e){return void 0===e&&(e=null),null},e.prototype.escaped=function(t,e){return null},e}(u.AbstractOutputJax),b=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(p.AbstractMathList),v=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(h.AbstractMathItem),_=function(){function t(e,r,n){var o=this,i=this.constructor;this.document=e,this.options=(0,l.userOptions)((0,l.defaultOptions)({},i.OPTIONS),n),this.math=new(this.options.MathList||b),this.renderActions=m.create(this.options.renderActions),this.processed=new t.ProcessBits,this.outputJax=this.options.OutputJax||new g;var a=this.options.InputJax||[new y];Array.isArray(a)||(a=[a]),this.inputJax=a,this.adaptor=r,this.outputJax.setAdaptor(r),this.inputJax.map((function(t){return t.setAdaptor(r)})),this.mmlFactory=this.options.MmlFactory||new d.MmlFactory,this.inputJax.map((function(t){return t.setMmlFactory(o.mmlFactory)})),this.outputJax.initialize(),this.inputJax.map((function(t){return t.initialize()}))}return Object.defineProperty(t.prototype,"kind",{get:function(){return this.constructor.KIND},enumerable:!1,configurable:!0}),t.prototype.addRenderAction=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=a(m.action(t,e),2),o=n[0],i=n[1];this.renderActions.add(o,i)},t.prototype.removeRenderAction=function(t){var e=this.renderActions.findID(t);e&&this.renderActions.remove(e)},t.prototype.render=function(){return this.renderActions.renderDoc(this),this},t.prototype.rerender=function(t){return void 0===t&&(t=h.STATE.RERENDER),this.state(t-1),this.render(),this},t.prototype.convert=function(t,e){void 0===e&&(e={});var r=(0,l.userOptions)({format:this.inputJax[0].name,display:!0,end:h.STATE.LAST,em:16,ex:8,containerWidth:null,lineWidth:1e6,scale:1,family:""},e),n=r.format,o=r.display,i=r.end,a=r.ex,s=r.em,c=r.containerWidth,u=r.lineWidth,p=r.scale,d=r.family;null===c&&(c=80*a);var f=this.inputJax.reduce((function(t,e){return e.name===n?e:t}),null),m=new this.options.MathItem(t,f,o);return m.start.node=this.adaptor.body(this.document),m.setMetrics(s,a,c,u,p),this.outputJax.options.mtextInheritFont&&(m.outputData.mtextFamily=d),this.outputJax.options.merrorInheritFont&&(m.outputData.merrorFamily=d),m.convert(this,i),m.typesetRoot||m.root},t.prototype.findMath=function(t){return void 0===t&&(t=null),this.processed.set("findMath"),this},t.prototype.compile=function(){var t,e,r,n;if(!this.processed.isSet("compile")){var o=[];try{for(var a=i(this.math),s=a.next();!s.done;s=a.next()){var l=s.value;this.compileMath(l),void 0!==l.inputData.recompile&&o.push(l)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}try{for(var c=i(o),u=c.next();!u.done;u=c.next()){var p=(l=u.value).inputData.recompile;l.state(p.state),l.inputData.recompile=p,this.compileMath(l)}}catch(t){r={error:t}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}this.processed.set("compile")}return this},t.prototype.compileMath=function(t){try{t.compile(this)}catch(e){if(e.retry||e.restart)throw e;this.options.compileError(this,t,e),t.inputData.error=e}},t.prototype.compileError=function(t,e){t.root=this.mmlFactory.create("math",null,[this.mmlFactory.create("merror",{"data-mjx-error":e.message,title:e.message},[this.mmlFactory.create("mtext",null,[this.mmlFactory.create("text").setText("Math input error")])])]),t.display&&t.root.attributes.set("display","block"),t.inputData.error=e.message},t.prototype.typeset=function(){var t,e;if(!this.processed.isSet("typeset")){try{for(var r=i(this.math),n=r.next();!n.done;n=r.next()){var o=n.value;try{o.typeset(this)}catch(t){if(t.retry||t.restart)throw t;this.options.typesetError(this,o,t),o.outputData.error=t}}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}this.processed.set("typeset")}return this},t.prototype.typesetError=function(t,e){t.typesetRoot=this.adaptor.node("mjx-container",{class:"MathJax mjx-output-error",jax:this.outputJax.name},[this.adaptor.node("span",{"data-mjx-error":e.message,title:e.message,style:{color:"red","background-color":"yellow","line-height":"normal"}},[this.adaptor.text("Math output error")])]),t.display&&this.adaptor.setAttributes(t.typesetRoot,{style:{display:"block",margin:"1em 0","text-align":"center"}}),t.outputData.error=e.message},t.prototype.getMetrics=function(){return this.processed.isSet("getMetrics")||(this.outputJax.getMetrics(this),this.processed.set("getMetrics")),this},t.prototype.updateDocument=function(){var t,e;if(!this.processed.isSet("updateDocument")){try{for(var r=i(this.math.reversed()),n=r.next();!n.done;n=r.next()){n.value.updateDocument(this)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}this.processed.set("updateDocument")}return this},t.prototype.removeFromDocument=function(t){return void 0===t&&(t=!1),this},t.prototype.state=function(t,e){var r,n;void 0===e&&(e=!1);try{for(var o=i(this.math),a=o.next();!a.done;a=o.next()){a.value.state(t,e)}}catch(t){r={error:t}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return t<h.STATE.INSERTED&&this.processed.clear("updateDocument"),t<h.STATE.TYPESET&&(this.processed.clear("typeset"),this.processed.clear("getMetrics")),t<h.STATE.COMPILED&&this.processed.clear("compile"),this},t.prototype.reset=function(t){var r;return void 0===t&&(t={processed:!0}),(t=(0,l.userOptions)(Object.assign({},e.resetOptions),t)).all&&Object.assign(t,e.resetAllOptions),t.processed&&this.processed.reset(),t.inputJax&&this.inputJax.forEach((function(e){return e.reset.apply(e,s([],a(t.inputJax),!1))})),t.outputJax&&(r=this.outputJax).reset.apply(r,s([],a(t.outputJax),!1)),this},t.prototype.clear=function(){return this.reset(),this.math.clear(),this},t.prototype.concat=function(t){return this.math.merge(t),this},t.prototype.clearMathItemsWithin=function(t){var e,r=this.getMathItemsWithin(t);return(e=this.math).remove.apply(e,s([],a(r),!1)),r},t.prototype.getMathItemsWithin=function(t){var e,r,n,o;Array.isArray(t)||(t=[t]);var a=this.adaptor,s=[],l=a.getElements(t,this.document);try{t:for(var c=i(this.math),u=c.next();!u.done;u=c.next()){var p=u.value;try{for(var h=(n=void 0,i(l)),d=h.next();!d.done;d=h.next()){var f=d.value;if(p.start.node&&a.contains(f,p.start.node)){s.push(p);continue t}}}catch(t){n={error:t}}finally{try{d&&!d.done&&(o=h.return)&&o.call(h)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(e)throw e.error}}return s},t.KIND="MathDocument",t.OPTIONS={OutputJax:null,InputJax:null,MmlFactory:null,MathList:b,MathItem:v,compileError:function(t,e,r){t.compileError(e,r)},typesetError:function(t,e,r){t.typesetError(e,r)},renderActions:(0,l.expandable)({find:[h.STATE.FINDMATH,"findMath","",!1],compile:[h.STATE.COMPILED],metrics:[h.STATE.METRICS,"getMetrics","",!1],typeset:[h.STATE.TYPESET],update:[h.STATE.INSERTED,"updateDocument",!1]})},t.ProcessBits=(0,f.BitFieldClass)("findMath","compile","getMetrics","typeset","updateDocument"),t}();e.AbstractMathDocument=_},4474:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.newState=e.STATE=e.AbstractMathItem=e.protoItem=void 0,e.protoItem=function(t,e,r,n,o,i,a){return void 0===a&&(a=null),{open:t,math:e,close:r,n:n,start:{n:o},end:{n:i},display:a}};var r=function(){function t(t,r,n,o,i){void 0===n&&(n=!0),void 0===o&&(o={i:0,n:0,delim:""}),void 0===i&&(i={i:0,n:0,delim:""}),this.root=null,this.typesetRoot=null,this.metrics={},this.inputData={},this.outputData={},this._state=e.STATE.UNPROCESSED,this.math=t,this.inputJax=r,this.display=n,this.start=o,this.end=i,this.root=null,this.typesetRoot=null,this.metrics={},this.inputData={},this.outputData={}}return Object.defineProperty(t.prototype,"isEscaped",{get:function(){return null===this.display},enumerable:!1,configurable:!0}),t.prototype.render=function(t){t.renderActions.renderMath(this,t)},t.prototype.rerender=function(t,r){void 0===r&&(r=e.STATE.RERENDER),this.state()>=r&&this.state(r-1),t.renderActions.renderMath(this,t,r)},t.prototype.convert=function(t,r){void 0===r&&(r=e.STATE.LAST),t.renderActions.renderConvert(this,t,r)},t.prototype.compile=function(t){this.state()<e.STATE.COMPILED&&(this.root=this.inputJax.compile(this,t),this.state(e.STATE.COMPILED))},t.prototype.typeset=function(t){this.state()<e.STATE.TYPESET&&(this.typesetRoot=t.outputJax[this.isEscaped?"escaped":"typeset"](this,t),this.state(e.STATE.TYPESET))},t.prototype.updateDocument=function(t){},t.prototype.removeFromDocument=function(t){void 0===t&&(t=!1)},t.prototype.setMetrics=function(t,e,r,n,o){this.metrics={em:t,ex:e,containerWidth:r,lineWidth:n,scale:o}},t.prototype.state=function(t,r){return void 0===t&&(t=null),void 0===r&&(r=!1),null!=t&&(t<e.STATE.INSERTED&&this._state>=e.STATE.INSERTED&&this.removeFromDocument(r),t<e.STATE.TYPESET&&this._state>=e.STATE.TYPESET&&(this.outputData={}),t<e.STATE.COMPILED&&this._state>=e.STATE.COMPILED&&(this.inputData={}),this._state=t),this._state},t.prototype.reset=function(t){void 0===t&&(t=!1),this.state(e.STATE.UNPROCESSED,t)},t}();e.AbstractMathItem=r,e.STATE={UNPROCESSED:0,FINDMATH:10,COMPILED:20,CONVERT:100,METRICS:110,RERENDER:125,TYPESET:150,INSERTED:200,LAST:1e4},e.newState=function(t,r){if(t in e.STATE)throw Error("State "+t+" already exists");e.STATE[t]=r}},9e3:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractMathList=void 0;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.isBefore=function(t,e){return t.start.i<e.start.i||t.start.i===e.start.i&&t.start.n<e.start.n},e}(r(103).LinkedList);e.AbstractMathList=i},91:function(t,e){var r=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.Attributes=e.INHERIT=void 0,e.INHERIT="_inherit_";var n=function(){function t(t,e){this.global=e,this.defaults=Object.create(e),this.inherited=Object.create(this.defaults),this.attributes=Object.create(this.inherited),Object.assign(this.defaults,t)}return t.prototype.set=function(t,e){this.attributes[t]=e},t.prototype.setList=function(t){Object.assign(this.attributes,t)},t.prototype.get=function(t){var r=this.attributes[t];return r===e.INHERIT&&(r=this.global[t]),r},t.prototype.getExplicit=function(t){if(this.attributes.hasOwnProperty(t))return this.attributes[t]},t.prototype.getList=function(){for(var t,e,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var i={};try{for(var a=r(n),s=a.next();!s.done;s=a.next()){var l=s.value;i[l]=this.get(l)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}return i},t.prototype.setInherited=function(t,e){this.inherited[t]=e},t.prototype.getInherited=function(t){return this.inherited[t]},t.prototype.getDefault=function(t){return this.defaults[t]},t.prototype.isSet=function(t){return this.attributes.hasOwnProperty(t)||this.inherited.hasOwnProperty(t)},t.prototype.hasDefault=function(t){return t in this.defaults},t.prototype.getExplicitNames=function(){return Object.keys(this.attributes)},t.prototype.getInheritedNames=function(){return Object.keys(this.inherited)},t.prototype.getDefaultNames=function(){return Object.keys(this.defaults)},t.prototype.getGlobalNames=function(){return Object.keys(this.global)},t.prototype.getAllAttributes=function(){return this.attributes},t.prototype.getAllInherited=function(){return this.inherited},t.prototype.getAllDefaults=function(){return this.defaults},t.prototype.getAllGlobals=function(){return this.global},t}();e.Attributes=n},6336:function(t,e,r){var n;Object.defineProperty(e,"__esModule",{value:!0}),e.MML=void 0;var o=r(9007),i=r(3233),a=r(450),s=r(3050),l=r(2756),c=r(4770),u=r(6030),p=r(7265),h=r(9878),d=r(6850),f=r(7131),m=r(6145),y=r(1314),g=r(1581),b=r(7238),v=r(5741),_=r(5410),S=r(6661),x=r(9145),M=r(4461),O=r(5184),E=r(6405),A=r(1349),C=r(5022),w=r(4359),T=r(142),N=r(7590),L=r(3985),P=r(9102),I=r(3948),k=r(1334);e.MML=((n={})[i.MmlMath.prototype.kind]=i.MmlMath,n[a.MmlMi.prototype.kind]=a.MmlMi,n[s.MmlMn.prototype.kind]=s.MmlMn,n[l.MmlMo.prototype.kind]=l.MmlMo,n[c.MmlMtext.prototype.kind]=c.MmlMtext,n[u.MmlMspace.prototype.kind]=u.MmlMspace,n[p.MmlMs.prototype.kind]=p.MmlMs,n[h.MmlMrow.prototype.kind]=h.MmlMrow,n[h.MmlInferredMrow.prototype.kind]=h.MmlInferredMrow,n[d.MmlMfrac.prototype.kind]=d.MmlMfrac,n[f.MmlMsqrt.prototype.kind]=f.MmlMsqrt,n[m.MmlMroot.prototype.kind]=m.MmlMroot,n[y.MmlMstyle.prototype.kind]=y.MmlMstyle,n[g.MmlMerror.prototype.kind]=g.MmlMerror,n[b.MmlMpadded.prototype.kind]=b.MmlMpadded,n[v.MmlMphantom.prototype.kind]=v.MmlMphantom,n[_.MmlMfenced.prototype.kind]=_.MmlMfenced,n[S.MmlMenclose.prototype.kind]=S.MmlMenclose,n[x.MmlMaction.prototype.kind]=x.MmlMaction,n[M.MmlMsub.prototype.kind]=M.MmlMsub,n[M.MmlMsup.prototype.kind]=M.MmlMsup,n[M.MmlMsubsup.prototype.kind]=M.MmlMsubsup,n[O.MmlMunder.prototype.kind]=O.MmlMunder,n[O.MmlMover.prototype.kind]=O.MmlMover,n[O.MmlMunderover.prototype.kind]=O.MmlMunderover,n[E.MmlMmultiscripts.prototype.kind]=E.MmlMmultiscripts,n[E.MmlMprescripts.prototype.kind]=E.MmlMprescripts,n[E.MmlNone.prototype.kind]=E.MmlNone,n[A.MmlMtable.prototype.kind]=A.MmlMtable,n[C.MmlMlabeledtr.prototype.kind]=C.MmlMlabeledtr,n[C.MmlMtr.prototype.kind]=C.MmlMtr,n[w.MmlMtd.prototype.kind]=w.MmlMtd,n[T.MmlMaligngroup.prototype.kind]=T.MmlMaligngroup,n[N.MmlMalignmark.prototype.kind]=N.MmlMalignmark,n[L.MmlMglyph.prototype.kind]=L.MmlMglyph,n[P.MmlSemantics.prototype.kind]=P.MmlSemantics,n[P.MmlAnnotation.prototype.kind]=P.MmlAnnotation,n[P.MmlAnnotationXML.prototype.kind]=P.MmlAnnotationXML,n[I.TeXAtom.prototype.kind]=I.TeXAtom,n[k.MathChoice.prototype.kind]=k.MathChoice,n[o.TextNode.prototype.kind]=o.TextNode,n[o.XMLNode.prototype.kind]=o.XMLNode,n)},1759:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.MathMLVisitor=void 0;var a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.document=null,e}return o(e,t),e.prototype.visitTree=function(t,e){this.document=e;var r=e.createElement("top");return this.visitNode(t,r),this.document=null,r.firstChild},e.prototype.visitTextNode=function(t,e){e.appendChild(this.document.createTextNode(t.getText()))},e.prototype.visitXMLNode=function(t,e){e.appendChild(t.getXML().cloneNode(!0))},e.prototype.visitInferredMrowNode=function(t,e){var r,n;try{for(var o=i(t.childNodes),a=o.next();!a.done;a=o.next()){var s=a.value;this.visitNode(s,e)}}catch(t){r={error:t}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},e.prototype.visitDefault=function(t,e){var r,n,o=this.document.createElement(t.kind);this.addAttributes(t,o);try{for(var a=i(t.childNodes),s=a.next();!s.done;s=a.next()){var l=s.value;this.visitNode(l,o)}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}e.appendChild(o)},e.prototype.addAttributes=function(t,e){var r,n,o=t.attributes,a=o.getExplicitNames();try{for(var s=i(a),l=s.next();!l.done;l=s.next()){var c=l.value;e.setAttribute(c,o.getExplicit(c).toString())}}catch(t){r={error:t}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}},e}(r(6325).MmlVisitor);e.MathMLVisitor=a},3909:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.MmlFactory=void 0;var i=r(7860),a=r(6336),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"MML",{get:function(){return this.node},enumerable:!1,configurable:!0}),e.defaultNodes=a.MML,e}(i.AbstractNodeFactory);e.MmlFactory=s},9007:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},a=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},s=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.XMLNode=e.TextNode=e.AbstractMmlEmptyNode=e.AbstractMmlBaseNode=e.AbstractMmlLayoutNode=e.AbstractMmlTokenNode=e.AbstractMmlNode=e.indentAttributes=e.TEXCLASSNAMES=e.TEXCLASS=void 0;var l=r(91),c=r(4596);e.TEXCLASS={ORD:0,OP:1,BIN:2,REL:3,OPEN:4,CLOSE:5,PUNCT:6,INNER:7,VCENTER:8,NONE:-1},e.TEXCLASSNAMES=["ORD","OP","BIN","REL","OPEN","CLOSE","PUNCT","INNER","VCENTER"];var u=["","thinmathspace","mediummathspace","thickmathspace"],p=[[0,-1,2,3,0,0,0,1],[-1,-1,0,3,0,0,0,1],[2,2,0,0,2,0,0,2],[3,3,0,0,3,0,0,3],[0,0,0,0,0,0,0,0],[0,-1,2,3,0,0,0,1],[1,1,0,1,1,1,1,1],[1,-1,2,3,1,0,1,1]];e.indentAttributes=["indentalign","indentalignfirst","indentshift","indentshiftfirst"];var h=function(t){function r(e,r,n){void 0===r&&(r={}),void 0===n&&(n=[]);var o=t.call(this,e)||this;return o.prevClass=null,o.prevLevel=null,o.texclass=null,o.arity<0&&(o.childNodes=[e.create("inferredMrow")],o.childNodes[0].parent=o),o.setChildren(n),o.attributes=new l.Attributes(e.getNodeClass(o.kind).defaults,e.getNodeClass("math").defaults),o.attributes.setList(r),o}return o(r,t),r.prototype.copy=function(t){var e,r,n,o;void 0===t&&(t=!1);var s=this.factory.create(this.kind);if(s.properties=i({},this.properties),this.attributes){var l=this.attributes.getAllAttributes();try{for(var c=a(Object.keys(l)),u=c.next();!u.done;u=c.next()){var p=u.value;("id"!==p||t)&&s.attributes.set(p,l[p])}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(e)throw e.error}}}if(this.childNodes&&this.childNodes.length){var h=this.childNodes;1===h.length&&h[0].isInferred&&(h=h[0].childNodes);try{for(var d=a(h),f=d.next();!f.done;f=d.next()){var m=f.value;m?s.appendChild(m.copy()):s.childNodes.push(null)}}catch(t){n={error:t}}finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}}return s},Object.defineProperty(r.prototype,"texClass",{get:function(){return this.texclass},set:function(t){this.texclass=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isToken",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isEmbellished",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isSpacelike",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"linebreakContainer",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"hasNewLine",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"arity",{get:function(){return 1/0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isInferred",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"Parent",{get:function(){for(var t=this.parent;t&&t.notParent;)t=t.Parent;return t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"notParent",{get:function(){return!1},enumerable:!1,configurable:!0}),r.prototype.setChildren=function(e){return this.arity<0?this.childNodes[0].setChildren(e):t.prototype.setChildren.call(this,e)},r.prototype.appendChild=function(e){var r,n,o=this;if(this.arity<0)return this.childNodes[0].appendChild(e),e;if(e.isInferred){if(this.arity===1/0)return e.childNodes.forEach((function(e){return t.prototype.appendChild.call(o,e)})),e;var i=e;(e=this.factory.create("mrow")).setChildren(i.childNodes),e.attributes=i.attributes;try{for(var s=a(i.getPropertyNames()),l=s.next();!l.done;l=s.next()){var c=l.value;e.setProperty(c,i.getProperty(c))}}catch(t){r={error:t}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}}return t.prototype.appendChild.call(this,e)},r.prototype.replaceChild=function(e,r){return this.arity<0?(this.childNodes[0].replaceChild(e,r),e):t.prototype.replaceChild.call(this,e,r)},r.prototype.core=function(){return this},r.prototype.coreMO=function(){return this},r.prototype.coreIndex=function(){return 0},r.prototype.childPosition=function(){for(var t,e,r=this,n=r.parent;n&&n.notParent;)r=n,n=n.parent;if(n){var o=0;try{for(var i=a(n.childNodes),s=i.next();!s.done;s=i.next()){if(s.value===r)return o;o++}}catch(e){t={error:e}}finally{try{s&&!s.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}}return null},r.prototype.setTeXclass=function(t){return this.getPrevClass(t),null!=this.texClass?this:t},r.prototype.updateTeXclass=function(t){t&&(this.prevClass=t.prevClass,this.prevLevel=t.prevLevel,t.prevClass=t.prevLevel=null,this.texClass=t.texClass)},r.prototype.getPrevClass=function(t){t&&(this.prevClass=t.texClass,this.prevLevel=t.attributes.get("scriptlevel"))},r.prototype.texSpacing=function(){var t=null!=this.prevClass?this.prevClass:e.TEXCLASS.NONE,r=this.texClass||e.TEXCLASS.ORD;if(t===e.TEXCLASS.NONE||r===e.TEXCLASS.NONE)return"";t===e.TEXCLASS.VCENTER&&(t=e.TEXCLASS.ORD),r===e.TEXCLASS.VCENTER&&(r=e.TEXCLASS.ORD);var n=p[t][r];return(this.prevLevel>0||this.attributes.get("scriptlevel")>0)&&n>=0?"":u[Math.abs(n)]},r.prototype.hasSpacingAttributes=function(){return this.isEmbellished&&this.coreMO().hasSpacingAttributes()},r.prototype.setInheritedAttributes=function(t,e,n,o){var i,l;void 0===t&&(t={}),void 0===e&&(e=!1),void 0===n&&(n=0),void 0===o&&(o=!1);var c=this.attributes.getAllDefaults();try{for(var u=a(Object.keys(t)),p=u.next();!p.done;p=u.next()){var h=p.value;if(c.hasOwnProperty(h)||r.alwaysInherit.hasOwnProperty(h)){var d=s(t[h],2),f=d[0],m=d[1];((r.noInherit[f]||{})[this.kind]||{})[h]||this.attributes.setInherited(h,m)}}}catch(t){i={error:t}}finally{try{p&&!p.done&&(l=u.return)&&l.call(u)}finally{if(i)throw i.error}}void 0===this.attributes.getExplicit("displaystyle")&&this.attributes.setInherited("displaystyle",e),void 0===this.attributes.getExplicit("scriptlevel")&&this.attributes.setInherited("scriptlevel",n),o&&this.setProperty("texprimestyle",o);var y=this.arity;if(y>=0&&y!==1/0&&(1===y&&0===this.childNodes.length||1!==y&&this.childNodes.length!==y))if(y<this.childNodes.length)this.childNodes=this.childNodes.slice(0,y);else for(;this.childNodes.length<y;)this.appendChild(this.factory.create("mrow"));this.setChildInheritedAttributes(t,e,n,o)},r.prototype.setChildInheritedAttributes=function(t,e,r,n){var o,i;try{for(var s=a(this.childNodes),l=s.next();!l.done;l=s.next()){l.value.setInheritedAttributes(t,e,r,n)}}catch(t){o={error:t}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}},r.prototype.addInheritedAttributes=function(t,e){var r,n,o=i({},t);try{for(var s=a(Object.keys(e)),l=s.next();!l.done;l=s.next()){var c=l.value;"displaystyle"!==c&&"scriptlevel"!==c&&"style"!==c&&(o[c]=[this.kind,e[c]])}}catch(t){r={error:t}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o},r.prototype.inheritAttributesFrom=function(t){var e=t.attributes,r=e.get("displaystyle"),n=e.get("scriptlevel"),o=e.isSet("mathsize")?{mathsize:["math",e.get("mathsize")]}:{},i=t.getProperty("texprimestyle")||!1;this.setInheritedAttributes(o,r,n,i)},r.prototype.verifyTree=function(t){if(void 0===t&&(t=null),null!==t){this.verifyAttributes(t);var e=this.arity;t.checkArity&&e>=0&&e!==1/0&&(1===e&&0===this.childNodes.length||1!==e&&this.childNodes.length!==e)&&this.mError('Wrong number of children for "'+this.kind+'" node',t,!0),this.verifyChildren(t)}},r.prototype.verifyAttributes=function(t){var e,r;if(t.checkAttributes){var n=this.attributes,o=[];try{for(var i=a(n.getExplicitNames()),s=i.next();!s.done;s=i.next()){var l=s.value;"data-"===l.substr(0,5)||void 0!==n.getDefault(l)||l.match(/^(?:class|style|id|(?:xlink:)?href)$/)||o.push(l)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}o.length&&this.mError("Unknown attributes for "+this.kind+" node: "+o.join(", "),t)}},r.prototype.verifyChildren=function(t){var e,r;try{for(var n=a(this.childNodes),o=n.next();!o.done;o=n.next()){o.value.verifyTree(t)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},r.prototype.mError=function(t,e,r){if(void 0===r&&(r=!1),this.parent&&this.parent.isKind("merror"))return null;var n=this.factory.create("merror");if(n.attributes.set("data-mjx-message",t),e.fullErrors||r){var o=this.factory.create("mtext"),i=this.factory.create("text");i.setText(e.fullErrors?t:this.kind),o.appendChild(i),n.appendChild(o),this.parent.replaceChild(n,this)}else this.parent.replaceChild(n,this),n.appendChild(this);return n},r.defaults={mathbackground:l.INHERIT,mathcolor:l.INHERIT,mathsize:l.INHERIT,dir:l.INHERIT},r.noInherit={mstyle:{mpadded:{width:!0,height:!0,depth:!0,lspace:!0,voffset:!0},mtable:{width:!0,height:!0,depth:!0,align:!0}},maligngroup:{mrow:{groupalign:!0},mtable:{groupalign:!0}}},r.alwaysInherit={scriptminsize:!0,scriptsizemultiplier:!0},r.verifyDefaults={checkArity:!0,checkAttributes:!1,fullErrors:!1,fixMmultiscripts:!0,fixMtables:!0},r}(c.AbstractNode);e.AbstractMmlNode=h;var d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"isToken",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.getText=function(){var t,e,r="";try{for(var n=a(this.childNodes),o=n.next();!o.done;o=n.next()){var i=o.value;i instanceof g&&(r+=i.getText())}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}return r},e.prototype.setChildInheritedAttributes=function(t,e,r,n){var o,i;try{for(var s=a(this.childNodes),l=s.next();!l.done;l=s.next()){var c=l.value;c instanceof h&&c.setInheritedAttributes(t,e,r,n)}}catch(t){o={error:t}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}},e.prototype.walkTree=function(t,e){var r,n;t(this,e);try{for(var o=a(this.childNodes),i=o.next();!i.done;i=o.next()){var s=i.value;s instanceof h&&s.walkTree(t,e)}}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return e},e.defaults=i(i({},h.defaults),{mathvariant:"normal",mathsize:l.INHERIT}),e}(h);e.AbstractMmlTokenNode=d;var f=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"isSpacelike",{get:function(){return this.childNodes[0].isSpacelike},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEmbellished",{get:function(){return this.childNodes[0].isEmbellished},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"arity",{get:function(){return-1},enumerable:!1,configurable:!0}),e.prototype.core=function(){return this.childNodes[0]},e.prototype.coreMO=function(){return this.childNodes[0].coreMO()},e.prototype.setTeXclass=function(t){return t=this.childNodes[0].setTeXclass(t),this.updateTeXclass(this.childNodes[0]),t},e.defaults=h.defaults,e}(h);e.AbstractMmlLayoutNode=f;var m=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return o(r,t),Object.defineProperty(r.prototype,"isEmbellished",{get:function(){return this.childNodes[0].isEmbellished},enumerable:!1,configurable:!0}),r.prototype.core=function(){return this.childNodes[0]},r.prototype.coreMO=function(){return this.childNodes[0].coreMO()},r.prototype.setTeXclass=function(t){var r,n;this.getPrevClass(t),this.texClass=e.TEXCLASS.ORD;var o=this.childNodes[0];o?this.isEmbellished||o.isKind("mi")?(t=o.setTeXclass(t),this.updateTeXclass(this.core())):(o.setTeXclass(null),t=this):t=this;try{for(var i=a(this.childNodes.slice(1)),s=i.next();!s.done;s=i.next()){var l=s.value;l&&l.setTeXclass(null)}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return t},r.defaults=h.defaults,r}(h);e.AbstractMmlBaseNode=m;var y=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return o(r,t),Object.defineProperty(r.prototype,"isToken",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isEmbellished",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isSpacelike",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"linebreakContainer",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"hasNewLine",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"arity",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isInferred",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"notParent",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"Parent",{get:function(){return this.parent},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"texClass",{get:function(){return e.TEXCLASS.NONE},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"prevClass",{get:function(){return e.TEXCLASS.NONE},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"prevLevel",{get:function(){return 0},enumerable:!1,configurable:!0}),r.prototype.hasSpacingAttributes=function(){return!1},Object.defineProperty(r.prototype,"attributes",{get:function(){return null},enumerable:!1,configurable:!0}),r.prototype.core=function(){return this},r.prototype.coreMO=function(){return this},r.prototype.coreIndex=function(){return 0},r.prototype.childPosition=function(){return 0},r.prototype.setTeXclass=function(t){return t},r.prototype.texSpacing=function(){return""},r.prototype.setInheritedAttributes=function(t,e,r,n){},r.prototype.inheritAttributesFrom=function(t){},r.prototype.verifyTree=function(t){},r.prototype.mError=function(t,e,r){return void 0===r&&(r=!1),null},r}(c.AbstractEmptyNode);e.AbstractMmlEmptyNode=y;var g=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.text="",e}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"text"},enumerable:!1,configurable:!0}),e.prototype.getText=function(){return this.text},e.prototype.setText=function(t){return this.text=t,this},e.prototype.copy=function(){return this.factory.create(this.kind).setText(this.getText())},e.prototype.toString=function(){return this.text},e}(y);e.TextNode=g;var b=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.xml=null,e.adaptor=null,e}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"XML"},enumerable:!1,configurable:!0}),e.prototype.getXML=function(){return this.xml},e.prototype.setXML=function(t,e){return void 0===e&&(e=null),this.xml=t,this.adaptor=e,this},e.prototype.getSerializedXML=function(){return this.adaptor.serializeXML(this.xml)},e.prototype.copy=function(){return this.factory.create(this.kind).setXML(this.adaptor.clone(this.xml))},e.prototype.toString=function(){return"XML data"},e}(y);e.XMLNode=b},3948:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.TeXAtom=void 0;var a=r(9007),s=r(2756),l=function(t){function e(e,r,n){var o=t.call(this,e,r,n)||this;return o.texclass=a.TEXCLASS.ORD,o.setProperty("texClass",o.texClass),o}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"TeXAtom"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"arity",{get:function(){return-1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"notParent",{get:function(){return this.childNodes[0]&&1===this.childNodes[0].childNodes.length},enumerable:!1,configurable:!0}),e.prototype.setTeXclass=function(t){return this.childNodes[0].setTeXclass(null),this.adjustTeXclass(t)},e.prototype.adjustTeXclass=function(t){return t},e.defaults=i({},a.AbstractMmlBaseNode.defaults),e}(a.AbstractMmlBaseNode);e.TeXAtom=l,l.prototype.adjustTeXclass=s.MmlMo.prototype.adjustTeXclass},9145:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMaction=void 0;var a=r(9007),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"maction"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"arity",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selected",{get:function(){var t=this.attributes.get("selection"),e=Math.max(1,Math.min(this.childNodes.length,t))-1;return this.childNodes[e]||this.factory.create("mrow")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEmbellished",{get:function(){return this.selected.isEmbellished},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSpacelike",{get:function(){return this.selected.isSpacelike},enumerable:!1,configurable:!0}),e.prototype.core=function(){return this.selected.core()},e.prototype.coreMO=function(){return this.selected.coreMO()},e.prototype.verifyAttributes=function(e){(t.prototype.verifyAttributes.call(this,e),"toggle"!==this.attributes.get("actiontype")&&void 0!==this.attributes.getExplicit("selection"))&&delete this.attributes.getAllAttributes().selection},e.prototype.setTeXclass=function(t){"tooltip"===this.attributes.get("actiontype")&&this.childNodes[1]&&this.childNodes[1].setTeXclass(null);var e=this.selected;return t=e.setTeXclass(t),this.updateTeXclass(e),t},e.prototype.nextToggleSelection=function(){var t=Math.max(1,this.attributes.get("selection")+1);t>this.childNodes.length&&(t=1),this.attributes.set("selection",t)},e.defaults=i(i({},a.AbstractMmlNode.defaults),{actiontype:"toggle",selection:1}),e}(a.AbstractMmlNode);e.MmlMaction=s},142:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMaligngroup=void 0;var a=r(9007),s=r(91),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"maligngroup"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSpacelike",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.setChildInheritedAttributes=function(e,r,n,o){e=this.addInheritedAttributes(e,this.attributes.getAllAttributes()),t.prototype.setChildInheritedAttributes.call(this,e,r,n,o)},e.defaults=i(i({},a.AbstractMmlLayoutNode.defaults),{groupalign:s.INHERIT}),e}(a.AbstractMmlLayoutNode);e.MmlMaligngroup=l},7590:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMalignmark=void 0;var a=r(9007),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"malignmark"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"arity",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSpacelike",{get:function(){return!0},enumerable:!1,configurable:!0}),e.defaults=i(i({},a.AbstractMmlNode.defaults),{edge:"left"}),e}(a.AbstractMmlNode);e.MmlMalignmark=s},3233:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMath=void 0;var a=r(9007),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"math"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"linebreakContainer",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.setChildInheritedAttributes=function(e,r,n,o){"display"===this.attributes.get("mode")&&this.attributes.setInherited("display","block"),e=this.addInheritedAttributes(e,this.attributes.getAllAttributes()),r=!!this.attributes.get("displaystyle")||!this.attributes.get("displaystyle")&&"block"===this.attributes.get("display"),this.attributes.setInherited("displaystyle",r),n=this.attributes.get("scriptlevel")||this.constructor.defaults.scriptlevel,t.prototype.setChildInheritedAttributes.call(this,e,r,n,o)},e.defaults=i(i({},a.AbstractMmlLayoutNode.defaults),{mathvariant:"normal",mathsize:"normal",mathcolor:"",mathbackground:"transparent",dir:"ltr",scriptlevel:0,displaystyle:!1,display:"inline",maxwidth:"",overflow:"linebreak",altimg:"","altimg-width":"","altimg-height":"","altimg-valign":"",alttext:"",cdgroup:"",scriptsizemultiplier:1/Math.sqrt(2),scriptminsize:"8px",infixlinebreakstyle:"before",lineleading:"1ex",linebreakmultchar:"\u2062",indentshift:"auto",indentalign:"auto",indenttarget:"",indentalignfirst:"indentalign",indentshiftfirst:"indentshift",indentalignlast:"indentalign",indentshiftlast:"indentshift"}),e}(a.AbstractMmlLayoutNode);e.MmlMath=s},1334:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MathChoice=void 0;var a=r(9007),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"MathChoice"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"arity",{get:function(){return 4},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"notParent",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.setInheritedAttributes=function(t,e,r,n){var o=e?0:Math.max(0,Math.min(r,2))+1,i=this.childNodes[o]||this.factory.create("mrow");this.parent.replaceChild(i,this),i.setInheritedAttributes(t,e,r,n)},e.defaults=i({},a.AbstractMmlBaseNode.defaults),e}(a.AbstractMmlBaseNode);e.MathChoice=s},6661:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMenclose=void 0;var a=r(9007),s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.texclass=a.TEXCLASS.ORD,e}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"menclose"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"arity",{get:function(){return-1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"linebreakContininer",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.setTeXclass=function(t){return t=this.childNodes[0].setTeXclass(t),this.updateTeXclass(this.childNodes[0]),t},e.defaults=i(i({},a.AbstractMmlNode.defaults),{notation:"longdiv"}),e}(a.AbstractMmlNode);e.MmlMenclose=s},1581:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMerror=void 0;var a=r(9007),s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.texclass=a.TEXCLASS.ORD,e}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"merror"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"arity",{get:function(){return-1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"linebreakContainer",{get:function(){return!0},enumerable:!1,configurable:!0}),e.defaults=i({},a.AbstractMmlNode.defaults),e}(a.AbstractMmlNode);e.MmlMerror=s},5410:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},a=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMfenced=void 0;var s=r(9007),l=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.texclass=s.TEXCLASS.INNER,e.separators=[],e.open=null,e.close=null,e}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"mfenced"},enumerable:!1,configurable:!0}),e.prototype.setTeXclass=function(t){this.getPrevClass(t),this.open&&(t=this.open.setTeXclass(t)),this.childNodes[0]&&(t=this.childNodes[0].setTeXclass(t));for(var e=1,r=this.childNodes.length;e<r;e++)this.separators[e-1]&&(t=this.separators[e-1].setTeXclass(t)),this.childNodes[e]&&(t=this.childNodes[e].setTeXclass(t));return this.close&&(t=this.close.setTeXclass(t)),this.updateTeXclass(this.open),t},e.prototype.setChildInheritedAttributes=function(e,r,n,o){var i,s;this.addFakeNodes();try{for(var l=a([this.open,this.close].concat(this.separators)),c=l.next();!c.done;c=l.next()){var u=c.value;u&&u.setInheritedAttributes(e,r,n,o)}}catch(t){i={error:t}}finally{try{c&&!c.done&&(s=l.return)&&s.call(l)}finally{if(i)throw i.error}}t.prototype.setChildInheritedAttributes.call(this,e,r,n,o)},e.prototype.addFakeNodes=function(){var t,e,r=this.attributes.getList("open","close","separators"),n=r.open,o=r.close,i=r.separators;if(n=n.replace(/[ \t\n\r]/g,""),o=o.replace(/[ \t\n\r]/g,""),i=i.replace(/[ \t\n\r]/g,""),n&&(this.open=this.fakeNode(n,{fence:!0,form:"prefix"},s.TEXCLASS.OPEN)),i){for(;i.length<this.childNodes.length-1;)i+=i.charAt(i.length-1);var l=0;try{for(var c=a(this.childNodes.slice(1)),u=c.next();!u.done;u=c.next()){u.value&&this.separators.push(this.fakeNode(i.charAt(l++)))}}catch(e){t={error:e}}finally{try{u&&!u.done&&(e=c.return)&&e.call(c)}finally{if(t)throw t.error}}}o&&(this.close=this.fakeNode(o,{fence:!0,form:"postfix"},s.TEXCLASS.CLOSE))},e.prototype.fakeNode=function(t,e,r){void 0===e&&(e={}),void 0===r&&(r=null);var n=this.factory.create("text").setText(t),o=this.factory.create("mo",e,[n]);return o.texClass=r,o.parent=this,o},e.defaults=i(i({},s.AbstractMmlNode.defaults),{open:"(",close:")",separators:","}),e}(s.AbstractMmlNode);e.MmlMfenced=l},6850:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},a=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMfrac=void 0;var s=r(9007),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"mfrac"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"arity",{get:function(){return 2},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"linebreakContainer",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.setTeXclass=function(t){var e,r;this.getPrevClass(t);try{for(var n=a(this.childNodes),o=n.next();!o.done;o=n.next()){o.value.setTeXclass(null)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return this},e.prototype.setChildInheritedAttributes=function(t,e,r,n){(!e||r>0)&&r++,this.childNodes[0].setInheritedAttributes(t,!1,r,n),this.childNodes[1].setInheritedAttributes(t,!1,r,!0)},e.defaults=i(i({},s.AbstractMmlBaseNode.defaults),{linethickness:"medium",numalign:"center",denomalign:"center",bevelled:!1}),e}(s.AbstractMmlBaseNode);e.MmlMfrac=l},3985:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMglyph=void 0;var a=r(9007),s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.texclass=a.TEXCLASS.ORD,e}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"mglyph"},enumerable:!1,configurable:!0}),e.prototype.verifyAttributes=function(e){var r=this.attributes.getList("src","fontfamily","index"),n=r.src,o=r.fontfamily,i=r.index;""!==n||""!==o&&""!==i?t.prototype.verifyAttributes.call(this,e):this.mError("mglyph must have either src or fontfamily and index attributes",e,!0)},e.defaults=i(i({},a.AbstractMmlTokenNode.defaults),{alt:"",src:"",index:"",width:"auto",height:"auto",valign:"0em"}),e}(a.AbstractMmlTokenNode);e.MmlMglyph=s},450:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMi=void 0;var a=r(9007),s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.texclass=a.TEXCLASS.ORD,e}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"mi"},enumerable:!1,configurable:!0}),e.prototype.setInheritedAttributes=function(r,n,o,i){void 0===r&&(r={}),void 0===n&&(n=!1),void 0===o&&(o=0),void 0===i&&(i=!1),t.prototype.setInheritedAttributes.call(this,r,n,o,i),this.getText().match(e.singleCharacter)&&!r.mathvariant&&this.attributes.setInherited("mathvariant","italic")},e.prototype.setTeXclass=function(t){this.getPrevClass(t);var r=this.getText();return r.length>1&&r.match(e.operatorName)&&"normal"===this.attributes.get("mathvariant")&&void 0===this.getProperty("autoOP")&&void 0===this.getProperty("texClass")&&(this.texClass=a.TEXCLASS.OP,this.setProperty("autoOP",!0)),this},e.defaults=i({},a.AbstractMmlTokenNode.defaults),e.operatorName=/^[a-z][a-z0-9]*$/i,e.singleCharacter=/^[\uD800-\uDBFF]?.[\u0300-\u036F\u1AB0-\u1ABE\u1DC0-\u1DFF\u20D0-\u20EF]*$/,e}(a.AbstractMmlTokenNode);e.MmlMi=s},6405:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlNone=e.MmlMprescripts=e.MmlMmultiscripts=void 0;var a=r(9007),s=r(4461),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"mmultiscripts"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"arity",{get:function(){return 1},enumerable:!1,configurable:!0}),e.prototype.setChildInheritedAttributes=function(t,e,r,n){this.childNodes[0].setInheritedAttributes(t,e,r,n);for(var o=!1,i=1,a=0;i<this.childNodes.length;i++){var s=this.childNodes[i];if(s.isKind("mprescripts")){if(!o&&(o=!0,i%2==0)){var l=this.factory.create("mrow");this.childNodes.splice(i,0,l),l.parent=this,i++}}else{var c=n||a%2==0;s.setInheritedAttributes(t,!1,r+1,c),a++}}this.childNodes.length%2==(o?1:0)&&(this.appendChild(this.factory.create("mrow")),this.childNodes[this.childNodes.length-1].setInheritedAttributes(t,!1,r+1,n))},e.prototype.verifyChildren=function(e){for(var r=!1,n=e.fixMmultiscripts,o=0;o<this.childNodes.length;o++){var i=this.childNodes[o];i.isKind("mprescripts")&&(r?i.mError(i.kind+" can only appear once in "+this.kind,e,!0):(r=!0,o%2!=0||n||this.mError("There must be an equal number of prescripts of each type",e)))}this.childNodes.length%2!=(r?1:0)||n||this.mError("There must be an equal number of scripts of each type",e),t.prototype.verifyChildren.call(this,e)},e.defaults=i({},s.MmlMsubsup.defaults),e}(s.MmlMsubsup);e.MmlMmultiscripts=l;var c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"mprescripts"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"arity",{get:function(){return 0},enumerable:!1,configurable:!0}),e.prototype.verifyTree=function(e){t.prototype.verifyTree.call(this,e),this.parent&&!this.parent.isKind("mmultiscripts")&&this.mError(this.kind+" must be a child of mmultiscripts",e,!0)},e.defaults=i({},a.AbstractMmlNode.defaults),e}(a.AbstractMmlNode);e.MmlMprescripts=c;var u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"none"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"arity",{get:function(){return 0},enumerable:!1,configurable:!0}),e.prototype.verifyTree=function(e){t.prototype.verifyTree.call(this,e),this.parent&&!this.parent.isKind("mmultiscripts")&&this.mError(this.kind+" must be a child of mmultiscripts",e,!0)},e.defaults=i({},a.AbstractMmlNode.defaults),e}(a.AbstractMmlNode);e.MmlNone=u},3050:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMn=void 0;var a=r(9007),s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.texclass=a.TEXCLASS.ORD,e}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"mn"},enumerable:!1,configurable:!0}),e.defaults=i({},a.AbstractMmlTokenNode.defaults),e}(a.AbstractMmlTokenNode);e.MmlMn=s},2756:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},s=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMo=void 0;var l=r(9007),c=r(4082),u=r(505),p=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._texClass=null,e.lspace=5/18,e.rspace=5/18,e}return o(e,t),Object.defineProperty(e.prototype,"texClass",{get:function(){if(null===this._texClass){var t=this.getText(),e=a(this.handleExplicitForm(this.getForms()),3),r=e[0],n=e[1],o=e[2],i=this.constructor.OPTABLE,s=i[r][t]||i[n][t]||i[o][t];return s?s[2]:l.TEXCLASS.REL}return this._texClass},set:function(t){this._texClass=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"kind",{get:function(){return"mo"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEmbellished",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasNewLine",{get:function(){return"newline"===this.attributes.get("linebreak")},enumerable:!1,configurable:!0}),e.prototype.coreParent=function(){for(var t=this,e=this,r=this.factory.getNodeClass("math");e&&e.isEmbellished&&e.coreMO()===this&&!(e instanceof r);)t=e,e=e.parent;return t},e.prototype.coreText=function(t){if(!t)return"";if(t.isEmbellished)return t.coreMO().getText();for(;((t.isKind("mrow")||t.isKind("TeXAtom")&&t.texClass!==l.TEXCLASS.VCENTER||t.isKind("mstyle")||t.isKind("mphantom"))&&1===t.childNodes.length||t.isKind("munderover"))&&t.childNodes[0];)t=t.childNodes[0];return t.isToken?t.getText():""},e.prototype.hasSpacingAttributes=function(){return this.attributes.isSet("lspace")||this.attributes.isSet("rspace")},Object.defineProperty(e.prototype,"isAccent",{get:function(){var t=!1,e=this.coreParent().parent;if(e){var r=e.isKind("mover")?e.childNodes[e.over].coreMO()?"accent":"":e.isKind("munder")?e.childNodes[e.under].coreMO()?"accentunder":"":e.isKind("munderover")?this===e.childNodes[e.over].coreMO()?"accent":this===e.childNodes[e.under].coreMO()?"accentunder":"":"";if(r)t=void 0!==e.attributes.getExplicit(r)?t:this.attributes.get("accent")}return t},enumerable:!1,configurable:!0}),e.prototype.setTeXclass=function(t){var e=this.attributes.getList("form","fence"),r=e.form,n=e.fence;return void 0===this.getProperty("texClass")&&(this.attributes.isSet("lspace")||this.attributes.isSet("rspace"))?null:(n&&this.texClass===l.TEXCLASS.REL&&("prefix"===r&&(this.texClass=l.TEXCLASS.OPEN),"postfix"===r&&(this.texClass=l.TEXCLASS.CLOSE)),this.adjustTeXclass(t))},e.prototype.adjustTeXclass=function(t){var e=this.texClass,r=this.prevClass;if(e===l.TEXCLASS.NONE)return t;if(t?(!t.getProperty("autoOP")||e!==l.TEXCLASS.BIN&&e!==l.TEXCLASS.REL||(r=t.texClass=l.TEXCLASS.ORD),r=this.prevClass=t.texClass||l.TEXCLASS.ORD,this.prevLevel=this.attributes.getInherited("scriptlevel")):r=this.prevClass=l.TEXCLASS.NONE,e!==l.TEXCLASS.BIN||r!==l.TEXCLASS.NONE&&r!==l.TEXCLASS.BIN&&r!==l.TEXCLASS.OP&&r!==l.TEXCLASS.REL&&r!==l.TEXCLASS.OPEN&&r!==l.TEXCLASS.PUNCT)if(r!==l.TEXCLASS.BIN||e!==l.TEXCLASS.REL&&e!==l.TEXCLASS.CLOSE&&e!==l.TEXCLASS.PUNCT){if(e===l.TEXCLASS.BIN){for(var n=this,o=this.parent;o&&o.parent&&o.isEmbellished&&(1===o.childNodes.length||!o.isKind("mrow")&&o.core()===n);)n=o,o=o.parent;o.childNodes[o.childNodes.length-1]===n&&(this.texClass=l.TEXCLASS.ORD)}}else t.texClass=this.prevClass=l.TEXCLASS.ORD;else this.texClass=l.TEXCLASS.ORD;return this},e.prototype.setInheritedAttributes=function(e,r,n,o){void 0===e&&(e={}),void 0===r&&(r=!1),void 0===n&&(n=0),void 0===o&&(o=!1),t.prototype.setInheritedAttributes.call(this,e,r,n,o);var i=this.getText();this.checkOperatorTable(i),this.checkPseudoScripts(i),this.checkPrimes(i),this.checkMathAccent(i)},e.prototype.checkOperatorTable=function(t){var e,r,n=a(this.handleExplicitForm(this.getForms()),3),o=n[0],i=n[1],l=n[2];this.attributes.setInherited("form",o);var u=this.constructor.OPTABLE,p=u[o][t]||u[i][t]||u[l][t];if(p){void 0===this.getProperty("texClass")&&(this.texClass=p[2]);try{for(var h=s(Object.keys(p[3]||{})),d=h.next();!d.done;d=h.next()){var f=d.value;this.attributes.setInherited(f,p[3][f])}}catch(t){e={error:t}}finally{try{d&&!d.done&&(r=h.return)&&r.call(h)}finally{if(e)throw e.error}}this.lspace=(p[0]+1)/18,this.rspace=(p[1]+1)/18}else{var m=(0,c.getRange)(t);if(m){void 0===this.getProperty("texClass")&&(this.texClass=m[2]);var y=this.constructor.MMLSPACING[m[2]];this.lspace=(y[0]+1)/18,this.rspace=(y[1]+1)/18}}},e.prototype.getForms=function(){for(var t=this,e=this.parent,r=this.Parent;r&&r.isEmbellished;)t=e,e=r.parent,r=r.Parent;if(e&&e.isKind("mrow")&&1!==e.nonSpaceLength()){if(e.firstNonSpace()===t)return["prefix","infix","postfix"];if(e.lastNonSpace()===t)return["postfix","infix","prefix"]}return["infix","prefix","postfix"]},e.prototype.handleExplicitForm=function(t){if(this.attributes.isSet("form")){var e=this.attributes.get("form");t=[e].concat(t.filter((function(t){return t!==e})))}return t},e.prototype.checkPseudoScripts=function(t){var e=this.constructor.pseudoScripts;if(t.match(e)){var r=this.coreParent().Parent,n=!r||!(r.isKind("msubsup")&&!r.isKind("msub"));this.setProperty("pseudoscript",n),n&&(this.attributes.setInherited("lspace",0),this.attributes.setInherited("rspace",0))}},e.prototype.checkPrimes=function(t){var e=this.constructor.primes;if(t.match(e)){var r=this.constructor.remapPrimes,n=(0,u.unicodeString)((0,u.unicodeChars)(t).map((function(t){return r[t]})));this.setProperty("primes",n)}},e.prototype.checkMathAccent=function(t){var e=this.Parent;if(void 0===this.getProperty("mathaccent")&&e&&e.isKind("munderover")){var r=e.childNodes[0];if(!r.isEmbellished||r.coreMO()!==this){var n=this.constructor.mathaccents;t.match(n)&&this.setProperty("mathaccent",!0)}}},e.defaults=i(i({},l.AbstractMmlTokenNode.defaults),{form:"infix",fence:!1,separator:!1,lspace:"thickmathspace",rspace:"thickmathspace",stretchy:!1,symmetric:!1,maxsize:"infinity",minsize:"0em",largeop:!1,movablelimits:!1,accent:!1,linebreak:"auto",lineleading:"1ex",linebreakstyle:"before",indentalign:"auto",indentshift:"0",indenttarget:"",indentalignfirst:"indentalign",indentshiftfirst:"indentshift",indentalignlast:"indentalign",indentshiftlast:"indentshift"}),e.MMLSPACING=c.MMLSPACING,e.OPTABLE=c.OPTABLE,e.pseudoScripts=new RegExp(["^[\"'*`","\xaa","\xb0","\xb2-\xb4","\xb9","\xba","\u2018-\u201f","\u2032-\u2037\u2057","\u2070\u2071","\u2074-\u207f","\u2080-\u208e","]+$"].join("")),e.primes=new RegExp(["^[\"'`","\u2018-\u201f","]+$"].join("")),e.remapPrimes={34:8243,39:8242,96:8245,8216:8245,8217:8242,8218:8242,8219:8245,8220:8246,8221:8243,8222:8243,8223:8246},e.mathaccents=new RegExp(["^[","\xb4\u0301\u02ca","`\u0300\u02cb","\xa8\u0308","~\u0303\u02dc","\xaf\u0304\u02c9","\u02d8\u0306","\u02c7\u030c","^\u0302\u02c6","\u2192\u20d7","\u02d9\u0307","\u02da\u030a","\u20db","\u20dc","]$"].join("")),e}(l.AbstractMmlTokenNode);e.MmlMo=p},7238:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMpadded=void 0;var a=r(9007),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"mpadded"},enumerable:!1,configurable:!0}),e.defaults=i(i({},a.AbstractMmlLayoutNode.defaults),{width:"",height:"",depth:"",lspace:0,voffset:0}),e}(a.AbstractMmlLayoutNode);e.MmlMpadded=s},5741:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMphantom=void 0;var a=r(9007),s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.texclass=a.TEXCLASS.ORD,e}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"mphantom"},enumerable:!1,configurable:!0}),e.defaults=i({},a.AbstractMmlLayoutNode.defaults),e}(a.AbstractMmlLayoutNode);e.MmlMphantom=s},6145:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMroot=void 0;var a=r(9007),s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.texclass=a.TEXCLASS.ORD,e}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"mroot"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"arity",{get:function(){return 2},enumerable:!1,configurable:!0}),e.prototype.setTeXclass=function(t){return this.getPrevClass(t),this.childNodes[0].setTeXclass(null),this.childNodes[1].setTeXclass(null),this},e.prototype.setChildInheritedAttributes=function(t,e,r,n){this.childNodes[0].setInheritedAttributes(t,e,r,!0),this.childNodes[1].setInheritedAttributes(t,!1,r+2,n)},e.defaults=i({},a.AbstractMmlNode.defaults),e}(a.AbstractMmlNode);e.MmlMroot=s},9878:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},a=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlInferredMrow=e.MmlMrow=void 0;var s=r(9007),l=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._core=null,e}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"mrow"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSpacelike",{get:function(){var t,e;try{for(var r=a(this.childNodes),n=r.next();!n.done;n=r.next()){if(!n.value.isSpacelike)return!1}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}return!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEmbellished",{get:function(){var t,e,r=!1,n=0;try{for(var o=a(this.childNodes),i=o.next();!i.done;i=o.next()){var s=i.value;if(s)if(s.isEmbellished){if(r)return!1;r=!0,this._core=n}else if(!s.isSpacelike)return!1;n++}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return r},enumerable:!1,configurable:!0}),e.prototype.core=function(){return this.isEmbellished&&null!=this._core?this.childNodes[this._core]:this},e.prototype.coreMO=function(){return this.isEmbellished&&null!=this._core?this.childNodes[this._core].coreMO():this},e.prototype.nonSpaceLength=function(){var t,e,r=0;try{for(var n=a(this.childNodes),o=n.next();!o.done;o=n.next()){var i=o.value;i&&!i.isSpacelike&&r++}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}return r},e.prototype.firstNonSpace=function(){var t,e;try{for(var r=a(this.childNodes),n=r.next();!n.done;n=r.next()){var o=n.value;if(o&&!o.isSpacelike)return o}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}return null},e.prototype.lastNonSpace=function(){for(var t=this.childNodes.length;--t>=0;){var e=this.childNodes[t];if(e&&!e.isSpacelike)return e}return null},e.prototype.setTeXclass=function(t){var e,r,n,o;if(null!=this.getProperty("open")||null!=this.getProperty("close")){this.getPrevClass(t),t=null;try{for(var i=a(this.childNodes),l=i.next();!l.done;l=i.next()){t=l.value.setTeXclass(t)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}null==this.texClass&&(this.texClass=s.TEXCLASS.INNER)}else{try{for(var c=a(this.childNodes),u=c.next();!u.done;u=c.next()){t=u.value.setTeXclass(t)}}catch(t){n={error:t}}finally{try{u&&!u.done&&(o=c.return)&&o.call(c)}finally{if(n)throw n.error}}this.childNodes[0]&&this.updateTeXclass(this.childNodes[0])}return t},e.defaults=i({},s.AbstractMmlNode.defaults),e}(s.AbstractMmlNode);e.MmlMrow=l;var c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"inferredMrow"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isInferred",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"notParent",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.toString=function(){return"["+this.childNodes.join(",")+"]"},e.defaults=l.defaults,e}(l);e.MmlInferredMrow=c},7265:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMs=void 0;var a=r(9007),s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.texclass=a.TEXCLASS.ORD,e}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"ms"},enumerable:!1,configurable:!0}),e.defaults=i(i({},a.AbstractMmlTokenNode.defaults),{lquote:'"',rquote:'"'}),e}(a.AbstractMmlTokenNode);e.MmlMs=s},6030:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMspace=void 0;var a=r(9007),s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.texclass=a.TEXCLASS.NONE,e}return o(e,t),e.prototype.setTeXclass=function(t){return t},Object.defineProperty(e.prototype,"kind",{get:function(){return"mspace"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"arity",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSpacelike",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasNewline",{get:function(){var t=this.attributes;return null==t.getExplicit("width")&&null==t.getExplicit("height")&&null==t.getExplicit("depth")&&"newline"===t.get("linebreak")},enumerable:!1,configurable:!0}),e.defaults=i(i({},a.AbstractMmlTokenNode.defaults),{width:"0em",height:"0ex",depth:"0ex",linebreak:"auto"}),e}(a.AbstractMmlTokenNode);e.MmlMspace=s},7131:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMsqrt=void 0;var a=r(9007),s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.texclass=a.TEXCLASS.ORD,e}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"msqrt"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"arity",{get:function(){return-1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"linebreakContainer",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.setTeXclass=function(t){return this.getPrevClass(t),this.childNodes[0].setTeXclass(null),this},e.prototype.setChildInheritedAttributes=function(t,e,r,n){this.childNodes[0].setInheritedAttributes(t,e,r,!0)},e.defaults=i({},a.AbstractMmlNode.defaults),e}(a.AbstractMmlNode);e.MmlMsqrt=s},1314:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMstyle=void 0;var a=r(9007),s=r(91),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"mstyle"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"notParent",{get:function(){return this.childNodes[0]&&1===this.childNodes[0].childNodes.length},enumerable:!1,configurable:!0}),e.prototype.setChildInheritedAttributes=function(t,e,r,n){var o=this.attributes.getExplicit("scriptlevel");null!=o&&((o=o.toString()).match(/^\s*[-+]/)?r+=parseInt(o):r=parseInt(o),n=!1);var i=this.attributes.getExplicit("displaystyle");null!=i&&(e=!0===i,n=!1);var a=this.attributes.getExplicit("data-cramped");null!=a&&(n=a),t=this.addInheritedAttributes(t,this.attributes.getAllAttributes()),this.childNodes[0].setInheritedAttributes(t,e,r,n)},e.defaults=i(i({},a.AbstractMmlLayoutNode.defaults),{scriptlevel:s.INHERIT,displaystyle:s.INHERIT,scriptsizemultiplier:1/Math.sqrt(2),scriptminsize:"8px",mathbackground:s.INHERIT,mathcolor:s.INHERIT,dir:s.INHERIT,infixlinebreakstyle:"before"}),e}(a.AbstractMmlLayoutNode);e.MmlMstyle=l},4461:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMsup=e.MmlMsub=e.MmlMsubsup=void 0;var a=r(9007),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"msubsup"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"arity",{get:function(){return 3},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"base",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sub",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sup",{get:function(){return 2},enumerable:!1,configurable:!0}),e.prototype.setChildInheritedAttributes=function(t,e,r,n){var o=this.childNodes;o[0].setInheritedAttributes(t,e,r,n),o[1].setInheritedAttributes(t,!1,r+1,n||1===this.sub),o[2]&&o[2].setInheritedAttributes(t,!1,r+1,n||2===this.sub)},e.defaults=i(i({},a.AbstractMmlBaseNode.defaults),{subscriptshift:"",superscriptshift:""}),e}(a.AbstractMmlBaseNode);e.MmlMsubsup=s;var l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"msub"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"arity",{get:function(){return 2},enumerable:!1,configurable:!0}),e.defaults=i({},s.defaults),e}(s);e.MmlMsub=l;var c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"msup"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"arity",{get:function(){return 2},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sup",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sub",{get:function(){return 2},enumerable:!1,configurable:!0}),e.defaults=i({},s.defaults),e}(s);e.MmlMsup=c},1349:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},a=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMtable=void 0;var s=r(9007),l=r(505),c=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.properties={useHeight:!0},e.texclass=s.TEXCLASS.ORD,e}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"mtable"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"linebreakContainer",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.setInheritedAttributes=function(e,r,n,o){var i,l;try{for(var c=a(s.indentAttributes),u=c.next();!u.done;u=c.next()){var p=u.value;e[p]&&this.attributes.setInherited(p,e[p][1]),void 0!==this.attributes.getExplicit(p)&&delete this.attributes.getAllAttributes()[p]}}catch(t){i={error:t}}finally{try{u&&!u.done&&(l=c.return)&&l.call(c)}finally{if(i)throw i.error}}t.prototype.setInheritedAttributes.call(this,e,r,n,o)},e.prototype.setChildInheritedAttributes=function(t,e,r,n){var o,i,s,c;try{for(var u=a(this.childNodes),p=u.next();!p.done;p=u.next()){(y=p.value).isKind("mtr")||this.replaceChild(this.factory.create("mtr"),y).appendChild(y)}}catch(t){o={error:t}}finally{try{p&&!p.done&&(i=u.return)&&i.call(u)}finally{if(o)throw o.error}}r=this.getProperty("scriptlevel")||r,e=!(!this.attributes.getExplicit("displaystyle")&&!this.attributes.getDefault("displaystyle")),t=this.addInheritedAttributes(t,{columnalign:this.attributes.get("columnalign"),rowalign:"center"});var h=this.attributes.getExplicit("data-cramped"),d=(0,l.split)(this.attributes.get("rowalign"));try{for(var f=a(this.childNodes),m=f.next();!m.done;m=f.next()){var y=m.value;t.rowalign[1]=d.shift()||t.rowalign[1],y.setInheritedAttributes(t,e,r,!!h)}}catch(t){s={error:t}}finally{try{m&&!m.done&&(c=f.return)&&c.call(f)}finally{if(s)throw s.error}}},e.prototype.verifyChildren=function(e){for(var r=null,n=this.factory,o=0;o<this.childNodes.length;o++){var i=this.childNodes[o];if(i.isKind("mtr"))r=null;else{var a=i.isKind("mtd");if(r?(this.removeChild(i),o--):r=this.replaceChild(n.create("mtr"),i),r.appendChild(a?i:n.create("mtd",{},[i])),!e.fixMtables){i.parent.removeChild(i),i.parent=this,a&&r.appendChild(n.create("mtd"));var s=i.mError("Children of "+this.kind+" must be mtr or mlabeledtr",e,a);r.childNodes[r.childNodes.length-1].appendChild(s)}}}t.prototype.verifyChildren.call(this,e)},e.prototype.setTeXclass=function(t){var e,r;this.getPrevClass(t);try{for(var n=a(this.childNodes),o=n.next();!o.done;o=n.next()){o.value.setTeXclass(null)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return this},e.defaults=i(i({},s.AbstractMmlNode.defaults),{align:"axis",rowalign:"baseline",columnalign:"center",groupalign:"{left}",alignmentscope:!0,columnwidth:"auto",width:"auto",rowspacing:"1ex",columnspacing:".8em",rowlines:"none",columnlines:"none",frame:"none",framespacing:"0.4em 0.5ex",equalrows:!1,equalcolumns:!1,displaystyle:!1,side:"right",minlabelspacing:"0.8em"}),e}(s.AbstractMmlNode);e.MmlMtable=c},4359:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMtd=void 0;var a=r(9007),s=r(91),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"mtd"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"arity",{get:function(){return-1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"linebreakContainer",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.verifyChildren=function(e){!this.parent||this.parent.isKind("mtr")?t.prototype.verifyChildren.call(this,e):this.mError(this.kind+" can only be a child of an mtr or mlabeledtr",e,!0)},e.prototype.setTeXclass=function(t){return this.getPrevClass(t),this.childNodes[0].setTeXclass(null),this},e.defaults=i(i({},a.AbstractMmlBaseNode.defaults),{rowspan:1,columnspan:1,rowalign:s.INHERIT,columnalign:s.INHERIT,groupalign:s.INHERIT}),e}(a.AbstractMmlBaseNode);e.MmlMtd=l},4770:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMtext=void 0;var a=r(9007),s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.texclass=a.TEXCLASS.ORD,e}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"mtext"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isSpacelike",{get:function(){return!0},enumerable:!1,configurable:!0}),e.defaults=i({},a.AbstractMmlTokenNode.defaults),e}(a.AbstractMmlTokenNode);e.MmlMtext=s},5022:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},a=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMlabeledtr=e.MmlMtr=void 0;var s=r(9007),l=r(91),c=r(505),u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"mtr"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"linebreakContainer",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.setChildInheritedAttributes=function(t,e,r,n){var o,i,s,l;try{for(var u=a(this.childNodes),p=u.next();!p.done;p=u.next()){(m=p.value).isKind("mtd")||this.replaceChild(this.factory.create("mtd"),m).appendChild(m)}}catch(t){o={error:t}}finally{try{p&&!p.done&&(i=u.return)&&i.call(u)}finally{if(o)throw o.error}}var h=(0,c.split)(this.attributes.get("columnalign"));1===this.arity&&h.unshift(this.parent.attributes.get("side")),t=this.addInheritedAttributes(t,{rowalign:this.attributes.get("rowalign"),columnalign:"center"});try{for(var d=a(this.childNodes),f=d.next();!f.done;f=d.next()){var m=f.value;t.columnalign[1]=h.shift()||t.columnalign[1],m.setInheritedAttributes(t,e,r,n)}}catch(t){s={error:t}}finally{try{f&&!f.done&&(l=d.return)&&l.call(d)}finally{if(s)throw s.error}}},e.prototype.verifyChildren=function(e){var r,n;if(!this.parent||this.parent.isKind("mtable")){try{for(var o=a(this.childNodes),i=o.next();!i.done;i=o.next()){var s=i.value;if(!s.isKind("mtd"))this.replaceChild(this.factory.create("mtd"),s).appendChild(s),e.fixMtables||s.mError("Children of "+this.kind+" must be mtd",e)}}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.prototype.verifyChildren.call(this,e)}else this.mError(this.kind+" can only be a child of an mtable",e,!0)},e.prototype.setTeXclass=function(t){var e,r;this.getPrevClass(t);try{for(var n=a(this.childNodes),o=n.next();!o.done;o=n.next()){o.value.setTeXclass(null)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return this},e.defaults=i(i({},s.AbstractMmlNode.defaults),{rowalign:l.INHERIT,columnalign:l.INHERIT,groupalign:l.INHERIT}),e}(s.AbstractMmlNode);e.MmlMtr=u;var p=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"mlabeledtr"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"arity",{get:function(){return 1},enumerable:!1,configurable:!0}),e}(u);e.MmlMlabeledtr=p},5184:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlMover=e.MmlMunder=e.MmlMunderover=void 0;var a=r(9007),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"munderover"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"arity",{get:function(){return 3},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"base",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"under",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"over",{get:function(){return 2},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"linebreakContainer",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.setChildInheritedAttributes=function(t,e,r,n){var o=this.childNodes;o[0].setInheritedAttributes(t,e,r,n||!!o[this.over]);var i=!(e||!o[0].coreMO().attributes.get("movablelimits")),a=this.constructor.ACCENTS;o[1].setInheritedAttributes(t,!1,this.getScriptlevel(a[1],i,r),n||1===this.under),this.setInheritedAccent(1,a[1],e,r,n,i),o[2]&&(o[2].setInheritedAttributes(t,!1,this.getScriptlevel(a[2],i,r),n||2===this.under),this.setInheritedAccent(2,a[2],e,r,n,i))},e.prototype.getScriptlevel=function(t,e,r){return!e&&this.attributes.get(t)||r++,r},e.prototype.setInheritedAccent=function(t,e,r,n,o,i){var a=this.childNodes[t];if(null==this.attributes.getExplicit(e)&&a.isEmbellished){var s=a.coreMO().attributes.get("accent");this.attributes.setInherited(e,s),s!==this.attributes.getDefault(e)&&a.setInheritedAttributes({},r,this.getScriptlevel(e,i,n),o)}},e.defaults=i(i({},a.AbstractMmlBaseNode.defaults),{accent:!1,accentunder:!1,align:"center"}),e.ACCENTS=["","accentunder","accent"],e}(a.AbstractMmlBaseNode);e.MmlMunderover=s;var l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"munder"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"arity",{get:function(){return 2},enumerable:!1,configurable:!0}),e.defaults=i({},s.defaults),e}(s);e.MmlMunder=l;var c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"mover"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"arity",{get:function(){return 2},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"over",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"under",{get:function(){return 2},enumerable:!1,configurable:!0}),e.defaults=i({},s.defaults),e.ACCENTS=["","accent","accentunder"],e}(s);e.MmlMover=c},9102:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.MmlAnnotation=e.MmlAnnotationXML=e.MmlSemantics=void 0;var a=r(9007),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"semantics"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"arity",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"notParent",{get:function(){return!0},enumerable:!1,configurable:!0}),e.defaults=i(i({},a.AbstractMmlBaseNode.defaults),{definitionUrl:null,encoding:null}),e}(a.AbstractMmlBaseNode);e.MmlSemantics=s;var l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"annotation-xml"},enumerable:!1,configurable:!0}),e.prototype.setChildInheritedAttributes=function(){},e.defaults=i(i({},a.AbstractMmlNode.defaults),{definitionUrl:null,encoding:null,cd:"mathmlkeys",name:"",src:null}),e}(a.AbstractMmlNode);e.MmlAnnotationXML=l;var c=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.properties={isChars:!0},e}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"annotation"},enumerable:!1,configurable:!0}),e.defaults=i({},l.defaults),e}(l);e.MmlAnnotation=c},6325:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.MmlVisitor=void 0;var i=r(3909),a=function(t){function e(e){return void 0===e&&(e=null),e||(e=new i.MmlFactory),t.call(this,e)||this}return o(e,t),e.prototype.visitTextNode=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r]},e.prototype.visitXMLNode=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r]},e}(r(8823).AbstractVisitor);e.MmlVisitor=a},4082:function(t,e,r){var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.OPTABLE=e.MMLSPACING=e.getRange=e.RANGES=e.MO=e.OPDEF=void 0;var o=r(9007);function i(t,e,r,n){return void 0===r&&(r=o.TEXCLASS.BIN),void 0===n&&(n=null),[t,e,r,n]}e.OPDEF=i,e.MO={ORD:i(0,0,o.TEXCLASS.ORD),ORD11:i(1,1,o.TEXCLASS.ORD),ORD21:i(2,1,o.TEXCLASS.ORD),ORD02:i(0,2,o.TEXCLASS.ORD),ORD55:i(5,5,o.TEXCLASS.ORD),NONE:i(0,0,o.TEXCLASS.NONE),OP:i(1,2,o.TEXCLASS.OP,{largeop:!0,movablelimits:!0,symmetric:!0}),OPFIXED:i(1,2,o.TEXCLASS.OP,{largeop:!0,movablelimits:!0}),INTEGRAL:i(0,1,o.TEXCLASS.OP,{largeop:!0,symmetric:!0}),INTEGRAL2:i(1,2,o.TEXCLASS.OP,{largeop:!0,symmetric:!0}),BIN3:i(3,3,o.TEXCLASS.BIN),BIN4:i(4,4,o.TEXCLASS.BIN),BIN01:i(0,1,o.TEXCLASS.BIN),BIN5:i(5,5,o.TEXCLASS.BIN),TALLBIN:i(4,4,o.TEXCLASS.BIN,{stretchy:!0}),BINOP:i(4,4,o.TEXCLASS.BIN,{largeop:!0,movablelimits:!0}),REL:i(5,5,o.TEXCLASS.REL),REL1:i(1,1,o.TEXCLASS.REL,{stretchy:!0}),REL4:i(4,4,o.TEXCLASS.REL),RELSTRETCH:i(5,5,o.TEXCLASS.REL,{stretchy:!0}),RELACCENT:i(5,5,o.TEXCLASS.REL,{accent:!0}),WIDEREL:i(5,5,o.TEXCLASS.REL,{accent:!0,stretchy:!0}),OPEN:i(0,0,o.TEXCLASS.OPEN,{fence:!0,stretchy:!0,symmetric:!0}),CLOSE:i(0,0,o.TEXCLASS.CLOSE,{fence:!0,stretchy:!0,symmetric:!0}),INNER:i(0,0,o.TEXCLASS.INNER),PUNCT:i(0,3,o.TEXCLASS.PUNCT),ACCENT:i(0,0,o.TEXCLASS.ORD,{accent:!0}),WIDEACCENT:i(0,0,o.TEXCLASS.ORD,{accent:!0,stretchy:!0})},e.RANGES=[[32,127,o.TEXCLASS.REL,"mo"],[160,191,o.TEXCLASS.ORD,"mo"],[192,591,o.TEXCLASS.ORD,"mi"],[688,879,o.TEXCLASS.ORD,"mo"],[880,6688,o.TEXCLASS.ORD,"mi"],[6832,6911,o.TEXCLASS.ORD,"mo"],[6912,7615,o.TEXCLASS.ORD,"mi"],[7616,7679,o.TEXCLASS.ORD,"mo"],[7680,8191,o.TEXCLASS.ORD,"mi"],[8192,8303,o.TEXCLASS.ORD,"mo"],[8304,8351,o.TEXCLASS.ORD,"mo"],[8448,8527,o.TEXCLASS.ORD,"mi"],[8528,8591,o.TEXCLASS.ORD,"mn"],[8592,8703,o.TEXCLASS.REL,"mo"],[8704,8959,o.TEXCLASS.BIN,"mo"],[8960,9215,o.TEXCLASS.ORD,"mo"],[9312,9471,o.TEXCLASS.ORD,"mn"],[9472,10223,o.TEXCLASS.ORD,"mo"],[10224,10239,o.TEXCLASS.REL,"mo"],[10240,10495,o.TEXCLASS.ORD,"mtext"],[10496,10623,o.TEXCLASS.REL,"mo"],[10624,10751,o.TEXCLASS.ORD,"mo"],[10752,11007,o.TEXCLASS.BIN,"mo"],[11008,11055,o.TEXCLASS.ORD,"mo"],[11056,11087,o.TEXCLASS.REL,"mo"],[11088,11263,o.TEXCLASS.ORD,"mo"],[11264,11744,o.TEXCLASS.ORD,"mi"],[11776,11903,o.TEXCLASS.ORD,"mo"],[11904,12255,o.TEXCLASS.ORD,"mi","normal"],[12272,12351,o.TEXCLASS.ORD,"mo"],[12352,42143,o.TEXCLASS.ORD,"mi","normal"],[42192,43055,o.TEXCLASS.ORD,"mi"],[43056,43071,o.TEXCLASS.ORD,"mn"],[43072,55295,o.TEXCLASS.ORD,"mi"],[63744,64255,o.TEXCLASS.ORD,"mi","normal"],[64256,65023,o.TEXCLASS.ORD,"mi"],[65024,65135,o.TEXCLASS.ORD,"mo"],[65136,65791,o.TEXCLASS.ORD,"mi"],[65792,65935,o.TEXCLASS.ORD,"mn"],[65936,74751,o.TEXCLASS.ORD,"mi","normal"],[74752,74879,o.TEXCLASS.ORD,"mn"],[74880,113823,o.TEXCLASS.ORD,"mi","normal"],[113824,119391,o.TEXCLASS.ORD,"mo"],[119648,119679,o.TEXCLASS.ORD,"mn"],[119808,120781,o.TEXCLASS.ORD,"mi"],[120782,120831,o.TEXCLASS.ORD,"mn"],[122624,129023,o.TEXCLASS.ORD,"mo"],[129024,129279,o.TEXCLASS.REL,"mo"],[129280,129535,o.TEXCLASS.ORD,"mo"],[131072,195103,o.TEXCLASS.ORD,"mi","normnal"]],e.getRange=function(t){var r,o,i=t.codePointAt(0);try{for(var a=n(e.RANGES),s=a.next();!s.done;s=a.next()){var l=s.value;if(i<=l[1]){if(i>=l[0])return l;break}}}catch(t){r={error:t}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return null},e.MMLSPACING=[[0,0],[1,2],[3,3],[4,4],[0,0],[0,0],[0,3]],e.OPTABLE={prefix:{"(":e.MO.OPEN,"+":e.MO.BIN01,"-":e.MO.BIN01,"[":e.MO.OPEN,"{":e.MO.OPEN,"|":e.MO.OPEN,"||":[0,0,o.TEXCLASS.BIN,{fence:!0,stretchy:!0,symmetric:!0}],"|||":[0,0,o.TEXCLASS.ORD,{fence:!0,stretchy:!0,symmetric:!0}],"\xac":e.MO.ORD21,"\xb1":e.MO.BIN01,"\u2016":[0,0,o.TEXCLASS.ORD,{fence:!0,stretchy:!0}],"\u2018":[0,0,o.TEXCLASS.OPEN,{fence:!0}],"\u201c":[0,0,o.TEXCLASS.OPEN,{fence:!0}],"\u2145":e.MO.ORD21,"\u2146":i(2,0,o.TEXCLASS.ORD),"\u2200":e.MO.ORD21,"\u2202":e.MO.ORD21,"\u2203":e.MO.ORD21,"\u2204":e.MO.ORD21,"\u2207":e.MO.ORD21,"\u220f":e.MO.OP,"\u2210":e.MO.OP,"\u2211":e.MO.OP,"\u2212":e.MO.BIN01,"\u2213":e.MO.BIN01,"\u221a":[1,1,o.TEXCLASS.ORD,{stretchy:!0}],"\u221b":e.MO.ORD11,"\u221c":e.MO.ORD11,"\u2220":e.MO.ORD,"\u2221":e.MO.ORD,"\u2222":e.MO.ORD,"\u222b":e.MO.INTEGRAL,"\u222c":e.MO.INTEGRAL,"\u222d":e.MO.INTEGRAL,"\u222e":e.MO.INTEGRAL,"\u222f":e.MO.INTEGRAL,"\u2230":e.MO.INTEGRAL,"\u2231":e.MO.INTEGRAL,"\u2232":e.MO.INTEGRAL,"\u2233":e.MO.INTEGRAL,"\u22c0":e.MO.OP,"\u22c1":e.MO.OP,"\u22c2":e.MO.OP,"\u22c3":e.MO.OP,"\u2308":e.MO.OPEN,"\u230a":e.MO.OPEN,"\u2329":e.MO.OPEN,"\u2772":e.MO.OPEN,"\u27e6":e.MO.OPEN,"\u27e8":e.MO.OPEN,"\u27ea":e.MO.OPEN,"\u27ec":e.MO.OPEN,"\u27ee":e.MO.OPEN,"\u2980":[0,0,o.TEXCLASS.ORD,{fence:!0,stretchy:!0}],"\u2983":e.MO.OPEN,"\u2985":e.MO.OPEN,"\u2987":e.MO.OPEN,"\u2989":e.MO.OPEN,"\u298b":e.MO.OPEN,"\u298d":e.MO.OPEN,"\u298f":e.MO.OPEN,"\u2991":e.MO.OPEN,"\u2993":e.MO.OPEN,"\u2995":e.MO.OPEN,"\u2997":e.MO.OPEN,"\u29fc":e.MO.OPEN,"\u2a00":e.MO.OP,"\u2a01":e.MO.OP,"\u2a02":e.MO.OP,"\u2a03":e.MO.OP,"\u2a04":e.MO.OP,"\u2a05":e.MO.OP,"\u2a06":e.MO.OP,"\u2a07":e.MO.OP,"\u2a08":e.MO.OP,"\u2a09":e.MO.OP,"\u2a0a":e.MO.OP,"\u2a0b":e.MO.INTEGRAL2,"\u2a0c":e.MO.INTEGRAL,"\u2a0d":e.MO.INTEGRAL2,"\u2a0e":e.MO.INTEGRAL2,"\u2a0f":e.MO.INTEGRAL2,"\u2a10":e.MO.OP,"\u2a11":e.MO.OP,"\u2a12":e.MO.OP,"\u2a13":e.MO.OP,"\u2a14":e.MO.OP,"\u2a15":e.MO.INTEGRAL2,"\u2a16":e.MO.INTEGRAL2,"\u2a17":e.MO.INTEGRAL2,"\u2a18":e.MO.INTEGRAL2,"\u2a19":e.MO.INTEGRAL2,"\u2a1a":e.MO.INTEGRAL2,"\u2a1b":e.MO.INTEGRAL2,"\u2a1c":e.MO.INTEGRAL2,"\u2afc":e.MO.OP,"\u2aff":e.MO.OP},postfix:{"!!":i(1,0),"!":[1,0,o.TEXCLASS.CLOSE,null],'"':e.MO.ACCENT,"&":e.MO.ORD,")":e.MO.CLOSE,"++":i(0,0),"--":i(0,0),"..":i(0,0),"...":e.MO.ORD,"'":e.MO.ACCENT,"]":e.MO.CLOSE,"^":e.MO.WIDEACCENT,_:e.MO.WIDEACCENT,"`":e.MO.ACCENT,"|":e.MO.CLOSE,"}":e.MO.CLOSE,"~":e.MO.WIDEACCENT,"||":[0,0,o.TEXCLASS.BIN,{fence:!0,stretchy:!0,symmetric:!0}],"|||":[0,0,o.TEXCLASS.ORD,{fence:!0,stretchy:!0,symmetric:!0}],"\xa8":e.MO.ACCENT,"\xaa":e.MO.ACCENT,"\xaf":e.MO.WIDEACCENT,"\xb0":e.MO.ORD,"\xb2":e.MO.ACCENT,"\xb3":e.MO.ACCENT,"\xb4":e.MO.ACCENT,"\xb8":e.MO.ACCENT,"\xb9":e.MO.ACCENT,"\xba":e.MO.ACCENT,"\u02c6":e.MO.WIDEACCENT,"\u02c7":e.MO.WIDEACCENT,"\u02c9":e.MO.WIDEACCENT,"\u02ca":e.MO.ACCENT,"\u02cb":e.MO.ACCENT,"\u02cd":e.MO.WIDEACCENT,"\u02d8":e.MO.ACCENT,"\u02d9":e.MO.ACCENT,"\u02da":e.MO.ACCENT,"\u02dc":e.MO.WIDEACCENT,"\u02dd":e.MO.ACCENT,"\u02f7":e.MO.WIDEACCENT,"\u0302":e.MO.WIDEACCENT,"\u0311":e.MO.ACCENT,"\u03f6":e.MO.REL,"\u2016":[0,0,o.TEXCLASS.ORD,{fence:!0,stretchy:!0}],"\u2019":[0,0,o.TEXCLASS.CLOSE,{fence:!0}],"\u201a":e.MO.ACCENT,"\u201b":e.MO.ACCENT,"\u201d":[0,0,o.TEXCLASS.CLOSE,{fence:!0}],"\u201e":e.MO.ACCENT,"\u201f":e.MO.ACCENT,"\u2032":e.MO.ORD,"\u2033":e.MO.ACCENT,"\u2034":e.MO.ACCENT,"\u2035":e.MO.ACCENT,"\u2036":e.MO.ACCENT,"\u2037":e.MO.ACCENT,"\u203e":e.MO.WIDEACCENT,"\u2057":e.MO.ACCENT,"\u20db":e.MO.ACCENT,"\u20dc":e.MO.ACCENT,"\u2309":e.MO.CLOSE,"\u230b":e.MO.CLOSE,"\u232a":e.MO.CLOSE,"\u23b4":e.MO.WIDEACCENT,"\u23b5":e.MO.WIDEACCENT,"\u23dc":e.MO.WIDEACCENT,"\u23dd":e.MO.WIDEACCENT,"\u23de":e.MO.WIDEACCENT,"\u23df":e.MO.WIDEACCENT,"\u23e0":e.MO.WIDEACCENT,"\u23e1":e.MO.WIDEACCENT,"\u25a0":e.MO.BIN3,"\u25a1":e.MO.BIN3,"\u25aa":e.MO.BIN3,"\u25ab":e.MO.BIN3,"\u25ad":e.MO.BIN3,"\u25ae":e.MO.BIN3,"\u25af":e.MO.BIN3,"\u25b0":e.MO.BIN3,"\u25b1":e.MO.BIN3,"\u25b2":e.MO.BIN4,"\u25b4":e.MO.BIN4,"\u25b6":e.MO.BIN4,"\u25b7":e.MO.BIN4,"\u25b8":e.MO.BIN4,"\u25bc":e.MO.BIN4,"\u25be":e.MO.BIN4,"\u25c0":e.MO.BIN4,"\u25c1":e.MO.BIN4,"\u25c2":e.MO.BIN4,"\u25c4":e.MO.BIN4,"\u25c5":e.MO.BIN4,"\u25c6":e.MO.BIN4,"\u25c7":e.MO.BIN4,"\u25c8":e.MO.BIN4,"\u25c9":e.MO.BIN4,"\u25cc":e.MO.BIN4,"\u25cd":e.MO.BIN4,"\u25ce":e.MO.BIN4,"\u25cf":e.MO.BIN4,"\u25d6":e.MO.BIN4,"\u25d7":e.MO.BIN4,"\u25e6":e.MO.BIN4,"\u266d":e.MO.ORD02,"\u266e":e.MO.ORD02,"\u266f":e.MO.ORD02,"\u2773":e.MO.CLOSE,"\u27e7":e.MO.CLOSE,"\u27e9":e.MO.CLOSE,"\u27eb":e.MO.CLOSE,"\u27ed":e.MO.CLOSE,"\u27ef":e.MO.CLOSE,"\u2980":[0,0,o.TEXCLASS.ORD,{fence:!0,stretchy:!0}],"\u2984":e.MO.CLOSE,"\u2986":e.MO.CLOSE,"\u2988":e.MO.CLOSE,"\u298a":e.MO.CLOSE,"\u298c":e.MO.CLOSE,"\u298e":e.MO.CLOSE,"\u2990":e.MO.CLOSE,"\u2992":e.MO.CLOSE,"\u2994":e.MO.CLOSE,"\u2996":e.MO.CLOSE,"\u2998":e.MO.CLOSE,"\u29fd":e.MO.CLOSE},infix:{"!=":e.MO.BIN4,"#":e.MO.ORD,$:e.MO.ORD,"%":[3,3,o.TEXCLASS.ORD,null],"&&":e.MO.BIN4,"":e.MO.ORD,"*":e.MO.BIN3,"**":i(1,1),"*=":e.MO.BIN4,"+":e.MO.BIN4,"+=":e.MO.BIN4,",":[0,3,o.TEXCLASS.PUNCT,{linebreakstyle:"after",separator:!0}],"-":e.MO.BIN4,"-=":e.MO.BIN4,"->":e.MO.BIN5,".":[0,3,o.TEXCLASS.PUNCT,{separator:!0}],"/":e.MO.ORD11,"//":i(1,1),"/=":e.MO.BIN4,":":[1,2,o.TEXCLASS.REL,null],":=":e.MO.BIN4,";":[0,3,o.TEXCLASS.PUNCT,{linebreakstyle:"after",separator:!0}],"<":e.MO.REL,"<=":e.MO.BIN5,"<>":i(1,1),"=":e.MO.REL,"==":e.MO.BIN4,">":e.MO.REL,">=":e.MO.BIN5,"?":[1,1,o.TEXCLASS.CLOSE,null],"@":e.MO.ORD11,"\\":e.MO.ORD,"^":e.MO.ORD11,_:e.MO.ORD11,"|":[2,2,o.TEXCLASS.ORD,{fence:!0,stretchy:!0,symmetric:!0}],"||":[2,2,o.TEXCLASS.BIN,{fence:!0,stretchy:!0,symmetric:!0}],"|||":[2,2,o.TEXCLASS.ORD,{fence:!0,stretchy:!0,symmetric:!0}],"\xb1":e.MO.BIN4,"\xb7":e.MO.BIN4,"\xd7":e.MO.BIN4,"\xf7":e.MO.BIN4,"\u02b9":e.MO.ORD,"\u0300":e.MO.ACCENT,"\u0301":e.MO.ACCENT,"\u0303":e.MO.WIDEACCENT,"\u0304":e.MO.ACCENT,"\u0306":e.MO.ACCENT,"\u0307":e.MO.ACCENT,"\u0308":e.MO.ACCENT,"\u030c":e.MO.ACCENT,"\u0332":e.MO.WIDEACCENT,"\u0338":e.MO.REL4,"\u2015":[0,0,o.TEXCLASS.ORD,{stretchy:!0}],"\u2017":[0,0,o.TEXCLASS.ORD,{stretchy:!0}],"\u2020":e.MO.BIN3,"\u2021":e.MO.BIN3,"\u2022":e.MO.BIN4,"\u2026":e.MO.INNER,"\u2043":e.MO.BIN4,"\u2044":e.MO.TALLBIN,"\u2061":e.MO.NONE,"\u2062":e.MO.NONE,"\u2063":[0,0,o.TEXCLASS.NONE,{linebreakstyle:"after",separator:!0}],"\u2064":e.MO.NONE,"\u20d7":e.MO.ACCENT,"\u2111":e.MO.ORD,"\u2113":e.MO.ORD,"\u2118":e.MO.ORD,"\u211c":e.MO.ORD,"\u2190":e.MO.WIDEREL,"\u2191":e.MO.RELSTRETCH,"\u2192":e.MO.WIDEREL,"\u2193":e.MO.RELSTRETCH,"\u2194":e.MO.WIDEREL,"\u2195":e.MO.RELSTRETCH,"\u2196":e.MO.RELSTRETCH,"\u2197":e.MO.RELSTRETCH,"\u2198":e.MO.RELSTRETCH,"\u2199":e.MO.RELSTRETCH,"\u219a":e.MO.RELACCENT,"\u219b":e.MO.RELACCENT,"\u219c":e.MO.WIDEREL,"\u219d":e.MO.WIDEREL,"\u219e":e.MO.WIDEREL,"\u219f":e.MO.WIDEREL,"\u21a0":e.MO.WIDEREL,"\u21a1":e.MO.RELSTRETCH,"\u21a2":e.MO.WIDEREL,"\u21a3":e.MO.WIDEREL,"\u21a4":e.MO.WIDEREL,"\u21a5":e.MO.RELSTRETCH,"\u21a6":e.MO.WIDEREL,"\u21a7":e.MO.RELSTRETCH,"\u21a8":e.MO.RELSTRETCH,"\u21a9":e.MO.WIDEREL,"\u21aa":e.MO.WIDEREL,"\u21ab":e.MO.WIDEREL,"\u21ac":e.MO.WIDEREL,"\u21ad":e.MO.WIDEREL,"\u21ae":e.MO.RELACCENT,"\u21af":e.MO.RELSTRETCH,"\u21b0":e.MO.RELSTRETCH,"\u21b1":e.MO.RELSTRETCH,"\u21b2":e.MO.RELSTRETCH,"\u21b3":e.MO.RELSTRETCH,"\u21b4":e.MO.RELSTRETCH,"\u21b5":e.MO.RELSTRETCH,"\u21b6":e.MO.RELACCENT,"\u21b7":e.MO.RELACCENT,"\u21b8":e.MO.REL,"\u21b9":e.MO.WIDEREL,"\u21ba":e.MO.REL,"\u21bb":e.MO.REL,"\u21bc":e.MO.WIDEREL,"\u21bd":e.MO.WIDEREL,"\u21be":e.MO.RELSTRETCH,"\u21bf":e.MO.RELSTRETCH,"\u21c0":e.MO.WIDEREL,"\u21c1":e.MO.WIDEREL,"\u21c2":e.MO.RELSTRETCH,"\u21c3":e.MO.RELSTRETCH,"\u21c4":e.MO.WIDEREL,"\u21c5":e.MO.RELSTRETCH,"\u21c6":e.MO.WIDEREL,"\u21c7":e.MO.WIDEREL,"\u21c8":e.MO.RELSTRETCH,"\u21c9":e.MO.WIDEREL,"\u21ca":e.MO.RELSTRETCH,"\u21cb":e.MO.WIDEREL,"\u21cc":e.MO.WIDEREL,"\u21cd":e.MO.RELACCENT,"\u21ce":e.MO.RELACCENT,"\u21cf":e.MO.RELACCENT,"\u21d0":e.MO.WIDEREL,"\u21d1":e.MO.RELSTRETCH,"\u21d2":e.MO.WIDEREL,"\u21d3":e.MO.RELSTRETCH,"\u21d4":e.MO.WIDEREL,"\u21d5":e.MO.RELSTRETCH,"\u21d6":e.MO.RELSTRETCH,"\u21d7":e.MO.RELSTRETCH,"\u21d8":e.MO.RELSTRETCH,"\u21d9":e.MO.RELSTRETCH,"\u21da":e.MO.WIDEREL,"\u21db":e.MO.WIDEREL,"\u21dc":e.MO.WIDEREL,"\u21dd":e.MO.WIDEREL,"\u21de":e.MO.REL,"\u21df":e.MO.REL,"\u21e0":e.MO.WIDEREL,"\u21e1":e.MO.RELSTRETCH,"\u21e2":e.MO.WIDEREL,"\u21e3":e.MO.RELSTRETCH,"\u21e4":e.MO.WIDEREL,"\u21e5":e.MO.WIDEREL,"\u21e6":e.MO.WIDEREL,"\u21e7":e.MO.RELSTRETCH,"\u21e8":e.MO.WIDEREL,"\u21e9":e.MO.RELSTRETCH,"\u21ea":e.MO.RELSTRETCH,"\u21eb":e.MO.RELSTRETCH,"\u21ec":e.MO.RELSTRETCH,"\u21ed":e.MO.RELSTRETCH,"\u21ee":e.MO.RELSTRETCH,"\u21ef":e.MO.RELSTRETCH,"\u21f0":e.MO.WIDEREL,"\u21f1":e.MO.REL,"\u21f2":e.MO.REL,"\u21f3":e.MO.RELSTRETCH,"\u21f4":e.MO.RELACCENT,"\u21f5":e.MO.RELSTRETCH,"\u21f6":e.MO.WIDEREL,"\u21f7":e.MO.RELACCENT,"\u21f8":e.MO.RELACCENT,"\u21f9":e.MO.RELACCENT,"\u21fa":e.MO.RELACCENT,"\u21fb":e.MO.RELACCENT,"\u21fc":e.MO.RELACCENT,"\u21fd":e.MO.WIDEREL,"\u21fe":e.MO.WIDEREL,"\u21ff":e.MO.WIDEREL,"\u2201":i(1,2,o.TEXCLASS.ORD),"\u2205":e.MO.ORD,"\u2206":e.MO.BIN3,"\u2208":e.MO.REL,"\u2209":e.MO.REL,"\u220a":e.MO.REL,"\u220b":e.MO.REL,"\u220c":e.MO.REL,"\u220d":e.MO.REL,"\u220e":e.MO.BIN3,"\u2212":e.MO.BIN4,"\u2213":e.MO.BIN4,"\u2214":e.MO.BIN4,"\u2215":e.MO.TALLBIN,"\u2216":e.MO.BIN4,"\u2217":e.MO.BIN4,"\u2218":e.MO.BIN4,"\u2219":e.MO.BIN4,"\u221d":e.MO.REL,"\u221e":e.MO.ORD,"\u221f":e.MO.REL,"\u2223":e.MO.REL,"\u2224":e.MO.REL,"\u2225":e.MO.REL,"\u2226":e.MO.REL,"\u2227":e.MO.BIN4,"\u2228":e.MO.BIN4,"\u2229":e.MO.BIN4,"\u222a":e.MO.BIN4,"\u2234":e.MO.REL,"\u2235":e.MO.REL,"\u2236":e.MO.REL,"\u2237":e.MO.REL,"\u2238":e.MO.BIN4,"\u2239":e.MO.REL,"\u223a":e.MO.BIN4,"\u223b":e.MO.REL,"\u223c":e.MO.REL,"\u223d":e.MO.REL,"\u223d\u0331":e.MO.BIN3,"\u223e":e.MO.REL,"\u223f":e.MO.BIN3,"\u2240":e.MO.BIN4,"\u2241":e.MO.REL,"\u2242":e.MO.REL,"\u2242\u0338":e.MO.REL,"\u2243":e.MO.REL,"\u2244":e.MO.REL,"\u2245":e.MO.REL,"\u2246":e.MO.REL,"\u2247":e.MO.REL,"\u2248":e.MO.REL,"\u2249":e.MO.REL,"\u224a":e.MO.REL,"\u224b":e.MO.REL,"\u224c":e.MO.REL,"\u224d":e.MO.REL,"\u224e":e.MO.REL,"\u224e\u0338":e.MO.REL,"\u224f":e.MO.REL,"\u224f\u0338":e.MO.REL,"\u2250":e.MO.REL,"\u2251":e.MO.REL,"\u2252":e.MO.REL,"\u2253":e.MO.REL,"\u2254":e.MO.REL,"\u2255":e.MO.REL,"\u2256":e.MO.REL,"\u2257":e.MO.REL,"\u2258":e.MO.REL,"\u2259":e.MO.REL,"\u225a":e.MO.REL,"\u225b":e.MO.REL,"\u225c":e.MO.REL,"\u225d":e.MO.REL,"\u225e":e.MO.REL,"\u225f":e.MO.REL,"\u2260":e.MO.REL,"\u2261":e.MO.REL,"\u2262":e.MO.REL,"\u2263":e.MO.REL,"\u2264":e.MO.REL,"\u2265":e.MO.REL,"\u2266":e.MO.REL,"\u2266\u0338":e.MO.REL,"\u2267":e.MO.REL,"\u2268":e.MO.REL,"\u2269":e.MO.REL,"\u226a":e.MO.REL,"\u226a\u0338":e.MO.REL,"\u226b":e.MO.REL,"\u226b\u0338":e.MO.REL,"\u226c":e.MO.REL,"\u226d":e.MO.REL,"\u226e":e.MO.REL,"\u226f":e.MO.REL,"\u2270":e.MO.REL,"\u2271":e.MO.REL,"\u2272":e.MO.REL,"\u2273":e.MO.REL,"\u2274":e.MO.REL,"\u2275":e.MO.REL,"\u2276":e.MO.REL,"\u2277":e.MO.REL,"\u2278":e.MO.REL,"\u2279":e.MO.REL,"\u227a":e.MO.REL,"\u227b":e.MO.REL,"\u227c":e.MO.REL,"\u227d":e.MO.REL,"\u227e":e.MO.REL,"\u227f":e.MO.REL,"\u227f\u0338":e.MO.REL,"\u2280":e.MO.REL,"\u2281":e.MO.REL,"\u2282":e.MO.REL,"\u2282\u20d2":e.MO.REL,"\u2283":e.MO.REL,"\u2283\u20d2":e.MO.REL,"\u2284":e.MO.REL,"\u2285":e.MO.REL,"\u2286":e.MO.REL,"\u2287":e.MO.REL,"\u2288":e.MO.REL,"\u2289":e.MO.REL,"\u228a":e.MO.REL,"\u228b":e.MO.REL,"\u228c":e.MO.BIN4,"\u228d":e.MO.BIN4,"\u228e":e.MO.BIN4,"\u228f":e.MO.REL,"\u228f\u0338":e.MO.REL,"\u2290":e.MO.REL,"\u2290\u0338":e.MO.REL,"\u2291":e.MO.REL,"\u2292":e.MO.REL,"\u2293":e.MO.BIN4,"\u2294":e.MO.BIN4,"\u2295":e.MO.BIN4,"\u2296":e.MO.BIN4,"\u2297":e.MO.BIN4,"\u2298":e.MO.BIN4,"\u2299":e.MO.BIN4,"\u229a":e.MO.BIN4,"\u229b":e.MO.BIN4,"\u229c":e.MO.BIN4,"\u229d":e.MO.BIN4,"\u229e":e.MO.BIN4,"\u229f":e.MO.BIN4,"\u22a0":e.MO.BIN4,"\u22a1":e.MO.BIN4,"\u22a2":e.MO.REL,"\u22a3":e.MO.REL,"\u22a4":e.MO.ORD55,"\u22a5":e.MO.REL,"\u22a6":e.MO.REL,"\u22a7":e.MO.REL,"\u22a8":e.MO.REL,"\u22a9":e.MO.REL,"\u22aa":e.MO.REL,"\u22ab":e.MO.REL,"\u22ac":e.MO.REL,"\u22ad":e.MO.REL,"\u22ae":e.MO.REL,"\u22af":e.MO.REL,"\u22b0":e.MO.REL,"\u22b1":e.MO.REL,"\u22b2":e.MO.REL,"\u22b3":e.MO.REL,"\u22b4":e.MO.REL,"\u22b5":e.MO.REL,"\u22b6":e.MO.REL,"\u22b7":e.MO.REL,"\u22b8":e.MO.REL,"\u22b9":e.MO.REL,"\u22ba":e.MO.BIN4,"\u22bb":e.MO.BIN4,"\u22bc":e.MO.BIN4,"\u22bd":e.MO.BIN4,"\u22be":e.MO.BIN3,"\u22bf":e.MO.BIN3,"\u22c4":e.MO.BIN4,"\u22c5":e.MO.BIN4,"\u22c6":e.MO.BIN4,"\u22c7":e.MO.BIN4,"\u22c8":e.MO.REL,"\u22c9":e.MO.BIN4,"\u22ca":e.MO.BIN4,"\u22cb":e.MO.BIN4,"\u22cc":e.MO.BIN4,"\u22cd":e.MO.REL,"\u22ce":e.MO.BIN4,"\u22cf":e.MO.BIN4,"\u22d0":e.MO.REL,"\u22d1":e.MO.REL,"\u22d2":e.MO.BIN4,"\u22d3":e.MO.BIN4,"\u22d4":e.MO.REL,"\u22d5":e.MO.REL,"\u22d6":e.MO.REL,"\u22d7":e.MO.REL,"\u22d8":e.MO.REL,"\u22d9":e.MO.REL,"\u22da":e.MO.REL,"\u22db":e.MO.REL,"\u22dc":e.MO.REL,"\u22dd":e.MO.REL,"\u22de":e.MO.REL,"\u22df":e.MO.REL,"\u22e0":e.MO.REL,"\u22e1":e.MO.REL,"\u22e2":e.MO.REL,"\u22e3":e.MO.REL,"\u22e4":e.MO.REL,"\u22e5":e.MO.REL,"\u22e6":e.MO.REL,"\u22e7":e.MO.REL,"\u22e8":e.MO.REL,"\u22e9":e.MO.REL,"\u22ea":e.MO.REL,"\u22eb":e.MO.REL,"\u22ec":e.MO.REL,"\u22ed":e.MO.REL,"\u22ee":e.MO.ORD55,"\u22ef":e.MO.INNER,"\u22f0":e.MO.REL,"\u22f1":[5,5,o.TEXCLASS.INNER,null],"\u22f2":e.MO.REL,"\u22f3":e.MO.REL,"\u22f4":e.MO.REL,"\u22f5":e.MO.REL,"\u22f6":e.MO.REL,"\u22f7":e.MO.REL,"\u22f8":e.MO.REL,"\u22f9":e.MO.REL,"\u22fa":e.MO.REL,"\u22fb":e.MO.REL,"\u22fc":e.MO.REL,"\u22fd":e.MO.REL,"\u22fe":e.MO.REL,"\u22ff":e.MO.REL,"\u2305":e.MO.BIN3,"\u2306":e.MO.BIN3,"\u2322":e.MO.REL4,"\u2323":e.MO.REL4,"\u2329":e.MO.OPEN,"\u232a":e.MO.CLOSE,"\u23aa":e.MO.ORD,"\u23af":[0,0,o.TEXCLASS.ORD,{stretchy:!0}],"\u23b0":e.MO.OPEN,"\u23b1":e.MO.CLOSE,"\u2500":e.MO.ORD,"\u25b3":e.MO.BIN4,"\u25b5":e.MO.BIN4,"\u25b9":e.MO.BIN4,"\u25bd":e.MO.BIN4,"\u25bf":e.MO.BIN4,"\u25c3":e.MO.BIN4,"\u25ef":e.MO.BIN3,"\u2660":e.MO.ORD,"\u2661":e.MO.ORD,"\u2662":e.MO.ORD,"\u2663":e.MO.ORD,"\u2758":e.MO.REL,"\u27f0":e.MO.RELSTRETCH,"\u27f1":e.MO.RELSTRETCH,"\u27f5":e.MO.WIDEREL,"\u27f6":e.MO.WIDEREL,"\u27f7":e.MO.WIDEREL,"\u27f8":e.MO.WIDEREL,"\u27f9":e.MO.WIDEREL,"\u27fa":e.MO.WIDEREL,"\u27fb":e.MO.WIDEREL,"\u27fc":e.MO.WIDEREL,"\u27fd":e.MO.WIDEREL,"\u27fe":e.MO.WIDEREL,"\u27ff":e.MO.WIDEREL,"\u2900":e.MO.RELACCENT,"\u2901":e.MO.RELACCENT,"\u2902":e.MO.RELACCENT,"\u2903":e.MO.RELACCENT,"\u2904":e.MO.RELACCENT,"\u2905":e.MO.RELACCENT,"\u2906":e.MO.RELACCENT,"\u2907":e.MO.RELACCENT,"\u2908":e.MO.REL,"\u2909":e.MO.REL,"\u290a":e.MO.RELSTRETCH,"\u290b":e.MO.RELSTRETCH,"\u290c":e.MO.WIDEREL,"\u290d":e.MO.WIDEREL,"\u290e":e.MO.WIDEREL,"\u290f":e.MO.WIDEREL,"\u2910":e.MO.WIDEREL,"\u2911":e.MO.RELACCENT,"\u2912":e.MO.RELSTRETCH,"\u2913":e.MO.RELSTRETCH,"\u2914":e.MO.RELACCENT,"\u2915":e.MO.RELACCENT,"\u2916":e.MO.RELACCENT,"\u2917":e.MO.RELACCENT,"\u2918":e.MO.RELACCENT,"\u2919":e.MO.RELACCENT,"\u291a":e.MO.RELACCENT,"\u291b":e.MO.RELACCENT,"\u291c":e.MO.RELACCENT,"\u291d":e.MO.RELACCENT,"\u291e":e.MO.RELACCENT,"\u291f":e.MO.RELACCENT,"\u2920":e.MO.RELACCENT,"\u2921":e.MO.RELSTRETCH,"\u2922":e.MO.RELSTRETCH,"\u2923":e.MO.REL,"\u2924":e.MO.REL,"\u2925":e.MO.REL,"\u2926":e.MO.REL,"\u2927":e.MO.REL,"\u2928":e.MO.REL,"\u2929":e.MO.REL,"\u292a":e.MO.REL,"\u292b":e.MO.REL,"\u292c":e.MO.REL,"\u292d":e.MO.REL,"\u292e":e.MO.REL,"\u292f":e.MO.REL,"\u2930":e.MO.REL,"\u2931":e.MO.REL,"\u2932":e.MO.REL,"\u2933":e.MO.RELACCENT,"\u2934":e.MO.REL,"\u2935":e.MO.REL,"\u2936":e.MO.REL,"\u2937":e.MO.REL,"\u2938":e.MO.REL,"\u2939":e.MO.REL,"\u293a":e.MO.RELACCENT,"\u293b":e.MO.RELACCENT,"\u293c":e.MO.RELACCENT,"\u293d":e.MO.RELACCENT,"\u293e":e.MO.REL,"\u293f":e.MO.REL,"\u2940":e.MO.REL,"\u2941":e.MO.REL,"\u2942":e.MO.RELACCENT,"\u2943":e.MO.RELACCENT,"\u2944":e.MO.RELACCENT,"\u2945":e.MO.RELACCENT,"\u2946":e.MO.RELACCENT,"\u2947":e.MO.RELACCENT,"\u2948":e.MO.RELACCENT,"\u2949":e.MO.REL,"\u294a":e.MO.RELACCENT,"\u294b":e.MO.RELACCENT,"\u294c":e.MO.REL,"\u294d":e.MO.REL,"\u294e":e.MO.WIDEREL,"\u294f":e.MO.RELSTRETCH,"\u2950":e.MO.WIDEREL,"\u2951":e.MO.RELSTRETCH,"\u2952":e.MO.WIDEREL,"\u2953":e.MO.WIDEREL,"\u2954":e.MO.RELSTRETCH,"\u2955":e.MO.RELSTRETCH,"\u2956":e.MO.RELSTRETCH,"\u2957":e.MO.RELSTRETCH,"\u2958":e.MO.RELSTRETCH,"\u2959":e.MO.RELSTRETCH,"\u295a":e.MO.WIDEREL,"\u295b":e.MO.WIDEREL,"\u295c":e.MO.RELSTRETCH,"\u295d":e.MO.RELSTRETCH,"\u295e":e.MO.WIDEREL,"\u295f":e.MO.WIDEREL,"\u2960":e.MO.RELSTRETCH,"\u2961":e.MO.RELSTRETCH,"\u2962":e.MO.RELACCENT,"\u2963":e.MO.REL,"\u2964":e.MO.RELACCENT,"\u2965":e.MO.REL,"\u2966":e.MO.RELACCENT,"\u2967":e.MO.RELACCENT,"\u2968":e.MO.RELACCENT,"\u2969":e.MO.RELACCENT,"\u296a":e.MO.RELACCENT,"\u296b":e.MO.RELACCENT,"\u296c":e.MO.RELACCENT,"\u296d":e.MO.RELACCENT,"\u296e":e.MO.RELSTRETCH,"\u296f":e.MO.RELSTRETCH,"\u2970":e.MO.RELACCENT,"\u2971":e.MO.RELACCENT,"\u2972":e.MO.RELACCENT,"\u2973":e.MO.RELACCENT,"\u2974":e.MO.RELACCENT,"\u2975":e.MO.RELACCENT,"\u2976":e.MO.RELACCENT,"\u2977":e.MO.RELACCENT,"\u2978":e.MO.RELACCENT,"\u2979":e.MO.RELACCENT,"\u297a":e.MO.RELACCENT,"\u297b":e.MO.RELACCENT,"\u297c":e.MO.RELACCENT,"\u297d":e.MO.RELACCENT,"\u297e":e.MO.REL,"\u297f":e.MO.REL,"\u2981":e.MO.BIN3,"\u2982":e.MO.BIN3,"\u2999":e.MO.BIN3,"\u299a":e.MO.BIN3,"\u299b":e.MO.BIN3,"\u299c":e.MO.BIN3,"\u299d":e.MO.BIN3,"\u299e":e.MO.BIN3,"\u299f":e.MO.BIN3,"\u29a0":e.MO.BIN3,"\u29a1":e.MO.BIN3,"\u29a2":e.MO.BIN3,"\u29a3":e.MO.BIN3,"\u29a4":e.MO.BIN3,"\u29a5":e.MO.BIN3,"\u29a6":e.MO.BIN3,"\u29a7":e.MO.BIN3,"\u29a8":e.MO.BIN3,"\u29a9":e.MO.BIN3,"\u29aa":e.MO.BIN3,"\u29ab":e.MO.BIN3,"\u29ac":e.MO.BIN3,"\u29ad":e.MO.BIN3,"\u29ae":e.MO.BIN3,"\u29af":e.MO.BIN3,"\u29b0":e.MO.BIN3,"\u29b1":e.MO.BIN3,"\u29b2":e.MO.BIN3,"\u29b3":e.MO.BIN3,"\u29b4":e.MO.BIN3,"\u29b5":e.MO.BIN3,"\u29b6":e.MO.BIN4,"\u29b7":e.MO.BIN4,"\u29b8":e.MO.BIN4,"\u29b9":e.MO.BIN4,"\u29ba":e.MO.BIN4,"\u29bb":e.MO.BIN4,"\u29bc":e.MO.BIN4,"\u29bd":e.MO.BIN4,"\u29be":e.MO.BIN4,"\u29bf":e.MO.BIN4,"\u29c0":e.MO.REL,"\u29c1":e.MO.REL,"\u29c2":e.MO.BIN3,"\u29c3":e.MO.BIN3,"\u29c4":e.MO.BIN4,"\u29c5":e.MO.BIN4,"\u29c6":e.MO.BIN4,"\u29c7":e.MO.BIN4,"\u29c8":e.MO.BIN4,"\u29c9":e.MO.BIN3,"\u29ca":e.MO.BIN3,"\u29cb":e.MO.BIN3,"\u29cc":e.MO.BIN3,"\u29cd":e.MO.BIN3,"\u29ce":e.MO.REL,"\u29cf":e.MO.REL,"\u29cf\u0338":e.MO.REL,"\u29d0":e.MO.REL,"\u29d0\u0338":e.MO.REL,"\u29d1":e.MO.REL,"\u29d2":e.MO.REL,"\u29d3":e.MO.REL,"\u29d4":e.MO.REL,"\u29d5":e.MO.REL,"\u29d6":e.MO.BIN4,"\u29d7":e.MO.BIN4,"\u29d8":e.MO.BIN3,"\u29d9":e.MO.BIN3,"\u29db":e.MO.BIN3,"\u29dc":e.MO.BIN3,"\u29dd":e.MO.BIN3,"\u29de":e.MO.REL,"\u29df":e.MO.BIN3,"\u29e0":e.MO.BIN3,"\u29e1":e.MO.REL,"\u29e2":e.MO.BIN4,"\u29e3":e.MO.REL,"\u29e4":e.MO.REL,"\u29e5":e.MO.REL,"\u29e6":e.MO.REL,"\u29e7":e.MO.BIN3,"\u29e8":e.MO.BIN3,"\u29e9":e.MO.BIN3,"\u29ea":e.MO.BIN3,"\u29eb":e.MO.BIN3,"\u29ec":e.MO.BIN3,"\u29ed":e.MO.BIN3,"\u29ee":e.MO.BIN3,"\u29ef":e.MO.BIN3,"\u29f0":e.MO.BIN3,"\u29f1":e.MO.BIN3,"\u29f2":e.MO.BIN3,"\u29f3":e.MO.BIN3,"\u29f4":e.MO.REL,"\u29f5":e.MO.BIN4,"\u29f6":e.MO.BIN4,"\u29f7":e.MO.BIN4,"\u29f8":e.MO.BIN3,"\u29f9":e.MO.BIN3,"\u29fa":e.MO.BIN3,"\u29fb":e.MO.BIN3,"\u29fe":e.MO.BIN4,"\u29ff":e.MO.BIN4,"\u2a1d":e.MO.BIN3,"\u2a1e":e.MO.BIN3,"\u2a1f":e.MO.BIN3,"\u2a20":e.MO.BIN3,"\u2a21":e.MO.BIN3,"\u2a22":e.MO.BIN4,"\u2a23":e.MO.BIN4,"\u2a24":e.MO.BIN4,"\u2a25":e.MO.BIN4,"\u2a26":e.MO.BIN4,"\u2a27":e.MO.BIN4,"\u2a28":e.MO.BIN4,"\u2a29":e.MO.BIN4,"\u2a2a":e.MO.BIN4,"\u2a2b":e.MO.BIN4,"\u2a2c":e.MO.BIN4,"\u2a2d":e.MO.BIN4,"\u2a2e":e.MO.BIN4,"\u2a2f":e.MO.BIN4,"\u2a30":e.MO.BIN4,"\u2a31":e.MO.BIN4,"\u2a32":e.MO.BIN4,"\u2a33":e.MO.BIN4,"\u2a34":e.MO.BIN4,"\u2a35":e.MO.BIN4,"\u2a36":e.MO.BIN4,"\u2a37":e.MO.BIN4,"\u2a38":e.MO.BIN4,"\u2a39":e.MO.BIN4,"\u2a3a":e.MO.BIN4,"\u2a3b":e.MO.BIN4,"\u2a3c":e.MO.BIN4,"\u2a3d":e.MO.BIN4,"\u2a3e":e.MO.BIN4,"\u2a3f":e.MO.BIN4,"\u2a40":e.MO.BIN4,"\u2a41":e.MO.BIN4,"\u2a42":e.MO.BIN4,"\u2a43":e.MO.BIN4,"\u2a44":e.MO.BIN4,"\u2a45":e.MO.BIN4,"\u2a46":e.MO.BIN4,"\u2a47":e.MO.BIN4,"\u2a48":e.MO.BIN4,"\u2a49":e.MO.BIN4,"\u2a4a":e.MO.BIN4,"\u2a4b":e.MO.BIN4,"\u2a4c":e.MO.BIN4,"\u2a4d":e.MO.BIN4,"\u2a4e":e.MO.BIN4,"\u2a4f":e.MO.BIN4,"\u2a50":e.MO.BIN4,"\u2a51":e.MO.BIN4,"\u2a52":e.MO.BIN4,"\u2a53":e.MO.BIN4,"\u2a54":e.MO.BIN4,"\u2a55":e.MO.BIN4,"\u2a56":e.MO.BIN4,"\u2a57":e.MO.BIN4,"\u2a58":e.MO.BIN4,"\u2a59":e.MO.REL,"\u2a5a":e.MO.BIN4,"\u2a5b":e.MO.BIN4,"\u2a5c":e.MO.BIN4,"\u2a5d":e.MO.BIN4,"\u2a5e":e.MO.BIN4,"\u2a5f":e.MO.BIN4,"\u2a60":e.MO.BIN4,"\u2a61":e.MO.BIN4,"\u2a62":e.MO.BIN4,"\u2a63":e.MO.BIN4,"\u2a64":e.MO.BIN4,"\u2a65":e.MO.BIN4,"\u2a66":e.MO.REL,"\u2a67":e.MO.REL,"\u2a68":e.MO.REL,"\u2a69":e.MO.REL,"\u2a6a":e.MO.REL,"\u2a6b":e.MO.REL,"\u2a6c":e.MO.REL,"\u2a6d":e.MO.REL,"\u2a6e":e.MO.REL,"\u2a6f":e.MO.REL,"\u2a70":e.MO.REL,"\u2a71":e.MO.BIN4,"\u2a72":e.MO.BIN4,"\u2a73":e.MO.REL,"\u2a74":e.MO.REL,"\u2a75":e.MO.REL,"\u2a76":e.MO.REL,"\u2a77":e.MO.REL,"\u2a78":e.MO.REL,"\u2a79":e.MO.REL,"\u2a7a":e.MO.REL,"\u2a7b":e.MO.REL,"\u2a7c":e.MO.REL,"\u2a7d":e.MO.REL,"\u2a7d\u0338":e.MO.REL,"\u2a7e":e.MO.REL,"\u2a7e\u0338":e.MO.REL,"\u2a7f":e.MO.REL,"\u2a80":e.MO.REL,"\u2a81":e.MO.REL,"\u2a82":e.MO.REL,"\u2a83":e.MO.REL,"\u2a84":e.MO.REL,"\u2a85":e.MO.REL,"\u2a86":e.MO.REL,"\u2a87":e.MO.REL,"\u2a88":e.MO.REL,"\u2a89":e.MO.REL,"\u2a8a":e.MO.REL,"\u2a8b":e.MO.REL,"\u2a8c":e.MO.REL,"\u2a8d":e.MO.REL,"\u2a8e":e.MO.REL,"\u2a8f":e.MO.REL,"\u2a90":e.MO.REL,"\u2a91":e.MO.REL,"\u2a92":e.MO.REL,"\u2a93":e.MO.REL,"\u2a94":e.MO.REL,"\u2a95":e.MO.REL,"\u2a96":e.MO.REL,"\u2a97":e.MO.REL,"\u2a98":e.MO.REL,"\u2a99":e.MO.REL,"\u2a9a":e.MO.REL,"\u2a9b":e.MO.REL,"\u2a9c":e.MO.REL,"\u2a9d":e.MO.REL,"\u2a9e":e.MO.REL,"\u2a9f":e.MO.REL,"\u2aa0":e.MO.REL,"\u2aa1":e.MO.REL,"\u2aa1\u0338":e.MO.REL,"\u2aa2":e.MO.REL,"\u2aa2\u0338":e.MO.REL,"\u2aa3":e.MO.REL,"\u2aa4":e.MO.REL,"\u2aa5":e.MO.REL,"\u2aa6":e.MO.REL,"\u2aa7":e.MO.REL,"\u2aa8":e.MO.REL,"\u2aa9":e.MO.REL,"\u2aaa":e.MO.REL,"\u2aab":e.MO.REL,"\u2aac":e.MO.REL,"\u2aad":e.MO.REL,"\u2aae":e.MO.REL,"\u2aaf":e.MO.REL,"\u2aaf\u0338":e.MO.REL,"\u2ab0":e.MO.REL,"\u2ab0\u0338":e.MO.REL,"\u2ab1":e.MO.REL,"\u2ab2":e.MO.REL,"\u2ab3":e.MO.REL,"\u2ab4":e.MO.REL,"\u2ab5":e.MO.REL,"\u2ab6":e.MO.REL,"\u2ab7":e.MO.REL,"\u2ab8":e.MO.REL,"\u2ab9":e.MO.REL,"\u2aba":e.MO.REL,"\u2abb":e.MO.REL,"\u2abc":e.MO.REL,"\u2abd":e.MO.REL,"\u2abe":e.MO.REL,"\u2abf":e.MO.REL,"\u2ac0":e.MO.REL,"\u2ac1":e.MO.REL,"\u2ac2":e.MO.REL,"\u2ac3":e.MO.REL,"\u2ac4":e.MO.REL,"\u2ac5":e.MO.REL,"\u2ac6":e.MO.REL,"\u2ac7":e.MO.REL,"\u2ac8":e.MO.REL,"\u2ac9":e.MO.REL,"\u2aca":e.MO.REL,"\u2acb":e.MO.REL,"\u2acc":e.MO.REL,"\u2acd":e.MO.REL,"\u2ace":e.MO.REL,"\u2acf":e.MO.REL,"\u2ad0":e.MO.REL,"\u2ad1":e.MO.REL,"\u2ad2":e.MO.REL,"\u2ad3":e.MO.REL,"\u2ad4":e.MO.REL,"\u2ad5":e.MO.REL,"\u2ad6":e.MO.REL,"\u2ad7":e.MO.REL,"\u2ad8":e.MO.REL,"\u2ad9":e.MO.REL,"\u2ada":e.MO.REL,"\u2adb":e.MO.REL,"\u2add":e.MO.REL,"\u2add\u0338":e.MO.REL,"\u2ade":e.MO.REL,"\u2adf":e.MO.REL,"\u2ae0":e.MO.REL,"\u2ae1":e.MO.REL,"\u2ae2":e.MO.REL,"\u2ae3":e.MO.REL,"\u2ae4":e.MO.REL,"\u2ae5":e.MO.REL,"\u2ae6":e.MO.REL,"\u2ae7":e.MO.REL,"\u2ae8":e.MO.REL,"\u2ae9":e.MO.REL,"\u2aea":e.MO.REL,"\u2aeb":e.MO.REL,"\u2aec":e.MO.REL,"\u2aed":e.MO.REL,"\u2aee":e.MO.REL,"\u2aef":e.MO.REL,"\u2af0":e.MO.REL,"\u2af1":e.MO.REL,"\u2af2":e.MO.REL,"\u2af3":e.MO.REL,"\u2af4":e.MO.BIN4,"\u2af5":e.MO.BIN4,"\u2af6":e.MO.BIN4,"\u2af7":e.MO.REL,"\u2af8":e.MO.REL,"\u2af9":e.MO.REL,"\u2afa":e.MO.REL,"\u2afb":e.MO.BIN4,"\u2afd":e.MO.BIN4,"\u2afe":e.MO.BIN3,"\u2b45":e.MO.RELSTRETCH,"\u2b46":e.MO.RELSTRETCH,"\u3008":e.MO.OPEN,"\u3009":e.MO.CLOSE,"\ufe37":e.MO.WIDEACCENT,"\ufe38":e.MO.WIDEACCENT}},e.OPTABLE.infix["^"]=e.MO.WIDEREL,e.OPTABLE.infix._=e.MO.WIDEREL,e.OPTABLE.infix["\u2adc"]=e.MO.REL},9259:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.SerializedMmlVisitor=e.toEntity=e.DATAMJX=void 0;var s=r(6325),l=r(9007),c=r(450);e.DATAMJX="data-mjx-";e.toEntity=function(t){return"&#x"+t.codePointAt(0).toString(16).toUpperCase()+";"};var u=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return o(r,t),r.prototype.visitTree=function(t){return this.visitNode(t,"")},r.prototype.visitTextNode=function(t,e){return this.quoteHTML(t.getText())},r.prototype.visitXMLNode=function(t,e){return e+t.getSerializedXML()},r.prototype.visitInferredMrowNode=function(t,e){var r,n,o=[];try{for(var a=i(t.childNodes),s=a.next();!s.done;s=a.next()){var l=s.value;o.push(this.visitNode(l,e))}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return o.join("\n")},r.prototype.visitTeXAtomNode=function(t,e){var r=this.childNodeMml(t,e+"  ","\n");return e+"<mrow"+this.getAttributes(t)+">"+(r.match(/\S/)?"\n"+r+e:"")+"</mrow>"},r.prototype.visitAnnotationNode=function(t,e){return e+"<annotation"+this.getAttributes(t)+">"+this.childNodeMml(t,"","")+"</annotation>"},r.prototype.visitDefault=function(t,e){var r=t.kind,n=a(t.isToken||0===t.childNodes.length?["",""]:["\n",e],2),o=n[0],i=n[1],s=this.childNodeMml(t,e+"  ",o);return e+"<"+r+this.getAttributes(t)+">"+(s.match(/\S/)?o+s+i:"")+"</"+r+">"},r.prototype.childNodeMml=function(t,e,r){var n,o,a="";try{for(var s=i(t.childNodes),l=s.next();!l.done;l=s.next()){var c=l.value;a+=this.visitNode(c,e)+r}}catch(t){n={error:t}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return a},r.prototype.getAttributes=function(t){var e,r,n=[],o=this.constructor.defaultAttributes[t.kind]||{},a=Object.assign({},o,this.getDataAttributes(t),t.attributes.getAllAttributes()),s=this.constructor.variants;a.hasOwnProperty("mathvariant")&&s.hasOwnProperty(a.mathvariant)&&(a.mathvariant=s[a.mathvariant]);try{for(var l=i(Object.keys(a)),c=l.next();!c.done;c=l.next()){var u=c.value,p=String(a[u]);void 0!==p&&n.push(u+'="'+this.quoteHTML(p)+'"')}}catch(t){e={error:t}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(e)throw e.error}}return n.length?" "+n.join(" "):""},r.prototype.getDataAttributes=function(t){var e={},r=t.attributes.getExplicit("mathvariant"),n=this.constructor.variants;r&&n.hasOwnProperty(r)&&this.setDataAttribute(e,"variant",r),t.getProperty("variantForm")&&this.setDataAttribute(e,"alternate","1"),t.getProperty("pseudoscript")&&this.setDataAttribute(e,"pseudoscript","true"),!1===t.getProperty("autoOP")&&this.setDataAttribute(e,"auto-op","false");var o=t.getProperty("scriptalign");o&&this.setDataAttribute(e,"script-align",o);var i=t.getProperty("texClass");if(void 0!==i){var a=!0;if(i===l.TEXCLASS.OP&&t.isKind("mi")){var s=t.getText();a=!(s.length>1&&s.match(c.MmlMi.operatorName))}a&&this.setDataAttribute(e,"texclass",i<0?"NONE":l.TEXCLASSNAMES[i])}return t.getProperty("scriptlevel")&&!1===t.getProperty("useHeight")&&this.setDataAttribute(e,"smallmatrix","true"),e},r.prototype.setDataAttribute=function(t,r,n){t[e.DATAMJX+r]=n},r.prototype.quoteHTML=function(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\"/g,"&quot;").replace(/[\uD800-\uDBFF]./g,e.toEntity).replace(/[\u0080-\uD7FF\uE000-\uFFFF]/g,e.toEntity)},r.variants={"-tex-calligraphic":"script","-tex-bold-calligraphic":"bold-script","-tex-oldstyle":"normal","-tex-bold-oldstyle":"bold","-tex-mathit":"italic"},r.defaultAttributes={math:{xmlns:"http://www.w3.org/1998/Math/MathML"}},r}(s.MmlVisitor);e.SerializedMmlVisitor=u},2975:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractOutputJax=void 0;var n=r(7233),o=r(7525),i=function(){function t(t){void 0===t&&(t={}),this.adaptor=null;var e=this.constructor;this.options=(0,n.userOptions)((0,n.defaultOptions)({},e.OPTIONS),t),this.postFilters=new o.FunctionList}return Object.defineProperty(t.prototype,"name",{get:function(){return this.constructor.NAME},enumerable:!1,configurable:!0}),t.prototype.setAdaptor=function(t){this.adaptor=t},t.prototype.initialize=function(){},t.prototype.reset=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]},t.prototype.getMetrics=function(t){},t.prototype.styleSheet=function(t){return null},t.prototype.pageElements=function(t){return null},t.prototype.executeFilters=function(t,e,r,n){var o={math:e,document:r,data:n};return t.execute(o),o.data},t.NAME="generic",t.OPTIONS={},t}();e.AbstractOutputJax=i},4574:function(t,e){var r=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractFactory=void 0;var i=function(){function t(t){var e,n;void 0===t&&(t=null),this.defaultKind="unknown",this.nodeMap=new Map,this.node={},null===t&&(t=this.constructor.defaultNodes);try{for(var o=r(Object.keys(t)),i=o.next();!i.done;i=o.next()){var a=i.value;this.setNodeClass(a,t[a])}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}}return t.prototype.create=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return(this.node[t]||this.node[this.defaultKind]).apply(void 0,o([],n(e),!1))},t.prototype.setNodeClass=function(t,e){this.nodeMap.set(t,e);var r=this,i=this.nodeMap.get(t);this.node[t]=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new(i.bind.apply(i,o([void 0,r],n(t),!1)))}},t.prototype.getNodeClass=function(t){return this.nodeMap.get(t)},t.prototype.deleteNodeClass=function(t){this.nodeMap.delete(t),delete this.node[t]},t.prototype.nodeIsKind=function(t,e){return t instanceof this.getNodeClass(e)},t.prototype.getKinds=function(){return Array.from(this.nodeMap.keys())},t.defaultNodes={},t}();e.AbstractFactory=i},4596:function(t,e){var r,n=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__assign||function(){return o=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},o.apply(this,arguments)},i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractEmptyNode=e.AbstractNode=void 0;var a=function(){function t(t,e,r){var n,o;void 0===e&&(e={}),void 0===r&&(r=[]),this.factory=t,this.parent=null,this.properties={},this.childNodes=[];try{for(var a=i(Object.keys(e)),s=a.next();!s.done;s=a.next()){var l=s.value;this.setProperty(l,e[l])}}catch(t){n={error:t}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}r.length&&this.setChildren(r)}return Object.defineProperty(t.prototype,"kind",{get:function(){return"unknown"},enumerable:!1,configurable:!0}),t.prototype.setProperty=function(t,e){this.properties[t]=e},t.prototype.getProperty=function(t){return this.properties[t]},t.prototype.getPropertyNames=function(){return Object.keys(this.properties)},t.prototype.getAllProperties=function(){return this.properties},t.prototype.removeProperty=function(){for(var t,e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];try{for(var o=i(r),a=o.next();!a.done;a=o.next()){var s=a.value;delete this.properties[s]}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}},t.prototype.isKind=function(t){return this.factory.nodeIsKind(this,t)},t.prototype.setChildren=function(t){var e,r;this.childNodes=[];try{for(var n=i(t),o=n.next();!o.done;o=n.next()){var a=o.value;this.appendChild(a)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},t.prototype.appendChild=function(t){return this.childNodes.push(t),t.parent=this,t},t.prototype.replaceChild=function(t,e){var r=this.childIndex(e);return null!==r&&(this.childNodes[r]=t,t.parent=this,e.parent=null),t},t.prototype.removeChild=function(t){var e=this.childIndex(t);return null!==e&&(this.childNodes.splice(e,1),t.parent=null),t},t.prototype.childIndex=function(t){var e=this.childNodes.indexOf(t);return-1===e?null:e},t.prototype.copy=function(){var t,e,r=this.factory.create(this.kind);r.properties=o({},this.properties);try{for(var n=i(this.childNodes||[]),a=n.next();!a.done;a=n.next()){var s=a.value;s&&r.appendChild(s.copy())}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}return r},t.prototype.findNodes=function(t){var e=[];return this.walkTree((function(r){r.isKind(t)&&e.push(r)})),e},t.prototype.walkTree=function(t,e){var r,n;t(this,e);try{for(var o=i(this.childNodes),a=o.next();!a.done;a=o.next()){var s=a.value;s&&s.walkTree(t,e)}}catch(t){r={error:t}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return e},t.prototype.toString=function(){return this.kind+"("+this.childNodes.join(",")+")"},t}();e.AbstractNode=a;var s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.setChildren=function(t){},e.prototype.appendChild=function(t){return t},e.prototype.replaceChild=function(t,e){return e},e.prototype.childIndex=function(t){return null},e.prototype.walkTree=function(t,e){return t(this,e),e},e.prototype.toString=function(){return this.kind},e}(a);e.AbstractEmptyNode=s},7860:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractNodeFactory=void 0;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.create=function(t,e,r){return void 0===e&&(e={}),void 0===r&&(r=[]),this.node[t](e,r)},e}(r(4574).AbstractFactory);e.AbstractNodeFactory=i},8823:function(t,e,r){var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractVisitor=void 0;var a=r(4596),s=function(){function t(e){var r,o;this.nodeHandlers=new Map;try{for(var i=n(e.getKinds()),a=i.next();!a.done;a=i.next()){var s=a.value,l=this[t.methodName(s)];l&&this.nodeHandlers.set(s,l)}}catch(t){r={error:t}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}}return t.methodName=function(t){return"visit"+(t.charAt(0).toUpperCase()+t.substr(1)).replace(/[^a-z0-9_]/gi,"_")+"Node"},t.prototype.visitTree=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return this.visitNode.apply(this,i([t],o(e),!1))},t.prototype.visitNode=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=this.nodeHandlers.get(t.kind)||this.visitDefault;return n.call.apply(n,i([this,t],o(e),!1))},t.prototype.visitDefault=function(t){for(var e,r,s=[],l=1;l<arguments.length;l++)s[l-1]=arguments[l];if(t instanceof a.AbstractNode)try{for(var c=n(t.childNodes),u=c.next();!u.done;u=c.next()){var p=u.value;this.visitNode.apply(this,i([p],o(s),!1))}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(e)throw e.error}}},t.prototype.setNodeHandler=function(t,e){this.nodeHandlers.set(t,e)},t.prototype.removeNodeHandler=function(t){this.nodeHandlers.delete(t)},t}();e.AbstractVisitor=s},8912:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractWrapper=void 0;var r=function(){function t(t,e){this.factory=t,this.node=e}return Object.defineProperty(t.prototype,"kind",{get:function(){return this.node.kind},enumerable:!1,configurable:!0}),t.prototype.wrap=function(t){return this.factory.wrap(t)},t}();e.AbstractWrapper=r},3811:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractWrapperFactory=void 0;var s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.wrap=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return this.create.apply(this,a([t.kind,t],i(e),!1))},e}(r(4574).AbstractFactory);e.AbstractWrapperFactory=s},6272:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.RegisterHTMLHandler=void 0;var n=r(5713),o=r(3726);e.RegisterHTMLHandler=function(t){var e=new o.HTMLHandler(t);return n.mathjax.handlers.register(e),e}},3683:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},s=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.HTMLDocument=void 0;var l=r(5722),c=r(7233),u=r(3363),p=r(3335),h=r(5138),d=r(4474),f=function(t){function e(e,r,n){var o=this,i=a((0,c.separateOptions)(n,h.HTMLDomStrings.OPTIONS),2),s=i[0],l=i[1];return(o=t.call(this,e,r,s)||this).domStrings=o.options.DomStrings||new h.HTMLDomStrings(l),o.domStrings.adaptor=r,o.styles=[],o}return o(e,t),e.prototype.findPosition=function(t,e,r,n){var o,i,l=this.adaptor;try{for(var c=s(n[t]),u=c.next();!u.done;u=c.next()){var p=u.value,h=a(p,2),d=h[0],f=h[1];if(e<=f&&"#text"===l.kind(d))return{node:d,n:Math.max(e,0),delim:r};e-=f}}catch(t){o={error:t}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(o)throw o.error}}return{node:null,n:0,delim:r}},e.prototype.mathItem=function(t,e,r){var n=t.math,o=this.findPosition(t.n,t.start.n,t.open,r),i=this.findPosition(t.n,t.end.n,t.close,r);return new this.options.MathItem(n,e,t.display,o,i)},e.prototype.findMath=function(t){var e,r,n,o,i,l,u,p,h;if(!this.processed.isSet("findMath")){this.adaptor.document=this.document,t=(0,c.userOptions)({elements:this.options.elements||[this.adaptor.body(this.document)]},t);try{for(var d=s(this.adaptor.getElements(t.elements,this.document)),f=d.next();!f.done;f=d.next()){var m=f.value,y=a([null,null],2),g=y[0],b=y[1];try{for(var v=(n=void 0,s(this.inputJax)),_=v.next();!_.done;_=v.next()){var S=_.value,x=new this.options.MathList;if(S.processStrings){null===g&&(g=(i=a(this.domStrings.find(m),2))[0],b=i[1]);try{for(var M=(l=void 0,s(S.findMath(g))),O=M.next();!O.done;O=M.next()){var E=O.value;x.push(this.mathItem(E,S,b))}}catch(t){l={error:t}}finally{try{O&&!O.done&&(u=M.return)&&u.call(M)}finally{if(l)throw l.error}}}else try{for(var A=(p=void 0,s(S.findMath(m))),C=A.next();!C.done;C=A.next()){E=C.value;var w=new this.options.MathItem(E.math,S,E.display,E.start,E.end);x.push(w)}}catch(t){p={error:t}}finally{try{C&&!C.done&&(h=A.return)&&h.call(A)}finally{if(p)throw p.error}}this.math.merge(x)}}catch(t){n={error:t}}finally{try{_&&!_.done&&(o=v.return)&&o.call(v)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(e)throw e.error}}this.processed.set("findMath")}return this},e.prototype.updateDocument=function(){return this.processed.isSet("updateDocument")||(this.addPageElements(),this.addStyleSheet(),t.prototype.updateDocument.call(this),this.processed.set("updateDocument")),this},e.prototype.addPageElements=function(){var t=this.adaptor.body(this.document),e=this.documentPageElements();e&&this.adaptor.append(t,e)},e.prototype.addStyleSheet=function(){var t=this.documentStyleSheet(),e=this.adaptor;if(t&&!e.parent(t)){var r=e.head(this.document),n=this.findSheet(r,e.getAttribute(t,"id"));n?e.replace(t,n):e.append(r,t)}},e.prototype.findSheet=function(t,e){var r,n;if(e)try{for(var o=s(this.adaptor.tags(t,"style")),i=o.next();!i.done;i=o.next()){var a=i.value;if(this.adaptor.getAttribute(a,"id")===e)return a}}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return null},e.prototype.removeFromDocument=function(t){var e,r;if(void 0===t&&(t=!1),this.processed.isSet("updateDocument"))try{for(var n=s(this.math),o=n.next();!o.done;o=n.next()){var i=o.value;i.state()>=d.STATE.INSERTED&&i.state(d.STATE.TYPESET,t)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return this.processed.clear("updateDocument"),this},e.prototype.documentStyleSheet=function(){return this.outputJax.styleSheet(this)},e.prototype.documentPageElements=function(){return this.outputJax.pageElements(this)},e.prototype.addStyles=function(t){this.styles.push(t)},e.prototype.getStyles=function(){return this.styles},e.KIND="HTML",e.OPTIONS=i(i({},l.AbstractMathDocument.OPTIONS),{renderActions:(0,c.expandable)(i(i({},l.AbstractMathDocument.OPTIONS.renderActions),{styles:[d.STATE.INSERTED+1,"","updateStyleSheet",!1]})),MathList:p.HTMLMathList,MathItem:u.HTMLMathItem,DomStrings:null}),e}(l.AbstractMathDocument);e.HTMLDocument=f},5138:function(t,e,r){var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.HTMLDomStrings=void 0;var o=r(7233),i=function(){function t(t){void 0===t&&(t=null);var e=this.constructor;this.options=(0,o.userOptions)((0,o.defaultOptions)({},e.OPTIONS),t),this.init(),this.getPatterns()}return t.prototype.init=function(){this.strings=[],this.string="",this.snodes=[],this.nodes=[],this.stack=[]},t.prototype.getPatterns=function(){var t=(0,o.makeArray)(this.options.skipHtmlTags),e=(0,o.makeArray)(this.options.ignoreHtmlClass),r=(0,o.makeArray)(this.options.processHtmlClass);this.skipHtmlTags=new RegExp("^(?:"+t.join("|")+")$","i"),this.ignoreHtmlClass=new RegExp("(?:^| )(?:"+e.join("|")+")(?: |$)"),this.processHtmlClass=new RegExp("(?:^| )(?:"+r+")(?: |$)")},t.prototype.pushString=function(){this.string.match(/\S/)&&(this.strings.push(this.string),this.nodes.push(this.snodes)),this.string="",this.snodes=[]},t.prototype.extendString=function(t,e){this.snodes.push([t,e.length]),this.string+=e},t.prototype.handleText=function(t,e){return e||this.extendString(t,this.adaptor.value(t)),this.adaptor.next(t)},t.prototype.handleTag=function(t,e){if(!e){var r=this.options.includeHtmlTags[this.adaptor.kind(t)];this.extendString(t,r)}return this.adaptor.next(t)},t.prototype.handleContainer=function(t,e){this.pushString();var r=this.adaptor.getAttribute(t,"class")||"",n=this.adaptor.kind(t)||"",o=this.processHtmlClass.exec(r),i=t;return!this.adaptor.firstChild(t)||this.adaptor.getAttribute(t,"data-MJX")||!o&&this.skipHtmlTags.exec(n)?i=this.adaptor.next(t):(this.adaptor.next(t)&&this.stack.push([this.adaptor.next(t),e]),i=this.adaptor.firstChild(t),e=(e||this.ignoreHtmlClass.exec(r))&&!o),[i,e]},t.prototype.handleOther=function(t,e){return this.pushString(),this.adaptor.next(t)},t.prototype.find=function(t){var e,r;this.init();for(var o=this.adaptor.next(t),i=!1,a=this.options.includeHtmlTags;t&&t!==o;){var s=this.adaptor.kind(t);"#text"===s?t=this.handleText(t,i):a.hasOwnProperty(s)?t=this.handleTag(t,i):s?(t=(e=n(this.handleContainer(t,i),2))[0],i=e[1]):t=this.handleOther(t,i),!t&&this.stack.length&&(this.pushString(),t=(r=n(this.stack.pop(),2))[0],i=r[1])}this.pushString();var l=[this.strings,this.nodes];return this.init(),l},t.OPTIONS={skipHtmlTags:["script","noscript","style","textarea","pre","code","annotation","annotation-xml"],includeHtmlTags:{br:"\n",wbr:"","#comment":""},ignoreHtmlClass:"mathjax_ignore",processHtmlClass:"mathjax_process"},t}();e.HTMLDomStrings=i},3726:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.HTMLHandler=void 0;var i=r(3670),a=r(3683),s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.documentClass=a.HTMLDocument,e}return o(e,t),e.prototype.handlesDocument=function(t){var e=this.adaptor;if("string"==typeof t)try{t=e.parse(t,"text/html")}catch(t){}return t instanceof e.window.Document||t instanceof e.window.HTMLElement||t instanceof e.window.DocumentFragment},e.prototype.create=function(e,r){var n=this.adaptor;if("string"==typeof e)e=n.parse(e,"text/html");else if(e instanceof n.window.HTMLElement||e instanceof n.window.DocumentFragment){var o=e;e=n.parse("","text/html"),n.append(n.body(e),o)}return t.prototype.create.call(this,e,r)},e}(i.AbstractHandler);e.HTMLHandler=s},3363:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.HTMLMathItem=void 0;var i=r(4474),a=function(t){function e(e,r,n,o,i){return void 0===n&&(n=!0),void 0===o&&(o={node:null,n:0,delim:""}),void 0===i&&(i={node:null,n:0,delim:""}),t.call(this,e,r,n,o,i)||this}return o(e,t),Object.defineProperty(e.prototype,"adaptor",{get:function(){return this.inputJax.adaptor},enumerable:!1,configurable:!0}),e.prototype.updateDocument=function(t){if(this.state()<i.STATE.INSERTED){if(this.inputJax.processStrings){var e=this.start.node;if(e===this.end.node)this.end.n&&this.end.n<this.adaptor.value(this.end.node).length&&this.adaptor.split(this.end.node,this.end.n),this.start.n&&(e=this.adaptor.split(this.start.node,this.start.n)),this.adaptor.replace(this.typesetRoot,e);else{for(this.start.n&&(e=this.adaptor.split(e,this.start.n));e!==this.end.node;){var r=this.adaptor.next(e);this.adaptor.remove(e),e=r}this.adaptor.insert(this.typesetRoot,e),this.end.n<this.adaptor.value(e).length&&this.adaptor.split(e,this.end.n),this.adaptor.remove(e)}}else this.adaptor.replace(this.typesetRoot,this.start.node);this.start.node=this.end.node=this.typesetRoot,this.start.n=this.end.n=0,this.state(i.STATE.INSERTED)}},e.prototype.updateStyleSheet=function(t){t.addStyleSheet()},e.prototype.removeFromDocument=function(t){if(void 0===t&&(t=!1),this.state()>=i.STATE.TYPESET){var e=this.adaptor,r=this.start.node,n=e.text("");if(t){var o=this.start.delim+this.math+this.end.delim;if(this.inputJax.processStrings)n=e.text(o);else{var a=e.parse(o,"text/html");n=e.firstChild(e.body(a))}}e.parent(r)&&e.replace(n,r),this.start.node=this.end.node=n,this.start.n=this.end.n=0}},e}(i.AbstractMathItem);e.HTMLMathItem=a},3335:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.HTMLMathList=void 0;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e}(r(9e3).AbstractMathList);e.HTMLMathList=i},8462:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.TeX=void 0;var l=r(9206),c=r(7233),u=r(7073),p=s(r(4676)),h=s(r(1256)),d=s(r(8417)),f=s(r(3971)),m=s(r(8562)),y=r(6521),g=r(9899);r(2942);var b=function(t){function e(r){void 0===r&&(r={});var n=this,o=a((0,c.separateOptions)(r,e.OPTIONS,u.FindTeX.OPTIONS),3),i=o[0],s=o[1],l=o[2];(n=t.call(this,s)||this).findTeX=n.options.FindTeX||new u.FindTeX(l);var h=n.options.packages,d=n.configuration=e.configure(h),f=n._parseOptions=new m.default(d,[n.options,y.TagsFactory.OPTIONS]);return(0,c.userOptions)(f.options,i),d.config(n),e.tags(f,d),n.postFilters.add(p.default.cleanSubSup,-6),n.postFilters.add(p.default.setInherited,-5),n.postFilters.add(p.default.moveLimits,-4),n.postFilters.add(p.default.cleanStretchy,-3),n.postFilters.add(p.default.cleanAttributes,-2),n.postFilters.add(p.default.combineRelations,-1),n}return o(e,t),e.configure=function(t){var e=new g.ParserConfiguration(t,["tex"]);return e.init(),e},e.tags=function(t,e){y.TagsFactory.addTags(e.tags),y.TagsFactory.setDefault(t.options.tags),t.tags=y.TagsFactory.getDefault(),t.tags.configuration=t},e.prototype.setMmlFactory=function(e){t.prototype.setMmlFactory.call(this,e),this._parseOptions.nodeFactory.setMmlFactory(e)},Object.defineProperty(e.prototype,"parseOptions",{get:function(){return this._parseOptions},enumerable:!1,configurable:!0}),e.prototype.reset=function(t){void 0===t&&(t=0),this.parseOptions.tags.reset(t)},e.prototype.compile=function(t,e){this.parseOptions.clear(),this.executeFilters(this.preFilters,t,e,this.parseOptions);var r,n,o=t.display;this.latex=t.math,this.parseOptions.tags.startEquation(t);try{var i=new d.default(this.latex,{display:o,isInner:!1},this.parseOptions);r=i.mml(),n=i.stack.global}catch(t){if(!(t instanceof f.default))throw t;this.parseOptions.error=!0,r=this.options.formatError(this,t)}return r=this.parseOptions.nodeFactory.create("node","math",[r]),(null==n?void 0:n.indentalign)&&h.default.setAttribute(r,"indentalign",n.indentalign),o&&h.default.setAttribute(r,"display","block"),this.parseOptions.tags.finishEquation(t),this.parseOptions.root=r,this.executeFilters(this.postFilters,t,e,this.parseOptions),this.mathNode=this.parseOptions.root,this.mathNode},e.prototype.findMath=function(t){return this.findTeX.findMath(t)},e.prototype.formatError=function(t){var e=t.message.replace(/\n.*/,"");return this.parseOptions.nodeFactory.create("error",e,t.id,this.latex)},e.NAME="TeX",e.OPTIONS=i(i({},l.AbstractInputJax.OPTIONS),{FindTeX:null,packages:["base"],digits:/^(?:[0-9]+(?:\{,\}[0-9]{3})*(?:\.[0-9]*)?|\.[0-9]+)/,maxBuffer:5120,formatError:function(t,e){return t.formatError(e)}}),e}(l.AbstractInputJax);e.TeX=b},210:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.AllPackages=void 0,r(2942),r(8174),r(8021),r(583),r(1186),r(8603),r(6538),r(9499),r(8963),r(3752),r(8227),r(5860),r(6628),r(6648),r(8458),r(5464),r(1428),r(6121),r(3078),r(8901),r(7535),r(6944),r(1496),r(4234),r(4898),r(3168),r(9365),r(1527),r(2307),r(2675),r(1442),r(6841),r(1247),"undefined"!=typeof MathJax&&MathJax.loader&&MathJax.loader.preLoad("[tex]/action","[tex]/ams","[tex]/amscd","[tex]/bbox","[tex]/boldsymbol","[tex]/braket","[tex]/bussproofs","[tex]/cancel","[tex]/cases","[tex]/centernot","[tex]/color","[tex]/colorv2","[tex]/colortbl","[tex]/empheq","[tex]/enclose","[tex]/extpfeil","[tex]/gensymb","[tex]/html","[tex]/mathtools","[tex]/mhchem","[tex]/newcommand","[tex]/noerrors","[tex]/noundefined","[tex]/physics","[tex]/upgreek","[tex]/unicode","[tex]/verb","[tex]/configmacros","[tex]/tagformat","[tex]/textcomp","[tex]/textmacros","[tex]/setoptions"),e.AllPackages=["base","action","ams","amscd","bbox","boldsymbol","braket","bussproofs","cancel","cases","centernot","color","colortbl","empheq","enclose","extpfeil","gensymb","html","mathtools","mhchem","newcommand","noerrors","noundefined","upgreek","unicode","verb","configmacros","tagformat","textcomp","textmacros"]},9899:function(t,e,r){var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.ParserConfiguration=e.ConfigurationHandler=e.Configuration=void 0;var i,a=r(7233),s=r(2947),l=r(7525),c=r(8666),u=r(6521),p=function(){function t(t,e,r,n,o,i,a,s,l,c,u,p,h){void 0===e&&(e={}),void 0===r&&(r={}),void 0===n&&(n={}),void 0===o&&(o={}),void 0===i&&(i={}),void 0===a&&(a={}),void 0===s&&(s=[]),void 0===l&&(l=[]),void 0===c&&(c=null),void 0===u&&(u=null),this.name=t,this.handler=e,this.fallback=r,this.items=n,this.tags=o,this.options=i,this.nodes=a,this.preprocessors=s,this.postprocessors=l,this.initMethod=c,this.configMethod=u,this.priority=p,this.parser=h,this.handler=Object.assign({character:[],delimiter:[],macro:[],environment:[]},e)}return t.makeProcessor=function(t,e){return Array.isArray(t)?t:[t,e]},t._create=function(e,r){var n=this;void 0===r&&(r={});var o=r.priority||c.PrioritizedList.DEFAULTPRIORITY,i=r.init?this.makeProcessor(r.init,o):null,a=r.config?this.makeProcessor(r.config,o):null,s=(r.preprocessors||[]).map((function(t){return n.makeProcessor(t,o)})),l=(r.postprocessors||[]).map((function(t){return n.makeProcessor(t,o)})),u=r.parser||"tex";return new t(e,r.handler||{},r.fallback||{},r.items||{},r.tags||{},r.options||{},r.nodes||{},s,l,i,a,o,u)},t.create=function(e,r){void 0===r&&(r={});var n=t._create(e,r);return i.set(e,n),n},t.local=function(e){return void 0===e&&(e={}),t._create("",e)},Object.defineProperty(t.prototype,"init",{get:function(){return this.initMethod?this.initMethod[0]:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"config",{get:function(){return this.configMethod?this.configMethod[0]:null},enumerable:!1,configurable:!0}),t}();e.Configuration=p,function(t){var e=new Map;t.set=function(t,r){e.set(t,r)},t.get=function(t){return e.get(t)},t.keys=function(){return e.keys()}}(i=e.ConfigurationHandler||(e.ConfigurationHandler={}));var h=function(){function t(t,e){var r,o,i,a;void 0===e&&(e=["tex"]),this.initMethod=new l.FunctionList,this.configMethod=new l.FunctionList,this.configurations=new c.PrioritizedList,this.parsers=[],this.handlers=new s.SubHandlers,this.items={},this.tags={},this.options={},this.nodes={},this.parsers=e;try{for(var u=n(t.slice().reverse()),p=u.next();!p.done;p=u.next()){var h=p.value;this.addPackage(h)}}catch(t){r={error:t}}finally{try{p&&!p.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}try{for(var d=n(this.configurations),f=d.next();!f.done;f=d.next()){var m=f.value,y=m.item,g=m.priority;this.append(y,g)}}catch(t){i={error:t}}finally{try{f&&!f.done&&(a=d.return)&&a.call(d)}finally{if(i)throw i.error}}}return t.prototype.init=function(){this.initMethod.execute(this)},t.prototype.config=function(t){var e,r;this.configMethod.execute(this,t);try{for(var o=n(this.configurations),i=o.next();!i.done;i=o.next()){var a=i.value;this.addFilters(t,a.item)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}},t.prototype.addPackage=function(t){var e="string"==typeof t?t:t[0],r=this.getPackage(e);r&&this.configurations.add(r,"string"==typeof t?r.priority:t[1])},t.prototype.add=function(t,e,r){var o,i;void 0===r&&(r={});var s=this.getPackage(t);this.append(s),this.configurations.add(s,s.priority),this.init();var l=e.parseOptions;l.nodeFactory.setCreators(s.nodes);try{for(var c=n(Object.keys(s.items)),p=c.next();!p.done;p=c.next()){var h=p.value;l.itemFactory.setNodeClass(h,s.items[h])}}catch(t){o={error:t}}finally{try{p&&!p.done&&(i=c.return)&&i.call(c)}finally{if(o)throw o.error}}u.TagsFactory.addTags(s.tags),(0,a.defaultOptions)(l.options,s.options),(0,a.userOptions)(l.options,r),this.addFilters(e,s),s.config&&s.config(this,e)},t.prototype.getPackage=function(t){var e=i.get(t);if(e&&this.parsers.indexOf(e.parser)<0)throw Error("Package ".concat(t," doesn't target the proper parser"));return e},t.prototype.append=function(t,e){e=e||t.priority,t.initMethod&&this.initMethod.add(t.initMethod[0],t.initMethod[1]),t.configMethod&&this.configMethod.add(t.configMethod[0],t.configMethod[1]),this.handlers.add(t.handler,t.fallback,e),Object.assign(this.items,t.items),Object.assign(this.tags,t.tags),(0,a.defaultOptions)(this.options,t.options),Object.assign(this.nodes,t.nodes)},t.prototype.addFilters=function(t,e){var r,i,a,s;try{for(var l=n(e.preprocessors),c=l.next();!c.done;c=l.next()){var u=o(c.value,2),p=u[0],h=u[1];t.preFilters.add(p,h)}}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}try{for(var d=n(e.postprocessors),f=d.next();!f.done;f=d.next()){var m=o(f.value,2),y=m[0];h=m[1];t.postFilters.add(y,h)}}catch(t){a={error:t}}finally{try{f&&!f.done&&(s=d.return)&&s.call(d)}finally{if(a)throw a.error}}},t}();e.ParserConfiguration=h},4676:function(t,e,r){var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i,a=r(9007),s=o(r(1256));!function(t){t.cleanStretchy=function(t){var e,r,o=t.data;try{for(var i=n(o.getList("fixStretchy")),a=i.next();!a.done;a=i.next()){var l=a.value;if(s.default.getProperty(l,"fixStretchy")){var c=s.default.getForm(l);c&&c[3]&&c[3].stretchy&&s.default.setAttribute(l,"stretchy",!1);var u=l.parent;if(!(s.default.getTexClass(l)||c&&c[2])){var p=o.nodeFactory.create("node","TeXAtom",[l]);u.replaceChild(p,l),p.inheritAttributesFrom(l)}s.default.removeProperties(l,"fixStretchy")}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},t.cleanAttributes=function(t){t.data.root.walkTree((function(t,e){var r,o,i=t.attributes;if(i){var a=new Set((i.get("mjx-keep-attrs")||"").split(/ /));delete i.getAllAttributes()["mjx-keep-attrs"];try{for(var s=n(i.getExplicitNames()),l=s.next();!l.done;l=s.next()){var c=l.value;a.has(c)||i.attributes[c]!==t.attributes.getInherited(c)||delete i.attributes[c]}}catch(t){r={error:t}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}}),{})},t.combineRelations=function(t){var o,i,l,c,u=[];try{for(var p=n(t.data.getList("mo")),h=p.next();!h.done;h=p.next()){var d=h.value;if(!d.getProperty("relationsCombined")&&d.parent&&(!d.parent||s.default.isType(d.parent,"mrow"))&&s.default.getTexClass(d)===a.TEXCLASS.REL){for(var f=d.parent,m=void 0,y=f.childNodes,g=y.indexOf(d)+1,b=s.default.getProperty(d,"variantForm");g<y.length&&(m=y[g])&&s.default.isType(m,"mo")&&s.default.getTexClass(m)===a.TEXCLASS.REL;){if(b!==s.default.getProperty(m,"variantForm")||!r(d,m)){null==d.attributes.getExplicit("rspace")&&s.default.setAttribute(d,"rspace","0pt"),null==m.attributes.getExplicit("lspace")&&s.default.setAttribute(m,"lspace","0pt");break}s.default.appendChildren(d,s.default.getChildren(m)),e(["stretchy","rspace"],d,m);try{for(var v=(l=void 0,n(m.getPropertyNames())),_=v.next();!_.done;_=v.next()){var S=_.value;d.setProperty(S,m.getProperty(S))}}catch(t){l={error:t}}finally{try{_&&!_.done&&(c=v.return)&&c.call(v)}finally{if(l)throw l.error}}y.splice(g,1),u.push(m),m.parent=null,m.setProperty("relationsCombined",!0)}d.attributes.setInherited("form",d.getForms()[0])}}}catch(t){o={error:t}}finally{try{h&&!h.done&&(i=p.return)&&i.call(p)}finally{if(o)throw o.error}}t.data.removeFromList("mo",u)};var e=function(t,e,r){var n=e.attributes,o=r.attributes;t.forEach((function(t){var e=o.getExplicit(t);null!=e&&n.set(t,e)}))},r=function(t,e){var r,o,i=function(t,e){return t.getExplicitNames().filter((function(r){return r!==e&&("stretchy"!==r||t.getExplicit("stretchy"))}))},a=t.attributes,s=e.attributes,l=i(a,"lspace"),c=i(s,"rspace");if(l.length!==c.length)return!1;try{for(var u=n(l),p=u.next();!p.done;p=u.next()){var h=p.value;if(a.getExplicit(h)!==s.getExplicit(h))return!1}}catch(t){r={error:t}}finally{try{p&&!p.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}return!0},o=function(t,e,r){var o,i,a=[];try{for(var l=n(t.getList("m"+e+r)),c=l.next();!c.done;c=l.next()){var u=c.value,p=u.childNodes;if(!p[u[e]]||!p[u[r]]){var h=u.parent,d=p[u[e]]?t.nodeFactory.create("node","m"+e,[p[u.base],p[u[e]]]):t.nodeFactory.create("node","m"+r,[p[u.base],p[u[r]]]);s.default.copyAttributes(u,d),h?h.replaceChild(d,u):t.root=d,a.push(u)}}}catch(t){o={error:t}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}t.removeFromList("m"+e+r,a)};t.cleanSubSup=function(t){var e=t.data;e.error||(o(e,"sub","sup"),o(e,"under","over"))};var i=function(t,e,r){var o,i,a=[];try{for(var l=n(t.getList(e)),c=l.next();!c.done;c=l.next()){var u=c.value;if(!u.attributes.get("displaystyle")){var p=u.childNodes[u.base],h=p.coreMO();if(p.getProperty("movablelimits")&&!h.attributes.getExplicit("movablelimits")){var d=t.nodeFactory.create("node",r,u.childNodes);s.default.copyAttributes(u,d),u.parent?u.parent.replaceChild(d,u):t.root=d,a.push(u)}}}}catch(t){o={error:t}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}t.removeFromList(e,a)};t.moveLimits=function(t){var e=t.data;i(e,"munderover","msubsup"),i(e,"munder","msub"),i(e,"mover","msup")},t.setInherited=function(t){t.data.root.setInheritedAttributes({},t.math.display,0,!1)}}(i||(i={})),e.default=i},7073:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.FindTeX=void 0;var a=r(3494),s=r(505),l=r(4474),c=function(t){function e(e){var r=t.call(this,e)||this;return r.getPatterns(),r}return o(e,t),e.prototype.getPatterns=function(){var t=this,e=this.options,r=[],n=[],o=[];this.end={},this.env=this.sub=0;var i=1;e.inlineMath.forEach((function(e){return t.addPattern(r,e,!1)})),e.displayMath.forEach((function(e){return t.addPattern(r,e,!0)})),r.length&&n.push(r.sort(s.sortLength).join("|")),e.processEnvironments&&(n.push("\\\\begin\\s*\\{([^}]*)\\}"),this.env=i,i++),e.processEscapes&&o.push("\\\\([\\\\$])"),e.processRefs&&o.push("(\\\\(?:eq)?ref\\s*\\{[^}]*\\})"),o.length&&(n.push("("+o.join("|")+")"),this.sub=i),this.start=new RegExp(n.join("|"),"g"),this.hasPatterns=n.length>0},e.prototype.addPattern=function(t,e,r){var n=i(e,2),o=n[0],a=n[1];t.push((0,s.quotePattern)(o)),this.end[o]=[a,r,this.endPattern(a)]},e.prototype.endPattern=function(t,e){return new RegExp((e||(0,s.quotePattern)(t))+"|\\\\(?:[a-zA-Z]|.)|[{}]","g")},e.prototype.findEnd=function(t,e,r,n){for(var o,a=i(n,3),s=a[0],c=a[1],u=a[2],p=u.lastIndex=r.index+r[0].length,h=0;o=u.exec(t);){if((o[1]||o[0])===s&&0===h)return(0,l.protoItem)(r[0],t.substr(p,o.index-p),o[0],e,r.index,o.index+o[0].length,c);"{"===o[0]?h++:"}"===o[0]&&h&&h--}return null},e.prototype.findMathInString=function(t,e,r){var n,o;for(this.start.lastIndex=0;n=this.start.exec(r);){if(void 0!==n[this.env]&&this.env){var i="\\\\end\\s*(\\{"+(0,s.quotePattern)(n[this.env])+"\\})";(o=this.findEnd(r,e,n,["{"+n[this.env]+"}",!0,this.endPattern(null,i)]))&&(o.math=o.open+o.math+o.close,o.open=o.close="")}else if(void 0!==n[this.sub]&&this.sub){var a=n[this.sub];i=n.index+n[this.sub].length;o=2===a.length?(0,l.protoItem)("",a.substr(1),"",e,n.index,i):(0,l.protoItem)("",a,"",e,n.index,i,!1)}else o=this.findEnd(r,e,n,this.end[n[0]]);o&&(t.push(o),this.start.lastIndex=o.end.n)}},e.prototype.findMath=function(t){var e=[];if(this.hasPatterns)for(var r=0,n=t.length;r<n;r++)this.findMathInString(e,r,t[r]);return e},e.OPTIONS={inlineMath:[["\\(","\\)"]],displayMath:[["$$","$$"],["\\[","\\]"]],processEscapes:!0,processEnvironments:!0,processRefs:!0},e}(a.AbstractFindMath);e.FindTeX=c},2947:function(t,e,r){var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.SubHandlers=e.SubHandler=e.MapHandler=void 0;var i,a=r(8666),s=r(7525);!function(t){var e=new Map;t.register=function(t){e.set(t.name,t)},t.getMap=function(t){return e.get(t)}}(i=e.MapHandler||(e.MapHandler={}));var l=function(){function t(){this._configuration=new a.PrioritizedList,this._fallback=new s.FunctionList}return t.prototype.add=function(t,e,r){var o,s;void 0===r&&(r=a.PrioritizedList.DEFAULTPRIORITY);try{for(var l=n(t.slice().reverse()),c=l.next();!c.done;c=l.next()){var u=c.value,p=i.getMap(u);if(!p)return void this.warn("Configuration "+u+" not found! Omitted.");this._configuration.add(p,r)}}catch(t){o={error:t}}finally{try{c&&!c.done&&(s=l.return)&&s.call(l)}finally{if(o)throw o.error}}e&&this._fallback.add(e,r)},t.prototype.parse=function(t){var e,r;try{for(var i=n(this._configuration),a=i.next();!a.done;a=i.next()){var s=a.value.item.parse(t);if(s)return s}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}var l=o(t,2),c=l[0],u=l[1];Array.from(this._fallback)[0].item(c,u)},t.prototype.lookup=function(t){var e=this.applicable(t);return e?e.lookup(t):null},t.prototype.contains=function(t){return!!this.applicable(t)},t.prototype.toString=function(){var t,e,r=[];try{for(var o=n(this._configuration),i=o.next();!i.done;i=o.next()){var a=i.value.item;r.push(a.name)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return r.join(", ")},t.prototype.applicable=function(t){var e,r;try{for(var o=n(this._configuration),i=o.next();!i.done;i=o.next()){var a=i.value.item;if(a.contains(t))return a}}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return null},t.prototype.retrieve=function(t){var e,r;try{for(var o=n(this._configuration),i=o.next();!i.done;i=o.next()){var a=i.value.item;if(a.name===t)return a}}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return null},t.prototype.warn=function(t){console.log("TexParser Warning: "+t)},t}();e.SubHandler=l;var c=function(){function t(){this.map=new Map}return t.prototype.add=function(t,e,r){var o,i;void 0===r&&(r=a.PrioritizedList.DEFAULTPRIORITY);try{for(var s=n(Object.keys(t)),c=s.next();!c.done;c=s.next()){var u=c.value,p=this.get(u);p||(p=new l,this.set(u,p)),p.add(t[u],e[u],r)}}catch(t){o={error:t}}finally{try{c&&!c.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}},t.prototype.set=function(t,e){this.map.set(t,e)},t.prototype.get=function(t){return this.map.get(t)},t.prototype.retrieve=function(t){var e,r;try{for(var o=n(this.map.values()),i=o.next();!i.done;i=o.next()){var a=i.value.retrieve(t);if(a)return a}}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return null},t.prototype.keys=function(){return this.map.keys()},t}();e.SubHandlers=c},8929:function(t,e,r){var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.NodeFactory=void 0;var a=i(r(1256)),s=function(){function t(){this.mmlFactory=null,this.factory={node:t.createNode,token:t.createToken,text:t.createText,error:t.createError}}return t.createNode=function(t,e,r,n,o){void 0===r&&(r=[]),void 0===n&&(n={});var i=t.mmlFactory.create(e);return i.setChildren(r),o&&i.appendChild(o),a.default.setProperties(i,n),i},t.createToken=function(t,e,r,n){void 0===r&&(r={}),void 0===n&&(n="");var o=t.create("text",n);return t.create("node",e,[],r,o)},t.createText=function(t,e){return null==e?null:t.mmlFactory.create("text").setText(e)},t.createError=function(t,e){var r=t.create("text",e),n=t.create("node","mtext",[],{},r);return t.create("node","merror",[n],{"data-mjx-error":e})},t.prototype.setMmlFactory=function(t){this.mmlFactory=t},t.prototype.set=function(t,e){this.factory[t]=e},t.prototype.setCreators=function(t){for(var e in t)this.set(e,t[e])},t.prototype.create=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var i=this.factory[t]||this.factory.node,a=i.apply(void 0,o([this,e[0]],n(e.slice(1)),!1));return"node"===t&&this.configuration.addNode(e[0],a),a},t.prototype.get=function(t){return this.factory[t]},t}();e.NodeFactory=s},1256:function(t,e,r){var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0});var a,s=r(9007),l=r(2756);!function(t){var e=new Map([["autoOP",!0],["fnOP",!0],["movesupsub",!0],["subsupOK",!0],["texprimestyle",!0],["useHeight",!0],["variantForm",!0],["withDelims",!0],["mathaccent",!0],["open",!0],["close",!0]]);function r(t,r){var o,i;try{for(var a=n(Object.keys(r)),s=a.next();!s.done;s=a.next()){var l=s.value,c=r[l];"texClass"===l?(t.texClass=c,t.setProperty(l,c)):"movablelimits"===l?(t.setProperty("movablelimits",c),(t.isKind("mo")||t.isKind("mstyle"))&&t.attributes.set("movablelimits",c)):"inferred"===l||(e.has(l)?t.setProperty(l,c):t.attributes.set(l,c))}}catch(t){o={error:t}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(o)throw o.error}}}function a(t,e,r){t.childNodes[e]=r,r&&(r.parent=t)}function c(t,e){return t.isKind(e)}t.createEntity=function(t){return String.fromCodePoint(parseInt(t,16))},t.getChildren=function(t){return t.childNodes},t.getText=function(t){return t.getText()},t.appendChildren=function(t,e){var r,o;try{for(var i=n(e),a=i.next();!a.done;a=i.next()){var s=a.value;t.appendChild(s)}}catch(t){r={error:t}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}},t.setAttribute=function(t,e,r){t.attributes.set(e,r)},t.setProperty=function(t,e,r){t.setProperty(e,r)},t.setProperties=r,t.getProperty=function(t,e){return t.getProperty(e)},t.getAttribute=function(t,e){return t.attributes.get(e)},t.removeProperties=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];t.removeProperty.apply(t,i([],o(e),!1))},t.getChildAt=function(t,e){return t.childNodes[e]},t.setChild=a,t.copyChildren=function(t,e){for(var r=t.childNodes,n=0;n<r.length;n++)a(e,n,r[n])},t.copyAttributes=function(t,e){e.attributes=t.attributes,r(e,t.getAllProperties())},t.isType=c,t.isEmbellished=function(t){return t.isEmbellished},t.getTexClass=function(t){return t.texClass},t.getCoreMO=function(t){return t.coreMO()},t.isNode=function(t){return t instanceof s.AbstractMmlNode||t instanceof s.AbstractMmlEmptyNode},t.isInferred=function(t){return t.isInferred},t.getForm=function(t){var e,r;if(!c(t,"mo"))return null;var o=t,i=o.getForms();try{for(var a=n(i),s=a.next();!s.done;s=a.next()){var u=s.value,p=l.MmlMo.OPTABLE[u][o.getText()];if(p)return p}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}return null}}(a||(a={})),e.default=a},5450:function(t,e,r){var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a,s=i(r(1256)),l=r(8317),c=i(r(1130));!function(t){t.variable=function(t,e){var r=c.default.getFontDef(t),n=t.stack.env;n.multiLetterIdentifiers&&""!==n.font&&(e=t.string.substr(t.i-1).match(n.multiLetterIdentifiers)[0],t.i+=e.length-1,r.mathvariant===l.TexConstant.Variant.NORMAL&&n.noAutoOP&&e.length>1&&(r.autoOP=!1));var o=t.create("token","mi",r,e);t.Push(o)},t.digit=function(t,e){var r,n=t.configuration.options.digits,o=t.string.slice(t.i-1).match(n),i=c.default.getFontDef(t);o?(r=t.create("token","mn",i,o[0].replace(/[{}]/g,"")),t.i+=o[0].length-1):r=t.create("token","mo",i,e),t.Push(r)},t.controlSequence=function(t,e){var r=t.GetCS();t.parse("macro",[t,r])},t.mathchar0mi=function(t,e){var r=e.attributes||{mathvariant:l.TexConstant.Variant.ITALIC},n=t.create("token","mi",r,e.char);t.Push(n)},t.mathchar0mo=function(t,e){var r=e.attributes||{};r.stretchy=!1;var n=t.create("token","mo",r,e.char);s.default.setProperty(n,"fixStretchy",!0),t.configuration.addNode("fixStretchy",n),t.Push(n)},t.mathchar7=function(t,e){var r=e.attributes||{mathvariant:l.TexConstant.Variant.NORMAL};t.stack.env.font&&(r.mathvariant=t.stack.env.font);var n=t.create("token","mi",r,e.char);t.Push(n)},t.delimiter=function(t,e){var r=e.attributes||{};r=Object.assign({fence:!1,stretchy:!1},r);var n=t.create("token","mo",r,e.char);t.Push(n)},t.environment=function(t,e,r,i){var a=i[0],s=t.itemFactory.create("begin").setProperties({name:e,end:a});s=r.apply(void 0,o([t,s],n(i.slice(1)),!1)),t.Push(s)}}(a||(a={})),e.default=a},8562:function(t,e,r){var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var s=a(r(5453)),l=r(8929),c=a(r(1256)),u=r(7233),p=function(){function t(t,e){void 0===e&&(e=[]),this.options={},this.packageData=new Map,this.parsers=[],this.root=null,this.nodeLists={},this.error=!1,this.handlers=t.handlers,this.nodeFactory=new l.NodeFactory,this.nodeFactory.configuration=this,this.nodeFactory.setCreators(t.nodes),this.itemFactory=new s.default(t.items),this.itemFactory.configuration=this,u.defaultOptions.apply(void 0,o([this.options],n(e),!1)),(0,u.defaultOptions)(this.options,t.options)}return t.prototype.pushParser=function(t){this.parsers.unshift(t)},t.prototype.popParser=function(){this.parsers.shift()},Object.defineProperty(t.prototype,"parser",{get:function(){return this.parsers[0]},enumerable:!1,configurable:!0}),t.prototype.clear=function(){this.parsers=[],this.root=null,this.nodeLists={},this.error=!1,this.tags.resetTag()},t.prototype.addNode=function(t,e){var r=this.nodeLists[t];if(r||(r=this.nodeLists[t]=[]),r.push(e),e.kind!==t){var n=c.default.getProperty(e,"in-lists")||"",o=(n?n.split(/,/):[]).concat(t).join(",");c.default.setProperty(e,"in-lists",o)}},t.prototype.getList=function(t){var e,r,n=this.nodeLists[t]||[],o=[];try{for(var a=i(n),s=a.next();!s.done;s=a.next()){var l=s.value;this.inTree(l)&&o.push(l)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}return this.nodeLists[t]=o,o},t.prototype.removeFromList=function(t,e){var r,n,o=this.nodeLists[t]||[];try{for(var a=i(e),s=a.next();!s.done;s=a.next()){var l=s.value,c=o.indexOf(l);c>=0&&o.splice(c,1)}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}},t.prototype.inTree=function(t){for(;t&&t!==this.root;)t=t.parent;return!!t},t}();e.default=p},1130:function(t,e,r){var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a,s=r(9007),l=i(r(1256)),c=i(r(8417)),u=i(r(3971)),p=r(5368);!function(t){var e=7.2,r={em:function(t){return t},ex:function(t){return.43*t},pt:function(t){return t/10},pc:function(t){return 1.2*t},px:function(t){return t*e/72},in:function(t){return t*e},cm:function(t){return t*e/2.54},mm:function(t){return t*e/25.4},mu:function(t){return t/18}},i="([-+]?([.,]\\d+|\\d+([.,]\\d*)?))",a="(pt|em|ex|mu|px|mm|cm|in|pc)",h=RegExp("^\\s*"+i+"\\s*"+a+"\\s*$"),d=RegExp("^\\s*"+i+"\\s*"+a+" ?");function f(t,e){void 0===e&&(e=!1);var o=t.match(e?d:h);return o?function(t){var e=n(t,3),o=e[0],i=e[1],a=e[2];if("mu"!==i)return[o,i,a];return[m(r[i](parseFloat(o||"1"))).slice(0,-2),"em",a]}([o[1].replace(/,/,"."),o[4],o[0].length]):[null,null,0]}function m(t){return Math.abs(t)<6e-4?"0em":t.toFixed(3).replace(/\.?0+$/,"")+"em"}function y(t,e,r){"{"!==e&&"}"!==e||(e="\\"+e);var n="{\\bigg"+r+" "+e+"}",o="{\\big"+r+" "+e+"}";return new c.default("\\mathchoice"+n+o+o+o,{},t).mml()}function g(t,e,r){e=e.replace(/^\s+/,p.entities.nbsp).replace(/\s+$/,p.entities.nbsp);var n=t.create("text",e);return t.create("node","mtext",[],r,n)}function b(t,e,r){if(r.match(/^[a-z]/i)&&e.match(/(^|[^\\])(\\\\)*\\[a-z]+$/i)&&(e+=" "),e.length+r.length>t.configuration.options.maxBuffer)throw new u.default("MaxBufferSize","MathJax internal buffer size exceeded; is there a recursive macro call?");return e+r}function v(t,e){for(;e>0;)t=t.trim().slice(1,-1),e--;return t.trim()}function _(t,e){for(var r=t.length,n=0,o="",i=0,a=0,s=!0,l=!1;i<r;){var c=t[i++];switch(c){case" ":break;case"{":s?a++:(l=!1,a>n&&(a=n)),n++;break;case"}":n&&n--,(s||l)&&(a--,l=!0),s=!1;break;default:if(!n&&-1!==e.indexOf(c))return[l?"true":v(o,a),c,t.slice(i)];s=!1,l=!1}o+=c}if(n)throw new u.default("ExtraOpenMissingClose","Extra open brace or missing close brace");return[l?"true":v(o,a),"",t.slice(i)]}t.matchDimen=f,t.dimen2em=function(t){var e=n(f(t),2),o=e[0],i=e[1],a=parseFloat(o||"1"),s=r[i];return s?s(a):0},t.Em=m,t.cols=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.map((function(t){return m(t)})).join(" ")},t.fenced=function(t,e,r,n,o,i){void 0===o&&(o=""),void 0===i&&(i="");var a,u=t.nodeFactory,p=u.create("node","mrow",[],{open:e,close:n,texClass:s.TEXCLASS.INNER});if(o)a=new c.default("\\"+o+"l"+e,t.parser.stack.env,t).mml();else{var h=u.create("text",e);a=u.create("node","mo",[],{fence:!0,stretchy:!0,symmetric:!0,texClass:s.TEXCLASS.OPEN},h)}if(l.default.appendChildren(p,[a,r]),o)a=new c.default("\\"+o+"r"+n,t.parser.stack.env,t).mml();else{var d=u.create("text",n);a=u.create("node","mo",[],{fence:!0,stretchy:!0,symmetric:!0,texClass:s.TEXCLASS.CLOSE},d)}return i&&a.attributes.set("mathcolor",i),l.default.appendChildren(p,[a]),p},t.fixedFence=function(t,e,r,n){var o=t.nodeFactory.create("node","mrow",[],{open:e,close:n,texClass:s.TEXCLASS.ORD});return e&&l.default.appendChildren(o,[y(t,e,"l")]),l.default.isType(r,"mrow")?l.default.appendChildren(o,l.default.getChildren(r)):l.default.appendChildren(o,[r]),n&&l.default.appendChildren(o,[y(t,n,"r")]),o},t.mathPalette=y,t.fixInitialMO=function(t,e){for(var r=0,n=e.length;r<n;r++){var o=e[r];if(o&&!l.default.isType(o,"mspace")&&(!l.default.isType(o,"TeXAtom")||l.default.getChildren(o)[0]&&l.default.getChildren(l.default.getChildren(o)[0]).length)){if(l.default.isEmbellished(o)||l.default.isType(o,"TeXAtom")&&l.default.getTexClass(o)===s.TEXCLASS.REL){var i=t.nodeFactory.create("node","mi");e.unshift(i)}break}}},t.internalMath=function(t,e,r,n){if(t.configuration.options.internalMath)return t.configuration.options.internalMath(t,e,r,n);var o,i,a=n||t.stack.env.font,s=a?{mathvariant:a}:{},l=[],p=0,h=0,d="",f=0;if(e.match(/\\?[${}\\]|\\\(|\\(eq)?ref\s*\{/)){for(;p<e.length;)if("$"===(o=e.charAt(p++)))"$"===d&&0===f?(i=t.create("node","TeXAtom",[new c.default(e.slice(h,p-1),{},t.configuration).mml()]),l.push(i),d="",h=p):""===d&&(h<p-1&&l.push(g(t,e.slice(h,p-1),s)),d="$",h=p);else if("{"===o&&""!==d)f++;else if("}"===o)if("}"===d&&0===f){var m=new c.default(e.slice(h,p),{},t.configuration).mml();i=t.create("node","TeXAtom",[m],s),l.push(i),d="",h=p}else""!==d&&f&&f--;else if("\\"===o)if(""===d&&e.substr(p).match(/^(eq)?ref\s*\{/)){var y=RegExp["$&"].length;h<p-1&&l.push(g(t,e.slice(h,p-1),s)),d="}",h=p-1,p+=y}else"("===(o=e.charAt(p++))&&""===d?(h<p-2&&l.push(g(t,e.slice(h,p-2),s)),d=")",h=p):")"===o&&")"===d&&0===f?(i=t.create("node","TeXAtom",[new c.default(e.slice(h,p-2),{},t.configuration).mml()]),l.push(i),d="",h=p):o.match(/[${}\\]/)&&""===d&&(p--,e=e.substr(0,p-1)+e.substr(p));if(""!==d)throw new u.default("MathNotTerminated","Math not terminated in text box")}return h<e.length&&l.push(g(t,e.slice(h),s)),null!=r?l=[t.create("node","mstyle",l,{displaystyle:!1,scriptlevel:r})]:l.length>1&&(l=[t.create("node","mrow",l)]),l},t.internalText=g,t.underOver=function(e,r,n,o,i){if(t.checkMovableLimits(r),l.default.isType(r,"munderover")&&l.default.isEmbellished(r)){l.default.setProperties(l.default.getCoreMO(r),{lspace:0,rspace:0});var a=e.create("node","mo",[],{rspace:0});r=e.create("node","mrow",[a,r])}var c=e.create("node","munderover",[r]);l.default.setChild(c,"over"===o?c.over:c.under,n);var u=c;return i&&(u=e.create("node","TeXAtom",[c],{texClass:s.TEXCLASS.OP,movesupsub:!0})),l.default.setProperty(u,"subsupOK",!0),u},t.checkMovableLimits=function(t){var e=l.default.isType(t,"mo")?l.default.getForm(t):null;(l.default.getProperty(t,"movablelimits")||e&&e[3]&&e[3].movablelimits)&&l.default.setProperties(t,{movablelimits:!1})},t.trimSpaces=function(t){if("string"!=typeof t)return t;var e=t.trim();return e.match(/\\$/)&&t.match(/ $/)&&(e+=" "),e},t.setArrayAlign=function(e,r){return"t"===(r=t.trimSpaces(r||""))?e.arraydef.align="baseline 1":"b"===r?e.arraydef.align="baseline -1":"c"===r?e.arraydef.align="axis":r&&(e.arraydef.align=r),e},t.substituteArgs=function(t,e,r){for(var n="",o="",i=0;i<r.length;){var a=r.charAt(i++);if("\\"===a)n+=a+r.charAt(i++);else if("#"===a)if("#"===(a=r.charAt(i++)))n+=a;else{if(!a.match(/[1-9]/)||parseInt(a,10)>e.length)throw new u.default("IllegalMacroParam","Illegal macro parameter reference");o=b(t,b(t,o,n),e[parseInt(a,10)-1]),n=""}else n+=a}return b(t,o,n)},t.addArgs=b,t.checkMaxMacros=function(t,e){if(void 0===e&&(e=!0),!(++t.macroCount<=t.configuration.options.maxMacros))throw e?new u.default("MaxMacroSub1","MathJax maximum macro substitution count exceeded; is here a recursive macro call?"):new u.default("MaxMacroSub2","MathJax maximum substitution count exceeded; is there a recursive latex environment?")},t.checkEqnEnv=function(t){if(t.stack.global.eqnenv)throw new u.default("ErroneousNestingEq","Erroneous nesting of equation structures");t.stack.global.eqnenv=!0},t.copyNode=function(t,e){var r=t.copy(),n=e.configuration;return r.walkTree((function(t){var e,r;n.addNode(t.kind,t);var i=(t.getProperty("in-lists")||"").split(/,/);try{for(var a=o(i),s=a.next();!s.done;s=a.next()){var l=s.value;l&&n.addNode(l,t)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}})),r},t.MmlFilterAttribute=function(t,e,r){return r},t.getFontDef=function(t){var e=t.stack.env.font;return e?{mathvariant:e}:{}},t.keyvalOptions=function(t,e,r){var i,a;void 0===e&&(e=null),void 0===r&&(r=!1);var s=function(t){var e,r,o,i,a,s={},l=t;for(;l;)i=(e=n(_(l,["=",","]),3))[0],o=e[1],l=e[2],"="===o?(a=(r=n(_(l,[","]),3))[0],o=r[1],l=r[2],a="false"===a||"true"===a?JSON.parse(a):a,s[i]=a):i&&(s[i]=!0);return s}(t);if(e)try{for(var l=o(Object.keys(s)),c=l.next();!c.done;c=l.next()){var p=c.value;if(!e.hasOwnProperty(p)){if(r)throw new u.default("InvalidOption","Invalid option: %1",p);delete s[p]}}}catch(t){i={error:t}}finally{try{c&&!c.done&&(a=l.return)&&a.call(l)}finally{if(i)throw i.error}}return s}}(a||(a={})),e.default=a},9497:function(t,e,r){var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var s=a(r(1256)),l=function(){function t(t,e,r){this._factory=t,this._env=e,this.global={},this.stack=[],this.global={isInner:r},this.stack=[this._factory.create("start",this.global)],e&&(this.stack[0].env=e),this.env=this.stack[0].env}return Object.defineProperty(t.prototype,"env",{get:function(){return this._env},set:function(t){this._env=t},enumerable:!1,configurable:!0}),t.prototype.Push=function(){for(var t,e,r=[],a=0;a<arguments.length;a++)r[a]=arguments[a];try{for(var l=n(r),c=l.next();!c.done;c=l.next()){var u=c.value;if(u){var p=s.default.isNode(u)?this._factory.create("mml",u):u;p.global=this.global;var h=o(this.stack.length?this.Top().checkItem(p):[null,!0],2),d=h[0],f=h[1];f&&(d?(this.Pop(),this.Push.apply(this,i([],o(d),!1))):(this.stack.push(p),p.env?(p.copyEnv&&Object.assign(p.env,this.env),this.env=p.env):p.env=this.env))}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(e=l.return)&&e.call(l)}finally{if(t)throw t.error}}},t.prototype.Pop=function(){var t=this.stack.pop();return t.isOpen||delete t.env,this.env=this.stack.length?this.Top().env:{},t},t.prototype.Top=function(t){return void 0===t&&(t=1),this.stack.length<t?null:this.stack[this.stack.length-t]},t.prototype.Prev=function(t){var e=this.Top();return t?e.First:e.Pop()},t.prototype.toString=function(){return"stack[\n  "+this.stack.join("\n  ")+"\n]"},t}();e.default=l},8292:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},s=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},l=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.BaseItem=e.MmlStack=void 0;var c=l(r(3971)),u=function(){function t(t){this._nodes=t}return Object.defineProperty(t.prototype,"nodes",{get:function(){return this._nodes},enumerable:!1,configurable:!0}),t.prototype.Push=function(){for(var t,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];(t=this._nodes).push.apply(t,a([],i(e),!1))},t.prototype.Pop=function(){return this._nodes.pop()},Object.defineProperty(t.prototype,"First",{get:function(){return this._nodes[this.Size()-1]},set:function(t){this._nodes[this.Size()-1]=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Last",{get:function(){return this._nodes[0]},set:function(t){this._nodes[0]=t},enumerable:!1,configurable:!0}),t.prototype.Peek=function(t){return null==t&&(t=1),this._nodes.slice(this.Size()-t)},t.prototype.Size=function(){return this._nodes.length},t.prototype.Clear=function(){this._nodes=[]},t.prototype.toMml=function(t,e){return void 0===t&&(t=!0),1!==this._nodes.length||e?this.create("node",t?"inferredMrow":"mrow",this._nodes,{}):this.First},t.prototype.create=function(t){for(var e,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return(e=this.factory.configuration.nodeFactory).create.apply(e,a([t],i(r),!1))},t}();e.MmlStack=u;var p=function(t){function e(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=t.call(this,r)||this;return o.factory=e,o.global={},o._properties={},o.isOpen&&(o._env={}),o}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"base"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"env",{get:function(){return this._env},set:function(t){this._env=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"copyEnv",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.getProperty=function(t){return this._properties[t]},e.prototype.setProperty=function(t,e){return this._properties[t]=e,this},Object.defineProperty(e.prototype,"isOpen",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isClose",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isFinal",{get:function(){return!1},enumerable:!1,configurable:!0}),e.prototype.isKind=function(t){return t===this.kind},e.prototype.checkItem=function(t){if(t.isKind("over")&&this.isOpen&&(t.setProperty("num",this.toMml(!1)),this.Clear()),t.isKind("cell")&&this.isOpen){if(t.getProperty("linebreak"))return e.fail;throw new c.default("Misplaced","Misplaced %1",t.getName())}if(t.isClose&&this.getErrors(t.kind)){var r=i(this.getErrors(t.kind),2),n=r[0],o=r[1];throw new c.default(n,o,t.getName())}return t.isFinal?(this.Push(t.First),e.fail):e.success},e.prototype.clearEnv=function(){var t,e;try{for(var r=s(Object.keys(this.env)),n=r.next();!n.done;n=r.next()){var o=n.value;delete this.env[o]}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},e.prototype.setProperties=function(t){return Object.assign(this._properties,t),this},e.prototype.getName=function(){return this.getProperty("name")},e.prototype.toString=function(){return this.kind+"["+this.nodes.join("; ")+"]"},e.prototype.getErrors=function(t){return(this.constructor.errors||{})[t]||e.errors[t]},e.fail=[null,!1],e.success=[null,!0],e.errors={end:["MissingBeginExtraEnd","Missing \\begin{%1} or extra \\end{%1}"],close:["ExtraCloseMissingOpen","Extra close brace or missing open brace"],right:["MissingLeftExtraRight","Missing \\left or extra \\right"],middle:["ExtraMiddle","Extra \\middle"]},e}(u);e.BaseItem=p},5453:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var a=r(8292),s=r(4574),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e}(a.BaseItem),c=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.defaultKind="dummy",e.configuration=null,e}return i(e,t),e.DefaultStackItems=((o={})[l.prototype.kind]=l,o),e}(s.AbstractFactory);e.default=c},8803:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Macro=e.Symbol=void 0;var r=function(){function t(t,e,r){this._symbol=t,this._char=e,this._attributes=r}return Object.defineProperty(t.prototype,"symbol",{get:function(){return this._symbol},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"char",{get:function(){return this._char},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){return this._attributes},enumerable:!1,configurable:!0}),t}();e.Symbol=r;var n=function(){function t(t,e,r){void 0===r&&(r=[]),this._symbol=t,this._func=e,this._args=r}return Object.defineProperty(t.prototype,"symbol",{get:function(){return this._symbol},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"func",{get:function(){return this._func},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"args",{get:function(){return this._args},enumerable:!1,configurable:!0}),t}();e.Macro=n},9140:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},s=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.EnvironmentMap=e.CommandMap=e.MacroMap=e.DelimiterMap=e.CharacterMap=e.AbstractParseMap=e.RegExpMap=e.AbstractSymbolMap=e.parseResult=void 0;var l=r(8803),c=r(2947);function u(t){return void 0===t||t}e.parseResult=u;var p=function(){function t(t,e){this._name=t,this._parser=e,c.MapHandler.register(this)}return Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),t.prototype.parserFor=function(t){return this.contains(t)?this.parser:null},t.prototype.parse=function(t){var e=i(t,2),r=e[0],n=e[1],o=this.parserFor(n),a=this.lookup(n);return o&&a?u(o(r,a)):null},Object.defineProperty(t.prototype,"parser",{get:function(){return this._parser},set:function(t){this._parser=t},enumerable:!1,configurable:!0}),t}();e.AbstractSymbolMap=p;var h=function(t){function e(e,r,n){var o=t.call(this,e,r)||this;return o._regExp=n,o}return o(e,t),e.prototype.contains=function(t){return this._regExp.test(t)},e.prototype.lookup=function(t){return this.contains(t)?t:null},e}(p);e.RegExpMap=h;var d=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.map=new Map,e}return o(e,t),e.prototype.lookup=function(t){return this.map.get(t)},e.prototype.contains=function(t){return this.map.has(t)},e.prototype.add=function(t,e){this.map.set(t,e)},e.prototype.remove=function(t){this.map.delete(t)},e}(p);e.AbstractParseMap=d;var f=function(t){function e(e,r,n){var o,s,c=t.call(this,e,r)||this;try{for(var u=a(Object.keys(n)),p=u.next();!p.done;p=u.next()){var h=p.value,d=n[h],f=i("string"==typeof d?[d,null]:d,2),m=f[0],y=f[1],g=new l.Symbol(h,m,y);c.add(h,g)}}catch(t){o={error:t}}finally{try{p&&!p.done&&(s=u.return)&&s.call(u)}finally{if(o)throw o.error}}return c}return o(e,t),e}(d);e.CharacterMap=f;var m=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.parse=function(e){var r=i(e,2),n=r[0],o=r[1];return t.prototype.parse.call(this,[n,"\\"+o])},e}(f);e.DelimiterMap=m;var y=function(t){function e(e,r,n){var o,s,c=t.call(this,e,null)||this;try{for(var u=a(Object.keys(r)),p=u.next();!p.done;p=u.next()){var h=p.value,d=r[h],f=i("string"==typeof d?[d]:d),m=f[0],y=f.slice(1),g=new l.Macro(h,n[m],y);c.add(h,g)}}catch(t){o={error:t}}finally{try{p&&!p.done&&(s=u.return)&&s.call(u)}finally{if(o)throw o.error}}return c}return o(e,t),e.prototype.parserFor=function(t){var e=this.lookup(t);return e?e.func:null},e.prototype.parse=function(t){var e=i(t,2),r=e[0],n=e[1],o=this.lookup(n),a=this.parserFor(n);return o&&a?u(a.apply(void 0,s([r,o.symbol],i(o.args),!1))):null},e}(d);e.MacroMap=y;var g=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.parse=function(t){var e=i(t,2),r=e[0],n=e[1],o=this.lookup(n),a=this.parserFor(n);if(!o||!a)return null;var l=r.currentCS;r.currentCS="\\"+n;var c=a.apply(void 0,s([r,"\\"+o.symbol],i(o.args),!1));return r.currentCS=l,u(c)},e}(y);e.CommandMap=g;var b=function(t){function e(e,r,n,o){var i=t.call(this,e,n,o)||this;return i.parser=r,i}return o(e,t),e.prototype.parse=function(t){var e=i(t,2),r=e[0],n=e[1],o=this.lookup(n),a=this.parserFor(n);return o&&a?u(this.parser(r,o.symbol,a,o.args)):null},e}(y);e.EnvironmentMap=b},6521:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.TagsFactory=e.AllTags=e.NoTags=e.AbstractTags=e.TagInfo=e.Label=void 0;var s=a(r(8417)),l=function(t,e){void 0===t&&(t="???"),void 0===e&&(e=""),this.tag=t,this.id=e};e.Label=l;var c=function(t,e,r,n,o,i,a,s){void 0===t&&(t=""),void 0===e&&(e=!1),void 0===r&&(r=!1),void 0===n&&(n=null),void 0===o&&(o=""),void 0===i&&(i=""),void 0===a&&(a=!1),void 0===s&&(s=""),this.env=t,this.taggable=e,this.defaultTags=r,this.tag=n,this.tagId=o,this.tagFormat=i,this.noTag=a,this.labelId=s};e.TagInfo=c;var u=function(){function t(){this.counter=0,this.allCounter=0,this.configuration=null,this.ids={},this.allIds={},this.labels={},this.allLabels={},this.redo=!1,this.refUpdate=!1,this.currentTag=new c,this.history=[],this.stack=[],this.enTag=function(t,e){var r=this.configuration.nodeFactory,n=r.create("node","mtd",[t]),o=r.create("node","mlabeledtr",[e,n]);return r.create("node","mtable",[o],{side:this.configuration.options.tagSide,minlabelspacing:this.configuration.options.tagIndent,displaystyle:!0})}}return t.prototype.start=function(t,e,r){this.currentTag&&this.stack.push(this.currentTag),this.currentTag=new c(t,e,r)},Object.defineProperty(t.prototype,"env",{get:function(){return this.currentTag.env},enumerable:!1,configurable:!0}),t.prototype.end=function(){this.history.push(this.currentTag),this.currentTag=this.stack.pop()},t.prototype.tag=function(t,e){this.currentTag.tag=t,this.currentTag.tagFormat=e?t:this.formatTag(t),this.currentTag.noTag=!1},t.prototype.notag=function(){this.tag("",!0),this.currentTag.noTag=!0},Object.defineProperty(t.prototype,"noTag",{get:function(){return this.currentTag.noTag},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"label",{get:function(){return this.currentTag.labelId},set:function(t){this.currentTag.labelId=t},enumerable:!1,configurable:!0}),t.prototype.formatUrl=function(t,e){return e+"#"+encodeURIComponent(t)},t.prototype.formatTag=function(t){return"("+t+")"},t.prototype.formatId=function(t){return"mjx-eqn:"+t.replace(/\s/g,"_")},t.prototype.formatNumber=function(t){return t.toString()},t.prototype.autoTag=function(){null==this.currentTag.tag&&(this.counter++,this.tag(this.formatNumber(this.counter),!1))},t.prototype.clearTag=function(){this.label="",this.tag(null,!0),this.currentTag.tagId=""},t.prototype.getTag=function(t){if(void 0===t&&(t=!1),t)return this.autoTag(),this.makeTag();var e=this.currentTag;return e.taggable&&!e.noTag&&(e.defaultTags&&this.autoTag(),e.tag)?this.makeTag():null},t.prototype.resetTag=function(){this.history=[],this.redo=!1,this.refUpdate=!1,this.clearTag()},t.prototype.reset=function(t){void 0===t&&(t=0),this.resetTag(),this.counter=this.allCounter=t,this.allLabels={},this.allIds={}},t.prototype.startEquation=function(t){this.history=[],this.stack=[],this.clearTag(),this.currentTag=new c("",void 0,void 0),this.labels={},this.ids={},this.counter=this.allCounter,this.redo=!1;var e=t.inputData.recompile;e&&(this.refUpdate=!0,this.counter=e.counter)},t.prototype.finishEquation=function(t){this.redo&&(t.inputData.recompile={state:t.state(),counter:this.allCounter}),this.refUpdate||(this.allCounter=this.counter),Object.assign(this.allIds,this.ids),Object.assign(this.allLabels,this.labels)},t.prototype.finalize=function(t,e){if(!e.display||this.currentTag.env||null==this.currentTag.tag)return t;var r=this.makeTag();return this.enTag(t,r)},t.prototype.makeId=function(){this.currentTag.tagId=this.formatId(this.configuration.options.useLabelIds&&this.label||this.currentTag.tag)},t.prototype.makeTag=function(){this.makeId(),this.label&&(this.labels[this.label]=new l(this.currentTag.tag,this.currentTag.tagId));var t=new s.default("\\text{"+this.currentTag.tagFormat+"}",{},this.configuration).mml();return this.configuration.nodeFactory.create("node","mtd",[t],{id:this.currentTag.tagId})},t}();e.AbstractTags=u;var p=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.autoTag=function(){},e.prototype.getTag=function(){return this.currentTag.tag?t.prototype.getTag.call(this):null},e}(u);e.NoTags=p;var h=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.finalize=function(t,e){if(!e.display||this.history.find((function(t){return t.taggable})))return t;var r=this.getTag(!0);return this.enTag(t,r)},e}(u);e.AllTags=h,function(t){var e=new Map([["none",p],["all",h]]),r="none";t.OPTIONS={tags:r,tagSide:"right",tagIndent:"0.8em",useLabelIds:!0,ignoreDuplicateLabels:!1},t.add=function(t,r){e.set(t,r)},t.addTags=function(e){var r,n;try{for(var o=i(Object.keys(e)),a=o.next();!a.done;a=o.next()){var s=a.value;t.add(s,e[s])}}catch(t){r={error:t}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},t.create=function(t){var n=e.get(t)||e.get(r);if(!n)throw Error("Unknown tags class");return new n},t.setDefault=function(t){r=t},t.getDefault=function(){return t.create(r)}}(e.TagsFactory||(e.TagsFactory={}))},8317:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.TexConstant=void 0,function(t){t.Variant={NORMAL:"normal",BOLD:"bold",ITALIC:"italic",BOLDITALIC:"bold-italic",DOUBLESTRUCK:"double-struck",FRAKTUR:"fraktur",BOLDFRAKTUR:"bold-fraktur",SCRIPT:"script",BOLDSCRIPT:"bold-script",SANSSERIF:"sans-serif",BOLDSANSSERIF:"bold-sans-serif",SANSSERIFITALIC:"sans-serif-italic",SANSSERIFBOLDITALIC:"sans-serif-bold-italic",MONOSPACE:"monospace",INITIAL:"inital",TAILED:"tailed",LOOPED:"looped",STRETCHED:"stretched",CALLIGRAPHIC:"-tex-calligraphic",BOLDCALLIGRAPHIC:"-tex-bold-calligraphic",OLDSTYLE:"-tex-oldstyle",BOLDOLDSTYLE:"-tex-bold-oldstyle",MATHITALIC:"-tex-mathit"},t.Form={PREFIX:"prefix",INFIX:"infix",POSTFIX:"postfix"},t.LineBreak={AUTO:"auto",NEWLINE:"newline",NOBREAK:"nobreak",GOODBREAK:"goodbreak",BADBREAK:"badbreak"},t.LineBreakStyle={BEFORE:"before",AFTER:"after",DUPLICATE:"duplicate",INFIXLINBREAKSTYLE:"infixlinebreakstyle"},t.IndentAlign={LEFT:"left",CENTER:"center",RIGHT:"right",AUTO:"auto",ID:"id",INDENTALIGN:"indentalign"},t.IndentShift={INDENTSHIFT:"indentshift"},t.LineThickness={THIN:"thin",MEDIUM:"medium",THICK:"thick"},t.Notation={LONGDIV:"longdiv",ACTUARIAL:"actuarial",PHASORANGLE:"phasorangle",RADICAL:"radical",BOX:"box",ROUNDEDBOX:"roundedbox",CIRCLE:"circle",LEFT:"left",RIGHT:"right",TOP:"top",BOTTOM:"bottom",UPDIAGONALSTRIKE:"updiagonalstrike",DOWNDIAGONALSTRIKE:"downdiagonalstrike",VERTICALSTRIKE:"verticalstrike",HORIZONTALSTRIKE:"horizontalstrike",NORTHEASTARROW:"northeastarrow",MADRUWB:"madruwb",UPDIAGONALARROW:"updiagonalarrow"},t.Align={TOP:"top",BOTTOM:"bottom",CENTER:"center",BASELINE:"baseline",AXIS:"axis",LEFT:"left",RIGHT:"right"},t.Lines={NONE:"none",SOLID:"solid",DASHED:"dashed"},t.Side={LEFT:"left",RIGHT:"right",LEFTOVERLAP:"leftoverlap",RIGHTOVERLAP:"rightoverlap"},t.Width={AUTO:"auto",FIT:"fit"},t.Actiontype={TOGGLE:"toggle",STATUSLINE:"statusline",TOOLTIP:"tooltip",INPUT:"input"},t.Overflow={LINBREAK:"linebreak",SCROLL:"scroll",ELIDE:"elide",TRUNCATE:"truncate",SCALE:"scale"},t.Unit={EM:"em",EX:"ex",PX:"px",IN:"in",CM:"cm",MM:"mm",PT:"pt",PC:"pc"}}(e.TexConstant||(e.TexConstant={}))},3971:function(t,e){Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(e,r){for(var n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];this.id=e,this.message=t.processString(r,n)}return t.processString=function(e,r){for(var n=e.split(t.pattern),o=1,i=n.length;o<i;o+=2){var a=n[o].charAt(0);if(a>="0"&&a<="9")n[o]=r[parseInt(n[o],10)-1],"number"==typeof n[o]&&(n[o]=n[o].toString());else if("{"===a){if((a=n[o].substr(1))>="0"&&a<="9")n[o]=r[parseInt(n[o].substr(1,n[o].length-2),10)-1],"number"==typeof n[o]&&(n[o]=n[o].toString());else n[o].match(/^\{([a-z]+):%(\d+)\|(.*)\}$/)&&(n[o]="%"+n[o])}null==n[o]&&(n[o]="???")}return n.join("")},t.pattern=/%(\d+|\{\d+\}|\{[a-z]+:\%\d+(?:\|(?:%\{\d+\}|%.|[^\}])*)+\}|.)/g,t}();e.default=r},8417:function(t,e,r){var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var s=a(r(1130)),l=a(r(9497)),c=a(r(3971)),u=r(9007),p=function(){function t(t,e,r){var o,i;this._string=t,this.configuration=r,this.macroCount=0,this.i=0,this.currentCS="";var a,s=e.hasOwnProperty("isInner"),c=e.isInner;if(delete e.isInner,e){a={};try{for(var u=n(Object.keys(e)),p=u.next();!p.done;p=u.next()){var h=p.value;a[h]=e[h]}}catch(t){o={error:t}}finally{try{p&&!p.done&&(i=u.return)&&i.call(u)}finally{if(o)throw o.error}}}this.configuration.pushParser(this),this.stack=new l.default(this.itemFactory,a,!s||c),this.Parse(),this.Push(this.itemFactory.create("stop"))}return Object.defineProperty(t.prototype,"options",{get:function(){return this.configuration.options},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"itemFactory",{get:function(){return this.configuration.itemFactory},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tags",{get:function(){return this.configuration.tags},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"string",{get:function(){return this._string},set:function(t){this._string=t},enumerable:!1,configurable:!0}),t.prototype.parse=function(t,e){return this.configuration.handlers.get(t).parse(e)},t.prototype.lookup=function(t,e){return this.configuration.handlers.get(t).lookup(e)},t.prototype.contains=function(t,e){return this.configuration.handlers.get(t).contains(e)},t.prototype.toString=function(){var t,e,r="";try{for(var o=n(Array.from(this.configuration.handlers.keys())),i=o.next();!i.done;i=o.next()){var a=i.value;r+=a+": "+this.configuration.handlers.get(a)+"\n"}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return r},t.prototype.Parse=function(){for(var t;this.i<this.string.length;)t=this.getCodePoint(),this.i+=t.length,this.parse("character",[this,t])},t.prototype.Push=function(t){t instanceof u.AbstractMmlNode&&t.isInferred?this.PushAll(t.childNodes):this.stack.Push(t)},t.prototype.PushAll=function(t){var e,r;try{for(var o=n(t),i=o.next();!i.done;i=o.next()){var a=i.value;this.stack.Push(a)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}},t.prototype.mml=function(){if(!this.stack.Top().isKind("mml"))return null;var t=this.stack.Top().First;return this.configuration.popParser(),t},t.prototype.convertDelimiter=function(t){var e=this.lookup("delimiter",t);return e?e.char:null},t.prototype.getCodePoint=function(){var t=this.string.codePointAt(this.i);return void 0===t?"":String.fromCodePoint(t)},t.prototype.nextIsSpace=function(){return!!this.string.charAt(this.i).match(/\s/)},t.prototype.GetNext=function(){for(;this.nextIsSpace();)this.i++;return this.getCodePoint()},t.prototype.GetCS=function(){var t=this.string.slice(this.i).match(/^(([a-z]+) ?|[\uD800-\uDBFF].|.)/i);return t?(this.i+=t[0].length,t[2]||t[1]):(this.i++," ")},t.prototype.GetArgument=function(t,e){switch(this.GetNext()){case"":if(!e)throw new c.default("MissingArgFor","Missing argument for %1",this.currentCS);return null;case"}":if(!e)throw new c.default("ExtraCloseMissingOpen","Extra close brace or missing open brace");return null;case"\\":return this.i++,"\\"+this.GetCS();case"{":for(var r=++this.i,n=1;this.i<this.string.length;)switch(this.string.charAt(this.i++)){case"\\":this.i++;break;case"{":n++;break;case"}":if(0==--n)return this.string.slice(r,this.i-1)}throw new c.default("MissingCloseBrace","Missing close brace")}var o=this.getCodePoint();return this.i+=o.length,o},t.prototype.GetBrackets=function(t,e){if("["!==this.GetNext())return e;for(var r=++this.i,n=0;this.i<this.string.length;)switch(this.string.charAt(this.i++)){case"{":n++;break;case"\\":this.i++;break;case"}":if(n--<=0)throw new c.default("ExtraCloseLooking","Extra close brace while looking for %1","']'");break;case"]":if(0===n)return this.string.slice(r,this.i-1)}throw new c.default("MissingCloseBracket","Could not find closing ']' for argument to %1",this.currentCS)},t.prototype.GetDelimiter=function(t,e){var r=this.GetNext();if(this.i+=r.length,this.i<=this.string.length&&("\\"===r?r+=this.GetCS():"{"===r&&e&&(this.i--,r=this.GetArgument(t).trim()),this.contains("delimiter",r)))return this.convertDelimiter(r);throw new c.default("MissingOrUnrecognizedDelim","Missing or unrecognized delimiter for %1",this.currentCS)},t.prototype.GetDimen=function(t){if("{"===this.GetNext()){var e=this.GetArgument(t),r=o(s.default.matchDimen(e),2),n=r[0],i=r[1];if(n)return n+i}else{e=this.string.slice(this.i);var a=o(s.default.matchDimen(e,!0),3),l=(n=a[0],i=a[1],a[2]);if(n)return this.i+=l,n+i}throw new c.default("MissingDimOrUnits","Missing dimension or its units for %1",this.currentCS)},t.prototype.GetUpTo=function(t,e){for(;this.nextIsSpace();)this.i++;for(var r=this.i,n=0;this.i<this.string.length;){var o=this.i,i=this.GetNext();switch(this.i+=i.length,i){case"\\":i+=this.GetCS();break;case"{":n++;break;case"}":if(0===n)throw new c.default("ExtraCloseLooking","Extra close brace while looking for %1",e);n--}if(0===n&&i===e)return this.string.slice(r,o)}throw new c.default("TokenNotFoundForCommand","Could not find %1 for %2",e,this.currentCS)},t.prototype.ParseArg=function(e){return new t(this.GetArgument(e),this.stack.env,this.configuration).mml()},t.prototype.ParseUpTo=function(e,r){return new t(this.GetUpTo(e,r),this.stack.env,this.configuration).mml()},t.prototype.GetDelimiterArg=function(t){var e=s.default.trimSpaces(this.GetArgument(t));if(""===e)return null;if(this.contains("delimiter",e))return e;throw new c.default("MissingOrUnrecognizedDelim","Missing or unrecognized delimiter for %1",this.currentCS)},t.prototype.GetStar=function(){var t="*"===this.GetNext();return t&&this.i++,t},t.prototype.create=function(t){for(var e,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return(e=this.configuration.nodeFactory).create.apply(e,i([t],o(r),!1))},t}();e.default=p},8174:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.ActionConfiguration=e.ActionMethods=void 0;var o=r(9899),i=n(r(8417)),a=r(9140),s=n(r(7693));e.ActionMethods={},e.ActionMethods.Macro=s.default.Macro,e.ActionMethods.Toggle=function(t,e){for(var r,n=[];"\\endtoggle"!==(r=t.GetArgument(e));)n.push(new i.default(r,t.stack.env,t.configuration).mml());t.Push(t.create("node","maction",n,{actiontype:"toggle"}))},e.ActionMethods.Mathtip=function(t,e){var r=t.ParseArg(e),n=t.ParseArg(e);t.Push(t.create("node","maction",[r,n],{actiontype:"tooltip"}))},new a.CommandMap("action-macros",{toggle:"Toggle",mathtip:"Mathtip",texttip:["Macro","\\mathtip{#1}{\\text{#2}}",2]},e.ActionMethods),e.ActionConfiguration=o.Configuration.create("action",{handler:{macro:["action-macros"]}})},8021:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.AmsConfiguration=e.AmsTags=void 0;var a=r(9899),s=r(2790),l=r(6521),c=r(4387);r(7379);var u=r(9140),p=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e}(l.AbstractTags);e.AmsTags=p;e.AmsConfiguration=a.Configuration.create("ams",{handler:{character:["AMSmath-operatorLetter"],delimiter:["AMSsymbols-delimiter","AMSmath-delimiter"],macro:["AMSsymbols-mathchar0mi","AMSsymbols-mathchar0mo","AMSsymbols-delimiter","AMSsymbols-macros","AMSmath-mathchar0mo","AMSmath-macros","AMSmath-delimiter"],environment:["AMSmath-environment"]},items:(o={},o[s.MultlineItem.prototype.kind]=s.MultlineItem,o[s.FlalignItem.prototype.kind]=s.FlalignItem,o),tags:{ams:p},init:function(t){new u.CommandMap(c.NEW_OPS,{},{}),t.append(a.Configuration.local({handler:{macro:[c.NEW_OPS]},priority:-1}))},config:function(t,e){e.parseOptions.options.multlineWidth&&(e.parseOptions.options.ams.multlineWidth=e.parseOptions.options.multlineWidth),delete e.parseOptions.options.multlineWidth},options:{multlineWidth:"",ams:{multlineWidth:"100%",multlineIndent:"1em"}}})},2790:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.FlalignItem=e.MultlineItem=void 0;var s=r(1181),l=a(r(1130)),c=a(r(1256)),u=a(r(3971)),p=r(8317),h=function(t){function e(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=t.call(this,e)||this;return o.factory.configuration.tags.start("multline",!0,r[0]),o}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"multline"},enumerable:!1,configurable:!0}),e.prototype.EndEntry=function(){this.table.length&&l.default.fixInitialMO(this.factory.configuration,this.nodes);var t=this.getProperty("shove"),e=this.create("node","mtd",this.nodes,t?{columnalign:t}:{});this.setProperty("shove",null),this.row.push(e),this.Clear()},e.prototype.EndRow=function(){if(1!==this.row.length)throw new u.default("MultlineRowsOneCol","The rows within the %1 environment must have exactly one column","multline");var t=this.create("node","mtr",this.row);this.table.push(t),this.row=[]},e.prototype.EndTable=function(){if(t.prototype.EndTable.call(this),this.table.length){var e=this.table.length-1,r=-1;c.default.getAttribute(c.default.getChildren(this.table[0])[0],"columnalign")||c.default.setAttribute(c.default.getChildren(this.table[0])[0],"columnalign",p.TexConstant.Align.LEFT),c.default.getAttribute(c.default.getChildren(this.table[e])[0],"columnalign")||c.default.setAttribute(c.default.getChildren(this.table[e])[0],"columnalign",p.TexConstant.Align.RIGHT);var n=this.factory.configuration.tags.getTag();if(n){r=this.arraydef.side===p.TexConstant.Align.LEFT?0:this.table.length-1;var o=this.table[r],i=this.create("node","mlabeledtr",[n].concat(c.default.getChildren(o)));c.default.copyAttributes(o,i),this.table[r]=i}}this.factory.configuration.tags.end()},e}(s.ArrayItem);e.MultlineItem=h;var d=function(t){function e(e,r,n,o,i){var a=t.call(this,e)||this;return a.name=r,a.numbered=n,a.padded=o,a.center=i,a.factory.configuration.tags.start(r,n,n),a}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"flalign"},enumerable:!1,configurable:!0}),e.prototype.EndEntry=function(){t.prototype.EndEntry.call(this);var e=this.getProperty("xalignat");if(e&&this.row.length>e)throw new u.default("XalignOverflow","Extra %1 in row of %2","&",this.name)},e.prototype.EndRow=function(){for(var e,r=this.row,n=this.getProperty("xalignat");r.length<n;)r.push(this.create("node","mtd"));for(this.row=[],this.padded&&this.row.push(this.create("node","mtd"));e=r.shift();)this.row.push(e),(e=r.shift())&&this.row.push(e),(r.length||this.padded)&&this.row.push(this.create("node","mtd"));this.row.length>this.maxrow&&(this.maxrow=this.row.length),t.prototype.EndRow.call(this);var o=this.table[this.table.length-1];if(this.getProperty("zeroWidthLabel")&&o.isKind("mlabeledtr")){var a=c.default.getChildren(o)[0],s=this.factory.configuration.options.tagSide,l=i({width:0},"right"===s?{lspace:"-1width"}:{}),u=this.create("node","mpadded",c.default.getChildren(a),l);a.setChildren([u])}},e.prototype.EndTable=function(){(t.prototype.EndTable.call(this),this.center)&&(this.maxrow<=2&&(delete this.arraydef.width,delete this.global.indentalign))},e}(s.EqnArrayItem);e.FlalignItem=d},7379:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var s=r(4387),l=i(r(9140)),c=r(8317),u=a(r(5450)),p=a(r(1130)),h=r(9007),d=r(6010);new l.CharacterMap("AMSmath-mathchar0mo",u.default.mathchar0mo,{iiiint:["\u2a0c",{texClass:h.TEXCLASS.OP}]}),new l.RegExpMap("AMSmath-operatorLetter",s.AmsMethods.operatorLetter,/[-*]/i),new l.CommandMap("AMSmath-macros",{mathring:["Accent","02DA"],nobreakspace:"Tilde",negmedspace:["Spacer",d.MATHSPACE.negativemediummathspace],negthickspace:["Spacer",d.MATHSPACE.negativethickmathspace],idotsint:["MultiIntegral","\\int\\cdots\\int"],dddot:["Accent","20DB"],ddddot:["Accent","20DC"],sideset:"SideSet",boxed:["Macro","\\fbox{$\\displaystyle{#1}$}",1],tag:"HandleTag",notag:"HandleNoTag",eqref:["HandleRef",!0],substack:["Macro","\\begin{subarray}{c}#1\\end{subarray}",1],injlim:["NamedOp","inj&thinsp;lim"],projlim:["NamedOp","proj&thinsp;lim"],varliminf:["Macro","\\mathop{\\underline{\\mmlToken{mi}{lim}}}"],varlimsup:["Macro","\\mathop{\\overline{\\mmlToken{mi}{lim}}}"],varinjlim:["Macro","\\mathop{\\underrightarrow{\\mmlToken{mi}{lim}}}"],varprojlim:["Macro","\\mathop{\\underleftarrow{\\mmlToken{mi}{lim}}}"],DeclareMathOperator:"HandleDeclareOp",operatorname:"HandleOperatorName",genfrac:"Genfrac",frac:["Genfrac","","","",""],tfrac:["Genfrac","","","","1"],dfrac:["Genfrac","","","","0"],binom:["Genfrac","(",")","0",""],tbinom:["Genfrac","(",")","0","1"],dbinom:["Genfrac","(",")","0","0"],cfrac:"CFrac",shoveleft:["HandleShove",c.TexConstant.Align.LEFT],shoveright:["HandleShove",c.TexConstant.Align.RIGHT],xrightarrow:["xArrow",8594,5,10],xleftarrow:["xArrow",8592,10,5]},s.AmsMethods),new l.EnvironmentMap("AMSmath-environment",u.default.environment,{"equation*":["Equation",null,!1],"eqnarray*":["EqnArray",null,!1,!0,"rcl",p.default.cols(0,d.MATHSPACE.thickmathspace),".5em"],align:["EqnArray",null,!0,!0,"rl",p.default.cols(0,2)],"align*":["EqnArray",null,!1,!0,"rl",p.default.cols(0,2)],multline:["Multline",null,!0],"multline*":["Multline",null,!1],split:["EqnArray",null,!1,!1,"rl",p.default.cols(0)],gather:["EqnArray",null,!0,!0,"c"],"gather*":["EqnArray",null,!1,!0,"c"],alignat:["AlignAt",null,!0,!0],"alignat*":["AlignAt",null,!1,!0],alignedat:["AlignAt",null,!1,!1],aligned:["AmsEqnArray",null,null,null,"rl",p.default.cols(0,2),".5em","D"],gathered:["AmsEqnArray",null,null,null,"c",null,".5em","D"],xalignat:["XalignAt",null,!0,!0],"xalignat*":["XalignAt",null,!1,!0],xxalignat:["XalignAt",null,!1,!1],flalign:["FlalignArray",null,!0,!1,!0,"rlc","auto auto fit"],"flalign*":["FlalignArray",null,!1,!1,!0,"rlc","auto auto fit"],subarray:["Array",null,null,null,null,p.default.cols(0),"0.1em","S",1],smallmatrix:["Array",null,null,null,"c",p.default.cols(1/3),".2em","S",1],matrix:["Array",null,null,null,"c"],pmatrix:["Array",null,"(",")","c"],bmatrix:["Array",null,"[","]","c"],Bmatrix:["Array",null,"\\{","\\}","c"],vmatrix:["Array",null,"\\vert","\\vert","c"],Vmatrix:["Array",null,"\\Vert","\\Vert","c"],cases:["Array",null,"\\{",".","ll",null,".2em","T"]},s.AmsMethods),new l.DelimiterMap("AMSmath-delimiter",u.default.delimiter,{"\\lvert":["|",{texClass:h.TEXCLASS.OPEN}],"\\rvert":["|",{texClass:h.TEXCLASS.CLOSE}],"\\lVert":["\u2016",{texClass:h.TEXCLASS.OPEN}],"\\rVert":["\u2016",{texClass:h.TEXCLASS.CLOSE}]}),new l.CharacterMap("AMSsymbols-mathchar0mi",u.default.mathchar0mi,{digamma:"\u03dd",varkappa:"\u03f0",varGamma:["\u0393",{mathvariant:c.TexConstant.Variant.ITALIC}],varDelta:["\u0394",{mathvariant:c.TexConstant.Variant.ITALIC}],varTheta:["\u0398",{mathvariant:c.TexConstant.Variant.ITALIC}],varLambda:["\u039b",{mathvariant:c.TexConstant.Variant.ITALIC}],varXi:["\u039e",{mathvariant:c.TexConstant.Variant.ITALIC}],varPi:["\u03a0",{mathvariant:c.TexConstant.Variant.ITALIC}],varSigma:["\u03a3",{mathvariant:c.TexConstant.Variant.ITALIC}],varUpsilon:["\u03a5",{mathvariant:c.TexConstant.Variant.ITALIC}],varPhi:["\u03a6",{mathvariant:c.TexConstant.Variant.ITALIC}],varPsi:["\u03a8",{mathvariant:c.TexConstant.Variant.ITALIC}],varOmega:["\u03a9",{mathvariant:c.TexConstant.Variant.ITALIC}],beth:"\u2136",gimel:"\u2137",daleth:"\u2138",backprime:["\u2035",{variantForm:!0}],hslash:"\u210f",varnothing:["\u2205",{variantForm:!0}],blacktriangle:"\u25b4",triangledown:["\u25bd",{variantForm:!0}],blacktriangledown:"\u25be",square:"\u25fb",Box:"\u25fb",blacksquare:"\u25fc",lozenge:"\u25ca",Diamond:"\u25ca",blacklozenge:"\u29eb",circledS:["\u24c8",{mathvariant:c.TexConstant.Variant.NORMAL}],bigstar:"\u2605",sphericalangle:"\u2222",measuredangle:"\u2221",nexists:"\u2204",complement:"\u2201",mho:"\u2127",eth:["\xf0",{mathvariant:c.TexConstant.Variant.NORMAL}],Finv:"\u2132",diagup:"\u2571",Game:"\u2141",diagdown:"\u2572",Bbbk:["k",{mathvariant:c.TexConstant.Variant.DOUBLESTRUCK}],yen:"\xa5",circledR:"\xae",checkmark:"\u2713",maltese:"\u2720"}),new l.CharacterMap("AMSsymbols-mathchar0mo",u.default.mathchar0mo,{dotplus:"\u2214",ltimes:"\u22c9",smallsetminus:["\u2216",{variantForm:!0}],rtimes:"\u22ca",Cap:"\u22d2",doublecap:"\u22d2",leftthreetimes:"\u22cb",Cup:"\u22d3",doublecup:"\u22d3",rightthreetimes:"\u22cc",barwedge:"\u22bc",curlywedge:"\u22cf",veebar:"\u22bb",curlyvee:"\u22ce",doublebarwedge:"\u2a5e",boxminus:"\u229f",circleddash:"\u229d",boxtimes:"\u22a0",circledast:"\u229b",boxdot:"\u22a1",circledcirc:"\u229a",boxplus:"\u229e",centerdot:["\u22c5",{variantForm:!0}],divideontimes:"\u22c7",intercal:"\u22ba",leqq:"\u2266",geqq:"\u2267",leqslant:"\u2a7d",geqslant:"\u2a7e",eqslantless:"\u2a95",eqslantgtr:"\u2a96",lesssim:"\u2272",gtrsim:"\u2273",lessapprox:"\u2a85",gtrapprox:"\u2a86",approxeq:"\u224a",lessdot:"\u22d6",gtrdot:"\u22d7",lll:"\u22d8",llless:"\u22d8",ggg:"\u22d9",gggtr:"\u22d9",lessgtr:"\u2276",gtrless:"\u2277",lesseqgtr:"\u22da",gtreqless:"\u22db",lesseqqgtr:"\u2a8b",gtreqqless:"\u2a8c",doteqdot:"\u2251",Doteq:"\u2251",eqcirc:"\u2256",risingdotseq:"\u2253",circeq:"\u2257",fallingdotseq:"\u2252",triangleq:"\u225c",backsim:"\u223d",thicksim:["\u223c",{variantForm:!0}],backsimeq:"\u22cd",thickapprox:["\u2248",{variantForm:!0}],subseteqq:"\u2ac5",supseteqq:"\u2ac6",Subset:"\u22d0",Supset:"\u22d1",sqsubset:"\u228f",sqsupset:"\u2290",preccurlyeq:"\u227c",succcurlyeq:"\u227d",curlyeqprec:"\u22de",curlyeqsucc:"\u22df",precsim:"\u227e",succsim:"\u227f",precapprox:"\u2ab7",succapprox:"\u2ab8",vartriangleleft:"\u22b2",lhd:"\u22b2",vartriangleright:"\u22b3",rhd:"\u22b3",trianglelefteq:"\u22b4",unlhd:"\u22b4",trianglerighteq:"\u22b5",unrhd:"\u22b5",vDash:["\u22a8",{variantForm:!0}],Vdash:"\u22a9",Vvdash:"\u22aa",smallsmile:["\u2323",{variantForm:!0}],shortmid:["\u2223",{variantForm:!0}],smallfrown:["\u2322",{variantForm:!0}],shortparallel:["\u2225",{variantForm:!0}],bumpeq:"\u224f",between:"\u226c",Bumpeq:"\u224e",pitchfork:"\u22d4",varpropto:["\u221d",{variantForm:!0}],backepsilon:"\u220d",blacktriangleleft:"\u25c2",blacktriangleright:"\u25b8",therefore:"\u2234",because:"\u2235",eqsim:"\u2242",vartriangle:["\u25b3",{variantForm:!0}],Join:"\u22c8",nless:"\u226e",ngtr:"\u226f",nleq:"\u2270",ngeq:"\u2271",nleqslant:["\u2a87",{variantForm:!0}],ngeqslant:["\u2a88",{variantForm:!0}],nleqq:["\u2270",{variantForm:!0}],ngeqq:["\u2271",{variantForm:!0}],lneq:"\u2a87",gneq:"\u2a88",lneqq:"\u2268",gneqq:"\u2269",lvertneqq:["\u2268",{variantForm:!0}],gvertneqq:["\u2269",{variantForm:!0}],lnsim:"\u22e6",gnsim:"\u22e7",lnapprox:"\u2a89",gnapprox:"\u2a8a",nprec:"\u2280",nsucc:"\u2281",npreceq:["\u22e0",{variantForm:!0}],nsucceq:["\u22e1",{variantForm:!0}],precneqq:"\u2ab5",succneqq:"\u2ab6",precnsim:"\u22e8",succnsim:"\u22e9",precnapprox:"\u2ab9",succnapprox:"\u2aba",nsim:"\u2241",ncong:"\u2247",nshortmid:["\u2224",{variantForm:!0}],nshortparallel:["\u2226",{variantForm:!0}],nmid:"\u2224",nparallel:"\u2226",nvdash:"\u22ac",nvDash:"\u22ad",nVdash:"\u22ae",nVDash:"\u22af",ntriangleleft:"\u22ea",ntriangleright:"\u22eb",ntrianglelefteq:"\u22ec",ntrianglerighteq:"\u22ed",nsubseteq:"\u2288",nsupseteq:"\u2289",nsubseteqq:["\u2288",{variantForm:!0}],nsupseteqq:["\u2289",{variantForm:!0}],subsetneq:"\u228a",supsetneq:"\u228b",varsubsetneq:["\u228a",{variantForm:!0}],varsupsetneq:["\u228b",{variantForm:!0}],subsetneqq:"\u2acb",supsetneqq:"\u2acc",varsubsetneqq:["\u2acb",{variantForm:!0}],varsupsetneqq:["\u2acc",{variantForm:!0}],leftleftarrows:"\u21c7",rightrightarrows:"\u21c9",leftrightarrows:"\u21c6",rightleftarrows:"\u21c4",Lleftarrow:"\u21da",Rrightarrow:"\u21db",twoheadleftarrow:"\u219e",twoheadrightarrow:"\u21a0",leftarrowtail:"\u21a2",rightarrowtail:"\u21a3",looparrowleft:"\u21ab",looparrowright:"\u21ac",leftrightharpoons:"\u21cb",rightleftharpoons:["\u21cc",{variantForm:!0}],curvearrowleft:"\u21b6",curvearrowright:"\u21b7",circlearrowleft:"\u21ba",circlearrowright:"\u21bb",Lsh:"\u21b0",Rsh:"\u21b1",upuparrows:"\u21c8",downdownarrows:"\u21ca",upharpoonleft:"\u21bf",upharpoonright:"\u21be",downharpoonleft:"\u21c3",restriction:"\u21be",multimap:"\u22b8",downharpoonright:"\u21c2",leftrightsquigarrow:"\u21ad",rightsquigarrow:"\u21dd",leadsto:"\u21dd",dashrightarrow:"\u21e2",dashleftarrow:"\u21e0",nleftarrow:"\u219a",nrightarrow:"\u219b",nLeftarrow:"\u21cd",nRightarrow:"\u21cf",nleftrightarrow:"\u21ae",nLeftrightarrow:"\u21ce"}),new l.DelimiterMap("AMSsymbols-delimiter",u.default.delimiter,{"\\ulcorner":"\u231c","\\urcorner":"\u231d","\\llcorner":"\u231e","\\lrcorner":"\u231f"}),new l.CommandMap("AMSsymbols-macros",{implies:["Macro","\\;\\Longrightarrow\\;"],impliedby:["Macro","\\;\\Longleftarrow\\;"]},s.AmsMethods)},4387:function(t,e,r){var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},n.apply(this,arguments)},o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.NEW_OPS=e.AmsMethods=void 0;var a=i(r(1130)),s=i(r(5450)),l=i(r(1256)),c=r(8317),u=i(r(8417)),p=i(r(3971)),h=r(8803),d=i(r(7693)),f=r(9007);function m(t){if(!t||t.isInferred&&0===t.childNodes.length)return[null,null];if(t.isKind("msubsup")&&y(t))return[t,null];var e=l.default.getChildAt(t,0);return t.isInferred&&e&&y(e)?(t.childNodes.splice(0,1),[e,t]):[null,t]}function y(t){var e=t.childNodes[0];return e&&e.isKind("mi")&&""===e.getText()}e.AmsMethods={},e.AmsMethods.AmsEqnArray=function(t,e,r,n,o,i,s){var l=t.GetBrackets("\\begin{"+e.getName()+"}"),c=d.default.EqnArray(t,e,r,n,o,i,s);return a.default.setArrayAlign(c,l)},e.AmsMethods.AlignAt=function(t,r,n,o){var i,s,l=r.getName(),c="",u=[];if(o||(s=t.GetBrackets("\\begin{"+l+"}")),(i=t.GetArgument("\\begin{"+l+"}")).match(/[^0-9]/))throw new p.default("PositiveIntegerArg","Argument to %1 must me a positive integer","\\begin{"+l+"}");for(var h=parseInt(i,10);h>0;)c+="rl",u.push("0em 0em"),h--;var d=u.join(" ");if(o)return e.AmsMethods.EqnArray(t,r,n,o,c,d);var f=e.AmsMethods.EqnArray(t,r,n,o,c,d);return a.default.setArrayAlign(f,s)},e.AmsMethods.Multline=function(t,e,r){t.Push(e),a.default.checkEqnEnv(t);var n=t.itemFactory.create("multline",r,t.stack);return n.arraydef={displaystyle:!0,rowspacing:".5em",columnspacing:"100%",width:t.options.ams.multlineWidth,side:t.options.tagSide,minlabelspacing:t.options.tagIndent,framespacing:t.options.ams.multlineIndent+" 0",frame:"","data-width-includes-label":!0},n},e.AmsMethods.XalignAt=function(t,r,n,o){var i=t.GetArgument("\\begin{"+r.getName()+"}");if(i.match(/[^0-9]/))throw new p.default("PositiveIntegerArg","Argument to %1 must me a positive integer","\\begin{"+r.getName()+"}");var a=o?"crl":"rlc",s=o?"fit auto auto":"auto auto fit",l=e.AmsMethods.FlalignArray(t,r,n,o,!1,a,s,!0);return l.setProperty("xalignat",2*parseInt(i)),l},e.AmsMethods.FlalignArray=function(t,e,r,n,o,i,s,l){void 0===l&&(l=!1),t.Push(e),a.default.checkEqnEnv(t),i=i.split("").join(" ").replace(/r/g,"right").replace(/l/g,"left").replace(/c/g,"center");var c=t.itemFactory.create("flalign",e.getName(),r,n,o,t.stack);return c.arraydef={width:"100%",displaystyle:!0,columnalign:i,columnspacing:"0em",columnwidth:s,rowspacing:"3pt",side:t.options.tagSide,minlabelspacing:l?"0":t.options.tagIndent,"data-width-includes-label":!0},c.setProperty("zeroWidthLabel",l),c},e.NEW_OPS="ams-declare-ops",e.AmsMethods.HandleDeclareOp=function(t,r){var n=t.GetStar()?"*":"",o=a.default.trimSpaces(t.GetArgument(r));"\\"===o.charAt(0)&&(o=o.substr(1));var i=t.GetArgument(r);t.configuration.handlers.retrieve(e.NEW_OPS).add(o,new h.Macro(o,e.AmsMethods.Macro,["\\operatorname".concat(n,"{").concat(i,"}")]))},e.AmsMethods.HandleOperatorName=function(t,e){var r=t.GetStar(),o=a.default.trimSpaces(t.GetArgument(e)),i=new u.default(o,n(n({},t.stack.env),{font:c.TexConstant.Variant.NORMAL,multiLetterIdentifiers:/^[-*a-z]+/i,operatorLetters:!0}),t.configuration).mml();if(i.isKind("mi")||(i=t.create("node","TeXAtom",[i])),l.default.setProperties(i,{movesupsub:r,movablelimits:!0,texClass:f.TEXCLASS.OP}),!r){var s=t.GetNext(),p=t.i;"\\"===s&&++t.i&&"limits"!==t.GetCS()&&(t.i=p)}t.Push(i)},e.AmsMethods.SideSet=function(t,e){var r=o(m(t.ParseArg(e)),2),n=r[0],i=r[1],s=o(m(t.ParseArg(e)),2),c=s[0],u=s[1],p=t.ParseArg(e),h=p;n&&(i?n.replaceChild(t.create("node","mphantom",[t.create("node","mpadded",[a.default.copyNode(p,t)],{width:0})]),l.default.getChildAt(n,0)):(h=t.create("node","mmultiscripts",[p]),c&&l.default.appendChildren(h,[l.default.getChildAt(c,1)||t.create("node","none"),l.default.getChildAt(c,2)||t.create("node","none")]),l.default.setProperty(h,"scriptalign","left"),l.default.appendChildren(h,[t.create("node","mprescripts"),l.default.getChildAt(n,1)||t.create("node","none"),l.default.getChildAt(n,2)||t.create("node","none")]))),c&&h===p&&(c.replaceChild(p,l.default.getChildAt(c,0)),h=c);var d=t.create("node","TeXAtom",[],{texClass:f.TEXCLASS.OP,movesupsub:!0,movablelimits:!0});i&&(n&&d.appendChild(n),d.appendChild(i)),d.appendChild(h),u&&d.appendChild(u),t.Push(d)},e.AmsMethods.operatorLetter=function(t,e){return!!t.stack.env.operatorLetters&&s.default.variable(t,e)},e.AmsMethods.MultiIntegral=function(t,e,r){var n=t.GetNext();if("\\"===n){var o=t.i;n=t.GetArgument(e),t.i=o,"\\limits"===n&&(r="\\idotsint"===e?"\\!\\!\\mathop{\\,\\,"+r+"}":"\\!\\!\\!\\mathop{\\,\\,\\,"+r+"}")}t.string=r+" "+t.string.slice(t.i),t.i=0},e.AmsMethods.xArrow=function(t,e,r,n,o){var i={width:"+"+a.default.Em((n+o)/18),lspace:a.default.Em(n/18)},s=t.GetBrackets(e),c=t.ParseArg(e),p=t.create("node","mspace",[],{depth:".25em"}),h=t.create("token","mo",{stretchy:!0,texClass:f.TEXCLASS.REL},String.fromCodePoint(r));h=t.create("node","mstyle",[h],{scriptlevel:0});var d=t.create("node","munderover",[h]),m=t.create("node","mpadded",[c,p],i);if(l.default.setAttribute(m,"voffset","-.2em"),l.default.setAttribute(m,"height","-.2em"),l.default.setChild(d,d.over,m),s){var y=new u.default(s,t.stack.env,t.configuration).mml(),g=t.create("node","mspace",[],{height:".75em"});m=t.create("node","mpadded",[y,g],i),l.default.setAttribute(m,"voffset",".15em"),l.default.setAttribute(m,"depth","-.15em"),l.default.setChild(d,d.under,m)}l.default.setProperty(d,"subsupOK",!0),t.Push(d)},e.AmsMethods.HandleShove=function(t,e,r){var n=t.stack.Top();if("multline"!==n.kind)throw new p.default("CommandOnlyAllowedInEnv","%1 only allowed in %2 environment",t.currentCS,"multline");if(n.Size())throw new p.default("CommandAtTheBeginingOfLine","%1 must come at the beginning of the line",t.currentCS);n.setProperty("shove",r)},e.AmsMethods.CFrac=function(t,e){var r=a.default.trimSpaces(t.GetBrackets(e,"")),n=t.GetArgument(e),o=t.GetArgument(e),i={l:c.TexConstant.Align.LEFT,r:c.TexConstant.Align.RIGHT,"":""},s=new u.default("\\strut\\textstyle{"+n+"}",t.stack.env,t.configuration).mml(),h=new u.default("\\strut\\textstyle{"+o+"}",t.stack.env,t.configuration).mml(),d=t.create("node","mfrac",[s,h]);if(null==(r=i[r]))throw new p.default("IllegalAlign","Illegal alignment specified in %1",t.currentCS);r&&l.default.setProperties(d,{numalign:r,denomalign:r}),t.Push(d)},e.AmsMethods.Genfrac=function(t,e,r,n,o,i){null==r&&(r=t.GetDelimiterArg(e)),null==n&&(n=t.GetDelimiterArg(e)),null==o&&(o=t.GetArgument(e)),null==i&&(i=a.default.trimSpaces(t.GetArgument(e)));var s=t.ParseArg(e),c=t.ParseArg(e),u=t.create("node","mfrac",[s,c]);if(""!==o&&l.default.setAttribute(u,"linethickness",o),(r||n)&&(l.default.setProperty(u,"withDelims",!0),u=a.default.fixedFence(t.configuration,r,u,n)),""!==i){var h=parseInt(i,10),d=["D","T","S","SS"][h];if(null==d)throw new p.default("BadMathStyleFor","Bad math style for %1",t.currentCS);u=t.create("node","mstyle",[u]),"D"===d?l.default.setProperties(u,{displaystyle:!0,scriptlevel:0}):l.default.setProperties(u,{displaystyle:!1,scriptlevel:h-1})}t.Push(u)},e.AmsMethods.HandleTag=function(t,e){if(!t.tags.currentTag.taggable&&t.tags.env)throw new p.default("CommandNotAllowedInEnv","%1 not allowed in %2 environment",t.currentCS,t.tags.env);if(t.tags.currentTag.tag)throw new p.default("MultipleCommand","Multiple %1",t.currentCS);var r=t.GetStar(),n=a.default.trimSpaces(t.GetArgument(e));t.tags.tag(n,r)},e.AmsMethods.HandleNoTag=d.default.HandleNoTag,e.AmsMethods.HandleRef=d.default.HandleRef,e.AmsMethods.Macro=d.default.Macro,e.AmsMethods.Accent=d.default.Accent,e.AmsMethods.Tilde=d.default.Tilde,e.AmsMethods.Array=d.default.Array,e.AmsMethods.Spacer=d.default.Spacer,e.AmsMethods.NamedOp=d.default.NamedOp,e.AmsMethods.EqnArray=d.default.EqnArray,e.AmsMethods.Equation=d.default.Equation},583:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.AmsCdConfiguration=void 0;var n=r(9899);r(8289),e.AmsCdConfiguration=n.Configuration.create("amscd",{handler:{character:["amscd_special"],macro:["amscd_macros"],environment:["amscd_environment"]},options:{amscd:{colspace:"5pt",rowspace:"5pt",harrowsize:"2.75em",varrowsize:"1.75em",hideHorizontalLabels:!1}}})},8289:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var s=i(r(9140)),l=a(r(5450)),c=a(r(7819));new s.EnvironmentMap("amscd_environment",l.default.environment,{CD:"CD"},c.default),new s.CommandMap("amscd_macros",{minCDarrowwidth:"minCDarrowwidth",minCDarrowheight:"minCDarrowheight"},c.default),new s.MacroMap("amscd_special",{"@":"arrow"},c.default)},7819:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=n(r(8417)),i=r(2942),a=r(9007),s=n(r(1256)),l={CD:function(t,e){t.Push(e);var r=t.itemFactory.create("array"),n=t.configuration.options.amscd;return r.setProperties({minw:t.stack.env.CD_minw||n.harrowsize,minh:t.stack.env.CD_minh||n.varrowsize}),r.arraydef={columnalign:"center",columnspacing:n.colspace,rowspacing:n.rowspace,displaystyle:!0},r},arrow:function(t,e){var r=t.string.charAt(t.i);if(!r.match(/[><VA.|=]/))return(0,i.Other)(t,e);t.i++;var n=t.stack.Top();n.isKind("array")&&!n.Size()||(l.cell(t,e),n=t.stack.Top());for(var c,u=n,p=u.table.length%2==1,h=(u.row.length+(p?0:1))%2;h;)l.cell(t,e),h--;var d={minsize:u.getProperty("minw"),stretchy:!0},f={minsize:u.getProperty("minh"),stretchy:!0,symmetric:!0,lspace:0,rspace:0};if("."===r);else if("|"===r)c=t.create("token","mo",f,"\u2225");else if("="===r)c=t.create("token","mo",d,"=");else{var m={">":"\u2192","<":"\u2190",V:"\u2193",A:"\u2191"}[r],y=t.GetUpTo(e+r,r),g=t.GetUpTo(e+r,r);if(">"===r||"<"===r){if(c=t.create("token","mo",d,m),y||(y="\\kern "+u.getProperty("minw")),y||g){var b={width:"+.67em",lspace:".33em"};if(c=t.create("node","munderover",[c]),y){var v=new o.default(y,t.stack.env,t.configuration).mml(),_=t.create("node","mpadded",[v],b);s.default.setAttribute(_,"voffset",".1em"),s.default.setChild(c,c.over,_)}if(g){var S=new o.default(g,t.stack.env,t.configuration).mml();s.default.setChild(c,c.under,t.create("node","mpadded",[S],b))}t.configuration.options.amscd.hideHorizontalLabels&&(c=t.create("node","mpadded",c,{depth:0,height:".67em"}))}}else{var x=t.create("token","mo",f,m);c=x,(y||g)&&(c=t.create("node","mrow"),y&&s.default.appendChildren(c,[new o.default("\\scriptstyle\\llap{"+y+"}",t.stack.env,t.configuration).mml()]),x.texClass=a.TEXCLASS.ORD,s.default.appendChildren(c,[x]),g&&s.default.appendChildren(c,[new o.default("\\scriptstyle\\rlap{"+g+"}",t.stack.env,t.configuration).mml()]))}}c&&t.Push(c),l.cell(t,e)},cell:function(t,e){var r=t.stack.Top();(r.table||[]).length%2==0&&0===(r.row||[]).length&&t.Push(t.create("node","mpadded",[],{height:"8.5pt",depth:"2pt"})),t.Push(t.itemFactory.create("cell").setProperties({isEntry:!0,name:e}))},minCDarrowwidth:function(t,e){t.stack.env.CD_minw=t.GetDimen(e)},minCDarrowheight:function(t,e){t.stack.env.CD_minh=t.GetDimen(e)}};e.default=l},1275:function(t,e,r){var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.AutoloadConfiguration=void 0;var i=r(9899),a=r(9140),s=r(8803),l=r(7741),c=r(265),u=r(7233);function p(t,e,r,i){var a,s,u,p;if(c.Package.packages.has(t.options.require.prefix+r)){var f=t.options.autoload[r],m=n(2===f.length&&Array.isArray(f[0])?f:[f,[]],2),y=m[0],g=m[1];try{for(var b=o(y),v=b.next();!v.done;v=b.next()){var _=v.value;h.remove(_)}}catch(t){a={error:t}}finally{try{v&&!v.done&&(s=b.return)&&s.call(b)}finally{if(a)throw a.error}}try{for(var S=o(g),x=S.next();!x.done;x=S.next()){var M=x.value;d.remove(M)}}catch(t){u={error:t}}finally{try{x&&!x.done&&(p=S.return)&&p.call(S)}finally{if(u)throw u.error}}t.string=(i?e+" ":"\\begin{"+e.slice(1)+"}")+t.string.slice(t.i),t.i=0}(0,l.RequireLoad)(t,r)}var h=new a.CommandMap("autoload-macros",{},{}),d=new a.CommandMap("autoload-environments",{},{});e.AutoloadConfiguration=i.Configuration.create("autoload",{handler:{macro:["autoload-macros"],environment:["autoload-environments"]},options:{autoload:(0,u.expandable)({action:["toggle","mathtip","texttip"],amscd:[[],["CD"]],bbox:["bbox"],boldsymbol:["boldsymbol"],braket:["bra","ket","braket","set","Bra","Ket","Braket","Set","ketbra","Ketbra"],bussproofs:[[],["prooftree"]],cancel:["cancel","bcancel","xcancel","cancelto"],color:["color","definecolor","textcolor","colorbox","fcolorbox"],enclose:["enclose"],extpfeil:["xtwoheadrightarrow","xtwoheadleftarrow","xmapsto","xlongequal","xtofrom","Newextarrow"],html:["href","class","style","cssId"],mhchem:["ce","pu"],newcommand:["newcommand","renewcommand","newenvironment","renewenvironment","def","let"],unicode:["unicode"],verb:["verb"]})},config:function(t,e){var r,i,a,c,u,f,m=e.parseOptions,y=m.handlers.get("macro"),g=m.handlers.get("environment"),b=m.options.autoload;m.packageData.set("autoload",{Autoload:p});try{for(var v=o(Object.keys(b)),_=v.next();!_.done;_=v.next()){var S=_.value,x=b[S],M=n(2===x.length&&Array.isArray(x[0])?x:[x,[]],2),O=M[0],E=M[1];try{for(var A=(a=void 0,o(O)),C=A.next();!C.done;C=A.next()){var w=C.value;y.lookup(w)&&"color"!==w||h.add(w,new s.Macro(w,p,[S,!0]))}}catch(t){a={error:t}}finally{try{C&&!C.done&&(c=A.return)&&c.call(A)}finally{if(a)throw a.error}}try{for(var T=(u=void 0,o(E)),N=T.next();!N.done;N=T.next()){var L=N.value;g.lookup(L)||d.add(L,new s.Macro(L,p,[S,!1]))}}catch(t){u={error:t}}finally{try{N&&!N.done&&(f=T.return)&&f.call(T)}finally{if(u)throw u.error}}}}catch(t){r={error:t}}finally{try{_&&!_.done&&(i=v.return)&&i.call(v)}finally{if(r)throw r.error}}m.packageData.get("require")||l.RequireConfiguration.config(t,e)},init:function(t){t.options.require||(0,u.defaultOptions)(t.options,l.RequireConfiguration.options)},priority:10})},2942:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),s=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&a(e,t,r);return s(e,t),e},c=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},u=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.BaseConfiguration=e.BaseTags=e.Other=void 0;var p=r(9899),h=r(2947),d=u(r(3971)),f=u(r(1256)),m=r(9140),y=l(r(1181)),g=r(6521);r(1267);var b=r(4082);function v(t,e){var r=t.stack.env.font?{mathvariant:t.stack.env.font}:{},n=h.MapHandler.getMap("remap").lookup(e),o=(0,b.getRange)(e),i=o?o[3]:"mo",a=t.create("token",i,r,n?n.char:e);o[4]&&a.attributes.set("mathvariant",o[4]),"mo"===i&&(f.default.setProperty(a,"fixStretchy",!0),t.configuration.addNode("fixStretchy",a)),t.Push(a)}new m.CharacterMap("remap",null,{"-":"\u2212","*":"\u2217","`":"\u2018"}),e.Other=v;var _=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e}(g.AbstractTags);e.BaseTags=_,e.BaseConfiguration=p.Configuration.create("base",{handler:{character:["command","special","letter","digit"],delimiter:["delimiter"],macro:["delimiter","macros","mathchar0mi","mathchar0mo","mathchar7"],environment:["environment"]},fallback:{character:v,macro:function(t,e){throw new d.default("UndefinedControlSequence","Undefined control sequence %1","\\"+e)},environment:function(t,e){throw new d.default("UnknownEnv","Unknown environment '%1'",e)}},items:(o={},o[y.StartItem.prototype.kind]=y.StartItem,o[y.StopItem.prototype.kind]=y.StopItem,o[y.OpenItem.prototype.kind]=y.OpenItem,o[y.CloseItem.prototype.kind]=y.CloseItem,o[y.PrimeItem.prototype.kind]=y.PrimeItem,o[y.SubsupItem.prototype.kind]=y.SubsupItem,o[y.OverItem.prototype.kind]=y.OverItem,o[y.LeftItem.prototype.kind]=y.LeftItem,o[y.Middle.prototype.kind]=y.Middle,o[y.RightItem.prototype.kind]=y.RightItem,o[y.BeginItem.prototype.kind]=y.BeginItem,o[y.EndItem.prototype.kind]=y.EndItem,o[y.StyleItem.prototype.kind]=y.StyleItem,o[y.PositionItem.prototype.kind]=y.PositionItem,o[y.CellItem.prototype.kind]=y.CellItem,o[y.MmlItem.prototype.kind]=y.MmlItem,o[y.FnItem.prototype.kind]=y.FnItem,o[y.NotItem.prototype.kind]=y.NotItem,o[y.NonscriptItem.prototype.kind]=y.NonscriptItem,o[y.DotsItem.prototype.kind]=y.DotsItem,o[y.ArrayItem.prototype.kind]=y.ArrayItem,o[y.EqnArrayItem.prototype.kind]=y.EqnArrayItem,o[y.EquationItem.prototype.kind]=y.EquationItem,o),options:{maxMacros:1e3,baseURL:"undefined"==typeof document||0===document.getElementsByTagName("base").length?"":String(document.location).replace(/#.*$/,"")},tags:{base:_},postprocessors:[[function(t){var e,r,n=t.data;try{for(var o=c(n.getList("nonscript")),i=o.next();!i.done;i=o.next()){var a=i.value;if(a.attributes.get("scriptlevel")>0){var s=a.parent;if(s.childNodes.splice(s.childIndex(a),1),n.removeFromList(a.kind,[a]),a.isKind("mrow")){var l=a.childNodes[0];n.removeFromList("mstyle",[l]),n.removeFromList("mspace",l.childNodes[0].childNodes)}}else a.isKind("mrow")&&(a.parent.replaceChild(a.childNodes[0],a),n.removeFromList("mrow",[a]))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}},-4]]})},1181:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.EquationItem=e.EqnArrayItem=e.ArrayItem=e.DotsItem=e.NonscriptItem=e.NotItem=e.FnItem=e.MmlItem=e.CellItem=e.PositionItem=e.StyleItem=e.EndItem=e.BeginItem=e.RightItem=e.Middle=e.LeftItem=e.OverItem=e.SubsupItem=e.PrimeItem=e.CloseItem=e.OpenItem=e.StopItem=e.StartItem=void 0;var l=r(2947),c=r(5368),u=r(9007),p=s(r(3971)),h=s(r(1130)),d=s(r(1256)),f=r(8292),m=function(t){function e(e,r){var n=t.call(this,e)||this;return n.global=r,n}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"start"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.checkItem=function(e){if(e.isKind("stop")){var r=this.toMml();return this.global.isInner||(r=this.factory.configuration.tags.finalize(r,this.env)),[[this.factory.create("mml",r)],!0]}return t.prototype.checkItem.call(this,e)},e}(f.BaseItem);e.StartItem=m;var y=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"stop"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isClose",{get:function(){return!0},enumerable:!1,configurable:!0}),e}(f.BaseItem);e.StopItem=y;var g=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"open"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.checkItem=function(e){if(e.isKind("close")){var r=this.toMml(),n=this.create("node","TeXAtom",[r]);return[[this.factory.create("mml",n)],!0]}return t.prototype.checkItem.call(this,e)},e.errors=Object.assign(Object.create(f.BaseItem.errors),{stop:["ExtraOpenMissingClose","Extra open brace or missing close brace"]}),e}(f.BaseItem);e.OpenItem=g;var b=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"close"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isClose",{get:function(){return!0},enumerable:!1,configurable:!0}),e}(f.BaseItem);e.CloseItem=b;var v=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"prime"},enumerable:!1,configurable:!0}),e.prototype.checkItem=function(t){var e=i(this.Peek(2),2),r=e[0],n=e[1];return!d.default.isType(r,"msubsup")||d.default.isType(r,"msup")?[[this.create("node","msup",[r,n]),t],!0]:(d.default.setChild(r,r.sup,n),[[r,t],!0])},e}(f.BaseItem);e.PrimeItem=v;var _=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"subsup"},enumerable:!1,configurable:!0}),e.prototype.checkItem=function(e){if(e.isKind("open")||e.isKind("left"))return f.BaseItem.success;var r=this.First,n=this.getProperty("position");if(e.isKind("mml")){if(this.getProperty("primes"))if(2!==n)d.default.setChild(r,2,this.getProperty("primes"));else{d.default.setProperty(this.getProperty("primes"),"variantForm",!0);var o=this.create("node","mrow",[this.getProperty("primes"),e.First]);e.First=o}return d.default.setChild(r,n,e.First),null!=this.getProperty("movesupsub")&&d.default.setProperty(r,"movesupsub",this.getProperty("movesupsub")),[[this.factory.create("mml",r)],!0]}if(t.prototype.checkItem.call(this,e)[1]){var s=this.getErrors(["","sub","sup"][n]);throw new(p.default.bind.apply(p.default,a([void 0,s[0],s[1]],i(s.splice(2)),!1)))}return null},e.errors=Object.assign(Object.create(f.BaseItem.errors),{stop:["MissingScript","Missing superscript or subscript argument"],sup:["MissingOpenForSup","Missing open brace for superscript"],sub:["MissingOpenForSub","Missing open brace for subscript"]}),e}(f.BaseItem);e.SubsupItem=_;var S=function(t){function e(e){var r=t.call(this,e)||this;return r.setProperty("name","\\over"),r}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"over"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isClose",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.checkItem=function(e){if(e.isKind("over"))throw new p.default("AmbiguousUseOf","Ambiguous use of %1",e.getName());if(e.isClose){var r=this.create("node","mfrac",[this.getProperty("num"),this.toMml(!1)]);return null!=this.getProperty("thickness")&&d.default.setAttribute(r,"linethickness",this.getProperty("thickness")),(this.getProperty("open")||this.getProperty("close"))&&(d.default.setProperty(r,"withDelims",!0),r=h.default.fixedFence(this.factory.configuration,this.getProperty("open"),r,this.getProperty("close"))),[[this.factory.create("mml",r),e],!0]}return t.prototype.checkItem.call(this,e)},e.prototype.toString=function(){return"over["+this.getProperty("num")+" / "+this.nodes.join("; ")+"]"},e}(f.BaseItem);e.OverItem=S;var x=function(t){function e(e,r){var n=t.call(this,e)||this;return n.setProperty("delim",r),n}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"left"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.checkItem=function(e){if(e.isKind("right"))return[[this.factory.create("mml",h.default.fenced(this.factory.configuration,this.getProperty("delim"),this.toMml(),e.getProperty("delim"),"",e.getProperty("color")))],!0];if(e.isKind("middle")){var r={stretchy:!0};return e.getProperty("color")&&(r.mathcolor=e.getProperty("color")),this.Push(this.create("node","TeXAtom",[],{texClass:u.TEXCLASS.CLOSE}),this.create("token","mo",r,e.getProperty("delim")),this.create("node","TeXAtom",[],{texClass:u.TEXCLASS.OPEN})),this.env={},[[this],!0]}return t.prototype.checkItem.call(this,e)},e.errors=Object.assign(Object.create(f.BaseItem.errors),{stop:["ExtraLeftMissingRight","Extra \\left or missing \\right"]}),e}(f.BaseItem);e.LeftItem=x;var M=function(t){function e(e,r,n){var o=t.call(this,e)||this;return o.setProperty("delim",r),n&&o.setProperty("color",n),o}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"middle"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isClose",{get:function(){return!0},enumerable:!1,configurable:!0}),e}(f.BaseItem);e.Middle=M;var O=function(t){function e(e,r,n){var o=t.call(this,e)||this;return o.setProperty("delim",r),n&&o.setProperty("color",n),o}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"right"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isClose",{get:function(){return!0},enumerable:!1,configurable:!0}),e}(f.BaseItem);e.RightItem=O;var E=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"begin"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.checkItem=function(e){if(e.isKind("end")){if(e.getName()!==this.getName())throw new p.default("EnvBadEnd","\\begin{%1} ended with \\end{%2}",this.getName(),e.getName());return this.getProperty("end")?f.BaseItem.fail:[[this.factory.create("mml",this.toMml())],!0]}if(e.isKind("stop"))throw new p.default("EnvMissingEnd","Missing \\end{%1}",this.getName());return t.prototype.checkItem.call(this,e)},e}(f.BaseItem);e.BeginItem=E;var A=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"end"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isClose",{get:function(){return!0},enumerable:!1,configurable:!0}),e}(f.BaseItem);e.EndItem=A;var C=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"style"},enumerable:!1,configurable:!0}),e.prototype.checkItem=function(e){if(!e.isClose)return t.prototype.checkItem.call(this,e);var r=this.create("node","mstyle",this.nodes,this.getProperty("styles"));return[[this.factory.create("mml",r),e],!0]},e}(f.BaseItem);e.StyleItem=C;var w=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"position"},enumerable:!1,configurable:!0}),e.prototype.checkItem=function(e){if(e.isClose)throw new p.default("MissingBoxFor","Missing box for %1",this.getName());if(e.isFinal){var r=e.toMml();switch(this.getProperty("move")){case"vertical":return r=this.create("node","mpadded",[r],{height:this.getProperty("dh"),depth:this.getProperty("dd"),voffset:this.getProperty("dh")}),[[this.factory.create("mml",r)],!0];case"horizontal":return[[this.factory.create("mml",this.getProperty("left")),e,this.factory.create("mml",this.getProperty("right"))],!0]}}return t.prototype.checkItem.call(this,e)},e}(f.BaseItem);e.PositionItem=w;var T=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"cell"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isClose",{get:function(){return!0},enumerable:!1,configurable:!0}),e}(f.BaseItem);e.CellItem=T;var N=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"isFinal",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"kind",{get:function(){return"mml"},enumerable:!1,configurable:!0}),e}(f.BaseItem);e.MmlItem=N;var L=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"fn"},enumerable:!1,configurable:!0}),e.prototype.checkItem=function(e){var r=this.First;if(r){if(e.isOpen)return f.BaseItem.success;if(!e.isKind("fn")){var n=e.First;if(!e.isKind("mml")||!n)return[[r,e],!0];if(d.default.isType(n,"mstyle")&&n.childNodes.length&&d.default.isType(n.childNodes[0].childNodes[0],"mspace")||d.default.isType(n,"mspace"))return[[r,e],!0];d.default.isEmbellished(n)&&(n=d.default.getCoreMO(n));var o=d.default.getForm(n);if(null!=o&&[0,0,1,1,0,1,1,0,0,0][o[2]])return[[r,e],!0]}var i=this.create("token","mo",{texClass:u.TEXCLASS.NONE},c.entities.ApplyFunction);return[[r,i,e],!0]}return t.prototype.checkItem.apply(this,arguments)},e}(f.BaseItem);e.FnItem=L;var P=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.remap=l.MapHandler.getMap("not_remap"),e}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"not"},enumerable:!1,configurable:!0}),e.prototype.checkItem=function(t){var e,r,n;if(t.isKind("open")||t.isKind("left"))return f.BaseItem.success;if(t.isKind("mml")&&(d.default.isType(t.First,"mo")||d.default.isType(t.First,"mi")||d.default.isType(t.First,"mtext"))&&(e=t.First,1===(r=d.default.getText(e)).length&&!d.default.getProperty(e,"movesupsub")&&1===d.default.getChildren(e).length))return this.remap.contains(r)?(n=this.create("text",this.remap.lookup(r).char),d.default.setChild(e,0,n)):(n=this.create("text","\u0338"),d.default.appendChildren(e,[n])),[[t],!0];n=this.create("text","\u29f8");var o=this.create("node","mtext",[],{},n),i=this.create("node","mpadded",[o],{width:0});return[[e=this.create("node","TeXAtom",[i],{texClass:u.TEXCLASS.REL}),t],!0]},e}(f.BaseItem);e.NotItem=P;var I=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"nonscript"},enumerable:!1,configurable:!0}),e.prototype.checkItem=function(t){if(t.isKind("mml")&&1===t.Size()){var e=t.First;if(e.isKind("mstyle")&&e.notParent&&(e=d.default.getChildren(d.default.getChildren(e)[0])[0]),e.isKind("mspace")){if(e!==t.First){var r=this.create("node","mrow",[t.Pop()]);t.Push(r)}this.factory.configuration.addNode("nonscript",t.First)}}return[[t],!0]},e}(f.BaseItem);e.NonscriptItem=I;var k=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"dots"},enumerable:!1,configurable:!0}),e.prototype.checkItem=function(t){if(t.isKind("open")||t.isKind("left"))return f.BaseItem.success;var e=this.getProperty("ldots"),r=t.First;if(t.isKind("mml")&&d.default.isEmbellished(r)){var n=d.default.getTexClass(d.default.getCoreMO(r));n!==u.TEXCLASS.BIN&&n!==u.TEXCLASS.REL||(e=this.getProperty("cdots"))}return[[e,t],!0]},e}(f.BaseItem);e.DotsItem=k;var R=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.table=[],e.row=[],e.frame=[],e.hfill=[],e.arraydef={},e.dashed=!1,e}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"array"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"copyEnv",{get:function(){return!1},enumerable:!1,configurable:!0}),e.prototype.checkItem=function(e){if(e.isClose&&!e.isKind("over")){if(e.getProperty("isEntry"))return this.EndEntry(),this.clearEnv(),f.BaseItem.fail;if(e.getProperty("isCR"))return this.EndEntry(),this.EndRow(),this.clearEnv(),f.BaseItem.fail;this.EndTable(),this.clearEnv();var r=this.factory.create("mml",this.createMml());if(this.getProperty("requireClose")){if(e.isKind("close"))return[[r],!0];throw new p.default("MissingCloseBrace","Missing close brace")}return[[r,e],!0]}return t.prototype.checkItem.call(this,e)},e.prototype.createMml=function(){var t=this.arraydef.scriptlevel;delete this.arraydef.scriptlevel;var e=this.create("node","mtable",this.table,this.arraydef);return t&&e.setProperty("scriptlevel",t),4===this.frame.length?d.default.setAttribute(e,"frame",this.dashed?"dashed":"solid"):this.frame.length&&(this.arraydef.rowlines&&(this.arraydef.rowlines=this.arraydef.rowlines.replace(/none( none)+$/,"none")),d.default.setAttribute(e,"frame",""),e=this.create("node","menclose",[e],{notation:this.frame.join(" ")}),"none"===(this.arraydef.columnlines||"none")&&"none"===(this.arraydef.rowlines||"none")||d.default.setAttribute(e,"data-padding",0)),(this.getProperty("open")||this.getProperty("close"))&&(e=h.default.fenced(this.factory.configuration,this.getProperty("open"),e,this.getProperty("close"))),e},e.prototype.EndEntry=function(){var t=this.create("node","mtd",this.nodes);this.hfill.length&&(0===this.hfill[0]&&d.default.setAttribute(t,"columnalign","right"),this.hfill[this.hfill.length-1]===this.Size()&&d.default.setAttribute(t,"columnalign",d.default.getAttribute(t,"columnalign")?"center":"left")),this.row.push(t),this.Clear(),this.hfill=[]},e.prototype.EndRow=function(){var t;this.getProperty("isNumbered")&&3===this.row.length?(this.row.unshift(this.row.pop()),t=this.create("node","mlabeledtr",this.row)):t=this.create("node","mtr",this.row),this.table.push(t),this.row=[]},e.prototype.EndTable=function(){(this.Size()||this.row.length)&&(this.EndEntry(),this.EndRow()),this.checkLines()},e.prototype.checkLines=function(){if(this.arraydef.rowlines){var t=this.arraydef.rowlines.split(/ /);t.length===this.table.length?(this.frame.push("bottom"),t.pop(),this.arraydef.rowlines=t.join(" ")):t.length<this.table.length-1&&(this.arraydef.rowlines+=" none")}if(this.getProperty("rowspacing")){for(var e=this.arraydef.rowspacing.split(/ /);e.length<this.table.length;)e.push(this.getProperty("rowspacing")+"em");this.arraydef.rowspacing=e.join(" ")}},e.prototype.addRowSpacing=function(t){if(this.arraydef.rowspacing){var e=this.arraydef.rowspacing.split(/ /);if(!this.getProperty("rowspacing")){var r=h.default.dimen2em(e[0]);this.setProperty("rowspacing",r)}for(var n=this.getProperty("rowspacing");e.length<this.table.length;)e.push(h.default.Em(n));e[this.table.length-1]=h.default.Em(Math.max(0,n+h.default.dimen2em(t))),this.arraydef.rowspacing=e.join(" ")}},e}(f.BaseItem);e.ArrayItem=R;var j=function(t){function e(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=t.call(this,e)||this;return o.maxrow=0,o.factory.configuration.tags.start(r[0],r[2],r[1]),o}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"eqnarray"},enumerable:!1,configurable:!0}),e.prototype.EndEntry=function(){this.row.length&&h.default.fixInitialMO(this.factory.configuration,this.nodes);var t=this.create("node","mtd",this.nodes);this.row.push(t),this.Clear()},e.prototype.EndRow=function(){this.row.length>this.maxrow&&(this.maxrow=this.row.length);var t="mtr",e=this.factory.configuration.tags.getTag();e&&(this.row=[e].concat(this.row),t="mlabeledtr"),this.factory.configuration.tags.clearTag();var r=this.create("node",t,this.row);this.table.push(r),this.row=[]},e.prototype.EndTable=function(){t.prototype.EndTable.call(this),this.factory.configuration.tags.end(),this.extendArray("columnalign",this.maxrow),this.extendArray("columnwidth",this.maxrow),this.extendArray("columnspacing",this.maxrow-1)},e.prototype.extendArray=function(t,e){if(this.arraydef[t]){var r=this.arraydef[t].split(/ /),n=a([],i(r),!1);if(n.length>1){for(;n.length<e;)n.push.apply(n,a([],i(r),!1));this.arraydef[t]=n.slice(0,e).join(" ")}}},e}(R);e.EqnArrayItem=j;var B=function(t){function e(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var o=t.call(this,e)||this;return o.factory.configuration.tags.start("equation",!0,r[0]),o}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"equation"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.checkItem=function(e){if(e.isKind("end")){var r=this.toMml(),n=this.factory.configuration.tags.getTag();return this.factory.configuration.tags.end(),[[n?this.factory.configuration.tags.enTag(r,n):r,e],!0]}if(e.isKind("stop"))throw new p.default("EnvMissingEnd","Missing \\end{%1}",this.getName());return t.prototype.checkItem.call(this,e)},e}(f.BaseItem);e.EquationItem=B},1267:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var s=i(r(9140)),l=r(8317),c=a(r(7693)),u=a(r(5450)),p=a(r(1130)),h=r(9007),d=r(6010);new s.RegExpMap("letter",u.default.variable,/[a-z]/i),new s.RegExpMap("digit",u.default.digit,/[0-9.,]/),new s.RegExpMap("command",u.default.controlSequence,/^\\/),new s.MacroMap("special",{"{":"Open","}":"Close","~":"Tilde","^":"Superscript",_:"Subscript"," ":"Space","\t":"Space","\r":"Space","\n":"Space","'":"Prime","%":"Comment","&":"Entry","#":"Hash","\xa0":"Space","\u2019":"Prime"},c.default),new s.CharacterMap("mathchar0mi",u.default.mathchar0mi,{alpha:"\u03b1",beta:"\u03b2",gamma:"\u03b3",delta:"\u03b4",epsilon:"\u03f5",zeta:"\u03b6",eta:"\u03b7",theta:"\u03b8",iota:"\u03b9",kappa:"\u03ba",lambda:"\u03bb",mu:"\u03bc",nu:"\u03bd",xi:"\u03be",omicron:"\u03bf",pi:"\u03c0",rho:"\u03c1",sigma:"\u03c3",tau:"\u03c4",upsilon:"\u03c5",phi:"\u03d5",chi:"\u03c7",psi:"\u03c8",omega:"\u03c9",varepsilon:"\u03b5",vartheta:"\u03d1",varpi:"\u03d6",varrho:"\u03f1",varsigma:"\u03c2",varphi:"\u03c6",S:["\xa7",{mathvariant:l.TexConstant.Variant.NORMAL}],aleph:["\u2135",{mathvariant:l.TexConstant.Variant.NORMAL}],hbar:["\u210f",{variantForm:!0}],imath:"\u0131",jmath:"\u0237",ell:"\u2113",wp:["\u2118",{mathvariant:l.TexConstant.Variant.NORMAL}],Re:["\u211c",{mathvariant:l.TexConstant.Variant.NORMAL}],Im:["\u2111",{mathvariant:l.TexConstant.Variant.NORMAL}],partial:["\u2202",{mathvariant:l.TexConstant.Variant.ITALIC}],infty:["\u221e",{mathvariant:l.TexConstant.Variant.NORMAL}],prime:["\u2032",{variantForm:!0}],emptyset:["\u2205",{mathvariant:l.TexConstant.Variant.NORMAL}],nabla:["\u2207",{mathvariant:l.TexConstant.Variant.NORMAL}],top:["\u22a4",{mathvariant:l.TexConstant.Variant.NORMAL}],bot:["\u22a5",{mathvariant:l.TexConstant.Variant.NORMAL}],angle:["\u2220",{mathvariant:l.TexConstant.Variant.NORMAL}],triangle:["\u25b3",{mathvariant:l.TexConstant.Variant.NORMAL}],backslash:["\u2216",{mathvariant:l.TexConstant.Variant.NORMAL}],forall:["\u2200",{mathvariant:l.TexConstant.Variant.NORMAL}],exists:["\u2203",{mathvariant:l.TexConstant.Variant.NORMAL}],neg:["\xac",{mathvariant:l.TexConstant.Variant.NORMAL}],lnot:["\xac",{mathvariant:l.TexConstant.Variant.NORMAL}],flat:["\u266d",{mathvariant:l.TexConstant.Variant.NORMAL}],natural:["\u266e",{mathvariant:l.TexConstant.Variant.NORMAL}],sharp:["\u266f",{mathvariant:l.TexConstant.Variant.NORMAL}],clubsuit:["\u2663",{mathvariant:l.TexConstant.Variant.NORMAL}],diamondsuit:["\u2662",{mathvariant:l.TexConstant.Variant.NORMAL}],heartsuit:["\u2661",{mathvariant:l.TexConstant.Variant.NORMAL}],spadesuit:["\u2660",{mathvariant:l.TexConstant.Variant.NORMAL}]}),new s.CharacterMap("mathchar0mo",u.default.mathchar0mo,{surd:"\u221a",coprod:["\u2210",{texClass:h.TEXCLASS.OP,movesupsub:!0}],bigvee:["\u22c1",{texClass:h.TEXCLASS.OP,movesupsub:!0}],bigwedge:["\u22c0",{texClass:h.TEXCLASS.OP,movesupsub:!0}],biguplus:["\u2a04",{texClass:h.TEXCLASS.OP,movesupsub:!0}],bigcap:["\u22c2",{texClass:h.TEXCLASS.OP,movesupsub:!0}],bigcup:["\u22c3",{texClass:h.TEXCLASS.OP,movesupsub:!0}],int:["\u222b",{texClass:h.TEXCLASS.OP}],intop:["\u222b",{texClass:h.TEXCLASS.OP,movesupsub:!0,movablelimits:!0}],iint:["\u222c",{texClass:h.TEXCLASS.OP}],iiint:["\u222d",{texClass:h.TEXCLASS.OP}],prod:["\u220f",{texClass:h.TEXCLASS.OP,movesupsub:!0}],sum:["\u2211",{texClass:h.TEXCLASS.OP,movesupsub:!0}],bigotimes:["\u2a02",{texClass:h.TEXCLASS.OP,movesupsub:!0}],bigoplus:["\u2a01",{texClass:h.TEXCLASS.OP,movesupsub:!0}],bigodot:["\u2a00",{texClass:h.TEXCLASS.OP,movesupsub:!0}],oint:["\u222e",{texClass:h.TEXCLASS.OP}],bigsqcup:["\u2a06",{texClass:h.TEXCLASS.OP,movesupsub:!0}],smallint:["\u222b",{largeop:!1}],triangleleft:"\u25c3",triangleright:"\u25b9",bigtriangleup:"\u25b3",bigtriangledown:"\u25bd",wedge:"\u2227",land:"\u2227",vee:"\u2228",lor:"\u2228",cap:"\u2229",cup:"\u222a",ddagger:"\u2021",dagger:"\u2020",sqcap:"\u2293",sqcup:"\u2294",uplus:"\u228e",amalg:"\u2a3f",diamond:"\u22c4",bullet:"\u2219",wr:"\u2240",div:"\xf7",divsymbol:"\xf7",odot:["\u2299",{largeop:!1}],oslash:["\u2298",{largeop:!1}],otimes:["\u2297",{largeop:!1}],ominus:["\u2296",{largeop:!1}],oplus:["\u2295",{largeop:!1}],mp:"\u2213",pm:"\xb1",circ:"\u2218",bigcirc:"\u25ef",setminus:"\u2216",cdot:"\u22c5",ast:"\u2217",times:"\xd7",star:"\u22c6",propto:"\u221d",sqsubseteq:"\u2291",sqsupseteq:"\u2292",parallel:"\u2225",mid:"\u2223",dashv:"\u22a3",vdash:"\u22a2",leq:"\u2264",le:"\u2264",geq:"\u2265",ge:"\u2265",lt:"<",gt:">",succ:"\u227b",prec:"\u227a",approx:"\u2248",succeq:"\u2ab0",preceq:"\u2aaf",supset:"\u2283",subset:"\u2282",supseteq:"\u2287",subseteq:"\u2286",in:"\u2208",ni:"\u220b",notin:"\u2209",owns:"\u220b",gg:"\u226b",ll:"\u226a",sim:"\u223c",simeq:"\u2243",perp:"\u22a5",equiv:"\u2261",asymp:"\u224d",smile:"\u2323",frown:"\u2322",ne:"\u2260",neq:"\u2260",cong:"\u2245",doteq:"\u2250",bowtie:"\u22c8",models:"\u22a8",notChar:"\u29f8",Leftrightarrow:"\u21d4",Leftarrow:"\u21d0",Rightarrow:"\u21d2",leftrightarrow:"\u2194",leftarrow:"\u2190",gets:"\u2190",rightarrow:"\u2192",to:["\u2192",{accent:!1}],mapsto:"\u21a6",leftharpoonup:"\u21bc",leftharpoondown:"\u21bd",rightharpoonup:"\u21c0",rightharpoondown:"\u21c1",nearrow:"\u2197",searrow:"\u2198",nwarrow:"\u2196",swarrow:"\u2199",rightleftharpoons:"\u21cc",hookrightarrow:"\u21aa",hookleftarrow:"\u21a9",longleftarrow:"\u27f5",Longleftarrow:"\u27f8",longrightarrow:"\u27f6",Longrightarrow:"\u27f9",Longleftrightarrow:"\u27fa",longleftrightarrow:"\u27f7",longmapsto:"\u27fc",ldots:"\u2026",cdots:"\u22ef",vdots:"\u22ee",ddots:"\u22f1",dotsc:"\u2026",dotsb:"\u22ef",dotsm:"\u22ef",dotsi:"\u22ef",dotso:"\u2026",ldotp:[".",{texClass:h.TEXCLASS.PUNCT}],cdotp:["\u22c5",{texClass:h.TEXCLASS.PUNCT}],colon:[":",{texClass:h.TEXCLASS.PUNCT}]}),new s.CharacterMap("mathchar7",u.default.mathchar7,{Gamma:"\u0393",Delta:"\u0394",Theta:"\u0398",Lambda:"\u039b",Xi:"\u039e",Pi:"\u03a0",Sigma:"\u03a3",Upsilon:"\u03a5",Phi:"\u03a6",Psi:"\u03a8",Omega:"\u03a9",_:"_","#":"#",$:"$","%":"%","&":"&",And:"&"}),new s.DelimiterMap("delimiter",u.default.delimiter,{"(":"(",")":")","[":"[","]":"]","<":"\u27e8",">":"\u27e9","\\lt":"\u27e8","\\gt":"\u27e9","/":"/","|":["|",{texClass:h.TEXCLASS.ORD}],".":"","\\\\":"\\","\\lmoustache":"\u23b0","\\rmoustache":"\u23b1","\\lgroup":"\u27ee","\\rgroup":"\u27ef","\\arrowvert":"\u23d0","\\Arrowvert":"\u2016","\\bracevert":"\u23aa","\\Vert":["\u2016",{texClass:h.TEXCLASS.ORD}],"\\|":["\u2016",{texClass:h.TEXCLASS.ORD}],"\\vert":["|",{texClass:h.TEXCLASS.ORD}],"\\uparrow":"\u2191","\\downarrow":"\u2193","\\updownarrow":"\u2195","\\Uparrow":"\u21d1","\\Downarrow":"\u21d3","\\Updownarrow":"\u21d5","\\backslash":"\\","\\rangle":"\u27e9","\\langle":"\u27e8","\\rbrace":"}","\\lbrace":"{","\\}":"}","\\{":"{","\\rceil":"\u2309","\\lceil":"\u2308","\\rfloor":"\u230b","\\lfloor":"\u230a","\\lbrack":"[","\\rbrack":"]"}),new s.CommandMap("macros",{displaystyle:["SetStyle","D",!0,0],textstyle:["SetStyle","T",!1,0],scriptstyle:["SetStyle","S",!1,1],scriptscriptstyle:["SetStyle","SS",!1,2],rm:["SetFont",l.TexConstant.Variant.NORMAL],mit:["SetFont",l.TexConstant.Variant.ITALIC],oldstyle:["SetFont",l.TexConstant.Variant.OLDSTYLE],cal:["SetFont",l.TexConstant.Variant.CALLIGRAPHIC],it:["SetFont",l.TexConstant.Variant.MATHITALIC],bf:["SetFont",l.TexConstant.Variant.BOLD],bbFont:["SetFont",l.TexConstant.Variant.DOUBLESTRUCK],scr:["SetFont",l.TexConstant.Variant.SCRIPT],frak:["SetFont",l.TexConstant.Variant.FRAKTUR],sf:["SetFont",l.TexConstant.Variant.SANSSERIF],tt:["SetFont",l.TexConstant.Variant.MONOSPACE],mathrm:["MathFont",l.TexConstant.Variant.NORMAL],mathup:["MathFont",l.TexConstant.Variant.NORMAL],mathnormal:["MathFont",""],mathbf:["MathFont",l.TexConstant.Variant.BOLD],mathbfup:["MathFont",l.TexConstant.Variant.BOLD],mathit:["MathFont",l.TexConstant.Variant.MATHITALIC],mathbfit:["MathFont",l.TexConstant.Variant.BOLDITALIC],mathbb:["MathFont",l.TexConstant.Variant.DOUBLESTRUCK],Bbb:["MathFont",l.TexConstant.Variant.DOUBLESTRUCK],mathfrak:["MathFont",l.TexConstant.Variant.FRAKTUR],mathbffrak:["MathFont",l.TexConstant.Variant.BOLDFRAKTUR],mathscr:["MathFont",l.TexConstant.Variant.SCRIPT],mathbfscr:["MathFont",l.TexConstant.Variant.BOLDSCRIPT],mathsf:["MathFont",l.TexConstant.Variant.SANSSERIF],mathsfup:["MathFont",l.TexConstant.Variant.SANSSERIF],mathbfsf:["MathFont",l.TexConstant.Variant.BOLDSANSSERIF],mathbfsfup:["MathFont",l.TexConstant.Variant.BOLDSANSSERIF],mathsfit:["MathFont",l.TexConstant.Variant.SANSSERIFITALIC],mathbfsfit:["MathFont",l.TexConstant.Variant.SANSSERIFBOLDITALIC],mathtt:["MathFont",l.TexConstant.Variant.MONOSPACE],mathcal:["MathFont",l.TexConstant.Variant.CALLIGRAPHIC],mathbfcal:["MathFont",l.TexConstant.Variant.BOLDCALLIGRAPHIC],symrm:["MathFont",l.TexConstant.Variant.NORMAL],symup:["MathFont",l.TexConstant.Variant.NORMAL],symnormal:["MathFont",""],symbf:["MathFont",l.TexConstant.Variant.BOLD],symbfup:["MathFont",l.TexConstant.Variant.BOLD],symit:["MathFont",l.TexConstant.Variant.ITALIC],symbfit:["MathFont",l.TexConstant.Variant.BOLDITALIC],symbb:["MathFont",l.TexConstant.Variant.DOUBLESTRUCK],symfrak:["MathFont",l.TexConstant.Variant.FRAKTUR],symbffrak:["MathFont",l.TexConstant.Variant.BOLDFRAKTUR],symscr:["MathFont",l.TexConstant.Variant.SCRIPT],symbfscr:["MathFont",l.TexConstant.Variant.BOLDSCRIPT],symsf:["MathFont",l.TexConstant.Variant.SANSSERIF],symsfup:["MathFont",l.TexConstant.Variant.SANSSERIF],symbfsf:["MathFont",l.TexConstant.Variant.BOLDSANSSERIF],symbfsfup:["MathFont",l.TexConstant.Variant.BOLDSANSSERIF],symsfit:["MathFont",l.TexConstant.Variant.SANSSERIFITALIC],symbfsfit:["MathFont",l.TexConstant.Variant.SANSSERIFBOLDITALIC],symtt:["MathFont",l.TexConstant.Variant.MONOSPACE],symcal:["MathFont",l.TexConstant.Variant.CALLIGRAPHIC],symbfcal:["MathFont",l.TexConstant.Variant.BOLDCALLIGRAPHIC],textrm:["HBox",null,l.TexConstant.Variant.NORMAL],textup:["HBox",null,l.TexConstant.Variant.NORMAL],textnormal:["HBox"],textit:["HBox",null,l.TexConstant.Variant.ITALIC],textbf:["HBox",null,l.TexConstant.Variant.BOLD],textsf:["HBox",null,l.TexConstant.Variant.SANSSERIF],texttt:["HBox",null,l.TexConstant.Variant.MONOSPACE],tiny:["SetSize",.5],Tiny:["SetSize",.6],scriptsize:["SetSize",.7],small:["SetSize",.85],normalsize:["SetSize",1],large:["SetSize",1.2],Large:["SetSize",1.44],LARGE:["SetSize",1.73],huge:["SetSize",2.07],Huge:["SetSize",2.49],arcsin:"NamedFn",arccos:"NamedFn",arctan:"NamedFn",arg:"NamedFn",cos:"NamedFn",cosh:"NamedFn",cot:"NamedFn",coth:"NamedFn",csc:"NamedFn",deg:"NamedFn",det:"NamedOp",dim:"NamedFn",exp:"NamedFn",gcd:"NamedOp",hom:"NamedFn",inf:"NamedOp",ker:"NamedFn",lg:"NamedFn",lim:"NamedOp",liminf:["NamedOp","lim&thinsp;inf"],limsup:["NamedOp","lim&thinsp;sup"],ln:"NamedFn",log:"NamedFn",max:"NamedOp",min:"NamedOp",Pr:"NamedOp",sec:"NamedFn",sin:"NamedFn",sinh:"NamedFn",sup:"NamedOp",tan:"NamedFn",tanh:"NamedFn",limits:["Limits",1],nolimits:["Limits",0],overline:["UnderOver","2015"],underline:["UnderOver","2015"],overbrace:["UnderOver","23DE",1],underbrace:["UnderOver","23DF",1],overparen:["UnderOver","23DC"],underparen:["UnderOver","23DD"],overrightarrow:["UnderOver","2192"],underrightarrow:["UnderOver","2192"],overleftarrow:["UnderOver","2190"],underleftarrow:["UnderOver","2190"],overleftrightarrow:["UnderOver","2194"],underleftrightarrow:["UnderOver","2194"],overset:"Overset",underset:"Underset",overunderset:"Overunderset",stackrel:["Macro","\\mathrel{\\mathop{#2}\\limits^{#1}}",2],stackbin:["Macro","\\mathbin{\\mathop{#2}\\limits^{#1}}",2],over:"Over",overwithdelims:"Over",atop:"Over",atopwithdelims:"Over",above:"Over",abovewithdelims:"Over",brace:["Over","{","}"],brack:["Over","[","]"],choose:["Over","(",")"],frac:"Frac",sqrt:"Sqrt",root:"Root",uproot:["MoveRoot","upRoot"],leftroot:["MoveRoot","leftRoot"],left:"LeftRight",right:"LeftRight",middle:"LeftRight",llap:"Lap",rlap:"Lap",raise:"RaiseLower",lower:"RaiseLower",moveleft:"MoveLeftRight",moveright:"MoveLeftRight",",":["Spacer",d.MATHSPACE.thinmathspace],":":["Spacer",d.MATHSPACE.mediummathspace],">":["Spacer",d.MATHSPACE.mediummathspace],";":["Spacer",d.MATHSPACE.thickmathspace],"!":["Spacer",d.MATHSPACE.negativethinmathspace],enspace:["Spacer",.5],quad:["Spacer",1],qquad:["Spacer",2],thinspace:["Spacer",d.MATHSPACE.thinmathspace],negthinspace:["Spacer",d.MATHSPACE.negativethinmathspace],hskip:"Hskip",hspace:"Hskip",kern:"Hskip",mskip:"Hskip",mspace:"Hskip",mkern:"Hskip",rule:"rule",Rule:["Rule"],Space:["Rule","blank"],nonscript:"Nonscript",big:["MakeBig",h.TEXCLASS.ORD,.85],Big:["MakeBig",h.TEXCLASS.ORD,1.15],bigg:["MakeBig",h.TEXCLASS.ORD,1.45],Bigg:["MakeBig",h.TEXCLASS.ORD,1.75],bigl:["MakeBig",h.TEXCLASS.OPEN,.85],Bigl:["MakeBig",h.TEXCLASS.OPEN,1.15],biggl:["MakeBig",h.TEXCLASS.OPEN,1.45],Biggl:["MakeBig",h.TEXCLASS.OPEN,1.75],bigr:["MakeBig",h.TEXCLASS.CLOSE,.85],Bigr:["MakeBig",h.TEXCLASS.CLOSE,1.15],biggr:["MakeBig",h.TEXCLASS.CLOSE,1.45],Biggr:["MakeBig",h.TEXCLASS.CLOSE,1.75],bigm:["MakeBig",h.TEXCLASS.REL,.85],Bigm:["MakeBig",h.TEXCLASS.REL,1.15],biggm:["MakeBig",h.TEXCLASS.REL,1.45],Biggm:["MakeBig",h.TEXCLASS.REL,1.75],mathord:["TeXAtom",h.TEXCLASS.ORD],mathop:["TeXAtom",h.TEXCLASS.OP],mathopen:["TeXAtom",h.TEXCLASS.OPEN],mathclose:["TeXAtom",h.TEXCLASS.CLOSE],mathbin:["TeXAtom",h.TEXCLASS.BIN],mathrel:["TeXAtom",h.TEXCLASS.REL],mathpunct:["TeXAtom",h.TEXCLASS.PUNCT],mathinner:["TeXAtom",h.TEXCLASS.INNER],vcenter:["TeXAtom",h.TEXCLASS.VCENTER],buildrel:"BuildRel",hbox:["HBox",0],text:"HBox",mbox:["HBox",0],fbox:"FBox",boxed:["Macro","\\fbox{$\\displaystyle{#1}$}",1],framebox:"FrameBox",strut:"Strut",mathstrut:["Macro","\\vphantom{(}"],phantom:"Phantom",vphantom:["Phantom",1,0],hphantom:["Phantom",0,1],smash:"Smash",acute:["Accent","00B4"],grave:["Accent","0060"],ddot:["Accent","00A8"],tilde:["Accent","007E"],bar:["Accent","00AF"],breve:["Accent","02D8"],check:["Accent","02C7"],hat:["Accent","005E"],vec:["Accent","2192"],dot:["Accent","02D9"],widetilde:["Accent","007E",1],widehat:["Accent","005E",1],matrix:"Matrix",array:"Matrix",pmatrix:["Matrix","(",")"],cases:["Matrix","{","","left left",null,".1em",null,!0],eqalign:["Matrix",null,null,"right left",(0,d.em)(d.MATHSPACE.thickmathspace),".5em","D"],displaylines:["Matrix",null,null,"center",null,".5em","D"],cr:"Cr","\\":"CrLaTeX",newline:["CrLaTeX",!0],hline:["HLine","solid"],hdashline:["HLine","dashed"],eqalignno:["Matrix",null,null,"right left",(0,d.em)(d.MATHSPACE.thickmathspace),".5em","D",null,"right"],leqalignno:["Matrix",null,null,"right left",(0,d.em)(d.MATHSPACE.thickmathspace),".5em","D",null,"left"],hfill:"HFill",hfil:"HFill",hfilll:"HFill",bmod:["Macro",'\\mmlToken{mo}[lspace="thickmathspace" rspace="thickmathspace"]{mod}'],pmod:["Macro","\\pod{\\mmlToken{mi}{mod}\\kern 6mu #1}",1],mod:["Macro","\\mathchoice{\\kern18mu}{\\kern12mu}{\\kern12mu}{\\kern12mu}\\mmlToken{mi}{mod}\\,\\,#1",1],pod:["Macro","\\mathchoice{\\kern18mu}{\\kern8mu}{\\kern8mu}{\\kern8mu}(#1)",1],iff:["Macro","\\;\\Longleftrightarrow\\;"],skew:["Macro","{{#2{#3\\mkern#1mu}\\mkern-#1mu}{}}",3],pmb:["Macro","\\rlap{#1}\\kern1px{#1}",1],TeX:["Macro","T\\kern-.14em\\lower.5ex{E}\\kern-.115em X"],LaTeX:["Macro","L\\kern-.325em\\raise.21em{\\scriptstyle{A}}\\kern-.17em\\TeX"]," ":["Macro","\\text{ }"],not:"Not",dots:"Dots",space:"Tilde","\xa0":"Tilde",begin:"BeginEnd",end:"BeginEnd",label:"HandleLabel",ref:"HandleRef",nonumber:"HandleNoTag",mathchoice:"MathChoice",mmlToken:"MmlToken"},c.default),new s.EnvironmentMap("environment",u.default.environment,{array:["AlignedArray"],equation:["Equation",null,!0],eqnarray:["EqnArray",null,!0,!0,"rcl",p.default.cols(0,d.MATHSPACE.thickmathspace),".5em"]},c.default),new s.CharacterMap("not_remap",null,{"\u2190":"\u219a","\u2192":"\u219b","\u2194":"\u21ae","\u21d0":"\u21cd","\u21d2":"\u21cf","\u21d4":"\u21ce","\u2208":"\u2209","\u220b":"\u220c","\u2223":"\u2224","\u2225":"\u2226","\u223c":"\u2241","~":"\u2241","\u2243":"\u2244","\u2245":"\u2247","\u2248":"\u2249","\u224d":"\u226d","=":"\u2260","\u2261":"\u2262","<":"\u226e",">":"\u226f","\u2264":"\u2270","\u2265":"\u2271","\u2272":"\u2274","\u2273":"\u2275","\u2276":"\u2278","\u2277":"\u2279","\u227a":"\u2280","\u227b":"\u2281","\u2282":"\u2284","\u2283":"\u2285","\u2286":"\u2288","\u2287":"\u2289","\u22a2":"\u22ac","\u22a8":"\u22ad","\u22a9":"\u22ae","\u22ab":"\u22af","\u227c":"\u22e0","\u227d":"\u22e1","\u2291":"\u22e2","\u2292":"\u22e3","\u22b2":"\u22ea","\u22b3":"\u22eb","\u22b4":"\u22ec","\u22b5":"\u22ed","\u2203":"\u2204"})},7693:function(t,e,r){var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},n.apply(this,arguments)},o=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&o(e,t,r);return i(e,t),e},s=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},l=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var c=a(r(1181)),u=l(r(1256)),p=l(r(3971)),h=l(r(8417)),d=r(8317),f=l(r(1130)),m=r(9007),y=r(6521),g=r(6010),b=r(5368),v=r(7233),_={},S={fontfamily:1,fontsize:1,fontweight:1,fontstyle:1,color:1,background:1,id:1,class:1,href:1,style:1};function x(t,e){var r=t.stack.env,n=r.inRoot;r.inRoot=!0;var o=new h.default(e,r,t.configuration),i=o.mml(),a=o.stack.global;if(a.leftRoot||a.upRoot){var s={};a.leftRoot&&(s.width=a.leftRoot),a.upRoot&&(s.voffset=a.upRoot,s.height=a.upRoot),i=t.create("node","mpadded",[i],s)}return r.inRoot=n,i}_.Open=function(t,e){t.Push(t.itemFactory.create("open"))},_.Close=function(t,e){t.Push(t.itemFactory.create("close"))},_.Tilde=function(t,e){t.Push(t.create("token","mtext",{},b.entities.nbsp))},_.Space=function(t,e){},_.Superscript=function(t,e){var r,n,o;t.GetNext().match(/\d/)&&(t.string=t.string.substr(0,t.i+1)+" "+t.string.substr(t.i+1));var i=t.stack.Top();i.isKind("prime")?(o=(r=s(i.Peek(2),2))[0],n=r[1],t.stack.Pop()):(o=t.stack.Prev())||(o=t.create("token","mi",{},""));var a=u.default.getProperty(o,"movesupsub"),l=u.default.isType(o,"msubsup")?o.sup:o.over;if(u.default.isType(o,"msubsup")&&!u.default.isType(o,"msup")&&u.default.getChildAt(o,o.sup)||u.default.isType(o,"munderover")&&!u.default.isType(o,"mover")&&u.default.getChildAt(o,o.over)&&!u.default.getProperty(o,"subsupOK"))throw new p.default("DoubleExponent","Double exponent: use braces to clarify");u.default.isType(o,"msubsup")&&!u.default.isType(o,"msup")||(a?((!u.default.isType(o,"munderover")||u.default.isType(o,"mover")||u.default.getChildAt(o,o.over))&&(o=t.create("node","munderover",[o],{movesupsub:!0})),l=o.over):l=(o=t.create("node","msubsup",[o])).sup),t.Push(t.itemFactory.create("subsup",o).setProperties({position:l,primes:n,movesupsub:a}))},_.Subscript=function(t,e){var r,n,o;t.GetNext().match(/\d/)&&(t.string=t.string.substr(0,t.i+1)+" "+t.string.substr(t.i+1));var i=t.stack.Top();i.isKind("prime")?(o=(r=s(i.Peek(2),2))[0],n=r[1],t.stack.Pop()):(o=t.stack.Prev())||(o=t.create("token","mi",{},""));var a=u.default.getProperty(o,"movesupsub"),l=u.default.isType(o,"msubsup")?o.sub:o.under;if(u.default.isType(o,"msubsup")&&!u.default.isType(o,"msup")&&u.default.getChildAt(o,o.sub)||u.default.isType(o,"munderover")&&!u.default.isType(o,"mover")&&u.default.getChildAt(o,o.under)&&!u.default.getProperty(o,"subsupOK"))throw new p.default("DoubleSubscripts","Double subscripts: use braces to clarify");u.default.isType(o,"msubsup")&&!u.default.isType(o,"msup")||(a?((!u.default.isType(o,"munderover")||u.default.isType(o,"mover")||u.default.getChildAt(o,o.under))&&(o=t.create("node","munderover",[o],{movesupsub:!0})),l=o.under):l=(o=t.create("node","msubsup",[o])).sub),t.Push(t.itemFactory.create("subsup",o).setProperties({position:l,primes:n,movesupsub:a}))},_.Prime=function(t,e){var r=t.stack.Prev();if(r||(r=t.create("node","mi")),u.default.isType(r,"msubsup")&&!u.default.isType(r,"msup")&&u.default.getChildAt(r,r.sup))throw new p.default("DoubleExponentPrime","Prime causes double exponent: use braces to clarify");var n="";t.i--;do{n+=b.entities.prime,t.i++,e=t.GetNext()}while("'"===e||e===b.entities.rsquo);n=["","\u2032","\u2033","\u2034","\u2057"][n.length]||n;var o=t.create("token","mo",{variantForm:!0},n);t.Push(t.itemFactory.create("prime",r,o))},_.Comment=function(t,e){for(;t.i<t.string.length&&"\n"!==t.string.charAt(t.i);)t.i++},_.Hash=function(t,e){throw new p.default("CantUseHash1","You can't use 'macro parameter character #' in math mode")},_.MathFont=function(t,e,r){var o=t.GetArgument(e),i=new h.default(o,n(n({},t.stack.env),{font:r,multiLetterIdentifiers:/^[a-zA-Z]+/,noAutoOP:!0}),t.configuration).mml();t.Push(t.create("node","TeXAtom",[i]))},_.SetFont=function(t,e,r){t.stack.env.font=r},_.SetStyle=function(t,e,r,n,o){t.stack.env.style=r,t.stack.env.level=o,t.Push(t.itemFactory.create("style").setProperty("styles",{displaystyle:n,scriptlevel:o}))},_.SetSize=function(t,e,r){t.stack.env.size=r,t.Push(t.itemFactory.create("style").setProperty("styles",{mathsize:(0,g.em)(r)}))},_.Spacer=function(t,e,r){var n=t.create("node","mspace",[],{width:(0,g.em)(r)}),o=t.create("node","mstyle",[n],{scriptlevel:0});t.Push(o)},_.LeftRight=function(t,e){var r=e.substr(1);t.Push(t.itemFactory.create(r,t.GetDelimiter(e),t.stack.env.color))},_.NamedFn=function(t,e,r){r||(r=e.substr(1));var n=t.create("token","mi",{texClass:m.TEXCLASS.OP},r);t.Push(t.itemFactory.create("fn",n))},_.NamedOp=function(t,e,r){r||(r=e.substr(1)),r=r.replace(/&thinsp;/,"\u2006");var n=t.create("token","mo",{movablelimits:!0,movesupsub:!0,form:d.TexConstant.Form.PREFIX,texClass:m.TEXCLASS.OP},r);t.Push(n)},_.Limits=function(t,e,r){var n=t.stack.Prev(!0);if(!n||u.default.getTexClass(u.default.getCoreMO(n))!==m.TEXCLASS.OP&&null==u.default.getProperty(n,"movesupsub"))throw new p.default("MisplacedLimits","%1 is allowed only on operators",t.currentCS);var o,i=t.stack.Top();u.default.isType(n,"munderover")&&!r?(o=t.create("node","msubsup"),u.default.copyChildren(n,o),n=i.Last=o):u.default.isType(n,"msubsup")&&r&&(o=t.create("node","munderover"),u.default.copyChildren(n,o),n=i.Last=o),u.default.setProperty(n,"movesupsub",!!r),u.default.setProperties(u.default.getCoreMO(n),{movablelimits:!1}),(u.default.getAttribute(n,"movablelimits")||u.default.getProperty(n,"movablelimits"))&&u.default.setProperties(n,{movablelimits:!1})},_.Over=function(t,e,r,n){var o=t.itemFactory.create("over").setProperty("name",t.currentCS);r||n?(o.setProperty("open",r),o.setProperty("close",n)):e.match(/withdelims$/)&&(o.setProperty("open",t.GetDelimiter(e)),o.setProperty("close",t.GetDelimiter(e))),e.match(/^\\above/)?o.setProperty("thickness",t.GetDimen(e)):(e.match(/^\\atop/)||r||n)&&o.setProperty("thickness",0),t.Push(o)},_.Frac=function(t,e){var r=t.ParseArg(e),n=t.ParseArg(e),o=t.create("node","mfrac",[r,n]);t.Push(o)},_.Sqrt=function(t,e){var r=t.GetBrackets(e),n=t.GetArgument(e);"\\frac"===n&&(n+="{"+t.GetArgument(n)+"}{"+t.GetArgument(n)+"}");var o=new h.default(n,t.stack.env,t.configuration).mml();o=r?t.create("node","mroot",[o,x(t,r)]):t.create("node","msqrt",[o]),t.Push(o)},_.Root=function(t,e){var r=t.GetUpTo(e,"\\of"),n=t.ParseArg(e),o=t.create("node","mroot",[n,x(t,r)]);t.Push(o)},_.MoveRoot=function(t,e,r){if(!t.stack.env.inRoot)throw new p.default("MisplacedMoveRoot","%1 can appear only within a root",t.currentCS);if(t.stack.global[r])throw new p.default("MultipleMoveRoot","Multiple use of %1",t.currentCS);var n=t.GetArgument(e);if(!n.match(/-?[0-9]+/))throw new p.default("IntegerArg","The argument to %1 must be an integer",t.currentCS);"-"!==(n=parseInt(n,10)/15+"em").substr(0,1)&&(n="+"+n),t.stack.global[r]=n},_.Accent=function(t,e,r,o){var i=t.ParseArg(e),a=n(n({},f.default.getFontDef(t)),{accent:!0,mathaccent:!0}),s=u.default.createEntity(r),l=t.create("token","mo",a,s);u.default.setAttribute(l,"stretchy",!!o);var c=u.default.isEmbellished(i)?u.default.getCoreMO(i):i;(u.default.isType(c,"mo")||u.default.getProperty(c,"movablelimits"))&&u.default.setProperties(c,{movablelimits:!1});var p=t.create("node","munderover");u.default.setChild(p,0,i),u.default.setChild(p,1,null),u.default.setChild(p,2,l);var h=t.create("node","TeXAtom",[p]);t.Push(h)},_.UnderOver=function(t,e,r,n){var o=u.default.createEntity(r),i=t.create("token","mo",{stretchy:!0,accent:!0},o),a="o"===e.charAt(1)?"over":"under",s=t.ParseArg(e);t.Push(f.default.underOver(t,s,i,a,n))},_.Overset=function(t,e){var r=t.ParseArg(e),n=t.ParseArg(e);f.default.checkMovableLimits(n),r.isKind("mo")&&u.default.setAttribute(r,"accent",!1);var o=t.create("node","mover",[n,r]);t.Push(o)},_.Underset=function(t,e){var r=t.ParseArg(e),n=t.ParseArg(e);f.default.checkMovableLimits(n),r.isKind("mo")&&u.default.setAttribute(r,"accent",!1);var o=t.create("node","munder",[n,r],{accentunder:!1});t.Push(o)},_.Overunderset=function(t,e){var r=t.ParseArg(e),n=t.ParseArg(e),o=t.ParseArg(e);f.default.checkMovableLimits(o),r.isKind("mo")&&u.default.setAttribute(r,"accent",!1),n.isKind("mo")&&u.default.setAttribute(n,"accent",!1);var i=t.create("node","munderover",[o,n,r],{accent:!1,accentunder:!1});t.Push(i)},_.TeXAtom=function(t,e,r){var n,o,i,a={texClass:r};if(r===m.TEXCLASS.OP){a.movesupsub=a.movablelimits=!0;var s=t.GetArgument(e),l=s.match(/^\s*\\rm\s+([a-zA-Z0-9 ]+)$/);l?(a.mathvariant=d.TexConstant.Variant.NORMAL,o=t.create("token","mi",a,l[1])):(i=new h.default(s,t.stack.env,t.configuration).mml(),o=t.create("node","TeXAtom",[i],a)),n=t.itemFactory.create("fn",o)}else i=t.ParseArg(e),n=t.create("node","TeXAtom",[i],a);t.Push(n)},_.MmlToken=function(t,e){var r,n=t.GetArgument(e),o=t.GetBrackets(e,"").replace(/^\s+/,""),i=t.GetArgument(e),a={},s=[];try{r=t.create("node",n)}catch(t){r=null}if(!r||!r.isToken)throw new p.default("NotMathMLToken","%1 is not a token element",n);for(;""!==o;){var l=o.match(/^([a-z]+)\s*=\s*('[^']*'|"[^"]*"|[^ ,]*)\s*,?\s*/i);if(!l)throw new p.default("InvalidMathMLAttr","Invalid MathML attribute: %1",o);if(!r.attributes.hasDefault(l[1])&&!S[l[1]])throw new p.default("UnknownAttrForElement","%1 is not a recognized attribute for %2",l[1],n);var c=f.default.MmlFilterAttribute(t,l[1],l[2].replace(/^(['"])(.*)\1$/,"$2"));c&&("true"===c.toLowerCase()?c=!0:"false"===c.toLowerCase()&&(c=!1),a[l[1]]=c,s.push(l[1])),o=o.substr(l[0].length)}s.length&&(a["mjx-keep-attrs"]=s.join(" "));var h=t.create("text",i);r.appendChild(h),u.default.setProperties(r,a),t.Push(r)},_.Strut=function(t,e){var r=t.create("node","mrow"),n=t.create("node","mpadded",[r],{height:"8.6pt",depth:"3pt",width:0});t.Push(n)},_.Phantom=function(t,e,r,n){var o=t.create("node","mphantom",[t.ParseArg(e)]);(r||n)&&(o=t.create("node","mpadded",[o]),n&&(u.default.setAttribute(o,"height",0),u.default.setAttribute(o,"depth",0)),r&&u.default.setAttribute(o,"width",0));var i=t.create("node","TeXAtom",[o]);t.Push(i)},_.Smash=function(t,e){var r=f.default.trimSpaces(t.GetBrackets(e,"")),n=t.create("node","mpadded",[t.ParseArg(e)]);switch(r){case"b":u.default.setAttribute(n,"depth",0);break;case"t":u.default.setAttribute(n,"height",0);break;default:u.default.setAttribute(n,"height",0),u.default.setAttribute(n,"depth",0)}var o=t.create("node","TeXAtom",[n]);t.Push(o)},_.Lap=function(t,e){var r=t.create("node","mpadded",[t.ParseArg(e)],{width:0});"\\llap"===e&&u.default.setAttribute(r,"lspace","-1width");var n=t.create("node","TeXAtom",[r]);t.Push(n)},_.RaiseLower=function(t,e){var r=t.GetDimen(e),n=t.itemFactory.create("position").setProperties({name:t.currentCS,move:"vertical"});"-"===r.charAt(0)&&(r=r.slice(1),e="raise"===e.substr(1)?"\\lower":"\\raise"),"\\lower"===e?(n.setProperty("dh","-"+r),n.setProperty("dd","+"+r)):(n.setProperty("dh","+"+r),n.setProperty("dd","-"+r)),t.Push(n)},_.MoveLeftRight=function(t,e){var r=t.GetDimen(e),n="-"===r.charAt(0)?r.slice(1):"-"+r;if("\\moveleft"===e){var o=r;r=n,n=o}t.Push(t.itemFactory.create("position").setProperties({name:t.currentCS,move:"horizontal",left:t.create("node","mspace",[],{width:r}),right:t.create("node","mspace",[],{width:n})}))},_.Hskip=function(t,e){var r=t.create("node","mspace",[],{width:t.GetDimen(e)});t.Push(r)},_.Nonscript=function(t,e){t.Push(t.itemFactory.create("nonscript"))},_.Rule=function(t,e,r){var n={width:t.GetDimen(e),height:t.GetDimen(e),depth:t.GetDimen(e)};"blank"!==r&&(n.mathbackground=t.stack.env.color||"black");var o=t.create("node","mspace",[],n);t.Push(o)},_.rule=function(t,e){var r=t.GetBrackets(e),n=t.GetDimen(e),o=t.GetDimen(e),i=t.create("node","mspace",[],{width:n,height:o,mathbackground:t.stack.env.color||"black"});r&&(i=t.create("node","mpadded",[i],{voffset:r}),r.match(/^\-/)?(u.default.setAttribute(i,"height",r),u.default.setAttribute(i,"depth","+"+r.substr(1))):u.default.setAttribute(i,"height","+"+r)),t.Push(i)},_.MakeBig=function(t,e,r,n){var o=String(n*=1.411764705882353).replace(/(\.\d\d\d).+/,"$1")+"em",i=t.GetDelimiter(e,!0),a=t.create("token","mo",{minsize:o,maxsize:o,fence:!0,stretchy:!0,symmetric:!0},i),s=t.create("node","TeXAtom",[a],{texClass:r});t.Push(s)},_.BuildRel=function(t,e){var r=t.ParseUpTo(e,"\\over"),n=t.ParseArg(e),o=t.create("node","munderover");u.default.setChild(o,0,n),u.default.setChild(o,1,null),u.default.setChild(o,2,r);var i=t.create("node","TeXAtom",[o],{texClass:m.TEXCLASS.REL});t.Push(i)},_.HBox=function(t,e,r,n){t.PushAll(f.default.internalMath(t,t.GetArgument(e),r,n))},_.FBox=function(t,e){var r=f.default.internalMath(t,t.GetArgument(e)),n=t.create("node","menclose",r,{notation:"box"});t.Push(n)},_.FrameBox=function(t,e){var r=t.GetBrackets(e),n=t.GetBrackets(e)||"c",o=f.default.internalMath(t,t.GetArgument(e));r&&(o=[t.create("node","mpadded",o,{width:r,"data-align":(0,v.lookup)(n,{l:"left",r:"right"},"center")})]);var i=t.create("node","TeXAtom",[t.create("node","menclose",o,{notation:"box"})],{texClass:m.TEXCLASS.ORD});t.Push(i)},_.Not=function(t,e){t.Push(t.itemFactory.create("not"))},_.Dots=function(t,e){var r=u.default.createEntity("2026"),n=u.default.createEntity("22EF"),o=t.create("token","mo",{stretchy:!1},r),i=t.create("token","mo",{stretchy:!1},n);t.Push(t.itemFactory.create("dots").setProperties({ldots:o,cdots:i}))},_.Matrix=function(t,e,r,n,o,i,a,s,l,c){var u=t.GetNext();if(""===u)throw new p.default("MissingArgFor","Missing argument for %1",t.currentCS);"{"===u?t.i++:(t.string=u+"}"+t.string.slice(t.i+1),t.i=0);var h=t.itemFactory.create("array").setProperty("requireClose",!0);h.arraydef={rowspacing:a||"4pt",columnspacing:i||"1em"},l&&h.setProperty("isCases",!0),c&&(h.setProperty("isNumbered",!0),h.arraydef.side=c),(r||n)&&(h.setProperty("open",r),h.setProperty("close",n)),"D"===s&&(h.arraydef.displaystyle=!0),null!=o&&(h.arraydef.columnalign=o),t.Push(h)},_.Entry=function(t,e){t.Push(t.itemFactory.create("cell").setProperties({isEntry:!0,name:e}));var r=t.stack.Top(),n=r.getProperty("casesEnv");if(r.getProperty("isCases")||n){for(var o=t.string,i=0,a=-1,s=t.i,l=o.length,c=n?new RegExp("^\\\\end\\s*\\{".concat(n.replace(/\*/,"\\*"),"\\}")):null;s<l;){var u=o.charAt(s);if("{"===u)i++,s++;else if("}"===u)0===i?l=0:(0===--i&&a<0&&(a=s-t.i),s++);else{if("&"===u&&0===i)throw new p.default("ExtraAlignTab","Extra alignment tab in \\cases text");if("\\"===u){var h=o.substr(s);h.match(/^((\\cr)[^a-zA-Z]|\\\\)/)||c&&h.match(c)?l=0:s+=2}else s++}}var d=o.substr(t.i,s-t.i);if(!d.match(/^\s*\\text[^a-zA-Z]/)||a!==d.replace(/\s+$/,"").length-1){var m=f.default.internalMath(t,f.default.trimSpaces(d),0);t.PushAll(m),t.i=s}}},_.Cr=function(t,e){t.Push(t.itemFactory.create("cell").setProperties({isCR:!0,name:e}))},_.CrLaTeX=function(t,e,r){var n;if(void 0===r&&(r=!1),!r&&("*"===t.string.charAt(t.i)&&t.i++,"["===t.string.charAt(t.i))){var o=t.GetBrackets(e,""),i=s(f.default.matchDimen(o),2),a=i[0],l=i[1];if(o&&!a)throw new p.default("BracketMustBeDimension","Bracket argument to %1 must be a dimension",t.currentCS);n=a+l}t.Push(t.itemFactory.create("cell").setProperties({isCR:!0,name:e,linebreak:!0}));var u,h=t.stack.Top();h instanceof c.ArrayItem?n&&h.addRowSpacing(n):(n&&(u=t.create("node","mspace",[],{depth:n}),t.Push(u)),u=t.create("node","mspace",[],{linebreak:d.TexConstant.LineBreak.NEWLINE}),t.Push(u))},_.HLine=function(t,e,r){null==r&&(r="solid");var n=t.stack.Top();if(!(n instanceof c.ArrayItem)||n.Size())throw new p.default("Misplaced","Misplaced %1",t.currentCS);if(n.table.length){for(var o=n.arraydef.rowlines?n.arraydef.rowlines.split(/ /):[];o.length<n.table.length;)o.push("none");o[n.table.length-1]=r,n.arraydef.rowlines=o.join(" ")}else n.frame.push("top")},_.HFill=function(t,e){var r=t.stack.Top();if(!(r instanceof c.ArrayItem))throw new p.default("UnsupportedHFill","Unsupported use of %1",t.currentCS);r.hfill.push(r.Size())},_.BeginEnd=function(t,e){var r=t.GetArgument(e);if(r.match(/\\/i))throw new p.default("InvalidEnv","Invalid environment name '%1'",r);var n=t.configuration.handlers.get("environment").lookup(r);if(n&&"\\end"===e){if(!n.args[0]){var o=t.itemFactory.create("end").setProperty("name",r);return void t.Push(o)}t.stack.env.closing=r}f.default.checkMaxMacros(t,!1),t.parse("environment",[t,r])},_.Array=function(t,e,r,n,o,i,a,s,l){o||(o=t.GetArgument("\\begin{"+e.getName()+"}"));var c=("c"+o).replace(/[^clr|:]/g,"").replace(/[^|:]([|:])+/g,"$1");o=(o=o.replace(/[^clr]/g,"").split("").join(" ")).replace(/l/g,"left").replace(/r/g,"right").replace(/c/g,"center");var u=t.itemFactory.create("array");return u.arraydef={columnalign:o,columnspacing:i||"1em",rowspacing:a||"4pt"},c.match(/[|:]/)&&(c.charAt(0).match(/[|:]/)&&(u.frame.push("left"),u.dashed=":"===c.charAt(0)),c.charAt(c.length-1).match(/[|:]/)&&u.frame.push("right"),c=c.substr(1,c.length-2),u.arraydef.columnlines=c.split("").join(" ").replace(/[^|: ]/g,"none").replace(/\|/g,"solid").replace(/:/g,"dashed")),r&&u.setProperty("open",t.convertDelimiter(r)),n&&u.setProperty("close",t.convertDelimiter(n)),"'"===(s||"").charAt(1)&&(u.arraydef["data-cramped"]=!0,s=s.charAt(0)),"D"===s?u.arraydef.displaystyle=!0:s&&(u.arraydef.displaystyle=!1),"S"===s&&(u.arraydef.scriptlevel=1),l&&(u.arraydef.useHeight=!1),t.Push(e),u},_.AlignedArray=function(t,e){var r=t.GetBrackets("\\begin{"+e.getName()+"}"),n=_.Array(t,e);return f.default.setArrayAlign(n,r)},_.Equation=function(t,e,r){return t.Push(e),f.default.checkEqnEnv(t),t.itemFactory.create("equation",r).setProperty("name",e.getName())},_.EqnArray=function(t,e,r,n,o,i){t.Push(e),n&&f.default.checkEqnEnv(t),o=(o=o.replace(/[^clr]/g,"").split("").join(" ")).replace(/l/g,"left").replace(/r/g,"right").replace(/c/g,"center");var a=t.itemFactory.create("eqnarray",e.getName(),r,n,t.stack.global);return a.arraydef={displaystyle:!0,columnalign:o,columnspacing:i||"1em",rowspacing:"3pt",side:t.options.tagSide,minlabelspacing:t.options.tagIndent},a},_.HandleNoTag=function(t,e){t.tags.notag()},_.HandleLabel=function(t,e){var r=t.GetArgument(e);if(""!==r&&!t.tags.refUpdate){if(t.tags.label)throw new p.default("MultipleCommand","Multiple %1",t.currentCS);if(t.tags.label=r,(t.tags.allLabels[r]||t.tags.labels[r])&&!t.options.ignoreDuplicateLabels)throw new p.default("MultipleLabel","Label '%1' multiply defined",r);t.tags.labels[r]=new y.Label}},_.HandleRef=function(t,e,r){var n=t.GetArgument(e),o=t.tags.allLabels[n]||t.tags.labels[n];o||(t.tags.refUpdate||(t.tags.redo=!0),o=new y.Label);var i=o.tag;r&&(i=t.tags.formatTag(i));var a=t.create("node","mrow",f.default.internalMath(t,i),{href:t.tags.formatUrl(o.id,t.options.baseURL),class:"MathJax_ref"});t.Push(a)},_.Macro=function(t,e,r,n,o){if(n){var i=[];if(null!=o){var a=t.GetBrackets(e);i.push(null==a?o:a)}for(var s=i.length;s<n;s++)i.push(t.GetArgument(e));r=f.default.substituteArgs(t,i,r)}t.string=f.default.addArgs(t,r,t.string.slice(t.i)),t.i=0,f.default.checkMaxMacros(t)},_.MathChoice=function(t,e){var r=t.ParseArg(e),n=t.ParseArg(e),o=t.ParseArg(e),i=t.ParseArg(e);t.Push(t.create("node","MathChoice",[r,n,o,i]))},e.default=_},1186:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.BboxConfiguration=e.BboxMethods=void 0;var o=r(9899),i=r(9140),a=n(r(3971));e.BboxMethods={},e.BboxMethods.BBox=function(t,e){for(var r,n,o,i=t.GetBrackets(e,""),c=t.ParseArg(e),u=i.split(/,/),p=0,h=u.length;p<h;p++){var d=u[p].trim(),f=d.match(/^(\.\d+|\d+(\.\d*)?)(pt|em|ex|mu|px|in|cm|mm)$/);if(f){if(r)throw new a.default("MultipleBBoxProperty","%1 specified twice in %2","Padding",e);var m=l(f[1]+f[3]);m&&(r={height:"+"+m,depth:"+"+m,lspace:m,width:"+"+2*parseInt(f[1],10)+f[3]})}else if(d.match(/^([a-z0-9]+|\#[0-9a-f]{6}|\#[0-9a-f]{3})$/i)){if(n)throw new a.default("MultipleBBoxProperty","%1 specified twice in %2","Background",e);n=d}else if(d.match(/^[-a-z]+:/i)){if(o)throw new a.default("MultipleBBoxProperty","%1 specified twice in %2","Style",e);o=s(d)}else if(""!==d)throw new a.default("InvalidBBoxProperty",'"%1" doesn\'t look like a color, a padding dimension, or a style',d)}r&&(c=t.create("node","mpadded",[c],r)),(n||o)&&(r={},n&&Object.assign(r,{mathbackground:n}),o&&Object.assign(r,{style:o}),c=t.create("node","mstyle",[c],r)),t.Push(c)};var s=function(t){return t},l=function(t){return t};new i.CommandMap("bbox",{bbox:"BBox"},e.BboxMethods),e.BboxConfiguration=o.Configuration.create("bbox",{handler:{macro:["bbox"]}})},8603:function(t,e,r){var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.BoldsymbolConfiguration=e.rewriteBoldTokens=e.createBoldToken=e.BoldsymbolMethods=void 0;var i=r(9899),a=o(r(1256)),s=r(8317),l=r(9140),c=r(8929),u={};function p(t,e,r,n){var o=c.NodeFactory.createToken(t,e,r,n);return"mtext"!==e&&t.configuration.parser.stack.env.boldsymbol&&(a.default.setProperty(o,"fixBold",!0),t.configuration.addNode("fixBold",o)),o}function h(t){var e,r;try{for(var o=n(t.data.getList("fixBold")),i=o.next();!i.done;i=o.next()){var l=i.value;if(a.default.getProperty(l,"fixBold")){var c=a.default.getAttribute(l,"mathvariant");null==c?a.default.setAttribute(l,"mathvariant",s.TexConstant.Variant.BOLD):a.default.setAttribute(l,"mathvariant",u[c]||c),a.default.removeProperties(l,"fixBold")}}}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}}u[s.TexConstant.Variant.NORMAL]=s.TexConstant.Variant.BOLD,u[s.TexConstant.Variant.ITALIC]=s.TexConstant.Variant.BOLDITALIC,u[s.TexConstant.Variant.FRAKTUR]=s.TexConstant.Variant.BOLDFRAKTUR,u[s.TexConstant.Variant.SCRIPT]=s.TexConstant.Variant.BOLDSCRIPT,u[s.TexConstant.Variant.SANSSERIF]=s.TexConstant.Variant.BOLDSANSSERIF,u["-tex-calligraphic"]="-tex-bold-calligraphic",u["-tex-oldstyle"]="-tex-bold-oldstyle",u["-tex-mathit"]=s.TexConstant.Variant.BOLDITALIC,e.BoldsymbolMethods={},e.BoldsymbolMethods.Boldsymbol=function(t,e){var r=t.stack.env.boldsymbol;t.stack.env.boldsymbol=!0;var n=t.ParseArg(e);t.stack.env.boldsymbol=r,t.Push(n)},new l.CommandMap("boldsymbol",{boldsymbol:"Boldsymbol"},e.BoldsymbolMethods),e.createBoldToken=p,e.rewriteBoldTokens=h,e.BoldsymbolConfiguration=i.Configuration.create("boldsymbol",{handler:{macro:["boldsymbol"]},nodes:{token:p},postprocessors:[h]})},6538:function(t,e,r){var n;Object.defineProperty(e,"__esModule",{value:!0}),e.BraketConfiguration=void 0;var o=r(9899),i=r(7191);r(2608),e.BraketConfiguration=o.Configuration.create("braket",{handler:{character:["Braket-characters"],macro:["Braket-macros"]},items:(n={},n[i.BraketItem.prototype.kind]=i.BraketItem,n)})},7191:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.BraketItem=void 0;var a=r(8292),s=r(9007),l=i(r(1130)),c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"braket"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.checkItem=function(e){return e.isKind("close")?[[this.factory.create("mml",this.toMml())],!0]:e.isKind("mml")?(this.Push(e.toMml()),this.getProperty("single")?[[this.toMml()],!0]:a.BaseItem.fail):t.prototype.checkItem.call(this,e)},e.prototype.toMml=function(){var e=t.prototype.toMml.call(this),r=this.getProperty("open"),n=this.getProperty("close");if(this.getProperty("stretchy"))return l.default.fenced(this.factory.configuration,r,e,n);var o={fence:!0,stretchy:!1,symmetric:!0,texClass:s.TEXCLASS.OPEN},i=this.create("token","mo",o,r);o.texClass=s.TEXCLASS.CLOSE;var a=this.create("token","mo",o,n);return this.create("node","mrow",[i,e,a],{open:r,close:n,texClass:s.TEXCLASS.INNER})},e}(a.BaseItem);e.BraketItem=c},2608:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=r(9140),i=n(r(8667));new o.CommandMap("Braket-macros",{bra:["Macro","{\\langle {#1} \\vert}",1],ket:["Macro","{\\vert {#1} \\rangle}",1],braket:["Braket","\u27e8","\u27e9",!1,1/0],set:["Braket","{","}",!1,1],Bra:["Macro","{\\left\\langle {#1} \\right\\vert}",1],Ket:["Macro","{\\left\\vert {#1} \\right\\rangle}",1],Braket:["Braket","\u27e8","\u27e9",!0,1/0],Set:["Braket","{","}",!0,1],ketbra:["Macro","{\\vert {#1} \\rangle\\langle {#2} \\vert}",2],Ketbra:["Macro","{\\left\\vert {#1} \\right\\rangle\\left\\langle {#2} \\right\\vert}",2],"|":"Bar"},i.default),new o.MacroMap("Braket-characters",{"|":"Bar"},i.default)},8667:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=n(r(7693)),i=r(9007),a=n(r(3971)),s={};s.Macro=o.default.Macro,s.Braket=function(t,e,r,n,o,i){var s=t.GetNext();if(""===s)throw new a.default("MissingArgFor","Missing argument for %1",t.currentCS);var l=!0;"{"===s&&(t.i++,l=!1),t.Push(t.itemFactory.create("braket").setProperties({barmax:i,barcount:0,open:r,close:n,stretchy:o,single:l}))},s.Bar=function(t,e){var r="|"===e?"|":"\u2225",n=t.stack.Top();if("braket"!==n.kind||n.getProperty("barcount")>=n.getProperty("barmax")){var o=t.create("token","mo",{texClass:i.TEXCLASS.ORD,stretchy:!1},r);t.Push(o)}else{if("|"===r&&"|"===t.GetNext()&&(t.i++,r="\u2225"),n.getProperty("stretchy")){var a=t.create("node","TeXAtom",[],{texClass:i.TEXCLASS.CLOSE});t.Push(a),n.setProperty("barcount",n.getProperty("barcount")+1),a=t.create("token","mo",{stretchy:!0,braketbar:!0},r),t.Push(a),a=t.create("node","TeXAtom",[],{texClass:i.TEXCLASS.OPEN}),t.Push(a)}else{var s=t.create("token","mo",{stretchy:!1,braketbar:!0},r);t.Push(s)}}},e.default=s},9499:function(t,e,r){var n;Object.defineProperty(e,"__esModule",{value:!0}),e.BussproofsConfiguration=void 0;var o=r(9899),i=r(3980),a=r(1933);r(8620),e.BussproofsConfiguration=o.Configuration.create("bussproofs",{handler:{macro:["Bussproofs-macros"],environment:["Bussproofs-environments"]},items:(n={},n[i.ProofTreeItem.prototype.kind]=i.ProofTreeItem,n),preprocessors:[[a.saveDocument,1]],postprocessors:[[a.clearDocument,3],[a.makeBsprAttributes,2],[a.balanceRules,1]]})},3980:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),a=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&i(e,t,r);return a(e,t),e},l=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.ProofTreeItem=void 0;var c=l(r(3971)),u=r(8292),p=l(r(9497)),h=s(r(1933)),d=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.leftLabel=null,e.rigthLabel=null,e.innerStack=new p.default(e.factory,{},!0),e}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"proofTree"},enumerable:!1,configurable:!0}),e.prototype.checkItem=function(t){if(t.isKind("end")&&"prooftree"===t.getName()){var e=this.toMml();return h.setProperty(e,"proof",!0),[[this.factory.create("mml",e),t],!0]}if(t.isKind("stop"))throw new c.default("EnvMissingEnd","Missing \\end{%1}",this.getName());return this.innerStack.Push(t),u.BaseItem.fail},e.prototype.toMml=function(){var e=t.prototype.toMml.call(this),r=this.innerStack.Top();if(r.isKind("start")&&!r.Size())return e;this.innerStack.Push(this.factory.create("stop"));var n=this.innerStack.Top().toMml();return this.create("node","mrow",[n,e],{})},e}(u.BaseItem);e.ProofTreeItem=d},8620:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=n(r(4934)),i=n(r(5450)),a=r(9140);new a.CommandMap("Bussproofs-macros",{AxiomC:"Axiom",UnaryInfC:["Inference",1],BinaryInfC:["Inference",2],TrinaryInfC:["Inference",3],QuaternaryInfC:["Inference",4],QuinaryInfC:["Inference",5],RightLabel:["Label","right"],LeftLabel:["Label","left"],AXC:"Axiom",UIC:["Inference",1],BIC:["Inference",2],TIC:["Inference",3],RL:["Label","right"],LL:["Label","left"],noLine:["SetLine","none",!1],singleLine:["SetLine","solid",!1],solidLine:["SetLine","solid",!1],dashedLine:["SetLine","dashed",!1],alwaysNoLine:["SetLine","none",!0],alwaysSingleLine:["SetLine","solid",!0],alwaysSolidLine:["SetLine","solid",!0],alwaysDashedLine:["SetLine","dashed",!0],rootAtTop:["RootAtTop",!0],alwaysRootAtTop:["RootAtTop",!0],rootAtBottom:["RootAtTop",!1],alwaysRootAtBottom:["RootAtTop",!1],fCenter:"FCenter",Axiom:"AxiomF",UnaryInf:["InferenceF",1],BinaryInf:["InferenceF",2],TrinaryInf:["InferenceF",3],QuaternaryInf:["InferenceF",4],QuinaryInf:["InferenceF",5]},o.default),new a.EnvironmentMap("Bussproofs-environments",i.default.environment,{prooftree:["Prooftree",null,!1]},o.default)},4934:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e},a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},s=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},l=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var c=l(r(3971)),u=l(r(8417)),p=l(r(1130)),h=i(r(1933)),d={Prooftree:function(t,e){return t.Push(e),t.itemFactory.create("proofTree").setProperties({name:e.getName(),line:"solid",currentLine:"solid",rootAtTop:!1})},Axiom:function(t,e){var r=t.stack.Top();if("proofTree"!==r.kind)throw new c.default("IllegalProofCommand","Proof commands only allowed in prooftree environment.");var n=f(t,t.GetArgument(e));h.setProperty(n,"axiom",!0),r.Push(n)}},f=function(t,e){var r=p.default.internalMath(t,p.default.trimSpaces(e),0);if(!r[0].childNodes[0].childNodes.length)return t.create("node","mrow",[]);var n=t.create("node","mspace",[],{width:".5ex"}),o=t.create("node","mspace",[],{width:".5ex"});return t.create("node","mrow",s(s([n],a(r),!1),[o],!1))};function m(t,e,r,n,o,i,a){var s,l,c,u,p=t.create("node","mtr",[t.create("node","mtd",[e],{})],{}),d=t.create("node","mtr",[t.create("node","mtd",r,{})],{}),f=t.create("node","mtable",a?[d,p]:[p,d],{align:"top 2",rowlines:i,framespacing:"0 0"});if(h.setProperty(f,"inferenceRule",a?"up":"down"),n&&(s=t.create("node","mpadded",[n],{height:"+.5em",width:"+.5em",voffset:"-.15em"}),h.setProperty(s,"prooflabel","left")),o&&(l=t.create("node","mpadded",[o],{height:"+.5em",width:"+.5em",voffset:"-.15em"}),h.setProperty(l,"prooflabel","right")),n&&o)c=[s,f,l],u="both";else if(n)c=[s,f],u="left";else{if(!o)return f;c=[f,l],u="right"}return f=t.create("node","mrow",c),h.setProperty(f,"labelledRule",u),f}function y(t,e){if("$"!==t.GetNext())throw new c.default("IllegalUseOfCommand","Use of %1 does not match it's definition.",e);t.i++;var r=t.GetUpTo(e,"$");if(-1===r.indexOf("\\fCenter"))throw new c.default("IllegalUseOfCommand","Missing \\fCenter in %1.",e);var n=a(r.split("\\fCenter"),2),o=n[0],i=n[1],s=new u.default(o,t.stack.env,t.configuration).mml(),l=new u.default(i,t.stack.env,t.configuration).mml(),p=new u.default("\\fCenter",t.stack.env,t.configuration).mml(),d=t.create("node","mtd",[s],{}),f=t.create("node","mtd",[p],{}),m=t.create("node","mtd",[l],{}),y=t.create("node","mtr",[d,f,m],{}),g=t.create("node","mtable",[y],{columnspacing:".5ex",columnalign:"center 2"});return h.setProperty(g,"sequent",!0),t.configuration.addNode("sequent",y),g}d.Inference=function(t,e,r){var n=t.stack.Top();if("proofTree"!==n.kind)throw new c.default("IllegalProofCommand","Proof commands only allowed in prooftree environment.");if(n.Size()<r)throw new c.default("BadProofTree","Proof tree badly specified.");var o=n.getProperty("rootAtTop"),i=1!==r||n.Peek()[0].childNodes.length?r:0,a=[];do{a.length&&a.unshift(t.create("node","mtd",[],{})),a.unshift(t.create("node","mtd",[n.Pop()],{rowalign:o?"top":"bottom"})),r--}while(r>0);var s=t.create("node","mtr",a,{}),l=t.create("node","mtable",[s],{framespacing:"0 0"}),u=f(t,t.GetArgument(e)),p=n.getProperty("currentLine");p!==n.getProperty("line")&&n.setProperty("currentLine",n.getProperty("line"));var d=m(t,l,[u],n.getProperty("left"),n.getProperty("right"),p,o);n.setProperty("left",null),n.setProperty("right",null),h.setProperty(d,"inference",i),t.configuration.addNode("inference",d),n.Push(d)},d.Label=function(t,e,r){var n=t.stack.Top();if("proofTree"!==n.kind)throw new c.default("IllegalProofCommand","Proof commands only allowed in prooftree environment.");var o=p.default.internalMath(t,t.GetArgument(e),0),i=o.length>1?t.create("node","mrow",o,{}):o[0];n.setProperty(r,i)},d.SetLine=function(t,e,r,n){var o=t.stack.Top();if("proofTree"!==o.kind)throw new c.default("IllegalProofCommand","Proof commands only allowed in prooftree environment.");o.setProperty("currentLine",r),n&&o.setProperty("line",r)},d.RootAtTop=function(t,e,r){var n=t.stack.Top();if("proofTree"!==n.kind)throw new c.default("IllegalProofCommand","Proof commands only allowed in prooftree environment.");n.setProperty("rootAtTop",r)},d.AxiomF=function(t,e){var r=t.stack.Top();if("proofTree"!==r.kind)throw new c.default("IllegalProofCommand","Proof commands only allowed in prooftree environment.");var n=y(t,e);h.setProperty(n,"axiom",!0),r.Push(n)},d.FCenter=function(t,e){},d.InferenceF=function(t,e,r){var n=t.stack.Top();if("proofTree"!==n.kind)throw new c.default("IllegalProofCommand","Proof commands only allowed in prooftree environment.");if(n.Size()<r)throw new c.default("BadProofTree","Proof tree badly specified.");var o=n.getProperty("rootAtTop"),i=1!==r||n.Peek()[0].childNodes.length?r:0,a=[];do{a.length&&a.unshift(t.create("node","mtd",[],{})),a.unshift(t.create("node","mtd",[n.Pop()],{rowalign:o?"top":"bottom"})),r--}while(r>0);var s=t.create("node","mtr",a,{}),l=t.create("node","mtable",[s],{framespacing:"0 0"}),u=y(t,e),p=n.getProperty("currentLine");p!==n.getProperty("line")&&n.setProperty("currentLine",n.getProperty("line"));var d=m(t,l,[u],n.getProperty("left"),n.getProperty("right"),p,o);n.setProperty("left",null),n.setProperty("right",null),h.setProperty(d,"inference",i),t.configuration.addNode("inference",d),n.Push(d)},e.default=d},1933:function(t,e,r){var n,o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.clearDocument=e.saveDocument=e.makeBsprAttributes=e.removeProperty=e.getProperty=e.setProperty=e.balanceRules=void 0;var s=a(r(1256)),l=a(r(1130)),c=null,u=null,p=function(t){return u.root=t,c.outputJax.getBBox(u,c).w},h=function(t){for(var e=0;t&&!s.default.isType(t,"mtable");){if(s.default.isType(t,"text"))return null;s.default.isType(t,"mrow")?(t=t.childNodes[0],e=0):(t=t.parent.childNodes[e],e++)}return t},d=function(t,e){return t.childNodes["up"===e?1:0].childNodes[0].childNodes[0].childNodes[0].childNodes[0]},f=function(t,e){return t.childNodes[e].childNodes[0].childNodes[0]},m=function(t){return f(t,0)},y=function(t){return f(t,t.childNodes.length-1)},g=function(t,e){return t.childNodes["up"===e?0:1].childNodes[0].childNodes[0].childNodes[0]},b=function(t){for(;t&&!s.default.isType(t,"mtd");)t=t.parent;return t},v=function(t){return t.parent.childNodes[t.parent.childNodes.indexOf(t)+1]},_=function(t){for(;t&&null==(0,e.getProperty)(t,"inference");)t=t.parent;return t},S=function(t,e,r){void 0===r&&(r=!1);var n=0;if(t===e)return n;if(t!==e.parent){var o=t.childNodes,i=r?o.length-1:0;s.default.isType(o[i],"mspace")&&(n+=p(o[i])),t=e.parent}if(t===e)return n;var a=t.childNodes,l=r?a.length-1:0;return a[l]!==e&&(n+=p(a[l])),n},x=function(t,r){void 0===r&&(r=!1);var n=h(t),o=g(n,(0,e.getProperty)(n,"inferenceRule"));return S(t,n,r)+(p(n)-p(o))/2},M=function(t,r,n,o){if(void 0===o&&(o=!1),(0,e.getProperty)(r,"inferenceRule")||(0,e.getProperty)(r,"labelledRule")){var i=t.nodeFactory.create("node","mrow");r.parent.replaceChild(i,r),i.setChildren([r]),O(r,i),r=i}var a=o?r.childNodes.length-1:0,c=r.childNodes[a];s.default.isType(c,"mspace")?s.default.setAttribute(c,"width",l.default.Em(l.default.dimen2em(s.default.getAttribute(c,"width"))+n)):(c=t.nodeFactory.create("node","mspace",[],{width:l.default.Em(n)}),o?r.appendChild(c):(c.parent=r,r.childNodes.unshift(c)))},O=function(t,r){["inference","proof","maxAdjust","labelledRule"].forEach((function(n){var o=(0,e.getProperty)(t,n);null!=o&&((0,e.setProperty)(r,n,o),(0,e.removeProperty)(t,n))}))},E=function(t,r,n,o,i){var a=t.nodeFactory.create("node","mspace",[],{width:l.default.Em(i)});if("left"===o){var s=r.childNodes[n].childNodes[0];a.parent=s,s.childNodes.unshift(a)}else r.childNodes[n].appendChild(a);(0,e.setProperty)(r.parent,"sequentAdjust_"+o,i)},A=function(t,r){for(var n=r.pop();r.length;){var i=r.pop(),a=o(C(n,i),2),s=a[0],l=a[1];(0,e.getProperty)(n.parent,"axiom")&&(E(t,s<0?n:i,0,"left",Math.abs(s)),E(t,l<0?n:i,2,"right",Math.abs(l))),n=i}},C=function(t,e){var r=p(t.childNodes[2]),n=p(e.childNodes[2]);return[p(t.childNodes[0])-p(e.childNodes[0]),r-n]};e.balanceRules=function(t){var r,n;u=new t.document.options.MathItem("",null,t.math.display);var o=t.data;!function(t){var r=t.nodeLists.sequent;if(r)for(var n=r.length-1,o=void 0;o=r[n];n--)if((0,e.getProperty)(o,"sequentProcessed"))(0,e.removeProperty)(o,"sequentProcessed");else{var i=[],a=_(o);if(1===(0,e.getProperty)(a,"inference")){for(i.push(o);1===(0,e.getProperty)(a,"inference");){a=h(a);var s=m(d(a,(0,e.getProperty)(a,"inferenceRule"))),l=(0,e.getProperty)(s,"inferenceRule")?g(s,(0,e.getProperty)(s,"inferenceRule")):s;(0,e.getProperty)(l,"sequent")&&(o=l.childNodes[0],i.push(o),(0,e.setProperty)(o,"sequentProcessed",!0)),a=s}A(t,i)}}}(o);var a=o.nodeLists.inference||[];try{for(var s=i(a),l=s.next();!l.done;l=s.next()){var c=l.value,p=(0,e.getProperty)(c,"proof"),f=h(c),O=d(f,(0,e.getProperty)(f,"inferenceRule")),E=m(O);if((0,e.getProperty)(E,"inference")){var C=x(E);if(C){M(o,E,-C);var w=S(c,f,!1);M(o,c,C-w)}}var T=y(O);if(null!=(0,e.getProperty)(T,"inference")){var N=x(T,!0);M(o,T,-N,!0);var L=S(c,f,!0),P=(0,e.getProperty)(c,"maxAdjust");null!=P&&(N=Math.max(N,P));var I=void 0;if(!p&&(I=b(c))){var k=v(I);if(k){var R=o.nodeFactory.create("node","mspace",[],{width:N-L+"em"});k.appendChild(R),c.removeProperty("maxAdjust")}else{var j=_(I);j&&(N=(0,e.getProperty)(j,"maxAdjust")?Math.max((0,e.getProperty)(j,"maxAdjust"),N):N,(0,e.setProperty)(j,"maxAdjust",N))}}else M(o,(0,e.getProperty)(c,"proof")?c:c.parent,N-L,!0)}}}catch(t){r={error:t}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}};var w="bspr_",T=((n={}).bspr_maxAdjust=!0,n);e.setProperty=function(t,e,r){s.default.setProperty(t,w+e,r)};e.getProperty=function(t,e){return s.default.getProperty(t,w+e)};e.removeProperty=function(t,e){t.removeProperty(w+e)};e.makeBsprAttributes=function(t){t.data.root.walkTree((function(t,e){var r=[];t.getPropertyNames().forEach((function(e){!T[e]&&e.match(RegExp("^bspr_"))&&r.push(e+":"+t.getProperty(e))})),r.length&&s.default.setAttribute(t,"semantics",r.join(";"))}))};e.saveDocument=function(t){if(!("getBBox"in(c=t.document).outputJax))throw Error("The bussproofs extension requires an output jax with a getBBox() method")};e.clearDocument=function(t){c=null}},8963:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.CancelConfiguration=e.CancelMethods=void 0;var o=r(9899),i=r(8317),a=r(9140),s=n(r(1130)),l=r(1428);e.CancelMethods={},e.CancelMethods.Cancel=function(t,e,r){var n=t.GetBrackets(e,""),o=t.ParseArg(e),i=s.default.keyvalOptions(n,l.ENCLOSE_OPTIONS);i.notation=r,t.Push(t.create("node","menclose",[o],i))},e.CancelMethods.CancelTo=function(t,e){var r=t.GetBrackets(e,""),n=t.ParseArg(e),o=t.ParseArg(e),a=s.default.keyvalOptions(r,l.ENCLOSE_OPTIONS);a.notation=[i.TexConstant.Notation.UPDIAGONALSTRIKE,i.TexConstant.Notation.UPDIAGONALARROW,i.TexConstant.Notation.NORTHEASTARROW].join(" "),n=t.create("node","mpadded",[n],{depth:"-.1em",height:"+.1em",voffset:".1em"}),t.Push(t.create("node","msup",[t.create("node","menclose",[o],a),n]))},new a.CommandMap("cancel",{cancel:["Cancel",i.TexConstant.Notation.UPDIAGONALSTRIKE],bcancel:["Cancel",i.TexConstant.Notation.DOWNDIAGONALSTRIKE],xcancel:["Cancel",i.TexConstant.Notation.UPDIAGONALSTRIKE+" "+i.TexConstant.Notation.DOWNDIAGONALSTRIKE],cancelto:"CancelTo"},e.CancelMethods),e.CancelConfiguration=o.Configuration.create("cancel",{handler:{macro:["cancel"]}})},3752:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.CasesConfiguration=e.CasesMethods=e.CasesTags=e.CasesBeginItem=void 0;var s=r(9899),l=r(9140),c=a(r(1130)),u=a(r(7693)),p=a(r(3971)),h=r(1181),d=r(8021),f=r(6471),m=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"cases-begin"},enumerable:!1,configurable:!0}),e.prototype.checkItem=function(e){return e.isKind("end")&&e.getName()===this.getName()&&this.getProperty("end")?(this.setProperty("end",!1),[[],!0]):t.prototype.checkItem.call(this,e)},e}(h.BeginItem);e.CasesBeginItem=m;var y=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.subcounter=0,e}return i(e,t),e.prototype.start=function(e,r,n){this.subcounter=0,t.prototype.start.call(this,e,r,n)},e.prototype.autoTag=function(){null==this.currentTag.tag&&("subnumcases"===this.currentTag.env?(0===this.subcounter&&this.counter++,this.subcounter++,this.tag(this.formatNumber(this.counter,this.subcounter),!1)):(0!==this.subcounter&&"numcases-left"===this.currentTag.env||this.counter++,this.tag(this.formatNumber(this.counter),!1)))},e.prototype.formatNumber=function(t,e){return void 0===e&&(e=null),t.toString()+(null===e?"":String.fromCharCode(96+e))},e}(d.AmsTags);e.CasesTags=y,e.CasesMethods={NumCases:function(t,e){if(t.stack.env.closing===e.getName()){delete t.stack.env.closing,t.Push(t.itemFactory.create("end").setProperty("name",e.getName()));var r=t.stack.Top(),n=r.Last,o=c.default.copyNode(n,t),i=r.getProperty("left");return f.EmpheqUtil.left(n,o,i+"\\empheqlbrace\\,",t,"numcases-left"),t.Push(t.itemFactory.create("end").setProperty("name",e.getName())),null}i=t.GetArgument("\\begin{"+e.getName()+"}");e.setProperty("left",i);var a=u.default.EqnArray(t,e,!0,!0,"ll");return a.arraydef.displaystyle=!1,a.arraydef.rowspacing=".2em",a.setProperty("numCases",!0),t.Push(e),a},Entry:function(t,e){if(!t.stack.Top().getProperty("numCases"))return u.default.Entry(t,e);t.Push(t.itemFactory.create("cell").setProperties({isEntry:!0,name:e}));for(var r=t.string,n=0,o=t.i,i=r.length;o<i;){var a=r.charAt(o);if("{"===a)n++,o++;else if("}"===a){if(0===n)break;n--,o++}else{if("&"===a&&0===n)throw new p.default("ExtraCasesAlignTab","Extra alignment tab in text for numcase environment");if("\\"===a&&0===n){var s=(r.slice(o+1).match(/^[a-z]+|./i)||[])[0];if("\\"===s||"cr"===s||"end"===s||"label"===s)break;o+=s.length}else o++}}var l=r.substr(t.i,o-t.i).replace(/^\s*/,"");t.PushAll(c.default.internalMath(t,l,0)),t.i=o}},new l.EnvironmentMap("cases-env",f.EmpheqUtil.environment,{numcases:["NumCases","cases"],subnumcases:["NumCases","cases"]},e.CasesMethods),new l.MacroMap("cases-macros",{"&":"Entry"},e.CasesMethods),e.CasesConfiguration=s.Configuration.create("cases",{handler:{environment:["cases-env"],character:["cases-macros"]},items:(o={},o[m.prototype.kind]=m,o),tags:{cases:y}})},8227:function(t,e,r){var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.CenternotConfiguration=e.filterCenterOver=void 0;var i=r(9899),a=o(r(8417)),s=o(r(1256)),l=r(9140),c=o(r(7693));function u(t){var e,r,o=t.data;try{for(var i=n(o.getList("centerOver")),a=i.next();!a.done;a=i.next()){var l=a.value,c=s.default.getTexClass(l.childNodes[0].childNodes[0]);null!==c&&s.default.setProperties(l.parent.parent.parent.parent.parent.parent,{texClass:c})}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}}new l.CommandMap("centernot",{centerOver:"CenterOver",centernot:["Macro","\\centerOver{#1}{{\u29f8}}",1]},{CenterOver:function(t,e){var r="{"+t.GetArgument(e)+"}",n=t.ParseArg(e),o=new a.default(r,t.stack.env,t.configuration).mml(),i=t.create("node","TeXAtom",[new a.default(r,t.stack.env,t.configuration).mml(),t.create("node","mpadded",[t.create("node","mpadded",[n],{width:0,lspace:"-.5width"}),t.create("node","mphantom",[o])],{width:0,lspace:"-.5width"})]);t.configuration.addNode("centerOver",o),t.Push(i)},Macro:c.default.Macro}),e.filterCenterOver=u,e.CenternotConfiguration=i.Configuration.create("centernot",{handler:{macro:["centernot"]},postprocessors:[u]})},5860:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.ColorConfiguration=void 0;var n=r(9140),o=r(9899),i=r(2784),a=r(4207);new n.CommandMap("color",{color:"Color",textcolor:"TextColor",definecolor:"DefineColor",colorbox:"ColorBox",fcolorbox:"FColorBox"},i.ColorMethods);e.ColorConfiguration=o.Configuration.create("color",{handler:{macro:["color"]},options:{color:{padding:"5px",borderWidth:"2px"}},config:function(t,e){e.parseOptions.packageData.set("color",{model:new a.ColorModel})}})},7960:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.COLORS=void 0,e.COLORS=new Map([["Apricot","#FBB982"],["Aquamarine","#00B5BE"],["Bittersweet","#C04F17"],["Black","#221E1F"],["Blue","#2D2F92"],["BlueGreen","#00B3B8"],["BlueViolet","#473992"],["BrickRed","#B6321C"],["Brown","#792500"],["BurntOrange","#F7921D"],["CadetBlue","#74729A"],["CarnationPink","#F282B4"],["Cerulean","#00A2E3"],["CornflowerBlue","#41B0E4"],["Cyan","#00AEEF"],["Dandelion","#FDBC42"],["DarkOrchid","#A4538A"],["Emerald","#00A99D"],["ForestGreen","#009B55"],["Fuchsia","#8C368C"],["Goldenrod","#FFDF42"],["Gray","#949698"],["Green","#00A64F"],["GreenYellow","#DFE674"],["JungleGreen","#00A99A"],["Lavender","#F49EC4"],["LimeGreen","#8DC73E"],["Magenta","#EC008C"],["Mahogany","#A9341F"],["Maroon","#AF3235"],["Melon","#F89E7B"],["MidnightBlue","#006795"],["Mulberry","#A93C93"],["NavyBlue","#006EB8"],["OliveGreen","#3C8031"],["Orange","#F58137"],["OrangeRed","#ED135A"],["Orchid","#AF72B0"],["Peach","#F7965A"],["Periwinkle","#7977B8"],["PineGreen","#008B72"],["Plum","#92268F"],["ProcessBlue","#00B0F0"],["Purple","#99479B"],["RawSienna","#974006"],["Red","#ED1B23"],["RedOrange","#F26035"],["RedViolet","#A1246B"],["Rhodamine","#EF559F"],["RoyalBlue","#0071BC"],["RoyalPurple","#613F99"],["RubineRed","#ED017D"],["Salmon","#F69289"],["SeaGreen","#3FBC9D"],["Sepia","#671800"],["SkyBlue","#46C5DD"],["SpringGreen","#C6DC67"],["Tan","#DA9D76"],["TealBlue","#00AEB3"],["Thistle","#D883B7"],["Turquoise","#00B4CE"],["Violet","#58429B"],["VioletRed","#EF58A0"],["White","#FFFFFF"],["WildStrawberry","#EE2967"],["Yellow","#FFF200"],["YellowGreen","#98CC70"],["YellowOrange","#FAA21A"]])},2784:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.ColorMethods=void 0;var o=n(r(1256)),i=n(r(1130));function a(t){var e="+".concat(t),r=t.replace(/^.*?([a-z]*)$/,"$1"),n=2*parseFloat(e);return{width:"+".concat(n).concat(r),height:e,depth:e,lspace:t}}e.ColorMethods={},e.ColorMethods.Color=function(t,e){var r=t.GetBrackets(e,""),n=t.GetArgument(e),o=t.configuration.packageData.get("color").model.getColor(r,n),i=t.itemFactory.create("style").setProperties({styles:{mathcolor:o}});t.stack.env.color=o,t.Push(i)},e.ColorMethods.TextColor=function(t,e){var r=t.GetBrackets(e,""),n=t.GetArgument(e),o=t.configuration.packageData.get("color").model.getColor(r,n),i=t.stack.env.color;t.stack.env.color=o;var a=t.ParseArg(e);i?t.stack.env.color=i:delete t.stack.env.color;var s=t.create("node","mstyle",[a],{mathcolor:o});t.Push(s)},e.ColorMethods.DefineColor=function(t,e){var r=t.GetArgument(e),n=t.GetArgument(e),o=t.GetArgument(e);t.configuration.packageData.get("color").model.defineColor(n,r,o)},e.ColorMethods.ColorBox=function(t,e){var r=t.GetArgument(e),n=i.default.internalMath(t,t.GetArgument(e)),s=t.configuration.packageData.get("color").model,l=t.create("node","mpadded",n,{mathbackground:s.getColor("named",r)});o.default.setProperties(l,a(t.options.color.padding)),t.Push(l)},e.ColorMethods.FColorBox=function(t,e){var r=t.GetArgument(e),n=t.GetArgument(e),s=i.default.internalMath(t,t.GetArgument(e)),l=t.options.color,c=t.configuration.packageData.get("color").model,u=t.create("node","mpadded",s,{mathbackground:c.getColor("named",n),style:"border: ".concat(l.borderWidth," solid ").concat(c.getColor("named",r))});o.default.setProperties(u,a(l.padding)),t.Push(u)}},4207:function(t,e,r){var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.ColorModel=void 0;var i=o(r(3971)),a=r(7960),s=new Map,l=function(){function t(){this.userColors=new Map}return t.prototype.normalizeColor=function(t,e){if(!t||"named"===t)return e;if(s.has(t))return s.get(t)(e);throw new i.default("UndefinedColorModel","Color model '%1' not defined",t)},t.prototype.getColor=function(t,e){return t&&"named"!==t?this.normalizeColor(t,e):this.getColorByName(e)},t.prototype.getColorByName=function(t){return this.userColors.has(t)?this.userColors.get(t):a.COLORS.has(t)?a.COLORS.get(t):t},t.prototype.defineColor=function(t,e,r){var n=this.normalizeColor(t,r);this.userColors.set(e,n)},t}();e.ColorModel=l,s.set("rgb",(function(t){var e,r,o=t.trim().split(/\s*,\s*/),a="#";if(3!==o.length)throw new i.default("ModelArg1","Color values for the %1 model require 3 numbers","rgb");try{for(var s=n(o),l=s.next();!l.done;l=s.next()){var c=l.value;if(!c.match(/^(\d+(\.\d*)?|\.\d+)$/))throw new i.default("InvalidDecimalNumber","Invalid decimal number");var u=parseFloat(c);if(u<0||u>1)throw new i.default("ModelArg2","Color values for the %1 model must be between %2 and %3","rgb","0","1");var p=Math.floor(255*u).toString(16);p.length<2&&(p="0"+p),a+=p}}catch(t){e={error:t}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}return a})),s.set("RGB",(function(t){var e,r,o=t.trim().split(/\s*,\s*/),a="#";if(3!==o.length)throw new i.default("ModelArg1","Color values for the %1 model require 3 numbers","RGB");try{for(var s=n(o),l=s.next();!l.done;l=s.next()){var c=l.value;if(!c.match(/^\d+$/))throw new i.default("InvalidNumber","Invalid number");var u=parseInt(c);if(u>255)throw new i.default("ModelArg2","Color values for the %1 model must be between %2 and %3","RGB","0","255");var p=u.toString(16);p.length<2&&(p="0"+p),a+=p}}catch(t){e={error:t}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}return a})),s.set("gray",(function(t){if(!t.match(/^\s*(\d+(\.\d*)?|\.\d+)\s*$/))throw new i.default("InvalidDecimalNumber","Invalid decimal number");var e=parseFloat(t);if(e<0||e>1)throw new i.default("ModelArg2","Color values for the %1 model must be between %2 and %3","gray","0","1");var r=Math.floor(255*e).toString(16);return r.length<2&&(r="0"+r),"#".concat(r).concat(r).concat(r)}))},6648:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.ColortblConfiguration=e.ColorArrayItem=void 0;var a=r(1181),s=r(9899),l=r(9140),c=i(r(3971)),u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.color={cell:"",row:"",col:[]},e.hasColor=!1,e}return o(e,t),e.prototype.EndEntry=function(){t.prototype.EndEntry.call(this);var e=this.row[this.row.length-1],r=this.color.cell||this.color.row||this.color.col[this.row.length-1];r&&(e.attributes.set("mathbackground",r),this.color.cell="",this.hasColor=!0)},e.prototype.EndRow=function(){t.prototype.EndRow.call(this),this.color.row=""},e.prototype.createMml=function(){var e=t.prototype.createMml.call(this),r=e.isKind("mrow")?e.childNodes[1]:e;return r.isKind("menclose")&&(r=r.childNodes[0].childNodes[0]),this.hasColor&&"none"===r.attributes.get("frame")&&r.attributes.set("frame",""),e},e}(a.ArrayItem);e.ColorArrayItem=u,new l.CommandMap("colortbl",{cellcolor:["TableColor","cell"],rowcolor:["TableColor","row"],columncolor:["TableColor","col"]},{TableColor:function(t,e,r){var n=t.configuration.packageData.get("color").model,o=t.GetBrackets(e,""),i=n.getColor(o,t.GetArgument(e)),a=t.stack.Top();if(!(a instanceof u))throw new c.default("UnsupportedTableColor","Unsupported use of %1",t.currentCS);if("col"===r){if(a.table.length)throw new c.default("ColumnColorNotTop","%1 must be in the top row",e);a.color.col[a.row.length]=i,t.GetBrackets(e,"")&&t.GetBrackets(e,"")}else if(a.color[r]=i,"row"===r&&(a.Size()||a.row.length))throw new c.default("RowColorNotFirst","%1 must be at the beginning of a row",e)}});e.ColortblConfiguration=s.Configuration.create("colortbl",{handler:{macro:["colortbl"]},items:{array:u},priority:10,config:[function(t,e){e.parseOptions.packageData.has("color")||s.ConfigurationHandler.get("color").config(t,e)},10]})},6628:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.ColorConfiguration=e.ColorV2Methods=void 0;var n=r(9140),o=r(9899);e.ColorV2Methods={Color:function(t,e){var r=t.GetArgument(e),n=t.stack.env.color;t.stack.env.color=r;var o=t.ParseArg(e);n?t.stack.env.color=n:delete t.stack.env.color;var i=t.create("node","mstyle",[o],{mathcolor:r});t.Push(i)}},new n.CommandMap("colorv2",{color:"Color"},e.ColorV2Methods),e.ColorConfiguration=o.Configuration.create("colorv2",{handler:{macro:["colorv2"]}})},8458:function(t,e,r){var n,o=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.ConfigMacrosConfiguration=void 0;var a=r(9899),s=r(7233),l=r(9140),c=i(r(5450)),u=r(8803),p=i(r(1110)),h=r(6793),d="configmacros-map",f="configmacros-env-map";e.ConfigMacrosConfiguration=a.Configuration.create("configmacros",{init:function(t){new l.CommandMap(d,{},{}),new l.EnvironmentMap(f,c.default.environment,{},{}),t.append(a.Configuration.local({handler:{macro:[d],environment:[f]},priority:3}))},config:function(t,e){!function(t){var e,r,n=t.parseOptions.handlers.retrieve(d),i=t.parseOptions.options.macros;try{for(var a=o(Object.keys(i)),s=a.next();!s.done;s=a.next()){var l=s.value,c="string"==typeof i[l]?[i[l]]:i[l],h=Array.isArray(c[2])?new u.Macro(l,p.default.MacroWithTemplate,c.slice(0,2).concat(c[2])):new u.Macro(l,p.default.Macro,c);n.add(l,h)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}}(e),function(t){var e,r,n=t.parseOptions.handlers.retrieve(f),i=t.parseOptions.options.environments;try{for(var a=o(Object.keys(i)),s=a.next();!s.done;s=a.next()){var l=s.value;n.add(l,new u.Macro(l,p.default.BeginEnv,[!0].concat(i[l])))}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}}(e)},items:(n={},n[h.BeginEnvItem.prototype.kind]=h.BeginEnvItem,n),options:{macros:(0,s.expandable)({}),environments:(0,s.expandable)({})}})},5464:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.EmpheqConfiguration=e.EmpheqMethods=e.EmpheqBeginItem=void 0;var l=r(9899),c=r(9140),u=s(r(1130)),p=s(r(3971)),h=r(1181),d=r(6471),f=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"empheq-begin"},enumerable:!1,configurable:!0}),e.prototype.checkItem=function(e){return e.isKind("end")&&e.getName()===this.getName()&&this.setProperty("end",!1),t.prototype.checkItem.call(this,e)},e}(h.BeginItem);e.EmpheqBeginItem=f,e.EmpheqMethods={Empheq:function(t,e){if(t.stack.env.closing===e.getName()){delete t.stack.env.closing,t.Push(t.itemFactory.create("end").setProperty("name",t.stack.global.empheq)),t.stack.global.empheq="";var r=t.stack.Top();d.EmpheqUtil.adjustTable(r,t),t.Push(t.itemFactory.create("end").setProperty("name","empheq"))}else{u.default.checkEqnEnv(t),delete t.stack.global.eqnenv;var n=t.GetBrackets("\\begin{"+e.getName()+"}")||"",o=a((t.GetArgument("\\begin{"+e.getName()+"}")||"").split(/=/),2),i=o[0],s=o[1];if(!d.EmpheqUtil.checkEnv(i))throw new p.default("UnknownEnv",'Unknown environment "%1"',i);n&&e.setProperties(d.EmpheqUtil.splitOptions(n,{left:1,right:1})),t.stack.global.empheq=i,t.string="\\begin{"+i+"}"+(s?"{"+s+"}":"")+t.string.slice(t.i),t.i=0,t.Push(e)}},EmpheqMO:function(t,e,r){t.Push(t.create("token","mo",{},r))},EmpheqDelim:function(t,e){var r=t.GetDelimiter(e);t.Push(t.create("token","mo",{stretchy:!0,symmetric:!0},r))}},new c.EnvironmentMap("empheq-env",d.EmpheqUtil.environment,{empheq:["Empheq","empheq"]},e.EmpheqMethods),new c.CommandMap("empheq-macros",{empheqlbrace:["EmpheqMO","{"],empheqrbrace:["EmpheqMO","}"],empheqlbrack:["EmpheqMO","["],empheqrbrack:["EmpheqMO","]"],empheqlangle:["EmpheqMO","\u27e8"],empheqrangle:["EmpheqMO","\u27e9"],empheqlparen:["EmpheqMO","("],empheqrparen:["EmpheqMO",")"],empheqlvert:["EmpheqMO","|"],empheqrvert:["EmpheqMO","|"],empheqlVert:["EmpheqMO","\u2016"],empheqrVert:["EmpheqMO","\u2016"],empheqlfloor:["EmpheqMO","\u230a"],empheqrfloor:["EmpheqMO","\u230b"],empheqlceil:["EmpheqMO","\u2308"],empheqrceil:["EmpheqMO","\u2309"],empheqbiglbrace:["EmpheqMO","{"],empheqbigrbrace:["EmpheqMO","}"],empheqbiglbrack:["EmpheqMO","["],empheqbigrbrack:["EmpheqMO","]"],empheqbiglangle:["EmpheqMO","\u27e8"],empheqbigrangle:["EmpheqMO","\u27e9"],empheqbiglparen:["EmpheqMO","("],empheqbigrparen:["EmpheqMO",")"],empheqbiglvert:["EmpheqMO","|"],empheqbigrvert:["EmpheqMO","|"],empheqbiglVert:["EmpheqMO","\u2016"],empheqbigrVert:["EmpheqMO","\u2016"],empheqbiglfloor:["EmpheqMO","\u230a"],empheqbigrfloor:["EmpheqMO","\u230b"],empheqbiglceil:["EmpheqMO","\u2308"],empheqbigrceil:["EmpheqMO","\u2309"],empheql:"EmpheqDelim",empheqr:"EmpheqDelim",empheqbigl:"EmpheqDelim",empheqbigr:"EmpheqDelim"},e.EmpheqMethods),e.EmpheqConfiguration=l.Configuration.create("empheq",{handler:{macro:["empheq-macros"],environment:["empheq-env"]},items:(o={},o[f.prototype.kind]=f,o)})},6471:function(t,e,r){var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.EmpheqUtil=void 0;var s=a(r(1130)),l=a(r(8417));e.EmpheqUtil={environment:function(t,e,r,i){var a=i[0],s=t.itemFactory.create(a+"-begin").setProperties({name:e,end:a});t.Push(r.apply(void 0,o([t,s],n(i.slice(1)),!1)))},splitOptions:function(t,e){return void 0===e&&(e=null),s.default.keyvalOptions(t,e,!0)},columnCount:function(t){var e,r,n=0;try{for(var o=i(t.childNodes),a=o.next();!a.done;a=o.next()){var s=a.value,l=s.childNodes.length-(s.isKind("mlabeledtr")?1:0);l>n&&(n=l)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return n},cellBlock:function(t,e,r,n){var o,a,s=r.create("node","mpadded",[],{height:0,depth:0,voffset:"-1height"}),c=new l.default(t,r.stack.env,r.configuration),u=c.mml();n&&c.configuration.tags.label&&(c.configuration.tags.currentTag.env=n,c.configuration.tags.getTag(!0));try{for(var p=i(u.isInferred?u.childNodes:[u]),h=p.next();!h.done;h=p.next()){var d=h.value;s.appendChild(d)}}catch(t){o={error:t}}finally{try{h&&!h.done&&(a=p.return)&&a.call(p)}finally{if(o)throw o.error}}return s.appendChild(r.create("node","mphantom",[r.create("node","mpadded",[e],{width:0})])),s},topRowTable:function(t,e){var r=s.default.copyNode(t,e);return r.setChildren(r.childNodes.slice(0,1)),r.attributes.set("align","baseline 1"),t.factory.create("mphantom",{},[e.create("node","mpadded",[r],{width:0})])},rowspanCell:function(t,e,r,n,o){t.appendChild(n.create("node","mpadded",[this.cellBlock(e,s.default.copyNode(r,n),n,o),this.topRowTable(r,n)],{height:0,depth:0,voffset:"height"}))},left:function(t,e,r,n,o){var a,s,l;void 0===o&&(o=""),t.attributes.set("columnalign","right "+(t.attributes.get("columnalign")||"")),t.attributes.set("columnspacing","0em "+(t.attributes.get("columnspacing")||""));try{for(var c=i(t.childNodes.slice(0).reverse()),u=c.next();!u.done;u=c.next()){var p=u.value;l=n.create("node","mtd"),p.childNodes.unshift(l),l.parent=p,p.isKind("mlabeledtr")&&(p.childNodes[0]=p.childNodes[1],p.childNodes[1]=l)}}catch(t){a={error:t}}finally{try{u&&!u.done&&(s=c.return)&&s.call(c)}finally{if(a)throw a.error}}this.rowspanCell(l,r,e,n,o)},right:function(t,r,n,o,i){void 0===i&&(i=""),0===t.childNodes.length&&t.appendChild(o.create("node","mtr"));for(var a=e.EmpheqUtil.columnCount(t),s=t.childNodes[0];s.childNodes.length<a;)s.appendChild(o.create("node","mtd"));var l=s.appendChild(o.create("node","mtd"));e.EmpheqUtil.rowspanCell(l,n,r,o,i),t.attributes.set("columnalign",(t.attributes.get("columnalign")||"").split(/ /).slice(0,a).join(" ")+" left"),t.attributes.set("columnspacing",(t.attributes.get("columnspacing")||"").split(/ /).slice(0,a-1).join(" ")+" 0em")},adjustTable:function(t,e){var r=t.getProperty("left"),n=t.getProperty("right");if(r||n){var o=t.Last,i=s.default.copyNode(o,e);r&&this.left(o,i,r,e),n&&this.right(o,i,n,e)}},allowEnv:{equation:!0,align:!0,gather:!0,flalign:!0,alignat:!0,multline:!0},checkEnv:function(t){return this.allowEnv.hasOwnProperty(t.replace(/\*$/,""))||!1}}},1428:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.EncloseConfiguration=e.EncloseMethods=e.ENCLOSE_OPTIONS=void 0;var o=r(9899),i=r(9140),a=n(r(1130));e.ENCLOSE_OPTIONS={"data-arrowhead":1,color:1,mathcolor:1,background:1,mathbackground:1,"data-padding":1,"data-thickness":1},e.EncloseMethods={},e.EncloseMethods.Enclose=function(t,r){var n=t.GetArgument(r).replace(/,/g," "),o=t.GetBrackets(r,""),i=t.ParseArg(r),s=a.default.keyvalOptions(o,e.ENCLOSE_OPTIONS);s.notation=n,t.Push(t.create("node","menclose",[i],s))},new i.CommandMap("enclose",{enclose:"Enclose"},e.EncloseMethods),e.EncloseConfiguration=o.Configuration.create("enclose",{handler:{macro:["enclose"]}})},6121:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.ExtpfeilConfiguration=e.ExtpfeilMethods=void 0;var o=r(9899),i=r(9140),a=r(4387),s=n(r(5579)),l=r(1496),c=n(r(3971));e.ExtpfeilMethods={},e.ExtpfeilMethods.xArrow=a.AmsMethods.xArrow,e.ExtpfeilMethods.NewExtArrow=function(t,r){var n=t.GetArgument(r),o=t.GetArgument(r),i=t.GetArgument(r);if(!n.match(/^\\([a-z]+|.)$/i))throw new c.default("NewextarrowArg1","First argument to %1 must be a control sequence name",r);if(!o.match(/^(\d+),(\d+)$/))throw new c.default("NewextarrowArg2","Second argument to %1 must be two integers separated by a comma",r);if(!i.match(/^(\d+|0x[0-9A-F]+)$/i))throw new c.default("NewextarrowArg3","Third argument to %1 must be a unicode character number",r);n=n.substr(1);var a=o.split(",");s.default.addMacro(t,n,e.ExtpfeilMethods.xArrow,[parseInt(i),parseInt(a[0]),parseInt(a[1])])},new i.CommandMap("extpfeil",{xtwoheadrightarrow:["xArrow",8608,12,16],xtwoheadleftarrow:["xArrow",8606,17,13],xmapsto:["xArrow",8614,6,7],xlongequal:["xArrow",61,7,7],xtofrom:["xArrow",8644,12,12],Newextarrow:"NewExtArrow"},e.ExtpfeilMethods);e.ExtpfeilConfiguration=o.Configuration.create("extpfeil",{handler:{macro:["extpfeil"]},init:function(t){l.NewcommandConfiguration.init(t)}})},3078:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.GensymbConfiguration=void 0;var n=r(9899),o=r(8317);new(r(9140).CharacterMap)("gensymb-symbols",(function(t,e){var r=e.attributes||{};r.mathvariant=o.TexConstant.Variant.NORMAL,r.class="MathML-Unit";var n=t.create("token","mi",r,e.char);t.Push(n)}),{ohm:"\u2126",degree:"\xb0",celsius:"\u2103",perthousand:"\u2030",micro:"\xb5"}),e.GensymbConfiguration=n.Configuration.create("gensymb",{handler:{macro:["gensymb-symbols"]}})},8901:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.HtmlConfiguration=void 0;var o=r(9899),i=r(9140),a=n(r(332));new i.CommandMap("html_macros",{href:"Href",class:"Class",style:"Style",cssId:"Id"},a.default),e.HtmlConfiguration=o.Configuration.create("html",{handler:{macro:["html_macros"]}})},332:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=n(r(1256)),i={Href:function(t,e){var r=t.GetArgument(e),n=a(t,e);o.default.setAttribute(n,"href",r),t.Push(n)},Class:function(t,e){var r=t.GetArgument(e),n=a(t,e),i=o.default.getAttribute(n,"class");i&&(r=i+" "+r),o.default.setAttribute(n,"class",r),t.Push(n)},Style:function(t,e){var r=t.GetArgument(e),n=a(t,e),i=o.default.getAttribute(n,"style");i&&(";"!==r.charAt(r.length-1)&&(r+=";"),r=i+" "+r),o.default.setAttribute(n,"style",r),t.Push(n)},Id:function(t,e){var r=t.GetArgument(e),n=a(t,e);o.default.setAttribute(n,"id",r),t.Push(n)}},a=function(t,e){var r=t.ParseArg(e);if(!o.default.isInferred(r))return r;var n=o.default.getChildren(r);if(1===n.length)return n[0];var i=t.create("node","mrow");return o.default.copyChildren(r,i),o.default.copyAttributes(r,i),i};e.default=i},7535:function(t,e,r){var n,o=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.MathtoolsConfiguration=e.fixPrescripts=e.PAIREDDELIMS=void 0;var a=r(9899),s=r(9140),l=i(r(1256)),c=r(7233);r(2448);var u=r(836),p=r(1503),h=r(6224);function d(t){var e,r,n,i,a,s,c=t.data;try{for(var u=o(c.getList("mmultiscripts")),p=u.next();!p.done;p=u.next()){var h=p.value;if(h.getProperty("fixPrescript")){var d=l.default.getChildren(h),f=0;try{for(var m=(n=void 0,o([1,2])),y=m.next();!y.done;y=m.next()){d[v=y.value]||(l.default.setChild(h,v,c.nodeFactory.create("node","none")),f++)}}catch(t){n={error:t}}finally{try{y&&!y.done&&(i=m.return)&&i.call(m)}finally{if(n)throw n.error}}try{for(var g=(a=void 0,o([4,5])),b=g.next();!b.done;b=g.next()){var v=b.value;l.default.isType(d[v],"mrow")&&0===l.default.getChildren(d[v]).length&&l.default.setChild(h,v,c.nodeFactory.create("node","none"))}}catch(t){a={error:t}}finally{try{b&&!b.done&&(s=g.return)&&s.call(g)}finally{if(a)throw a.error}}2===f&&d.splice(1,2)}}}catch(t){e={error:t}}finally{try{p&&!p.done&&(r=u.return)&&r.call(u)}finally{if(e)throw e.error}}}e.PAIREDDELIMS="mathtools-paired-delims",e.fixPrescripts=d,e.MathtoolsConfiguration=a.Configuration.create("mathtools",{handler:{macro:["mathtools-macros","mathtools-delimiters"],environment:["mathtools-environments"],delimiter:["mathtools-delimiters"],character:["mathtools-characters"]},items:(n={},n[h.MultlinedItem.prototype.kind]=h.MultlinedItem,n),init:function(t){new s.CommandMap(e.PAIREDDELIMS,{},{}),t.append(a.Configuration.local({handler:{macro:[e.PAIREDDELIMS]},priority:-5}))},config:function(t,e){var r,n,i=e.parseOptions,a=i.options.mathtools.pairedDelimiters;try{for(var s=o(Object.keys(a)),l=s.next();!l.done;l=s.next()){var c=l.value;u.MathtoolsUtil.addPairedDelims(i,c,a[c])}}catch(t){r={error:t}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}(0,p.MathtoolsTagFormat)(t,e)},postprocessors:[[d,-6]],options:{mathtools:{multlinegap:"1em","multlined-pos":"c","firstline-afterskip":"","lastline-preskip":"","smallmatrix-align":"c",shortvdotsadjustabove:".2em",shortvdotsadjustbelow:".2em",centercolon:!1,"centercolon-offset":".04em","thincolon-dx":"-.04em","thincolon-dw":"-.08em","use-unicode":!1,"prescript-sub-format":"","prescript-sup-format":"","prescript-arg-format":"","allow-mathtoolsset":!0,pairedDelimiters:(0,c.expandable)({}),tagforms:(0,c.expandable)({})}}})},6224:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.MultlinedItem=void 0;var a=r(2790),s=i(r(1256)),l=r(8317),c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"multlined"},enumerable:!1,configurable:!0}),e.prototype.EndTable=function(){if((this.Size()||this.row.length)&&(this.EndEntry(),this.EndRow()),this.table.length>1){var e=this.factory.configuration.options.mathtools,r=e.multlinegap,n=e["firstline-afterskip"]||r,o=e["lastline-preskip"]||r,i=s.default.getChildren(this.table[0])[0];s.default.getAttribute(i,"columnalign")!==l.TexConstant.Align.RIGHT&&i.appendChild(this.create("node","mspace",[],{width:n}));var a=s.default.getChildren(this.table[this.table.length-1])[0];if(s.default.getAttribute(a,"columnalign")!==l.TexConstant.Align.LEFT){var c=s.default.getChildren(a)[0];c.childNodes.unshift(null);var u=this.create("node","mspace",[],{width:o});s.default.setChild(c,0,u)}}t.prototype.EndTable.call(this)},e}(a.MultlineItem);e.MultlinedItem=c},2448:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=n(r(5450)),i=r(9140),a=r(8317),s=r(643);new i.CommandMap("mathtools-macros",{shoveleft:["HandleShove",a.TexConstant.Align.LEFT],shoveright:["HandleShove",a.TexConstant.Align.RIGHT],xleftrightarrow:["xArrow",8596,10,10],xLeftarrow:["xArrow",8656,12,7],xRightarrow:["xArrow",8658,7,12],xLeftrightarrow:["xArrow",8660,12,12],xhookleftarrow:["xArrow",8617,10,5],xhookrightarrow:["xArrow",8618,5,10],xmapsto:["xArrow",8614,10,10],xrightharpoondown:["xArrow",8641,5,10],xleftharpoondown:["xArrow",8637,10,5],xrightleftharpoons:["xArrow",8652,10,10],xrightharpoonup:["xArrow",8640,5,10],xleftharpoonup:["xArrow",8636,10,5],xleftrightharpoons:["xArrow",8651,10,10],mathllap:["MathLap","l",!1],mathrlap:["MathLap","r",!1],mathclap:["MathLap","c",!1],clap:["MtLap","c"],textllap:["MtLap","l"],textrlap:["MtLap","r"],textclap:["MtLap","c"],cramped:"Cramped",crampedllap:["MathLap","l",!0],crampedrlap:["MathLap","r",!0],crampedclap:["MathLap","c",!0],crampedsubstack:["Macro","\\begin{crampedsubarray}{c}#1\\end{crampedsubarray}",1],mathmbox:"MathMBox",mathmakebox:"MathMakeBox",overbracket:"UnderOverBracket",underbracket:"UnderOverBracket",refeq:"HandleRef",MoveEqLeft:["Macro","\\hspace{#1em}&\\hspace{-#1em}",1,"2"],Aboxed:"Aboxed",ArrowBetweenLines:"ArrowBetweenLines",vdotswithin:"VDotsWithin",shortvdotswithin:"ShortVDotsWithin",MTFlushSpaceAbove:"FlushSpaceAbove",MTFlushSpaceBelow:"FlushSpaceBelow",DeclarePairedDelimiter:"DeclarePairedDelimiter",DeclarePairedDelimiterX:"DeclarePairedDelimiterX",DeclarePairedDelimiterXPP:"DeclarePairedDelimiterXPP",DeclarePairedDelimiters:"DeclarePairedDelimiter",DeclarePairedDelimitersX:"DeclarePairedDelimiterX",DeclarePairedDelimitersXPP:"DeclarePairedDelimiterXPP",centercolon:["CenterColon",!0,!0],ordinarycolon:["CenterColon",!1],MTThinColon:["CenterColon",!0,!0,!0],coloneqq:["Relation",":=","\u2254"],Coloneqq:["Relation","::=","\u2a74"],coloneq:["Relation",":-"],Coloneq:["Relation","::-"],eqqcolon:["Relation","=:","\u2255"],Eqqcolon:["Relation","=::"],eqcolon:["Relation","-:","\u2239"],Eqcolon:["Relation","-::"],colonapprox:["Relation",":\\approx"],Colonapprox:["Relation","::\\approx"],colonsim:["Relation",":\\sim"],Colonsim:["Relation","::\\sim"],dblcolon:["Relation","::","\u2237"],nuparrow:["NArrow","\u2191",".06em"],ndownarrow:["NArrow","\u2193",".25em"],bigtimes:["Macro","\\mathop{\\Large\\kern-.1em\\boldsymbol{\\times}\\kern-.1em}"],splitfrac:["SplitFrac",!1],splitdfrac:["SplitFrac",!0],xmathstrut:"XMathStrut",prescript:"Prescript",newtagform:["NewTagForm",!1],renewtagform:["NewTagForm",!0],usetagform:"UseTagForm",adjustlimits:["MacroWithTemplate","\\mathop{{#1}\\vphantom{{#3}}}_{{#2}\\vphantom{{#4}}}\\mathop{{#3}\\vphantom{{#1}}}_{{#4}\\vphantom{{#2}}}",4,,"_",,"_"],mathtoolsset:"SetOptions"},s.MathtoolsMethods),new i.EnvironmentMap("mathtools-environments",o.default.environment,{dcases:["Array",null,"\\{","","ll",null,".2em","D"],rcases:["Array",null,"","\\}","ll",null,".2em"],drcases:["Array",null,"","\\}","ll",null,".2em","D"],"dcases*":["Cases",null,"{","","D"],"rcases*":["Cases",null,"","}"],"drcases*":["Cases",null,"","}","D"],"cases*":["Cases",null,"{",""],"matrix*":["MtMatrix",null,null,null],"pmatrix*":["MtMatrix",null,"(",")"],"bmatrix*":["MtMatrix",null,"[","]"],"Bmatrix*":["MtMatrix",null,"\\{","\\}"],"vmatrix*":["MtMatrix",null,"\\vert","\\vert"],"Vmatrix*":["MtMatrix",null,"\\Vert","\\Vert"],"smallmatrix*":["MtSmallMatrix",null,null,null],psmallmatrix:["MtSmallMatrix",null,"(",")","c"],"psmallmatrix*":["MtSmallMatrix",null,"(",")"],bsmallmatrix:["MtSmallMatrix",null,"[","]","c"],"bsmallmatrix*":["MtSmallMatrix",null,"[","]"],Bsmallmatrix:["MtSmallMatrix",null,"\\{","\\}","c"],"Bsmallmatrix*":["MtSmallMatrix",null,"\\{","\\}"],vsmallmatrix:["MtSmallMatrix",null,"\\vert","\\vert","c"],"vsmallmatrix*":["MtSmallMatrix",null,"\\vert","\\vert"],Vsmallmatrix:["MtSmallMatrix",null,"\\Vert","\\Vert","c"],"Vsmallmatrix*":["MtSmallMatrix",null,"\\Vert","\\Vert"],crampedsubarray:["Array",null,null,null,null,"0em","0.1em","S'",1],multlined:"MtMultlined",spreadlines:["SpreadLines",!0],lgathered:["AmsEqnArray",null,null,null,"l",null,".5em","D"],rgathered:["AmsEqnArray",null,null,null,"r",null,".5em","D"]},s.MathtoolsMethods),new i.DelimiterMap("mathtools-delimiters",o.default.delimiter,{"\\lparen":"(","\\rparen":")"}),new i.CommandMap("mathtools-characters",{":":["CenterColon",!0]},s.MathtoolsMethods)},643:function(t,e,r){var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},n.apply(this,arguments)},o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.MathtoolsMethods=void 0;var s=a(r(1130)),l=r(4387),c=a(r(7693)),u=a(r(8417)),p=a(r(3971)),h=a(r(1256)),d=r(9007),f=r(6010),m=r(7233),y=a(r(5579)),g=a(r(1110)),b=r(836);e.MathtoolsMethods={MtMatrix:function(t,r,n,o){var i=t.GetBrackets("\\begin{".concat(r.getName(),"}"),"c");return e.MathtoolsMethods.Array(t,r,n,o,i)},MtSmallMatrix:function(t,r,n,o,i){return i||(i=t.GetBrackets("\\begin{".concat(r.getName(),"}"),t.options.mathtools["smallmatrix-align"])),e.MathtoolsMethods.Array(t,r,n,o,i,s.default.Em(1/3),".2em","S",1)},MtMultlined:function(t,e){var r,n="\\begin{".concat(e.getName(),"}"),i=t.GetBrackets(n,t.options.mathtools["multlined-pos"]||"c"),a=i?t.GetBrackets(n,""):"";i&&!i.match(/^[cbt]$/)&&(a=(r=o([i,a],2))[0],i=r[1]),t.Push(e);var l=t.itemFactory.create("multlined",t,e);return l.arraydef={displaystyle:!0,rowspacing:".5em",width:a||"auto",columnwidth:"100%"},s.default.setArrayAlign(l,i||"c")},HandleShove:function(t,e,r){var n=t.stack.Top();if("multline"!==n.kind&&"multlined"!==n.kind)throw new p.default("CommandInMultlined","%1 can only appear within the multline or multlined environments",e);if(n.Size())throw new p.default("CommandAtTheBeginingOfLine","%1 must come at the beginning of the line",e);n.setProperty("shove",r);var o=t.GetBrackets(e),i=t.ParseArg(e);if(o){var a=t.create("node","mrow",[]),s=t.create("node","mspace",[],{width:o});"left"===r?(a.appendChild(s),a.appendChild(i)):(a.appendChild(i),a.appendChild(s)),i=a}t.Push(i)},SpreadLines:function(t,e){var r,n;if(t.stack.env.closing===e.getName()){delete t.stack.env.closing;var o=t.stack.Pop(),a=o.toMml(),s=o.getProperty("spread");if(a.isInferred)try{for(var l=i(h.default.getChildren(a)),c=l.next();!c.done;c=l.next()){var u=c.value;b.MathtoolsUtil.spreadLines(u,s)}}catch(t){r={error:t}}finally{try{c&&!c.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}else b.MathtoolsUtil.spreadLines(a,s);t.Push(a)}else{s=t.GetDimen("\\begin{".concat(e.getName(),"}"));e.setProperty("spread",s),t.Push(e)}},Cases:function(t,e,r,n,o){var i=t.itemFactory.create("array").setProperty("casesEnv",e.getName());return i.arraydef={rowspacing:".2em",columnspacing:"1em",columnalign:"left"},"D"===o&&(i.arraydef.displaystyle=!0),i.setProperties({open:r,close:n}),t.Push(e),i},MathLap:function(t,e,r,o){var i=t.GetBrackets(e,"").trim(),a=t.create("node","mstyle",[t.create("node","mpadded",[t.ParseArg(e)],n({width:0},"r"===r?{}:{lspace:"l"===r?"-1width":"-.5width"}))],{"data-cramped":o});b.MathtoolsUtil.setDisplayLevel(a,i),t.Push(t.create("node","TeXAtom",[a]))},Cramped:function(t,e){var r=t.GetBrackets(e,"").trim(),n=t.ParseArg(e),o=t.create("node","mstyle",[n],{"data-cramped":!0});b.MathtoolsUtil.setDisplayLevel(o,r),t.Push(o)},MtLap:function(t,e,r){var n=s.default.internalMath(t,t.GetArgument(e),0),o=t.create("node","mpadded",n,{width:0});"r"!==r&&h.default.setAttribute(o,"lspace","l"===r?"-1width":"-.5width"),t.Push(o)},MathMakeBox:function(t,e){var r=t.GetBrackets(e),n=t.GetBrackets(e,"c"),o=t.create("node","mpadded",[t.ParseArg(e)]);r&&h.default.setAttribute(o,"width",r);var i=(0,m.lookup)(n,{c:"center",r:"right"},"");i&&h.default.setAttribute(o,"data-align",i),t.Push(o)},MathMBox:function(t,e){t.Push(t.create("node","mrow",[t.ParseArg(e)]))},UnderOverBracket:function(t,e){var r=(0,f.length2em)(t.GetBrackets(e,".1em"),.1),n=t.GetBrackets(e,".2em"),i=t.GetArgument(e),a=o("o"===e.charAt(1)?["over","accent","bottom"]:["under","accentunder","top"],3),l=a[0],c=a[1],p=a[2],d=(0,f.em)(r),m=new u.default(i,t.stack.env,t.configuration).mml(),y=new u.default(i,t.stack.env,t.configuration).mml(),g=t.create("node","mpadded",[t.create("node","mphantom",[y])],{style:"border: ".concat(d," solid; border-").concat(p,": none"),height:n,depth:0}),b=s.default.underOver(t,m,g,l,!0),v=h.default.getChildAt(h.default.getChildAt(b,0),0);h.default.setAttribute(v,c,!0),t.Push(b)},Aboxed:function(t,e){var r=b.MathtoolsUtil.checkAlignment(t,e);r.row.length%2==1&&r.row.push(t.create("node","mtd",[]));var n=t.GetArgument(e),o=t.string.substr(t.i);t.string=n+"&&\\endAboxed",t.i=0;var i=t.GetUpTo(e,"&"),a=t.GetUpTo(e,"&");t.GetUpTo(e,"\\endAboxed");var l=s.default.substituteArgs(t,[i,a],"\\rlap{\\boxed{#1{}#2}}\\kern.267em\\phantom{#1}&\\phantom{{}#2}\\kern.267em");t.string=l+o,t.i=0},ArrowBetweenLines:function(t,e){var r=b.MathtoolsUtil.checkAlignment(t,e);if(r.Size()||r.row.length)throw new p.default("BetweenLines","%1 must be on a row by itself",e);var n=t.GetStar(),o=t.GetBrackets(e,"\\Updownarrow");n&&(r.EndEntry(),r.EndEntry());var i=n?"\\quad"+o:o+"\\quad",a=new u.default(i,t.stack.env,t.configuration).mml();t.Push(a),r.EndEntry(),r.EndRow()},VDotsWithin:function(t,e){var r=t.stack.Top(),o=r.getProperty("flushspaceabove")===r.table.length,i="\\mmlToken{mi}{}"+t.GetArgument(e)+"\\mmlToken{mi}{}",a=new u.default(i,t.stack.env,t.configuration).mml(),s=t.create("node","mpadded",[t.create("node","mpadded",[t.create("node","mo",[t.create("text","\u22ee")])],n({width:0,lspace:"-.5width"},o?{height:"-.6em",voffset:"-.18em"}:{})),t.create("node","mphantom",[a])],{lspace:".5width"});t.Push(s)},ShortVDotsWithin:function(t,r){var n=t.stack.Top(),o=t.GetStar();e.MathtoolsMethods.FlushSpaceAbove(t,"\\MTFlushSpaceAbove"),!o&&n.EndEntry(),e.MathtoolsMethods.VDotsWithin(t,"\\vdotswithin"),o&&n.EndEntry(),e.MathtoolsMethods.FlushSpaceBelow(t,"\\MTFlushSpaceBelow")},FlushSpaceAbove:function(t,e){var r=b.MathtoolsUtil.checkAlignment(t,e);r.setProperty("flushspaceabove",r.table.length),r.addRowSpacing("-"+t.options.mathtools.shortvdotsadjustabove)},FlushSpaceBelow:function(t,e){var r=b.MathtoolsUtil.checkAlignment(t,e);r.Size()&&r.EndEntry(),r.EndRow(),r.addRowSpacing("-"+t.options.mathtools.shortvdotsadjustbelow)},PairedDelimiters:function(t,e,r,n,i,a,l,c){void 0===i&&(i="#1"),void 0===a&&(a=1),void 0===l&&(l=""),void 0===c&&(c="");var u=t.GetStar(),p=u?"":t.GetBrackets(e),h=o(u?["\\left","\\right"]:p?[p+"l",p+"r"]:["",""],2),d=h[0],f=h[1],m=u?"\\middle":p||"";if(a){for(var y=[],g=y.length;g<a;g++)y.push(t.GetArgument(e));l=s.default.substituteArgs(t,y,l),i=s.default.substituteArgs(t,y,i),c=s.default.substituteArgs(t,y,c)}i=i.replace(/\\delimsize/g,m),t.string=[l,d,r,i,f,n,c,t.string.substr(t.i)].reduce((function(e,r){return s.default.addArgs(t,e,r)}),""),t.i=0,s.default.checkMaxMacros(t)},DeclarePairedDelimiter:function(t,e){var r=y.default.GetCsNameArgument(t,e),n=t.GetArgument(e),o=t.GetArgument(e);b.MathtoolsUtil.addPairedDelims(t.configuration,r,[n,o])},DeclarePairedDelimiterX:function(t,e){var r=y.default.GetCsNameArgument(t,e),n=y.default.GetArgCount(t,e),o=t.GetArgument(e),i=t.GetArgument(e),a=t.GetArgument(e);b.MathtoolsUtil.addPairedDelims(t.configuration,r,[o,i,a,n])},DeclarePairedDelimiterXPP:function(t,e){var r=y.default.GetCsNameArgument(t,e),n=y.default.GetArgCount(t,e),o=t.GetArgument(e),i=t.GetArgument(e),a=t.GetArgument(e),s=t.GetArgument(e),l=t.GetArgument(e);b.MathtoolsUtil.addPairedDelims(t.configuration,r,[i,a,l,n,o,s])},CenterColon:function(t,e,r,o,i){void 0===o&&(o=!1),void 0===i&&(i=!1);var a=t.options.mathtools,s=t.create("token","mo",{},":");if(r&&(a.centercolon||o)){var l=a["centercolon-offset"];s=t.create("node","mpadded",[s],n({voffset:l,height:"+".concat(l),depth:"-".concat(l)},i?{width:a["thincolon-dw"],lspace:a["thincolon-dx"]}:{}))}t.Push(s)},Relation:function(t,e,r,n){t.options.mathtools["use-unicode"]&&n?t.Push(t.create("token","mo",{texClass:d.TEXCLASS.REL},n)):(r="\\mathrel{"+r.replace(/:/g,"\\MTThinColon").replace(/-/g,"\\mathrel{-}")+"}",t.string=s.default.addArgs(t,r,t.string.substr(t.i)),t.i=0)},NArrow:function(t,e,r,n){t.Push(t.create("node","TeXAtom",[t.create("token","mtext",{},r),t.create("node","mpadded",[t.create("node","mpadded",[t.create("node","menclose",[t.create("node","mspace",[],{height:".2em",depth:0,width:".4em"})],{notation:"updiagonalstrike","data-thickness":".05em","data-padding":0})],{width:0,lspace:"-.5width",voffset:n}),t.create("node","mphantom",[t.create("token","mtext",{},r)])],{width:0,lspace:"-.5width"})],{texClass:d.TEXCLASS.REL}))},SplitFrac:function(t,e,r){var n=t.ParseArg(e),o=t.ParseArg(e);t.Push(t.create("node","mstyle",[t.create("node","mfrac",[t.create("node","mstyle",[n,t.create("token","mi"),t.create("token","mspace",{width:"1em"})],{scriptlevel:0}),t.create("node","mstyle",[t.create("token","mspace",{width:"1em"}),t.create("token","mi"),o],{scriptlevel:0})],{linethickness:0,numalign:"left",denomalign:"right"})],{displaystyle:r,scriptlevel:0}))},XMathStrut:function(t,e){var r=t.GetBrackets(e),n=t.GetArgument(e);n=b.MathtoolsUtil.plusOrMinus(e,n),r=b.MathtoolsUtil.plusOrMinus(e,r||n),t.Push(t.create("node","TeXAtom",[t.create("node","mpadded",[t.create("node","mphantom",[t.create("token","mo",{stretchy:!1},"(")])],{width:0,height:n+"height",depth:r+"depth"})],{texClass:d.TEXCLASS.ORD}))},Prescript:function(t,e){var r=b.MathtoolsUtil.getScript(t,e,"sup"),n=b.MathtoolsUtil.getScript(t,e,"sub"),o=b.MathtoolsUtil.getScript(t,e,"arg");if(h.default.isType(r,"none")&&h.default.isType(n,"none"))t.Push(o);else{var i=t.create("node","mmultiscripts",[o]);h.default.getChildren(i).push(null,null),h.default.appendChildren(i,[t.create("node","mprescripts"),n,r]),i.setProperty("fixPrescript",!0),t.Push(i)}},NewTagForm:function(t,e,r){void 0===r&&(r=!1);var n=t.tags;if(!("mtFormats"in n))throw new p.default("TagsNotMT","%1 can only be used with ams or mathtools tags",e);var o=t.GetArgument(e).trim();if(!o)throw new p.default("InvalidTagFormID","Tag form name can't be empty");var i=t.GetBrackets(e,""),a=t.GetArgument(e),s=t.GetArgument(e);if(!r&&n.mtFormats.has(o))throw new p.default("DuplicateTagForm","Duplicate tag form: %1",o);n.mtFormats.set(o,[a,s,i])},UseTagForm:function(t,e){var r=t.tags;if(!("mtFormats"in r))throw new p.default("TagsNotMT","%1 can only be used with ams or mathtools tags",e);var n=t.GetArgument(e).trim();if(n){if(!r.mtFormats.has(n))throw new p.default("UndefinedTagForm","Undefined tag form: %1",n);r.mtCurrent=r.mtFormats.get(n)}else r.mtCurrent=null},SetOptions:function(t,e){var r,n,o=t.options.mathtools;if(!o["allow-mathtoolsset"])throw new p.default("ForbiddenMathtoolsSet","%1 is disabled",e);var a={};Object.keys(o).forEach((function(t){"pariedDelimiters"!==t&&"tagforms"!==t&&"allow-mathtoolsset"!==t&&(a[t]=1)}));var l=t.GetArgument(e),c=s.default.keyvalOptions(l,a,!0);try{for(var u=i(Object.keys(c)),h=u.next();!h.done;h=u.next()){var d=h.value;o[d]=c[d]}}catch(t){r={error:t}}finally{try{h&&!h.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}},Array:c.default.Array,Macro:c.default.Macro,xArrow:l.AmsMethods.xArrow,HandleRef:l.AmsMethods.HandleRef,AmsEqnArray:l.AmsMethods.AmsEqnArray,MacroWithTemplate:g.default.MacroWithTemplate}},1503:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.MathtoolsTagFormat=void 0;var l=s(r(3971)),c=r(6521),u=0;e.MathtoolsTagFormat=function(t,e){var r=e.parseOptions.options.tags;"base"!==r&&t.tags.hasOwnProperty(r)&&c.TagsFactory.add(r,t.tags[r]);var n=function(t){function r(){var r,n,o=t.call(this)||this;o.mtFormats=new Map,o.mtCurrent=null;var a=e.parseOptions.options.mathtools.tagforms;try{for(var s=i(Object.keys(a)),c=s.next();!c.done;c=s.next()){var u=c.value;if(!Array.isArray(a[u])||3!==a[u].length)throw new l.default("InvalidTagFormDef",'The tag form definition for "%1" should be an array fo three strings',u);o.mtFormats.set(u,a[u])}}catch(t){r={error:t}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o}return o(r,t),r.prototype.formatTag=function(e){if(this.mtCurrent){var r=a(this.mtCurrent,3),n=r[0],o=r[1],i=r[2];return i?"".concat(n).concat(i,"{").concat(e,"}").concat(o):"".concat(n).concat(e).concat(o)}return t.prototype.formatTag.call(this,e)},r}(c.TagsFactory.create(e.parseOptions.options.tags).constructor),s="MathtoolsTags-"+ ++u;c.TagsFactory.add(s,n),e.parseOptions.options.tags=s}},836:function(t,e,r){var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.MathtoolsUtil=void 0;var i=r(1181),a=o(r(1130)),s=o(r(8417)),l=o(r(3971)),c=r(8803),u=r(7233),p=r(643),h=r(7535);e.MathtoolsUtil={setDisplayLevel:function(t,e){if(e){var r=n((0,u.lookup)(e,{"\\displaystyle":[!0,0],"\\textstyle":[!1,0],"\\scriptstyle":[!1,1],"\\scriptscriptstyle":[!1,2]},[null,null]),2),o=r[0],i=r[1];null!==o&&(t.attributes.set("displaystyle",o),t.attributes.set("scriptlevel",i))}},checkAlignment:function(t,e){var r=t.stack.Top();if(r.kind!==i.EqnArrayItem.prototype.kind)throw new l.default("NotInAlignment","%1 can only be used in aligment environments",e);return r},addPairedDelims:function(t,e,r){t.handlers.retrieve(h.PAIREDDELIMS).add(e,new c.Macro(e,p.MathtoolsMethods.PairedDelimiters,r))},spreadLines:function(t,e){if(t.isKind("mtable")){var r=t.attributes.get("rowspacing");if(r){var n=a.default.dimen2em(e);r=r.split(/ /).map((function(t){return a.default.Em(Math.max(0,a.default.dimen2em(t)+n))})).join(" ")}else r=e;t.attributes.set("rowspacing",r)}},plusOrMinus:function(t,e){if(!(e=e.trim()).match(/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)$/))throw new l.default("NotANumber","Argument to %1 is not a number",t);return e.match(/^[-+]/)?e:"+"+e},getScript:function(t,e,r){var n=a.default.trimSpaces(t.GetArgument(e));if(""===n)return t.create("node","none");var o=t.options.mathtools["prescript-".concat(r,"-format")];return o&&(n="".concat(o,"{").concat(n,"}")),new s.default(n,t.stack.env,t.configuration).mml()}}},6944:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.MhchemConfiguration=void 0;var o=r(9899),i=r(9140),a=n(r(3971)),s=n(r(7693)),l=r(4387),c=r(7718),u={};u.Macro=s.default.Macro,u.xArrow=l.AmsMethods.xArrow,u.Machine=function(t,e,r){var n,o=t.GetArgument(e);try{n=c.mhchemParser.toTex(o,r)}catch(t){throw new a.default(t[0],t[1])}t.string=n+t.string.substr(t.i),t.i=0},new i.CommandMap("mhchem",{ce:["Machine","ce"],pu:["Machine","pu"],longrightleftharpoons:["Macro","\\stackrel{\\textstyle{-}\\!\\!{\\rightharpoonup}}{\\smash{{\\leftharpoondown}\\!\\!{-}}}"],longRightleftharpoons:["Macro","\\stackrel{\\textstyle{-}\\!\\!{\\rightharpoonup}}{\\smash{\\leftharpoondown}}"],longLeftrightharpoons:["Macro","\\stackrel{\\textstyle\\vphantom{{-}}{\\rightharpoonup}}{\\smash{{\\leftharpoondown}\\!\\!{-}}}"],longleftrightarrows:["Macro","\\stackrel{\\longrightarrow}{\\smash{\\longleftarrow}\\Rule{0px}{.25em}{0px}}"],tripledash:["Macro","\\vphantom{-}\\raise2mu{\\kern2mu\\tiny\\text{-}\\kern1mu\\text{-}\\kern1mu\\text{-}\\kern2mu}"],xleftrightarrow:["xArrow",8596,6,6],xrightleftharpoons:["xArrow",8652,5,7],xRightleftharpoons:["xArrow",8652,5,7],xLeftrightharpoons:["xArrow",8652,5,7]},u),e.MhchemConfiguration=o.Configuration.create("mhchem",{handler:{macro:["mhchem"]}})},1496:function(t,e,r){var n,o=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&o(e,t,r);return i(e,t),e},s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.NewcommandConfiguration=void 0;var l=r(9899),c=r(6793),u=s(r(5579));r(5117);var p=s(r(5450)),h=a(r(9140));e.NewcommandConfiguration=l.Configuration.create("newcommand",{handler:{macro:["Newcommand-macros"]},items:(n={},n[c.BeginEnvItem.prototype.kind]=c.BeginEnvItem,n),options:{maxMacros:1e3},init:function(t){new h.DelimiterMap(u.default.NEW_DELIMITER,p.default.delimiter,{}),new h.CommandMap(u.default.NEW_COMMAND,{},{}),new h.EnvironmentMap(u.default.NEW_ENVIRONMENT,p.default.environment,{},{}),t.append(l.Configuration.local({handler:{character:[],delimiter:[u.default.NEW_DELIMITER],macro:[u.default.NEW_DELIMITER,u.default.NEW_COMMAND],environment:[u.default.NEW_ENVIRONMENT]},priority:-1}))}})},6793:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.BeginEnvItem=void 0;var a=i(r(3971)),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"beginEnv"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.checkItem=function(e){if(e.isKind("end")){if(e.getName()!==this.getName())throw new a.default("EnvBadEnd","\\begin{%1} ended with \\end{%2}",this.getName(),e.getName());return[[this.factory.create("mml",this.toMml())],!0]}if(e.isKind("stop"))throw new a.default("EnvMissingEnd","Missing \\end{%1}",this.getName());return t.prototype.checkItem.call(this,e)},e}(r(8292).BaseItem);e.BeginEnvItem=s},5117:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=n(r(1110));new(r(9140).CommandMap)("Newcommand-macros",{newcommand:"NewCommand",renewcommand:"NewCommand",newenvironment:"NewEnvironment",renewenvironment:"NewEnvironment",def:"MacroDef",let:"Let"},o.default)},1110:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var s=a(r(3971)),l=i(r(9140)),c=a(r(7693)),u=a(r(1130)),p=a(r(5579)),h={NewCommand:function(t,e){var r=p.default.GetCsNameArgument(t,e),n=p.default.GetArgCount(t,e),o=t.GetBrackets(e),i=t.GetArgument(e);p.default.addMacro(t,r,h.Macro,[i,n,o])},NewEnvironment:function(t,e){var r=u.default.trimSpaces(t.GetArgument(e)),n=p.default.GetArgCount(t,e),o=t.GetBrackets(e),i=t.GetArgument(e),a=t.GetArgument(e);p.default.addEnvironment(t,r,h.BeginEnv,[!0,i,a,n,o])},MacroDef:function(t,e){var r=p.default.GetCSname(t,e),n=p.default.GetTemplate(t,e,"\\"+r),o=t.GetArgument(e);n instanceof Array?p.default.addMacro(t,r,h.MacroWithTemplate,[o].concat(n)):p.default.addMacro(t,r,h.Macro,[o,n])},Let:function(t,e){var r=p.default.GetCSname(t,e),n=t.GetNext();"="===n&&(t.i++,n=t.GetNext());var o=t.configuration.handlers;if("\\"!==n){t.i++;var i=o.get("delimiter").lookup(n);i?p.default.addDelimiter(t,"\\"+r,i.char,i.attributes):p.default.addMacro(t,r,h.Macro,[n])}else{e=p.default.GetCSname(t,e);var a=o.get("delimiter").lookup("\\"+e);if(a)return void p.default.addDelimiter(t,"\\"+r,a.char,a.attributes);var s=o.get("macro").applicable(e);if(!s)return;if(s instanceof l.MacroMap){var c=s.lookup(e);return void p.default.addMacro(t,r,c.func,c.args,c.symbol)}a=s.lookup(e);var u=p.default.disassembleSymbol(r,a);p.default.addMacro(t,r,(function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=p.default.assembleSymbol(r);return s.parser(t,o)}),u)}},MacroWithTemplate:function(t,e,r,n){for(var o=[],i=4;i<arguments.length;i++)o[i-4]=arguments[i];var a=parseInt(n,10);if(a){var l=[];if(t.GetNext(),o[0]&&!p.default.MatchParam(t,o[0]))throw new s.default("MismatchUseDef","Use of %1 doesn't match its definition",e);for(var c=0;c<a;c++)l.push(p.default.GetParameter(t,e,o[c+1]));r=u.default.substituteArgs(t,l,r)}t.string=u.default.addArgs(t,r,t.string.slice(t.i)),t.i=0,u.default.checkMaxMacros(t)},BeginEnv:function(t,e,r,n,o,i){if(e.getProperty("end")&&t.stack.env.closing===e.getName()){delete t.stack.env.closing;var a=t.string.slice(t.i);return t.string=n,t.i=0,t.Parse(),t.string=a,t.i=0,t.itemFactory.create("end").setProperty("name",e.getName())}if(o){var s=[];if(null!=i){var l=t.GetBrackets("\\begin{"+e.getName()+"}");s.push(null==l?i:l)}for(var c=s.length;c<o;c++)s.push(t.GetArgument("\\begin{"+e.getName()+"}"));r=u.default.substituteArgs(t,s,r),n=u.default.substituteArgs(t,[],n)}return t.string=u.default.addArgs(t,r,t.string.slice(t.i)),t.i=0,t.itemFactory.create("beginEnv").setProperty("name",e.getName())}};h.Macro=c.default.Macro,e.default=h},5579:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o,i=n(r(1130)),a=n(r(3971)),s=r(8803);!function(t){function e(t,e){return t.string.substr(t.i,e.length)!==e||e.match(/\\[a-z]+$/i)&&t.string.charAt(t.i+e.length).match(/[a-z]/i)?0:(t.i+=e.length,1)}t.disassembleSymbol=function(t,e){var r=[t,e.char];if(e.attributes)for(var n in e.attributes)r.push(n),r.push(e.attributes[n]);return r},t.assembleSymbol=function(t){for(var e=t[0],r=t[1],n={},o=2;o<t.length;o+=2)n[t[o]]=t[o+1];return new s.Symbol(e,r,n)},t.GetCSname=function(t,e){if("\\"!==t.GetNext())throw new a.default("MissingCS","%1 must be followed by a control sequence",e);return i.default.trimSpaces(t.GetArgument(e)).substr(1)},t.GetCsNameArgument=function(t,e){var r=i.default.trimSpaces(t.GetArgument(e));if("\\"===r.charAt(0)&&(r=r.substr(1)),!r.match(/^(.|[a-z]+)$/i))throw new a.default("IllegalControlSequenceName","Illegal control sequence name for %1",e);return r},t.GetArgCount=function(t,e){var r=t.GetBrackets(e);if(r&&!(r=i.default.trimSpaces(r)).match(/^[0-9]+$/))throw new a.default("IllegalParamNumber","Illegal number of parameters specified in %1",e);return r},t.GetTemplate=function(t,e,r){for(var n=t.GetNext(),o=[],i=0,s=t.i;t.i<t.string.length;){if("#"===(n=t.GetNext())){if(s!==t.i&&(o[i]=t.string.substr(s,t.i-s)),!(n=t.string.charAt(++t.i)).match(/^[1-9]$/))throw new a.default("CantUseHash2","Illegal use of # in template for %1",r);if(parseInt(n)!==++i)throw new a.default("SequentialParam","Parameters for %1 must be numbered sequentially",r);s=t.i+1}else if("{"===n)return s!==t.i&&(o[i]=t.string.substr(s,t.i-s)),o.length>0?[i.toString()].concat(o):i;t.i++}throw new a.default("MissingReplacementString","Missing replacement string for definition of %1",e)},t.GetParameter=function(t,r,n){if(null==n)return t.GetArgument(r);for(var o=t.i,i=0,s=0;t.i<t.string.length;){var l=t.string.charAt(t.i);if("{"===l)t.i===o&&(s=1),t.GetArgument(r),i=t.i-o;else{if(e(t,n))return s&&(o++,i-=2),t.string.substr(o,i);if("\\"===l){t.i++,i++,s=0;var c=t.string.substr(t.i).match(/[a-z]+|./i);c&&(t.i+=c[0].length,i=t.i-o)}else t.i++,i++,s=0}}throw new a.default("RunawayArgument","Runaway argument for %1?",r)},t.MatchParam=e,t.addDelimiter=function(e,r,n,o){e.configuration.handlers.retrieve(t.NEW_DELIMITER).add(r,new s.Symbol(r,n,o))},t.addMacro=function(e,r,n,o,i){void 0===i&&(i=""),e.configuration.handlers.retrieve(t.NEW_COMMAND).add(r,new s.Macro(i||r,n,o))},t.addEnvironment=function(e,r,n,o){e.configuration.handlers.retrieve(t.NEW_ENVIRONMENT).add(r,new s.Macro(r,n,o))},t.NEW_DELIMITER="new-Delimiter",t.NEW_COMMAND="new-Command",t.NEW_ENVIRONMENT="new-Environment"}(o||(o={})),e.default=o},4234:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.NoErrorsConfiguration=void 0;var n=r(9899);e.NoErrorsConfiguration=n.Configuration.create("noerrors",{nodes:{error:function(t,e,r,n){var o=t.create("token","mtext",{},n.replace(/\n/g," "));return t.create("node","merror",[o],{"data-mjx-error":e,title:e})}}})},4898:function(t,e,r){var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.NoUndefinedConfiguration=void 0;var o=r(9899);e.NoUndefinedConfiguration=o.Configuration.create("noundefined",{fallback:{macro:function(t,e){var r,o,i=t.create("text","\\"+e),a=t.options.noundefined||{},s={};try{for(var l=n(["color","background","size"]),c=l.next();!c.done;c=l.next()){var u=c.value;a[u]&&(s["math"+u]=a[u])}}catch(t){r={error:t}}finally{try{c&&!c.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}t.Push(t.create("node","mtext",[],s,i))}},options:{noundefined:{color:"red",background:"",size:""}},priority:3})},3168:function(t,e,r){var n;Object.defineProperty(e,"__esModule",{value:!0}),e.PhysicsConfiguration=void 0;var o=r(9899),i=r(2612);r(3847),e.PhysicsConfiguration=o.Configuration.create("physics",{handler:{macro:["Physics-automatic-bracing-macros","Physics-vector-macros","Physics-vector-mo","Physics-vector-mi","Physics-derivative-macros","Physics-expressions-macros","Physics-quick-quad-macros","Physics-bra-ket-macros","Physics-matrix-macros"],character:["Physics-characters"],environment:["Physics-aux-envs"]},items:(n={},n[i.AutoOpen.prototype.kind]=i.AutoOpen,n),options:{physics:{italicdiff:!1,arrowdel:!1}}})},2612:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.AutoOpen=void 0;var a=r(8292),s=i(r(1130)),l=i(r(1256)),c=i(r(8417)),u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.openCount=0,e}return o(e,t),Object.defineProperty(e.prototype,"kind",{get:function(){return"auto open"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isOpen",{get:function(){return!0},enumerable:!1,configurable:!0}),e.prototype.toMml=function(){var e=this.factory.configuration.parser,r=this.getProperty("right");if(this.getProperty("smash")){var n=t.prototype.toMml.call(this),o=e.create("node","mpadded",[n],{height:0,depth:0});this.Clear(),this.Push(e.create("node","TeXAtom",[o]))}r&&this.Push(new c.default(r,e.stack.env,e.configuration).mml());var i=s.default.fenced(this.factory.configuration,this.getProperty("open"),t.prototype.toMml.call(this),this.getProperty("close"),this.getProperty("big"));return l.default.removeProperties(i,"open","close","texClass"),i},e.prototype.checkItem=function(e){if(e.isKind("mml")&&1===e.Size()){var r=e.toMml();r.isKind("mo")&&r.getText()===this.getProperty("open")&&this.openCount++}var n=e.getProperty("autoclose");return n&&n===this.getProperty("close")&&!this.openCount--?this.getProperty("ignore")?(this.Clear(),[[],!0]):[[this.toMml()],!0]:t.prototype.checkItem.call(this,e)},e.errors=Object.assign(Object.create(a.BaseItem.errors),{stop:["ExtraOrMissingDelims","Extra open or missing close delimiter"]}),e}(a.BaseItem);e.AutoOpen=u},3847:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=r(9140),i=n(r(7157)),a=r(8317),s=n(r(5450)),l=r(9007);new o.CommandMap("Physics-automatic-bracing-macros",{quantity:"Quantity",qty:"Quantity",pqty:["Quantity","(",")",!0],bqty:["Quantity","[","]",!0],vqty:["Quantity","|","|",!0],Bqty:["Quantity","\\{","\\}",!0],absolutevalue:["Quantity","|","|",!0],abs:["Quantity","|","|",!0],norm:["Quantity","\\|","\\|",!0],evaluated:"Eval",eval:"Eval",order:["Quantity","(",")",!0,"O",a.TexConstant.Variant.CALLIGRAPHIC],commutator:"Commutator",comm:"Commutator",anticommutator:["Commutator","\\{","\\}"],acomm:["Commutator","\\{","\\}"],poissonbracket:["Commutator","\\{","\\}"],pb:["Commutator","\\{","\\}"]},i.default),new o.CharacterMap("Physics-vector-mo",s.default.mathchar0mo,{dotproduct:["\u22c5",{mathvariant:a.TexConstant.Variant.BOLD}],vdot:["\u22c5",{mathvariant:a.TexConstant.Variant.BOLD}],crossproduct:"\xd7",cross:"\xd7",cp:"\xd7",gradientnabla:["\u2207",{mathvariant:a.TexConstant.Variant.BOLD}]}),new o.CharacterMap("Physics-vector-mi",s.default.mathchar0mi,{real:["\u211c",{mathvariant:a.TexConstant.Variant.NORMAL}],imaginary:["\u2111",{mathvariant:a.TexConstant.Variant.NORMAL}]}),new o.CommandMap("Physics-vector-macros",{vnabla:"Vnabla",vectorbold:"VectorBold",vb:"VectorBold",vectorarrow:["StarMacro",1,"\\vec{\\vb","{#1}}"],va:["StarMacro",1,"\\vec{\\vb","{#1}}"],vectorunit:["StarMacro",1,"\\hat{\\vb","{#1}}"],vu:["StarMacro",1,"\\hat{\\vb","{#1}}"],gradient:["OperatorApplication","\\vnabla","(","["],grad:["OperatorApplication","\\vnabla","(","["],divergence:["VectorOperator","\\vnabla\\vdot","(","["],div:["VectorOperator","\\vnabla\\vdot","(","["],curl:["VectorOperator","\\vnabla\\crossproduct","(","["],laplacian:["OperatorApplication","\\nabla^2","(","["]},i.default),new o.CommandMap("Physics-expressions-macros",{sin:"Expression",sinh:"Expression",arcsin:"Expression",asin:"Expression",cos:"Expression",cosh:"Expression",arccos:"Expression",acos:"Expression",tan:"Expression",tanh:"Expression",arctan:"Expression",atan:"Expression",csc:"Expression",csch:"Expression",arccsc:"Expression",acsc:"Expression",sec:"Expression",sech:"Expression",arcsec:"Expression",asec:"Expression",cot:"Expression",coth:"Expression",arccot:"Expression",acot:"Expression",exp:["Expression",!1],log:"Expression",ln:"Expression",det:["Expression",!1],Pr:["Expression",!1],tr:["Expression",!1],trace:["Expression",!1,"tr"],Tr:["Expression",!1],Trace:["Expression",!1,"Tr"],rank:"NamedFn",erf:["Expression",!1],Residue:["Macro","\\mathrm{Res}"],Res:["OperatorApplication","\\Residue","(","[","{"],principalvalue:["OperatorApplication","{\\cal P}"],pv:["OperatorApplication","{\\cal P}"],PV:["OperatorApplication","{\\rm P.V.}"],Re:["OperatorApplication","\\mathrm{Re}","{"],Im:["OperatorApplication","\\mathrm{Im}","{"],sine:["NamedFn","sin"],hypsine:["NamedFn","sinh"],arcsine:["NamedFn","arcsin"],asine:["NamedFn","asin"],cosine:["NamedFn","cos"],hypcosine:["NamedFn","cosh"],arccosine:["NamedFn","arccos"],acosine:["NamedFn","acos"],tangent:["NamedFn","tan"],hyptangent:["NamedFn","tanh"],arctangent:["NamedFn","arctan"],atangent:["NamedFn","atan"],cosecant:["NamedFn","csc"],hypcosecant:["NamedFn","csch"],arccosecant:["NamedFn","arccsc"],acosecant:["NamedFn","acsc"],secant:["NamedFn","sec"],hypsecant:["NamedFn","sech"],arcsecant:["NamedFn","arcsec"],asecant:["NamedFn","asec"],cotangent:["NamedFn","cot"],hypcotangent:["NamedFn","coth"],arccotangent:["NamedFn","arccot"],acotangent:["NamedFn","acot"],exponential:["NamedFn","exp"],logarithm:["NamedFn","log"],naturallogarithm:["NamedFn","ln"],determinant:["NamedFn","det"],Probability:["NamedFn","Pr"]},i.default),new o.CommandMap("Physics-quick-quad-macros",{qqtext:"Qqtext",qq:"Qqtext",qcomma:["Macro","\\qqtext*{,}"],qc:["Macro","\\qqtext*{,}"],qcc:["Qqtext","c.c."],qif:["Qqtext","if"],qthen:["Qqtext","then"],qelse:["Qqtext","else"],qotherwise:["Qqtext","otherwise"],qunless:["Qqtext","unless"],qgiven:["Qqtext","given"],qusing:["Qqtext","using"],qassume:["Qqtext","assume"],qsince:["Qqtext","since"],qlet:["Qqtext","let"],qfor:["Qqtext","for"],qall:["Qqtext","all"],qeven:["Qqtext","even"],qodd:["Qqtext","odd"],qinteger:["Qqtext","integer"],qand:["Qqtext","and"],qor:["Qqtext","or"],qas:["Qqtext","as"],qin:["Qqtext","in"]},i.default),new o.CommandMap("Physics-derivative-macros",{diffd:"DiffD",flatfrac:["Macro","\\left.#1\\middle/#2\\right.",2],differential:["Differential","\\diffd"],dd:["Differential","\\diffd"],variation:["Differential","\\delta"],var:["Differential","\\delta"],derivative:["Derivative",2,"\\diffd"],dv:["Derivative",2,"\\diffd"],partialderivative:["Derivative",3,"\\partial"],pderivative:["Derivative",3,"\\partial"],pdv:["Derivative",3,"\\partial"],functionalderivative:["Derivative",2,"\\delta"],fderivative:["Derivative",2,"\\delta"],fdv:["Derivative",2,"\\delta"]},i.default),new o.CommandMap("Physics-bra-ket-macros",{bra:"Bra",ket:"Ket",innerproduct:"BraKet",ip:"BraKet",braket:"BraKet",outerproduct:"KetBra",dyad:"KetBra",ketbra:"KetBra",op:"KetBra",expectationvalue:"Expectation",expval:"Expectation",ev:"Expectation",matrixelement:"MatrixElement",matrixel:"MatrixElement",mel:"MatrixElement"},i.default),new o.CommandMap("Physics-matrix-macros",{matrixquantity:"MatrixQuantity",mqty:"MatrixQuantity",pmqty:["Macro","\\mqty(#1)",1],Pmqty:["Macro","\\mqty*(#1)",1],bmqty:["Macro","\\mqty[#1]",1],vmqty:["Macro","\\mqty|#1|",1],smallmatrixquantity:["MatrixQuantity",!0],smqty:["MatrixQuantity",!0],spmqty:["Macro","\\smqty(#1)",1],sPmqty:["Macro","\\smqty*(#1)",1],sbmqty:["Macro","\\smqty[#1]",1],svmqty:["Macro","\\smqty|#1|",1],matrixdeterminant:["Macro","\\vmqty{#1}",1],mdet:["Macro","\\vmqty{#1}",1],smdet:["Macro","\\svmqty{#1}",1],identitymatrix:"IdentityMatrix",imat:"IdentityMatrix",xmatrix:"XMatrix",xmat:"XMatrix",zeromatrix:["Macro","\\xmat{0}{#1}{#2}",2],zmat:["Macro","\\xmat{0}{#1}{#2}",2],paulimatrix:"PauliMatrix",pmat:"PauliMatrix",diagonalmatrix:"DiagonalMatrix",dmat:"DiagonalMatrix",antidiagonalmatrix:["DiagonalMatrix",!0],admat:["DiagonalMatrix",!0]},i.default),new o.EnvironmentMap("Physics-aux-envs",s.default.environment,{smallmatrix:["Array",null,null,null,"c","0.333em",".2em","S",1]},i.default),new o.MacroMap("Physics-characters",{"|":["AutoClose",l.TEXCLASS.ORD],")":"AutoClose","]":"AutoClose"},i.default)},7157:function(t,e,r){var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=o(r(7693)),a=o(r(8417)),s=o(r(3971)),l=r(9007),c=o(r(1130)),u=o(r(1256)),p=r(8929),h={},d={"(":")","[":"]","{":"}","|":"|"},f=/^(b|B)i(g{1,2})$/;h.Quantity=function(t,e,r,n,o,i,p){void 0===r&&(r="("),void 0===n&&(n=")"),void 0===o&&(o=!1),void 0===i&&(i=""),void 0===p&&(p="");var h=!!o&&t.GetStar(),m=t.GetNext(),y=t.i,g=null;if("\\"===m){if(t.i++,!(g=t.GetCS()).match(f)){var b=t.create("node","mrow");return t.Push(c.default.fenced(t.configuration,r,b,n)),void(t.i=y)}m=t.GetNext()}var v=d[m];if(o&&"{"!==m)throw new s.default("MissingArgFor","Missing argument for %1",t.currentCS);if(!v){b=t.create("node","mrow");return t.Push(c.default.fenced(t.configuration,r,b,n)),void(t.i=y)}if(i){var _=t.create("token","mi",{texClass:l.TEXCLASS.OP},i);p&&u.default.setAttribute(_,"mathvariant",p),t.Push(t.itemFactory.create("fn",_))}if("{"===m){var S=t.GetArgument(e);return m=o?r:"\\{",v=o?n:"\\}",S=h?m+" "+S+" "+v:g?"\\"+g+"l"+m+" "+S+" \\"+g+"r"+v:"\\left"+m+" "+S+" \\right"+v,void t.Push(new a.default(S,t.stack.env,t.configuration).mml())}o&&(m=r,v=n),t.i++,t.Push(t.itemFactory.create("auto open").setProperties({open:m,close:v,big:g}))},h.Eval=function(t,e){var r=t.GetStar(),n=t.GetNext();if("{"!==n){if("("===n||"["===n)return t.i++,void t.Push(t.itemFactory.create("auto open").setProperties({open:n,close:"|",smash:r,right:"\\vphantom{\\int}"}));throw new s.default("MissingArgFor","Missing argument for %1",t.currentCS)}var o=t.GetArgument(e),i="\\left. "+(r?"\\smash{"+o+"}":o)+" \\vphantom{\\int}\\right|";t.string=t.string.slice(0,t.i)+i+t.string.slice(t.i)},h.Commutator=function(t,e,r,n){void 0===r&&(r="["),void 0===n&&(n="]");var o=t.GetStar(),i=t.GetNext(),l=null;if("\\"===i){if(t.i++,!(l=t.GetCS()).match(f))throw new s.default("MissingArgFor","Missing argument for %1",t.currentCS);i=t.GetNext()}if("{"!==i)throw new s.default("MissingArgFor","Missing argument for %1",t.currentCS);var c=t.GetArgument(e)+","+t.GetArgument(e);c=o?r+" "+c+" "+n:l?"\\"+l+"l"+r+" "+c+" \\"+l+"r"+n:"\\left"+r+" "+c+" \\right"+n,t.Push(new a.default(c,t.stack.env,t.configuration).mml())};var m=[65,90],y=[97,122],g=[913,937],b=[945,969],v=[48,57];function _(t,e){return t>=e[0]&&t<=e[1]}function S(t,e,r,n){var o=t.configuration.parser,i=p.NodeFactory.createToken(t,e,r,n),a=n.codePointAt(0);return 1===n.length&&!o.stack.env.font&&o.stack.env.vectorFont&&(_(a,m)||_(a,y)||_(a,g)||_(a,v)||_(a,b)&&o.stack.env.vectorStar||u.default.getAttribute(i,"accent"))&&u.default.setAttribute(i,"mathvariant",o.stack.env.vectorFont),i}h.VectorBold=function(t,e){var r=t.GetStar(),n=t.GetArgument(e),o=t.configuration.nodeFactory.get("token"),i=t.stack.env.font;delete t.stack.env.font,t.configuration.nodeFactory.set("token",S),t.stack.env.vectorFont=r?"bold-italic":"bold",t.stack.env.vectorStar=r;var s=new a.default(n,t.stack.env,t.configuration).mml();i&&(t.stack.env.font=i),delete t.stack.env.vectorFont,delete t.stack.env.vectorStar,t.configuration.nodeFactory.set("token",o),t.Push(s)},h.StarMacro=function(t,e,r){for(var n=[],o=3;o<arguments.length;o++)n[o-3]=arguments[o];var i=t.GetStar(),a=[];if(r)for(var s=a.length;s<r;s++)a.push(t.GetArgument(e));var l=n.join(i?"*":"");l=c.default.substituteArgs(t,a,l),t.string=c.default.addArgs(t,l,t.string.slice(t.i)),t.i=0,c.default.checkMaxMacros(t)};var x=function(t,e,r,n,o){var i=new a.default(n,t.stack.env,t.configuration).mml();t.Push(t.itemFactory.create(e,i));var s=t.GetNext(),l=d[s];if(l){var c=-1!==o.indexOf(s);if("{"===s){var u=(c?"\\left\\{":"")+" "+t.GetArgument(r)+" "+(c?"\\right\\}":"");return t.string=u+t.string.slice(t.i),void(t.i=0)}c&&(t.i++,t.Push(t.itemFactory.create("auto open").setProperties({open:s,close:l})))}};function M(t,e,r){var o=n(t,3),i=o[0],a=o[1],s=o[2];return e&&r?"\\left\\langle{".concat(i,"}\\middle\\vert{").concat(a,"}\\middle\\vert{").concat(s,"}\\right\\rangle"):e?"\\langle{".concat(i,"}\\vert{").concat(a,"}\\vert{").concat(s,"}\\rangle"):"\\left\\langle{".concat(i,"}\\right\\vert{").concat(a,"}\\left\\vert{").concat(s,"}\\right\\rangle")}h.OperatorApplication=function(t,e,r){for(var n=[],o=3;o<arguments.length;o++)n[o-3]=arguments[o];x(t,"fn",e,r,n)},h.VectorOperator=function(t,e,r){for(var n=[],o=3;o<arguments.length;o++)n[o-3]=arguments[o];x(t,"mml",e,r,n)},h.Expression=function(t,e,r,n){void 0===r&&(r=!0),void 0===n&&(n=""),n=n||e.slice(1);var o=r?t.GetBrackets(e):null,i=t.create("token","mi",{texClass:l.TEXCLASS.OP},n);if(o){var s=new a.default(o,t.stack.env,t.configuration).mml();i=t.create("node","msup",[i,s])}t.Push(t.itemFactory.create("fn",i)),"("===t.GetNext()&&(t.i++,t.Push(t.itemFactory.create("auto open").setProperties({open:"(",close:")"})))},h.Qqtext=function(t,e,r){var n=(t.GetStar()?"":"\\quad")+"\\text{"+(r||t.GetArgument(e))+"}\\quad ";t.string=t.string.slice(0,t.i)+n+t.string.slice(t.i)},h.Differential=function(t,e,r){var n=t.GetBrackets(e),o=null!=n?"^{"+n+"}":" ",i="("===t.GetNext(),s="{"===t.GetNext(),c=r+o;if(i||s)if(s){c+=t.GetArgument(e);u=new a.default(c,t.stack.env,t.configuration).mml();t.Push(t.create("node","TeXAtom",[u],{texClass:l.TEXCLASS.OP}))}else t.Push(new a.default(c,t.stack.env,t.configuration).mml()),t.i++,t.Push(t.itemFactory.create("auto open").setProperties({open:"(",close:")"}));else{c+=t.GetArgument(e,!0)||"";var u=new a.default(c,t.stack.env,t.configuration).mml();t.Push(u)}},h.Derivative=function(t,e,r,n){var o=t.GetStar(),i=t.GetBrackets(e),s=1,l=[];for(l.push(t.GetArgument(e));"{"===t.GetNext()&&s<r;)l.push(t.GetArgument(e)),s++;var c=!1,u=" ",p=" ";r>2&&l.length>2?(u="^{"+(l.length-1)+"}",c=!0):null!=i&&(r>2&&l.length>1&&(c=!0),p=u="^{"+i+"}");for(var h=o?"\\flatfrac":"\\frac",d=l.length>1?l[0]:"",f=l.length>1?l[1]:l[0],m="",y=2,g=void 0;g=l[y];y++)m+=n+" "+g;var b=h+"{"+n+u+d+"}{"+n+" "+f+p+" "+m+"}";t.Push(new a.default(b,t.stack.env,t.configuration).mml()),"("===t.GetNext()&&(t.i++,t.Push(t.itemFactory.create("auto open").setProperties({open:"(",close:")",ignore:c})))},h.Bra=function(t,e){var r=t.GetStar(),n=t.GetArgument(e),o="",i=!1,s=!1;if("\\"===t.GetNext()){var l=t.i;t.i++;var c=t.GetCS(),u=t.lookup("macro",c);u&&"ket"===u.symbol?(i=!0,l=t.i,s=t.GetStar(),"{"===t.GetNext()?o=t.GetArgument(c,!0):(t.i=l,s=!1)):t.i=l}var p="";p=i?r||s?"\\langle{".concat(n,"}\\vert{").concat(o,"}\\rangle"):"\\left\\langle{".concat(n,"}\\middle\\vert{").concat(o,"}\\right\\rangle"):r||s?"\\langle{".concat(n,"}\\vert"):"\\left\\langle{".concat(n,"}\\right\\vert{").concat(o,"}"),t.Push(new a.default(p,t.stack.env,t.configuration).mml())},h.Ket=function(t,e){var r=t.GetStar(),n=t.GetArgument(e),o=r?"\\vert{".concat(n,"}\\rangle"):"\\left\\vert{".concat(n,"}\\right\\rangle");t.Push(new a.default(o,t.stack.env,t.configuration).mml())},h.BraKet=function(t,e){var r=t.GetStar(),n=t.GetArgument(e),o=null;"{"===t.GetNext()&&(o=t.GetArgument(e,!0));var i="";i=null==o?r?"\\langle{".concat(n,"}\\vert{").concat(n,"}\\rangle"):"\\left\\langle{".concat(n,"}\\middle\\vert{").concat(n,"}\\right\\rangle"):r?"\\langle{".concat(n,"}\\vert{").concat(o,"}\\rangle"):"\\left\\langle{".concat(n,"}\\middle\\vert{").concat(o,"}\\right\\rangle"),t.Push(new a.default(i,t.stack.env,t.configuration).mml())},h.KetBra=function(t,e){var r=t.GetStar(),n=t.GetArgument(e),o=null;"{"===t.GetNext()&&(o=t.GetArgument(e,!0));var i="";i=null==o?r?"\\vert{".concat(n,"}\\rangle\\!\\langle{").concat(n,"}\\vert"):"\\left\\vert{".concat(n,"}\\middle\\rangle\\!\\middle\\langle{").concat(n,"}\\right\\vert"):r?"\\vert{".concat(n,"}\\rangle\\!\\langle{").concat(o,"}\\vert"):"\\left\\vert{".concat(n,"}\\middle\\rangle\\!\\middle\\langle{").concat(o,"}\\right\\vert"),t.Push(new a.default(i,t.stack.env,t.configuration).mml())},h.Expectation=function(t,e){var r=t.GetStar(),n=r&&t.GetStar(),o=t.GetArgument(e),i=null;"{"===t.GetNext()&&(i=t.GetArgument(e,!0));var s=o&&i?M([i,o,i],r,n):r?"\\langle {".concat(o,"} \\rangle"):"\\left\\langle {".concat(o,"} \\right\\rangle");t.Push(new a.default(s,t.stack.env,t.configuration).mml())},h.MatrixElement=function(t,e){var r=t.GetStar(),n=r&&t.GetStar(),o=M([t.GetArgument(e),t.GetArgument(e),t.GetArgument(e)],r,n);t.Push(new a.default(o,t.stack.env,t.configuration).mml())},h.MatrixQuantity=function(t,e,r){var n=t.GetStar(),o=r?"smallmatrix":"array",i="",s="",l="";switch(t.GetNext()){case"{":i=t.GetArgument(e);break;case"(":t.i++,s=n?"\\lgroup":"(",l=n?"\\rgroup":")",i=t.GetUpTo(e,")");break;case"[":t.i++,s="[",l="]",i=t.GetUpTo(e,"]");break;case"|":t.i++,s="|",l="|",i=t.GetUpTo(e,"|");break;default:s="(",l=")"}var c=(s?"\\left":"")+s+"\\begin{"+o+"}{} "+i+"\\end{"+o+"}"+(s?"\\right":"")+l;t.Push(new a.default(c,t.stack.env,t.configuration).mml())},h.IdentityMatrix=function(t,e){var r=t.GetArgument(e),n=parseInt(r,10);if(isNaN(n))throw new s.default("InvalidNumber","Invalid number");if(n<=1)return t.string="1"+t.string.slice(t.i),void(t.i=0);for(var o=Array(n).fill("0"),i=[],a=0;a<n;a++){var l=o.slice();l[a]="1",i.push(l.join(" & "))}t.string=i.join("\\\\ ")+t.string.slice(t.i),t.i=0},h.XMatrix=function(t,e){var r=t.GetStar(),n=t.GetArgument(e),o=t.GetArgument(e),i=t.GetArgument(e),a=parseInt(o,10),l=parseInt(i,10);if(isNaN(a)||isNaN(l)||l.toString()!==i||a.toString()!==o)throw new s.default("InvalidNumber","Invalid number");if(a=a<1?1:a,l=l<1?1:l,!r){var c=Array(l).fill(n).join(" & "),u=Array(a).fill(c).join("\\\\ ");return t.string=u+t.string.slice(t.i),void(t.i=0)}var p="";if(1===a&&1===l)p=n;else if(1===a){c=[];for(var h=1;h<=l;h++)c.push("".concat(n,"_{").concat(h,"}"));p=c.join(" & ")}else if(1===l){for(c=[],h=1;h<=a;h++)c.push("".concat(n,"_{").concat(h,"}"));p=c.join("\\\\ ")}else{var d=[];for(h=1;h<=a;h++){c=[];for(var f=1;f<=l;f++)c.push("".concat(n,"_{{").concat(h,"}{").concat(f,"}}"));d.push(c.join(" & "))}p=d.join("\\\\ ")}t.string=p+t.string.slice(t.i),t.i=0},h.PauliMatrix=function(t,e){var r=t.GetArgument(e),n=r.slice(1);switch(r[0]){case"0":n+=" 1 & 0\\\\ 0 & 1";break;case"1":case"x":n+=" 0 & 1\\\\ 1 & 0";break;case"2":case"y":n+=" 0 & -i\\\\ i & 0";break;case"3":case"z":n+=" 1 & 0\\\\ 0 & -1"}t.string=n+t.string.slice(t.i),t.i=0},h.DiagonalMatrix=function(t,e,r){if("{"===t.GetNext()){var n=t.i;t.GetArgument(e);var o=t.i;t.i=n+1;for(var i=[],a="",s=t.i;s<o;){try{a=t.GetUpTo(e,",")}catch(e){t.i=o,i.push(t.string.slice(s,o-1));break}if(t.i>=o){i.push(t.string.slice(s,o));break}s=t.i,i.push(a)}t.string=function(t,e){for(var r=t.length,n=[],o=0;o<r;o++)n.push(Array(e?r-o:o+1).join("&")+"\\mqty{"+t[o]+"}");return n.join("\\\\ ")}(i,r)+t.string.slice(o),t.i=0}},h.AutoClose=function(t,e,r){var n=t.create("token","mo",{stretchy:!1},e),o=t.itemFactory.create("mml",n).setProperties({autoclose:e});t.Push(o)},h.Vnabla=function(t,e){var r=t.options.physics.arrowdel?"\\vec{\\gradientnabla}":"{\\gradientnabla}";return t.Push(new a.default(r,t.stack.env,t.configuration).mml())},h.DiffD=function(t,e){var r=t.options.physics.italicdiff?"d":"{\\rm d}";return t.Push(new a.default(r,t.stack.env,t.configuration).mml())},h.Macro=i.default.Macro,h.NamedFn=i.default.NamedFn,h.Array=i.default.Array,e.default=h},7741:function(t,e,r){var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.RequireConfiguration=e.options=e.RequireMethods=e.RequireLoad=void 0;var s=r(9899),l=r(9140),c=a(r(3971)),u=r(9515),p=r(265),h=r(235),d=r(5713),f=r(7233),m=u.MathJax.config;function y(t,e){var r,o=t.parseOptions.options.require,i=t.parseOptions.packageData.get("require").required,a=e.substr(o.prefix.length);if(i.indexOf(a)<0){i.push(a),function(t,e){var r,o;void 0===e&&(e=[]);var i=t.parseOptions.options.require.prefix;try{for(var a=n(e),s=a.next();!s.done;s=a.next()){var l=s.value;l.substr(0,i.length)===i&&y(t,l)}}catch(t){r={error:t}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}}(t,h.CONFIG.dependencies[e]);var l=s.ConfigurationHandler.get(a);if(l){var c=m[e]||{};l.options&&1===Object.keys(l.options).length&&l.options[a]&&((r={})[a]=c,c=r),t.configuration.add(a,t,c);var u=t.parseOptions.packageData.get("require").configured;l.preprocessors.length&&!u.has(a)&&(u.set(a,!0),d.mathjax.retryAfter(Promise.resolve()))}}}function g(t,e){var r=t.options.require,n=r.allow,o=("["===e.substr(0,1)?"":r.prefix)+e;if(!(n.hasOwnProperty(o)?n[o]:n.hasOwnProperty(e)?n[e]:r.defaultAllow))throw new c.default("BadRequire",'Extension "%1" is not allowed to be loaded',o);p.Package.packages.has(o)?y(t.configuration.packageData.get("require").jax,o):d.mathjax.retryAfter(h.Loader.load(o))}e.RequireLoad=g,e.RequireMethods={Require:function(t,e){var r=t.GetArgument(e);if(r.match(/[^_a-zA-Z0-9]/)||""===r)throw new c.default("BadPackageName","Argument for %1 is not a valid package name",e);g(t,r)}},e.options={require:{allow:(0,f.expandable)({base:!1,"all-packages":!1,autoload:!1,configmacros:!1,tagformat:!1,setoptions:!1}),defaultAllow:!0,prefix:"tex"}},new l.CommandMap("require",{require:"Require"},e.RequireMethods),e.RequireConfiguration=s.Configuration.create("require",{handler:{macro:["require"]},config:function(t,e){e.parseOptions.packageData.set("require",{jax:e,required:i([],o(e.options.packages),!1),configured:new Map});var r=e.parseOptions.options.require,n=r.prefix;if(n.match(/[^_a-zA-Z0-9]/))throw Error("Illegal characters used in \\require prefix");h.CONFIG.paths[n]||(h.CONFIG.paths[n]="[mathjax]/input/tex/extensions"),r.prefix="["+n+"]/"},options:e.options})},9365:function(t,e,r){var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.SetOptionsConfiguration=e.SetOptionsUtil=void 0;var i=r(9899),a=r(9140),s=o(r(3971)),l=o(r(1130)),c=r(8803),u=o(r(7693)),p=r(7233);e.SetOptionsUtil={filterPackage:function(t,e){if("tex"!==e&&!i.ConfigurationHandler.get(e))throw new s.default("NotAPackage","Not a defined package: %1",e);var r=t.options.setoptions,n=r.allowOptions[e];if(void 0===n&&!r.allowPackageDefault||!1===n)throw new s.default("PackageNotSettable",'Options can\'t be set for package "%1"',e);return!0},filterOption:function(t,e,r){var n,o=t.options.setoptions,i=o.allowOptions[e]||{},a=i.hasOwnProperty(r)&&!(0,p.isObject)(i[r])?i[r]:null;if(!1===a||null===a&&!o.allowOptionsDefault)throw new s.default("OptionNotSettable",'Option "%1" is not allowed to be set',r);if(!(null===(n="tex"===e?t.options:t.options[e])||void 0===n?void 0:n.hasOwnProperty(r)))throw"tex"===e?new s.default("InvalidTexOption",'Invalid TeX option "%1"',r):new s.default("InvalidOptionKey",'Invalid option "%1" for package "%2"',r,e);return!0},filterValue:function(t,e,r,n){return n}};var h=new a.CommandMap("setoptions",{setOptions:"SetOptions"},{SetOptions:function(t,e){var r,o,i=t.GetBrackets(e)||"tex",a=l.default.keyvalOptions(t.GetArgument(e)),s=t.options.setoptions;if(s.filterPackage(t,i))try{for(var c=n(Object.keys(a)),u=c.next();!u.done;u=c.next()){var p=u.value;s.filterOption(t,i,p)&&(("tex"===i?t.options:t.options[i])[p]=s.filterValue(t,i,p,a[p]))}}catch(t){r={error:t}}finally{try{u&&!u.done&&(o=c.return)&&o.call(c)}finally{if(r)throw r.error}}}});e.SetOptionsConfiguration=i.Configuration.create("setoptions",{handler:{macro:["setoptions"]},config:function(t,e){var r=e.parseOptions.handlers.get("macro").lookup("require");r&&(h.add("Require",new c.Macro("Require",r._func)),h.add("require",new c.Macro("require",u.default.Macro,["\\Require{#2}\\setOptions[#2]{#1}",2,""])))},priority:3,options:{setoptions:{filterPackage:e.SetOptionsUtil.filterPackage,filterOption:e.SetOptionsUtil.filterOption,filterValue:e.SetOptionsUtil.filterValue,allowPackageDefault:!0,allowOptionsDefault:!0,allowOptions:(0,p.expandable)({tex:{FindTeX:!1,formatError:!1,package:!1,baseURL:!1,tags:!1,maxBuffer:!1,maxMaxros:!1,macros:!1,environments:!1},setoptions:!1,autoload:!1,require:!1,configmacros:!1,tagformat:!1})}}})},1527:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.TagFormatConfiguration=e.tagformatConfig=void 0;var i=r(9899),a=r(6521),s=0;function l(t,e){var r=e.parseOptions.options.tags;"base"!==r&&t.tags.hasOwnProperty(r)&&a.TagsFactory.add(r,t.tags[r]);var n=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return o(r,t),r.prototype.formatNumber=function(t){return e.parseOptions.options.tagformat.number(t)},r.prototype.formatTag=function(t){return e.parseOptions.options.tagformat.tag(t)},r.prototype.formatId=function(t){return e.parseOptions.options.tagformat.id(t)},r.prototype.formatUrl=function(t,r){return e.parseOptions.options.tagformat.url(t,r)},r}(a.TagsFactory.create(e.parseOptions.options.tags).constructor),i="configTags-"+ ++s;a.TagsFactory.add(i,n),e.parseOptions.options.tags=i}e.tagformatConfig=l,e.TagFormatConfiguration=i.Configuration.create("tagformat",{config:[l,10],options:{tagformat:{number:function(t){return t.toString()},tag:function(t){return"("+t+")"},id:function(t){return"mjx-eqn:"+t.replace(/\s/g,"_")},url:function(t,e){return e+"#"+encodeURIComponent(t)}}}})},2307:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.TextcompConfiguration=void 0;var n=r(9899);r(9906),e.TextcompConfiguration=n.Configuration.create("textcomp",{handler:{macro:["textcomp-macros"]}})},9906:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=r(9140),i=r(8317),a=r(58),s=n(r(1130)),l=r(8728);new o.CommandMap("textcomp-macros",{textasciicircum:["Insert","^"],textasciitilde:["Insert","~"],textasteriskcentered:["Insert","*"],textbackslash:["Insert","\\"],textbar:["Insert","|"],textbraceleft:["Insert","{"],textbraceright:["Insert","}"],textbullet:["Insert","\u2022"],textdagger:["Insert","\u2020"],textdaggerdbl:["Insert","\u2021"],textellipsis:["Insert","\u2026"],textemdash:["Insert","\u2014"],textendash:["Insert","\u2013"],textexclamdown:["Insert","\xa1"],textgreater:["Insert",">"],textless:["Insert","<"],textordfeminine:["Insert","\xaa"],textordmasculine:["Insert","\xba"],textparagraph:["Insert","\xb6"],textperiodcentered:["Insert","\xb7"],textquestiondown:["Insert","\xbf"],textquotedblleft:["Insert","\u201c"],textquotedblright:["Insert","\u201d"],textquoteleft:["Insert","\u2018"],textquoteright:["Insert","\u2019"],textsection:["Insert","\xa7"],textunderscore:["Insert","_"],textvisiblespace:["Insert","\u2423"],textacutedbl:["Insert","\u02dd"],textasciiacute:["Insert","\xb4"],textasciibreve:["Insert","\u02d8"],textasciicaron:["Insert","\u02c7"],textasciidieresis:["Insert","\xa8"],textasciimacron:["Insert","\xaf"],textgravedbl:["Insert","\u02f5"],texttildelow:["Insert","\u02f7"],textbaht:["Insert","\u0e3f"],textcent:["Insert","\xa2"],textcolonmonetary:["Insert","\u20a1"],textcurrency:["Insert","\xa4"],textdollar:["Insert","$"],textdong:["Insert","\u20ab"],texteuro:["Insert","\u20ac"],textflorin:["Insert","\u0192"],textguarani:["Insert","\u20b2"],textlira:["Insert","\u20a4"],textnaira:["Insert","\u20a6"],textpeso:["Insert","\u20b1"],textsterling:["Insert","\xa3"],textwon:["Insert","\u20a9"],textyen:["Insert","\xa5"],textcircledP:["Insert","\u2117"],textcompwordmark:["Insert","\u200c"],textcopyleft:["Insert","\ud83c\udd2f"],textcopyright:["Insert","\xa9"],textregistered:["Insert","\xae"],textservicemark:["Insert","\u2120"],texttrademark:["Insert","\u2122"],textbardbl:["Insert","\u2016"],textbigcircle:["Insert","\u25ef"],textblank:["Insert","\u2422"],textbrokenbar:["Insert","\xa6"],textdiscount:["Insert","\u2052"],textestimated:["Insert","\u212e"],textinterrobang:["Insert","\u203d"],textinterrobangdown:["Insert","\u2e18"],textmusicalnote:["Insert","\u266a"],textnumero:["Insert","\u2116"],textopenbullet:["Insert","\u25e6"],textpertenthousand:["Insert","\u2031"],textperthousand:["Insert","\u2030"],textrecipe:["Insert","\u211e"],textreferencemark:["Insert","\u203b"],textlangle:["Insert","\u2329"],textrangle:["Insert","\u232a"],textlbrackdbl:["Insert","\u27e6"],textrbrackdbl:["Insert","\u27e7"],textlquill:["Insert","\u2045"],textrquill:["Insert","\u2046"],textcelsius:["Insert","\u2103"],textdegree:["Insert","\xb0"],textdiv:["Insert","\xf7"],textdownarrow:["Insert","\u2193"],textfractionsolidus:["Insert","\u2044"],textleftarrow:["Insert","\u2190"],textlnot:["Insert","\xac"],textmho:["Insert","\u2127"],textminus:["Insert","\u2212"],textmu:["Insert","\xb5"],textohm:["Insert","\u2126"],textonehalf:["Insert","\xbd"],textonequarter:["Insert","\xbc"],textonesuperior:["Insert","\xb9"],textpm:["Insert","\xb1"],textrightarrow:["Insert","\u2192"],textsurd:["Insert","\u221a"],textthreequarters:["Insert","\xbe"],textthreesuperior:["Insert","\xb3"],texttimes:["Insert","\xd7"],texttwosuperior:["Insert","\xb2"],textuparrow:["Insert","\u2191"],textborn:["Insert","*"],textdied:["Insert","\u2020"],textdivorced:["Insert","\u26ae"],textmarried:["Insert","\u26ad"],textcentoldstyle:["Insert","\xa2",i.TexConstant.Variant.OLDSTYLE],textdollaroldstyle:["Insert","$",i.TexConstant.Variant.OLDSTYLE],textzerooldstyle:["Insert","0",i.TexConstant.Variant.OLDSTYLE],textoneoldstyle:["Insert","1",i.TexConstant.Variant.OLDSTYLE],texttwooldstyle:["Insert","2",i.TexConstant.Variant.OLDSTYLE],textthreeoldstyle:["Insert","3",i.TexConstant.Variant.OLDSTYLE],textfouroldstyle:["Insert","4",i.TexConstant.Variant.OLDSTYLE],textfiveoldstyle:["Insert","5",i.TexConstant.Variant.OLDSTYLE],textsixoldstyle:["Insert","6",i.TexConstant.Variant.OLDSTYLE],textsevenoldstyle:["Insert","7",i.TexConstant.Variant.OLDSTYLE],texteightoldstyle:["Insert","8",i.TexConstant.Variant.OLDSTYLE],textnineoldstyle:["Insert","9",i.TexConstant.Variant.OLDSTYLE]},{Insert:function(t,e,r,n){if(t instanceof l.TextParser){if(!n)return void a.TextMacrosMethods.Insert(t,e,r);t.saveText()}t.Push(s.default.internalText(t,r,n?{mathvariant:n}:{}))}})},2675:function(t,e,r){var n,o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.TextMacrosConfiguration=e.TextBaseConfiguration=void 0;var i=r(9899),a=o(r(8562)),s=r(6521),l=r(1181),c=r(8728),u=r(58);function p(t,e,r,n){var o=t.configuration.packageData.get("textmacros");return t instanceof c.TextParser||(o.texParser=t),[new c.TextParser(e,n?{mathvariant:n}:{},o.parseOptions,r).mml()]}r(8376),e.TextBaseConfiguration=i.Configuration.create("text-base",{parser:"text",handler:{character:["command","text-special"],macro:["text-macros"]},fallback:{character:function(t,e){t.text+=e},macro:function(t,e){var r=t.texParser,n=r.lookup("macro",e);n&&n._func!==u.TextMacrosMethods.Macro&&t.Error("MathMacro","%1 is only supported in math mode","\\"+e),r.parse("macro",[t,e])}},items:(n={},n[l.StartItem.prototype.kind]=l.StartItem,n[l.StopItem.prototype.kind]=l.StopItem,n[l.MmlItem.prototype.kind]=l.MmlItem,n[l.StyleItem.prototype.kind]=l.StyleItem,n)}),e.TextMacrosConfiguration=i.Configuration.create("textmacros",{config:function(t,e){var r=new i.ParserConfiguration(e.parseOptions.options.textmacros.packages,["tex","text"]);r.init();var n=new a.default(r,[]);n.options=e.parseOptions.options,r.config(e),s.TagsFactory.addTags(r.tags),n.tags=s.TagsFactory.getDefault(),n.tags.configuration=n,n.packageData=e.parseOptions.packageData,n.packageData.set("textmacros",{parseOptions:n,jax:e,texParser:null}),n.options.internalMath=p},preprocessors:[function(t){var e=t.data.packageData.get("textmacros");e.parseOptions.nodeFactory.setMmlFactory(e.jax.mmlFactory)}],options:{textmacros:{packages:["text-base"]}}})},8376:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0});var n=r(9140),o=r(8317),i=r(58),a=r(6010);new n.MacroMap("text-special",{$:"Math","%":"Comment","^":"MathModeOnly",_:"MathModeOnly","&":"Misplaced","#":"Misplaced","~":"Tilde"," ":"Space","\t":"Space","\r":"Space","\n":"Space","\xa0":"Tilde","{":"OpenBrace","}":"CloseBrace","`":"OpenQuote","'":"CloseQuote"},i.TextMacrosMethods),new n.CommandMap("text-macros",{"(":"Math",$:"SelfQuote",_:"SelfQuote","%":"SelfQuote","{":"SelfQuote","}":"SelfQuote"," ":"SelfQuote","&":"SelfQuote","#":"SelfQuote","\\":"SelfQuote","'":["Accent","\xb4"],"\u2019":["Accent","\xb4"],"`":["Accent","`"],"\u2018":["Accent","`"],"^":["Accent","^"],'"':["Accent","\xa8"],"~":["Accent","~"],"=":["Accent","\xaf"],".":["Accent","\u02d9"],u:["Accent","\u02d8"],v:["Accent","\u02c7"],emph:"Emph",rm:["SetFont",o.TexConstant.Variant.NORMAL],mit:["SetFont",o.TexConstant.Variant.ITALIC],oldstyle:["SetFont",o.TexConstant.Variant.OLDSTYLE],cal:["SetFont",o.TexConstant.Variant.CALLIGRAPHIC],it:["SetFont","-tex-mathit"],bf:["SetFont",o.TexConstant.Variant.BOLD],bbFont:["SetFont",o.TexConstant.Variant.DOUBLESTRUCK],scr:["SetFont",o.TexConstant.Variant.SCRIPT],frak:["SetFont",o.TexConstant.Variant.FRAKTUR],sf:["SetFont",o.TexConstant.Variant.SANSSERIF],tt:["SetFont",o.TexConstant.Variant.MONOSPACE],tiny:["SetSize",.5],Tiny:["SetSize",.6],scriptsize:["SetSize",.7],small:["SetSize",.85],normalsize:["SetSize",1],large:["SetSize",1.2],Large:["SetSize",1.44],LARGE:["SetSize",1.73],huge:["SetSize",2.07],Huge:["SetSize",2.49],Bbb:["Macro","{\\bbFont #1}",1],textnormal:["Macro","{\\rm #1}",1],textup:["Macro","{\\rm #1}",1],textrm:["Macro","{\\rm #1}",1],textit:["Macro","{\\it #1}",1],textbf:["Macro","{\\bf #1}",1],textsf:["Macro","{\\sf #1}",1],texttt:["Macro","{\\tt #1}",1],dagger:["Insert","\u2020"],ddagger:["Insert","\u2021"],S:["Insert","\xa7"],",":["Spacer",a.MATHSPACE.thinmathspace],":":["Spacer",a.MATHSPACE.mediummathspace],">":["Spacer",a.MATHSPACE.mediummathspace],";":["Spacer",a.MATHSPACE.thickmathspace],"!":["Spacer",a.MATHSPACE.negativethinmathspace],enspace:["Spacer",.5],quad:["Spacer",1],qquad:["Spacer",2],thinspace:["Spacer",a.MATHSPACE.thinmathspace],negthinspace:["Spacer",a.MATHSPACE.negativethinmathspace],hskip:"Hskip",hspace:"Hskip",kern:"Hskip",mskip:"Hskip",mspace:"Hskip",mkern:"Hskip",rule:"rule",Rule:["Rule"],Space:["Rule","blank"],color:"CheckAutoload",textcolor:"CheckAutoload",colorbox:"CheckAutoload",fcolorbox:"CheckAutoload",href:"CheckAutoload",style:"CheckAutoload",class:"CheckAutoload",cssId:"CheckAutoload",unicode:"CheckAutoload",ref:["HandleRef",!1],eqref:["HandleRef",!0]},i.TextMacrosMethods)},58:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.TextMacrosMethods=void 0;var o=n(r(8417)),i=r(4542),a=n(r(7693));e.TextMacrosMethods={Comment:function(t,e){for(;t.i<t.string.length&&"\n"!==t.string.charAt(t.i);)t.i++;t.i++},Math:function(t,e){t.saveText();for(var r,n,i=t.i,a=0;n=t.GetNext();)switch(r=t.i++,n){case"\\":")"===t.GetCS()&&(n="\\(");case"$":if(0===a&&e===n){var s=t.texParser.configuration,l=new o.default(t.string.substr(i,r-i),t.stack.env,s).mml();return void t.PushMath(l)}break;case"{":a++;break;case"}":0===a&&t.Error("ExtraCloseMissingOpen","Extra close brace or missing open brace"),a--}t.Error("MathNotTerminated","Math-mode is not properly terminated")},MathModeOnly:function(t,e){t.Error("MathModeOnly","'%1' allowed only in math mode",e)},Misplaced:function(t,e){t.Error("Misplaced","'%1' can not be used here",e)},OpenBrace:function(t,e){var r=t.stack.env;t.envStack.push(r),t.stack.env=Object.assign({},r)},CloseBrace:function(t,e){t.envStack.length?(t.saveText(),t.stack.env=t.envStack.pop()):t.Error("ExtraCloseMissingOpen","Extra close brace or missing open brace")},OpenQuote:function(t,e){t.string.charAt(t.i)===e?(t.text+="\u201c",t.i++):t.text+="\u2018"},CloseQuote:function(t,e){t.string.charAt(t.i)===e?(t.text+="\u201d",t.i++):t.text+="\u2019"},Tilde:function(t,e){t.text+="\xa0"},Space:function(t,e){for(t.text+=" ";t.GetNext().match(/\s/);)t.i++},SelfQuote:function(t,e){t.text+=e.substr(1)},Insert:function(t,e,r){t.text+=r},Accent:function(t,e,r){var n=t.ParseArg(e),o=t.create("token","mo",{},r);t.addAttributes(o),t.Push(t.create("node","mover",[n,o]))},Emph:function(t,e){var r="-tex-mathit"===t.stack.env.mathvariant?"normal":"-tex-mathit";t.Push(t.ParseTextArg(e,{mathvariant:r}))},SetFont:function(t,e,r){t.saveText(),t.stack.env.mathvariant=r},SetSize:function(t,e,r){t.saveText(),t.stack.env.mathsize=r},CheckAutoload:function(t,e){var r=t.configuration.packageData.get("autoload"),n=t.texParser;e=e.slice(1);var o=n.lookup("macro",e);if(!o||r&&o._func===r.Autoload){if(n.parse("macro",[n,e]),!o)return;(0,i.retryAfter)(Promise.resolve())}n.parse("macro",[t,e])},Macro:a.default.Macro,Spacer:a.default.Spacer,Hskip:a.default.Hskip,rule:a.default.rule,Rule:a.default.Rule,HandleRef:a.default.HandleRef}},8728:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},s=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},l=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.TextParser=void 0;var c=l(r(8417)),u=l(r(3971)),p=l(r(1130)),h=r(9007),d=l(r(1256)),f=r(1181),m=function(t){function e(e,r,n,o){var i=t.call(this,e,r,n)||this;return i.level=o,i}return o(e,t),Object.defineProperty(e.prototype,"texParser",{get:function(){return this.configuration.packageData.get("textmacros").texParser},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tags",{get:function(){return this.texParser.tags},enumerable:!1,configurable:!0}),e.prototype.mml=function(){return null!=this.level?this.create("node","mstyle",this.nodes,{displaystyle:!1,scriptlevel:this.level}):1===this.nodes.length?this.nodes[0]:this.create("node","mrow",this.nodes)},e.prototype.Parse=function(){this.text="",this.nodes=[],this.envStack=[],t.prototype.Parse.call(this)},e.prototype.saveText=function(){if(this.text){var t=this.stack.env.mathvariant,e=p.default.internalText(this,this.text,t?{mathvariant:t}:{});this.text="",this.Push(e)}},e.prototype.Push=function(e){if(this.text&&this.saveText(),e instanceof f.StopItem)return t.prototype.Push.call(this,e);e instanceof f.StyleItem?this.stack.env.mathcolor=this.stack.env.color:e instanceof h.AbstractMmlNode&&(this.addAttributes(e),this.nodes.push(e))},e.prototype.PushMath=function(t){var e,r,n=this.stack.env;t.isKind("TeXAtom")||(t=this.create("node","TeXAtom",[t]));try{for(var o=i(["mathsize","mathcolor"]),a=o.next();!a.done;a=o.next()){var s=a.value;n[s]&&!t.attributes.getExplicit(s)&&(t.isToken||t.isKind("mstyle")||(t=this.create("node","mstyle",[t])),d.default.setAttribute(t,s,n[s]))}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}t.isInferred&&(t=this.create("node","mrow",t.childNodes)),this.nodes.push(t)},e.prototype.addAttributes=function(t){var e,r,n=this.stack.env;if(t.isToken)try{for(var o=i(["mathsize","mathcolor","mathvariant"]),a=o.next();!a.done;a=o.next()){var s=a.value;n[s]&&!t.attributes.getExplicit(s)&&d.default.setAttribute(t,s,n[s])}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}},e.prototype.ParseTextArg=function(t,r){return new e(this.GetArgument(t),r=Object.assign(Object.assign({},this.stack.env),r),this.configuration).mml()},e.prototype.ParseArg=function(t){return new e(this.GetArgument(t),this.stack.env,this.configuration).mml()},e.prototype.Error=function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];throw new(u.default.bind.apply(u.default,s([void 0,t,e],a(r),!1)))},e}(c.default);e.TextParser=m},6841:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.UnicodeConfiguration=e.UnicodeMethods=void 0;var o=r(9899),i=n(r(3971)),a=r(9140),s=n(r(1130)),l=n(r(1256)),c=r(5368);e.UnicodeMethods={};var u={};e.UnicodeMethods.Unicode=function(t,e){var r=t.GetBrackets(e),n=null,o=null;r&&(r.replace(/ /g,"").match(/^(\d+(\.\d*)?|\.\d+),(\d+(\.\d*)?|\.\d+)$/)?(n=r.replace(/ /g,"").split(/,/),o=t.GetBrackets(e)):o=r);var a=s.default.trimSpaces(t.GetArgument(e)).replace(/^0x/,"x");if(!a.match(/^(x[0-9A-Fa-f]+|[0-9]+)$/))throw new i.default("BadUnicode","Argument to \\unicode must be a number");var p=parseInt(a.match(/^x/)?"0"+a:a);u[p]?o||(o=u[p][2]):u[p]=[800,200,o,p],n&&(u[p][0]=Math.floor(1e3*parseFloat(n[0])),u[p][1]=Math.floor(1e3*parseFloat(n[1])));var h=t.stack.env.font,d={};o?(u[p][2]=d.fontfamily=o.replace(/'/g,"'"),h&&(h.match(/bold/)&&(d.fontweight="bold"),h.match(/italic|-mathit/)&&(d.fontstyle="italic"))):h&&(d.mathvariant=h);var f=t.create("token","mtext",d,(0,c.numeric)(a));l.default.setProperty(f,"unicode",!0),t.Push(f)},new a.CommandMap("unicode",{unicode:"Unicode"},e.UnicodeMethods),e.UnicodeConfiguration=o.Configuration.create("unicode",{handler:{macro:["unicode"]}})},1442:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.UpgreekConfiguration=void 0;var n=r(9899),o=r(9140),i=r(8317);new o.CharacterMap("upgreek",(function(t,e){var r=e.attributes||{};r.mathvariant=i.TexConstant.Variant.NORMAL;var n=t.create("token","mi",r,e.char);t.Push(n)}),{upalpha:"\u03b1",upbeta:"\u03b2",upgamma:"\u03b3",updelta:"\u03b4",upepsilon:"\u03f5",upzeta:"\u03b6",upeta:"\u03b7",uptheta:"\u03b8",upiota:"\u03b9",upkappa:"\u03ba",uplambda:"\u03bb",upmu:"\u03bc",upnu:"\u03bd",upxi:"\u03be",upomicron:"\u03bf",uppi:"\u03c0",uprho:"\u03c1",upsigma:"\u03c3",uptau:"\u03c4",upupsilon:"\u03c5",upphi:"\u03d5",upchi:"\u03c7",uppsi:"\u03c8",upomega:"\u03c9",upvarepsilon:"\u03b5",upvartheta:"\u03d1",upvarpi:"\u03d6",upvarrho:"\u03f1",upvarsigma:"\u03c2",upvarphi:"\u03c6",Upgamma:"\u0393",Updelta:"\u0394",Uptheta:"\u0398",Uplambda:"\u039b",Upxi:"\u039e",Uppi:"\u03a0",Upsigma:"\u03a3",Upupsilon:"\u03a5",Upphi:"\u03a6",Uppsi:"\u03a8",Upomega:"\u03a9"}),e.UpgreekConfiguration=n.Configuration.create("upgreek",{handler:{macro:["upgreek"]}})},1247:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.VerbConfiguration=e.VerbMethods=void 0;var o=r(9899),i=r(8317),a=r(9140),s=n(r(3971));e.VerbMethods={},e.VerbMethods.Verb=function(t,e){var r=t.GetNext(),n=++t.i;if(""===r)throw new s.default("MissingArgFor","Missing argument for %1",e);for(;t.i<t.string.length&&t.string.charAt(t.i)!==r;)t.i++;if(t.i===t.string.length)throw new s.default("NoClosingDelim","Can't find closing delimiter for %1",t.currentCS);var o=t.string.slice(n,t.i).replace(/ /g,"\xa0");t.i++,t.Push(t.create("token","mtext",{mathvariant:i.TexConstant.Variant.MONOSPACE},o))},new a.CommandMap("verb",{verb:"Verb"},e.VerbMethods),e.VerbConfiguration=o.Configuration.create("verb",{handler:{macro:["verb"]}})},5713:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.mathjax=void 0;var n=r(3282),o=r(805),i=r(4542);e.mathjax={version:n.VERSION,handlers:new o.HandlerList,document:function(t,r){return e.mathjax.handlers.document(t,r)},handleRetriesFor:i.handleRetriesFor,retryAfter:i.retryAfter,asyncLoad:null}},50:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},a=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),s=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&a(e,t,r);return s(e,t),e},c=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.CHTML=void 0;var u=r(3055),p=r(4139),h=r(9261),d=r(6797),f=r(2760),m=l(r(6010)),y=r(505),g=function(t){function e(e){void 0===e&&(e=null);var r=t.call(this,e,h.CHTMLWrapperFactory,f.TeXFont)||this;return r.chtmlStyles=null,r.font.adaptiveCSS(r.options.adaptiveCSS),r.wrapperUsage=new d.Usage,r}return o(e,t),e.prototype.escaped=function(t,e){return this.setDocument(e),this.html("span",{},[this.text(t.math)])},e.prototype.styleSheet=function(r){if(this.chtmlStyles){if(this.options.adaptiveCSS){var n=new p.CssStyles;this.addWrapperStyles(n),this.updateFontStyles(n),this.adaptor.insertRules(this.chtmlStyles,n.getStyleRules())}return this.chtmlStyles}var o=this.chtmlStyles=t.prototype.styleSheet.call(this,r);return this.adaptor.setAttribute(o,"id",e.STYLESHEETID),this.wrapperUsage.update(),o},e.prototype.updateFontStyles=function(t){t.addStyles(this.font.updateStyles({}))},e.prototype.addWrapperStyles=function(e){var r,n;if(this.options.adaptiveCSS)try{for(var o=c(this.wrapperUsage.update()),i=o.next();!i.done;i=o.next()){var a=i.value,s=this.factory.getNodeClass(a);s&&this.addClassStyles(s,e)}}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}else t.prototype.addWrapperStyles.call(this,e)},e.prototype.addClassStyles=function(e,r){var n,o=e;o.autoStyle&&"unknown"!==o.kind&&r.addStyles(((n={})["mjx-"+o.kind]={display:"inline-block","text-align":"left"},n)),this.wrapperUsage.add(o.kind),t.prototype.addClassStyles.call(this,e,r)},e.prototype.processMath=function(t,e){this.factory.wrap(t).toCHTML(e)},e.prototype.clearCache=function(){this.cssStyles.clear(),this.font.clearCache(),this.wrapperUsage.clear(),this.chtmlStyles=null},e.prototype.reset=function(){this.clearCache()},e.prototype.unknownText=function(t,e,r){void 0===r&&(r=null);var n={},o=100/this.math.metrics.scale;if(100!==o&&(n["font-size"]=this.fixed(o,1)+"%",n.padding=m.em(75/o)+" 0 "+m.em(20/o)+" 0"),"-explicitFont"!==e){var i=(0,y.unicodeChars)(t);(1!==i.length||i[0]<119808||i[0]>120831)&&this.cssFontStyles(this.font.getCssFont(e),n)}if(null!==r){var a=this.math.metrics;n.width=Math.round(r*a.em*a.scale)+"px"}return this.html("mjx-utext",{variant:e,style:n},[this.text(t)])},e.prototype.measureTextNode=function(t){var e=this.adaptor,r=e.clone(t);e.setStyle(r,"font-family",e.getStyle(r,"font-family").replace(/MJXZERO, /g,""));var n=this.html("mjx-measure-text",{style:{position:"absolute","white-space":"nowrap"}},[r]);e.append(e.parent(this.math.start.node),this.container),e.append(this.container,n);var o=e.nodeSize(r,this.math.metrics.em)[0]/this.math.metrics.scale;return e.remove(this.container),e.remove(n),{w:o,h:.75,d:.2}},e.NAME="CHTML",e.OPTIONS=i(i({},u.CommonOutputJax.OPTIONS),{adaptiveCSS:!0,matchFontHeight:!0}),e.commonStyles={'mjx-container[jax="CHTML"]':{"line-height":0},'mjx-container [space="1"]':{"margin-left":".111em"},'mjx-container [space="2"]':{"margin-left":".167em"},'mjx-container [space="3"]':{"margin-left":".222em"},'mjx-container [space="4"]':{"margin-left":".278em"},'mjx-container [space="5"]':{"margin-left":".333em"},'mjx-container [rspace="1"]':{"margin-right":".111em"},'mjx-container [rspace="2"]':{"margin-right":".167em"},'mjx-container [rspace="3"]':{"margin-right":".222em"},'mjx-container [rspace="4"]':{"margin-right":".278em"},'mjx-container [rspace="5"]':{"margin-right":".333em"},'mjx-container [size="s"]':{"font-size":"70.7%"},'mjx-container [size="ss"]':{"font-size":"50%"},'mjx-container [size="Tn"]':{"font-size":"60%"},'mjx-container [size="sm"]':{"font-size":"85%"},'mjx-container [size="lg"]':{"font-size":"120%"},'mjx-container [size="Lg"]':{"font-size":"144%"},'mjx-container [size="LG"]':{"font-size":"173%"},'mjx-container [size="hg"]':{"font-size":"207%"},'mjx-container [size="HG"]':{"font-size":"249%"},'mjx-container [width="full"]':{width:"100%"},"mjx-box":{display:"inline-block"},"mjx-block":{display:"block"},"mjx-itable":{display:"inline-table"},"mjx-row":{display:"table-row"},"mjx-row > *":{display:"table-cell"},"mjx-mtext":{display:"inline-block"},"mjx-mstyle":{display:"inline-block"},"mjx-merror":{display:"inline-block",color:"red","background-color":"yellow"},"mjx-mphantom":{visibility:"hidden"},"_::-webkit-full-page-media, _:future, :root mjx-container":{"will-change":"opacity"}},e.STYLESHEETID="MJX-CHTML-styles",e}(u.CommonOutputJax);e.CHTML=g},8042:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},a=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),s=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||a(e,t,r)},l=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},c=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.AddCSS=e.CHTMLFontData=void 0;var u=r(5884),p=r(6797),h=r(6010);s(r(5884),e);var d=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.charUsage=new p.Usage,e.delimUsage=new p.Usage,e}return o(e,t),e.charOptions=function(e,r){return t.charOptions.call(this,e,r)},e.prototype.adaptiveCSS=function(t){this.options.adaptiveCSS=t},e.prototype.clearCache=function(){this.options.adaptiveCSS&&(this.charUsage.clear(),this.delimUsage.clear())},e.prototype.createVariant=function(e,r,n){void 0===r&&(r=null),void 0===n&&(n=null),t.prototype.createVariant.call(this,e,r,n);var o=this.constructor;this.variant[e].classes=o.defaultVariantClasses[e],this.variant[e].letter=o.defaultVariantLetters[e]},e.prototype.defineChars=function(r,n){var o,i;t.prototype.defineChars.call(this,r,n);var a=this.variant[r].letter;try{for(var s=l(Object.keys(n)),c=s.next();!c.done;c=s.next()){var u=c.value,p=e.charOptions(n,parseInt(u));void 0===p.f&&(p.f=a)}}catch(t){o={error:t}}finally{try{c&&!c.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}},Object.defineProperty(e.prototype,"styles",{get:function(){var t=this.constructor,e=i({},t.defaultStyles);return this.addFontURLs(e,t.defaultFonts,this.options.fontURL),this.options.adaptiveCSS?this.updateStyles(e):this.allStyles(e),e},enumerable:!1,configurable:!0}),e.prototype.updateStyles=function(t){var e,r,n,o;try{for(var i=l(this.delimUsage.update()),a=i.next();!a.done;a=i.next()){var s=a.value;this.addDelimiterStyles(t,s,this.delimiters[s])}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}try{for(var u=l(this.charUsage.update()),p=u.next();!p.done;p=u.next()){var h=c(p.value,2),d=h[0],f=(s=h[1],this.variant[d]);this.addCharStyles(t,f.letter,s,f.chars[s])}}catch(t){n={error:t}}finally{try{p&&!p.done&&(o=u.return)&&o.call(u)}finally{if(n)throw n.error}}return t},e.prototype.allStyles=function(t){var e,r,n,o,i,a;try{for(var s=l(Object.keys(this.delimiters)),c=s.next();!c.done;c=s.next()){var u=c.value,p=parseInt(u);this.addDelimiterStyles(t,p,this.delimiters[p])}}catch(t){e={error:t}}finally{try{c&&!c.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}try{for(var h=l(Object.keys(this.variant)),d=h.next();!d.done;d=h.next()){var f=d.value,m=this.variant[f],y=m.letter;try{for(var g=(i=void 0,l(Object.keys(m.chars))),b=g.next();!b.done;b=g.next()){u=b.value,p=parseInt(u);var v=m.chars[p];(v[3]||{}).smp||(v.length<4&&(v[3]={}),this.addCharStyles(t,y,p,v))}}catch(t){i={error:t}}finally{try{b&&!b.done&&(a=g.return)&&a.call(g)}finally{if(i)throw i.error}}}}catch(t){n={error:t}}finally{try{d&&!d.done&&(o=h.return)&&o.call(h)}finally{if(n)throw n.error}}},e.prototype.addFontURLs=function(t,e,r){var n,o;try{for(var a=l(Object.keys(e)),s=a.next();!s.done;s=a.next()){var c=s.value,u=i({},e[c]);u.src=u.src.replace(/%%URL%%/,r),t[c]=u}}catch(t){n={error:t}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}},e.prototype.addDelimiterStyles=function(t,e,r){var n=this.charSelector(e);r.c&&r.c!==e&&(t[".mjx-stretched mjx-c"+(n=this.charSelector(r.c))+"::before"]={content:this.charContent(r.c)}),r.stretch&&(1===r.dir?this.addDelimiterVStyles(t,n,r):this.addDelimiterHStyles(t,n,r))},e.prototype.addDelimiterVStyles=function(t,e,r){var n=r.HDW,o=c(r.stretch,4),i=o[0],a=o[1],s=o[2],l=o[3],u=this.addDelimiterVPart(t,e,"beg",i,n);this.addDelimiterVPart(t,e,"ext",a,n);var p=this.addDelimiterVPart(t,e,"end",s,n),h={};if(l){var d=this.addDelimiterVPart(t,e,"mid",l,n);h.height="50%",t["mjx-stretchy-v"+e+" > mjx-mid"]={"margin-top":this.em(-d/2),"margin-bottom":this.em(-d/2)}}u&&(h["border-top-width"]=this.em0(u-.03)),p&&(h["border-bottom-width"]=this.em0(p-.03),t["mjx-stretchy-v"+e+" > mjx-end"]={"margin-top":this.em(-p)}),Object.keys(h).length&&(t["mjx-stretchy-v"+e+" > mjx-ext"]=h)},e.prototype.addDelimiterVPart=function(t,e,r,n,o){if(!n)return 0;var i=this.getDelimiterData(n),a=(o[2]-i[2])/2,s={content:this.charContent(n)};return"ext"!==r?s.padding=this.padding(i,a):(s.width=this.em0(o[2]),a&&(s["padding-left"]=this.em0(a))),t["mjx-stretchy-v"+e+" mjx-"+r+" mjx-c::before"]=s,i[0]+i[1]},e.prototype.addDelimiterHStyles=function(t,e,r){var n=c(r.stretch,4),o=n[0],i=n[1],a=n[2],s=n[3],l=r.HDW;this.addDelimiterHPart(t,e,"beg",o,l),this.addDelimiterHPart(t,e,"ext",i,l),this.addDelimiterHPart(t,e,"end",a,l),s&&(this.addDelimiterHPart(t,e,"mid",s,l),t["mjx-stretchy-h"+e+" > mjx-ext"]={width:"50%"})},e.prototype.addDelimiterHPart=function(t,e,r,n,o){if(n){var i=this.getDelimiterData(n)[3],a={content:i&&i.c?'"'+i.c+'"':this.charContent(n)};a.padding=this.padding(o,0,-o[2]),t["mjx-stretchy-h"+e+" mjx-"+r+" mjx-c::before"]=a}},e.prototype.addCharStyles=function(t,e,r,n){var o=n[3],i=void 0!==o.f?o.f:e;t["mjx-c"+this.charSelector(r)+(i?".TEX-"+i:"")+"::before"]={padding:this.padding(n,0,o.ic||0),content:null!=o.c?'"'+o.c+'"':this.charContent(r)}},e.prototype.getDelimiterData=function(t){return this.getChar("-smallop",t)},e.prototype.em=function(t){return(0,h.em)(t)},e.prototype.em0=function(t){return(0,h.em)(Math.max(0,t))},e.prototype.padding=function(t,e,r){var n=c(t,3),o=n[0],i=n[1];return void 0===e&&(e=0),void 0===r&&(r=0),[o,n[2]+r,i,e].map(this.em0).join(" ")},e.prototype.charContent=function(t){return'"'+(t>=32&&t<=126&&34!==t&&39!==t&&92!==t?String.fromCharCode(t):"\\"+t.toString(16).toUpperCase())+'"'},e.prototype.charSelector=function(t){return".mjx-c"+t.toString(16).toUpperCase()},e.OPTIONS=i(i({},u.FontData.OPTIONS),{fontURL:"js/output/chtml/fonts/tex-woff-v2"}),e.JAX="CHTML",e.defaultVariantClasses={},e.defaultVariantLetters={},e.defaultStyles={"mjx-c::before":{display:"block",width:0}},e.defaultFonts={"@font-face /* 0 */":{"font-family":"MJXZERO",src:'url("%%URL%%/MathJax_Zero.woff") format("woff")'}},e}(u.FontData);e.CHTMLFontData=d,e.AddCSS=function(t,e){var r,n;try{for(var o=l(Object.keys(e)),i=o.next();!i.done;i=o.next()){var a=i.value,s=parseInt(a);Object.assign(u.FontData.charOptions(t,s),e[s])}}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return t}},8270:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e},a=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)},s=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.Arrow=e.DiagonalArrow=e.DiagonalStrike=e.Border2=e.Border=e.RenderElement=void 0;var l=i(r(5552));a(r(5552),e);e.RenderElement=function(t,e){return void 0===e&&(e=""),function(r,n){var o=r.adjustBorder(r.html("mjx-"+t));if(e){var i=r.getOffset(e);if(r.thickness!==l.THICKNESS||i){var a="translate".concat(e,"(").concat(r.em(r.thickness/2-i),")");r.adaptor.setStyle(o,"transform",a)}}r.adaptor.append(r.chtml,o)}};e.Border=function(t){return l.CommonBorder((function(e,r){e.adaptor.setStyle(r,"border-"+t,e.em(e.thickness)+" solid")}))(t)};e.Border2=function(t,e,r){return l.CommonBorder2((function(t,n){var o=t.em(t.thickness)+" solid";t.adaptor.setStyle(n,"border-"+e,o),t.adaptor.setStyle(n,"border-"+r,o)}))(t,e,r)};e.DiagonalStrike=function(t,e){return l.CommonDiagonalStrike((function(t){return function(r,n){var o=r.getBBox(),i=o.w,a=o.h,l=o.d,c=s(r.getArgMod(i,a+l),2),u=c[0],p=c[1],h=e*r.thickness/2,d=r.adjustBorder(r.html(t,{style:{width:r.em(p),transform:"rotate("+r.fixed(-e*u)+"rad) translateY("+h+"em)"}}));r.adaptor.append(r.chtml,d)}}))(t)};e.DiagonalArrow=function(t){return l.CommonDiagonalArrow((function(t,e){t.adaptor.append(t.chtml,e)}))(t)};e.Arrow=function(t){return l.CommonArrow((function(t,e){t.adaptor.append(t.chtml,e)}))(t)}},6797:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Usage=void 0;var r=function(){function t(){this.used=new Set,this.needsUpdate=[]}return t.prototype.add=function(t){var e=JSON.stringify(t);this.used.has(e)||this.needsUpdate.push(t),this.used.add(e)},t.prototype.has=function(t){return this.used.has(JSON.stringify(t))},t.prototype.clear=function(){this.used.clear(),this.needsUpdate=[]},t.prototype.update=function(){var t=this.needsUpdate;return this.needsUpdate=[],t},t}();e.Usage=r},5355:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),s=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&a(e,t,r);return s(e,t),e},c=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},u=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLWrapper=e.SPACE=e.FONTSIZE=void 0;var p=l(r(6010)),h=r(7519),d=r(6469);e.FONTSIZE={"70.7%":"s","70%":"s","50%":"ss","60%":"Tn","85%":"sm","120%":"lg","144%":"Lg","173%":"LG","207%":"hg","249%":"HG"},e.SPACE=((o={})[p.em(2/18)]="1",o[p.em(3/18)]="2",o[p.em(4/18)]="3",o[p.em(5/18)]="4",o[p.em(6/18)]="5",o);var f=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.chtml=null,e}return i(r,t),r.prototype.toCHTML=function(t){var e,r,n=this.standardCHTMLnode(t);try{for(var o=c(this.childNodes),i=o.next();!i.done;i=o.next()){i.value.toCHTML(n)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}},r.prototype.standardCHTMLnode=function(t){this.markUsed();var e=this.createCHTMLnode(t);return this.handleStyles(),this.handleVariant(),this.handleScale(),this.handleColor(),this.handleSpace(),this.handleAttributes(),this.handlePWidth(),e},r.prototype.markUsed=function(){this.jax.wrapperUsage.add(this.kind)},r.prototype.createCHTMLnode=function(t){var e=this.node.attributes.get("href");return e&&(t=this.adaptor.append(t,this.html("a",{href:e}))),this.chtml=this.adaptor.append(t,this.html("mjx-"+this.node.kind)),this.chtml},r.prototype.handleStyles=function(){if(this.styles){var t=this.styles.cssText;if(t){this.adaptor.setAttribute(this.chtml,"style",t);var e=this.styles.get("font-family");e&&this.adaptor.setStyle(this.chtml,"font-family","MJXZERO, "+e)}}},r.prototype.handleVariant=function(){this.node.isToken&&"-explicitFont"!==this.variant&&this.adaptor.setAttribute(this.chtml,"class",(this.font.getVariant(this.variant)||this.font.getVariant("normal")).classes)},r.prototype.handleScale=function(){this.setScale(this.chtml,this.bbox.rscale)},r.prototype.setScale=function(t,r){var n=Math.abs(r-1)<.001?1:r;if(t&&1!==n){var o=this.percent(n);e.FONTSIZE[o]?this.adaptor.setAttribute(t,"size",e.FONTSIZE[o]):this.adaptor.setStyle(t,"fontSize",o)}return t},r.prototype.handleSpace=function(){var t,r;try{for(var n=c([[this.bbox.L,"space","marginLeft"],[this.bbox.R,"rspace","marginRight"]]),o=n.next();!o.done;o=n.next()){var i=o.value,a=u(i,3),s=a[0],l=a[1],p=a[2];if(s){var h=this.em(s);e.SPACE[h]?this.adaptor.setAttribute(this.chtml,l,e.SPACE[h]):this.adaptor.setStyle(this.chtml,p,h)}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},r.prototype.handleColor=function(){var t=this.node.attributes,e=t.getExplicit("mathcolor"),r=t.getExplicit("color"),n=t.getExplicit("mathbackground"),o=t.getExplicit("background");(e||r)&&this.adaptor.setStyle(this.chtml,"color",e||r),(n||o)&&this.adaptor.setStyle(this.chtml,"backgroundColor",n||o)},r.prototype.handleAttributes=function(){var t,e,n,o,i=this.node.attributes,a=i.getAllDefaults(),s=r.skipAttributes;try{for(var l=c(i.getExplicitNames()),u=l.next();!u.done;u=l.next()){var p=u.value;!1!==s[p]&&(p in a||s[p]||this.adaptor.hasAttribute(this.chtml,p))||this.adaptor.setAttribute(this.chtml,p,i.getExplicit(p))}}catch(e){t={error:e}}finally{try{u&&!u.done&&(e=l.return)&&e.call(l)}finally{if(t)throw t.error}}if(i.get("class")){var h=i.get("class").trim().split(/ +/);try{for(var d=c(h),f=d.next();!f.done;f=d.next()){var m=f.value;this.adaptor.addClass(this.chtml,m)}}catch(t){n={error:t}}finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}}},r.prototype.handlePWidth=function(){this.bbox.pwidth&&(this.bbox.pwidth===d.BBox.fullWidth?this.adaptor.setAttribute(this.chtml,"width","full"):this.adaptor.setStyle(this.chtml,"width",this.bbox.pwidth))},r.prototype.setIndent=function(t,e,r){var n=this.adaptor;if("center"===e||"left"===e){var o=this.getBBox().L;n.setStyle(t,"margin-left",this.em(r+o))}if("center"===e||"right"===e){var i=this.getBBox().R;n.setStyle(t,"margin-right",this.em(-r+i))}},r.prototype.drawBBox=function(){var t=this.getBBox(),e=t.w,r=t.h,n=t.d,o=t.R,i=this.html("mjx-box",{style:{opacity:.25,"margin-left":this.em(-e-o)}},[this.html("mjx-box",{style:{height:this.em(r),width:this.em(e),"background-color":"red"}}),this.html("mjx-box",{style:{height:this.em(n),width:this.em(e),"margin-left":this.em(-e),"vertical-align":this.em(-n),"background-color":"green"}})]),a=this.chtml||this.parent.chtml,s=this.adaptor.getAttribute(a,"size");s&&this.adaptor.setAttribute(i,"size",s);var l=this.adaptor.getStyle(a,"fontSize");l&&this.adaptor.setStyle(i,"fontSize",l),this.adaptor.append(this.adaptor.parent(a),i),this.adaptor.setStyle(a,"backgroundColor","#FFEE00")},r.prototype.html=function(t,e,r){return void 0===e&&(e={}),void 0===r&&(r=[]),this.jax.html(t,e,r)},r.prototype.text=function(t){return this.jax.text(t)},r.prototype.char=function(t){return this.font.charSelector(t).substr(1)},r.kind="unknown",r.autoStyle=!0,r}(h.CommonWrapper);e.CHTMLWrapper=f},9261:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLWrapperFactory=void 0;var i=r(4420),a=r(9086),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.defaultNodes=a.CHTMLWrappers,e}(i.CommonWrapperFactory);e.CHTMLWrapperFactory=s},9086:function(t,e,r){var n;Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLWrappers=void 0;var o=r(5355),i=r(804),a=r(1653),s=r(6287),l=r(6460),c=r(4597),u=r(1259),p=r(2970),h=r(5964),d=r(8147),f=r(4798),m=r(2275),y=r(9063),g=r(5610),b=r(8776),v=r(4300),_=r(6590),S=r(6781),x=r(8002),M=r(3571),O=r(7056),E=r(8102),A=r(6911),C=r(421),w=r(95),T=r(1148);e.CHTMLWrappers=((n={})[i.CHTMLmath.kind]=i.CHTMLmath,n[f.CHTMLmrow.kind]=f.CHTMLmrow,n[f.CHTMLinferredMrow.kind]=f.CHTMLinferredMrow,n[a.CHTMLmi.kind]=a.CHTMLmi,n[s.CHTMLmo.kind]=s.CHTMLmo,n[l.CHTMLmn.kind]=l.CHTMLmn,n[c.CHTMLms.kind]=c.CHTMLms,n[u.CHTMLmtext.kind]=u.CHTMLmtext,n[p.CHTMLmspace.kind]=p.CHTMLmspace,n[h.CHTMLmpadded.kind]=h.CHTMLmpadded,n[d.CHTMLmenclose.kind]=d.CHTMLmenclose,n[y.CHTMLmfrac.kind]=y.CHTMLmfrac,n[g.CHTMLmsqrt.kind]=g.CHTMLmsqrt,n[b.CHTMLmroot.kind]=b.CHTMLmroot,n[v.CHTMLmsub.kind]=v.CHTMLmsub,n[v.CHTMLmsup.kind]=v.CHTMLmsup,n[v.CHTMLmsubsup.kind]=v.CHTMLmsubsup,n[_.CHTMLmunder.kind]=_.CHTMLmunder,n[_.CHTMLmover.kind]=_.CHTMLmover,n[_.CHTMLmunderover.kind]=_.CHTMLmunderover,n[S.CHTMLmmultiscripts.kind]=S.CHTMLmmultiscripts,n[m.CHTMLmfenced.kind]=m.CHTMLmfenced,n[x.CHTMLmtable.kind]=x.CHTMLmtable,n[M.CHTMLmtr.kind]=M.CHTMLmtr,n[M.CHTMLmlabeledtr.kind]=M.CHTMLmlabeledtr,n[O.CHTMLmtd.kind]=O.CHTMLmtd,n[E.CHTMLmaction.kind]=E.CHTMLmaction,n[A.CHTMLmglyph.kind]=A.CHTMLmglyph,n[C.CHTMLsemantics.kind]=C.CHTMLsemantics,n[C.CHTMLannotation.kind]=C.CHTMLannotation,n[C.CHTMLannotationXML.kind]=C.CHTMLannotationXML,n[C.CHTMLxml.kind]=C.CHTMLxml,n[w.CHTMLTeXAtom.kind]=w.CHTMLTeXAtom,n[T.CHTMLTextNode.kind]=T.CHTMLTextNode,n[o.CHTMLWrapper.kind]=o.CHTMLWrapper,n)},95:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLTeXAtom=void 0;var i=r(5355),a=r(9800),s=r(3948),l=r(9007),c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(e){if(t.prototype.toCHTML.call(this,e),this.adaptor.setAttribute(this.chtml,"texclass",l.TEXCLASSNAMES[this.node.texClass]),this.node.texClass===l.TEXCLASS.VCENTER){var r=this.childNodes[0].getBBox(),n=r.h,o=(n+r.d)/2+this.font.params.axis_height-n;this.adaptor.setStyle(this.chtml,"verticalAlign",this.em(o))}},e.kind=s.TeXAtom.prototype.kind,e}((0,a.CommonTeXAtomMixin)(i.CHTMLWrapper));e.CHTMLTeXAtom=c},1148:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLTextNode=void 0;var a=r(9007),s=r(5355),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(t){var e,r;this.markUsed();var n=this.adaptor,o=this.parent.variant,a=this.node.getText();if(0!==a.length)if("-explicitFont"===o)n.append(t,this.jax.unknownText(a,o,this.getBBox().w));else{var s=this.remappedText(a,o);try{for(var l=i(s),c=l.next();!c.done;c=l.next()){var u=c.value,p=this.getVariantChar(o,u)[3],h=p.f?" TEX-"+p.f:"",d=p.unknown?this.jax.unknownText(String.fromCodePoint(u),o):this.html("mjx-c",{class:this.char(u)+h});n.append(t,d),!p.unknown&&this.font.charUsage.add([o,u])}}catch(t){e={error:t}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(e)throw e.error}}}},e.kind=a.TextNode.prototype.kind,e.autoStyle=!1,e.styles={"mjx-c":{display:"inline-block"},"mjx-utext":{display:"inline-block",padding:".75em 0 .2em 0"}},e}((0,r(1160).CommonTextNodeMixin)(s.CHTMLWrapper));e.CHTMLTextNode=l},8102:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmaction=void 0;var i=r(5355),a=r(1956),s=r(1956),l=r(9145),c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(t){var e=this.standardCHTMLnode(t);this.selected.toCHTML(e),this.action(this,this.data)},e.prototype.setEventHandler=function(t,e){this.chtml.addEventListener(t,e)},e.kind=l.MmlMaction.prototype.kind,e.styles={"mjx-maction":{position:"relative"},"mjx-maction > mjx-tool":{display:"none",position:"absolute",bottom:0,right:0,width:0,height:0,"z-index":500},"mjx-tool > mjx-tip":{display:"inline-block",padding:".2em",border:"1px solid #888","font-size":"70%","background-color":"#F8F8F8",color:"black","box-shadow":"2px 2px 5px #AAAAAA"},"mjx-maction[toggle]":{cursor:"pointer"},"mjx-status":{display:"block",position:"fixed",left:"1em",bottom:"1em","min-width":"25%",padding:".2em .4em",border:"1px solid #888","font-size":"90%","background-color":"#F8F8F8",color:"black"}},e.actions=new Map([["toggle",[function(t,e){t.adaptor.setAttribute(t.chtml,"toggle",t.node.attributes.get("selection"));var r=t.factory.jax.math,n=t.factory.jax.document,o=t.node;t.setEventHandler("click",(function(t){r.end.node||(r.start.node=r.end.node=r.typesetRoot,r.start.n=r.end.n=0),o.nextToggleSelection(),r.rerender(n),t.stopPropagation()}))},{}]],["tooltip",[function(t,e){var r=t.childNodes[1];if(r)if(r.node.isKind("mtext")){var n=r.node.getText();t.adaptor.setAttribute(t.chtml,"title",n)}else{var o=t.adaptor,i=o.append(t.chtml,t.html("mjx-tool",{style:{bottom:t.em(-t.dy),right:t.em(-t.dx)}},[t.html("mjx-tip")]));r.toCHTML(o.firstChild(i)),t.setEventHandler("mouseover",(function(r){e.stopTimers(t,e);var n=setTimeout((function(){return o.setStyle(i,"display","block")}),e.postDelay);e.hoverTimer.set(t,n),r.stopPropagation()})),t.setEventHandler("mouseout",(function(r){e.stopTimers(t,e);var n=setTimeout((function(){return o.setStyle(i,"display","")}),e.clearDelay);e.clearTimer.set(t,n),r.stopPropagation()}))}},s.TooltipData]],["statusline",[function(t,e){var r=t.childNodes[1];if(r&&r.node.isKind("mtext")){var n=t.adaptor,o=r.node.getText();n.setAttribute(t.chtml,"statusline",o),t.setEventHandler("mouseover",(function(r){if(null===e.status){var i=n.body(n.document);e.status=n.append(i,t.html("mjx-status",{},[t.text(o)]))}r.stopPropagation()})),t.setEventHandler("mouseout",(function(t){e.status&&(n.remove(e.status),e.status=null),t.stopPropagation()}))}},{status:null}]]]),e}((0,a.CommonMactionMixin)(i.CHTMLWrapper));e.CHTMLmaction=c},804:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmath=void 0;var a=r(5355),s=r(7490),l=r(3233),c=r(6469),u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(e){t.prototype.toCHTML.call(this,e);var r=this.chtml,n=this.adaptor;"block"===this.node.attributes.get("display")?(n.setAttribute(r,"display","true"),n.setAttribute(e,"display","true"),this.handleDisplay(e)):this.handleInline(e),n.addClass(r,"MJX-TEX")},e.prototype.handleDisplay=function(t){var e=this.adaptor,r=i(this.getAlignShift(),2),n=r[0],o=r[1];if("center"!==n&&e.setAttribute(t,"justify",n),this.bbox.pwidth===c.BBox.fullWidth){if(e.setAttribute(t,"width","full"),this.jax.table){var a=this.jax.table.getOuterBBox(),s=a.L,l=a.w,u=a.R;"right"===n?u=Math.max(u||-o,-o):"left"===n?s=Math.max(s||o,o):"center"===n&&(l+=2*Math.abs(o));var p=this.em(Math.max(0,s+l+u));e.setStyle(t,"min-width",p),e.setStyle(this.jax.table.chtml,"min-width",p)}}else this.setIndent(this.chtml,n,o)},e.prototype.handleInline=function(t){var e=this.adaptor,r=e.getStyle(this.chtml,"margin-right");r&&(e.setStyle(this.chtml,"margin-right",""),e.setStyle(t,"margin-right",r),e.setStyle(t,"width","0"))},e.prototype.setChildPWidths=function(e,r,n){return void 0===r&&(r=null),void 0===n&&(n=!0),!!this.parent&&t.prototype.setChildPWidths.call(this,e,r,n)},e.kind=l.MmlMath.prototype.kind,e.styles={"mjx-math":{"line-height":0,"text-align":"left","text-indent":0,"font-style":"normal","font-weight":"normal","font-size":"100%","font-size-adjust":"none","letter-spacing":"normal","border-collapse":"collapse","word-wrap":"normal","word-spacing":"normal","white-space":"nowrap",direction:"ltr",padding:"1px 0"},'mjx-container[jax="CHTML"][display="true"]':{display:"block","text-align":"center",margin:"1em 0"},'mjx-container[jax="CHTML"][display="true"][width="full"]':{display:"flex"},'mjx-container[jax="CHTML"][display="true"] mjx-math':{padding:0},'mjx-container[jax="CHTML"][justify="left"]':{"text-align":"left"},'mjx-container[jax="CHTML"][justify="right"]':{"text-align":"right"}},e}((0,s.CommonMathMixin)(a.CHTMLWrapper));e.CHTMLmath=u},8147:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),a=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&i(e,t,r);return a(e,t),e},l=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},c=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmenclose=void 0;var u=r(5355),p=r(7313),h=s(r(8270)),d=r(6661),f=r(6010);function m(t,e){return Math.atan2(t,e).toFixed(3).replace(/\.?0+$/,"")}var y=m(h.ARROWDX,h.ARROWY),g=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(t){var e,r,n,o,i=this.adaptor,a=this.standardCHTMLnode(t),s=i.append(a,this.html("mjx-box"));this.renderChild?this.renderChild(this,s):this.childNodes[0].toCHTML(s);try{for(var c=l(Object.keys(this.notations)),u=c.next();!u.done;u=c.next()){var p=u.value,d=this.notations[p];!d.renderChild&&d.renderer(this,s)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(e)throw e.error}}var f=this.getPadding();try{for(var m=l(h.sideNames),y=m.next();!y.done;y=m.next()){var g=y.value,b=h.sideIndex[g];f[b]>0&&i.setStyle(s,"padding-"+g,this.em(f[b]))}}catch(t){n={error:t}}finally{try{y&&!y.done&&(o=m.return)&&o.call(m)}finally{if(n)throw n.error}}},e.prototype.arrow=function(t,e,r,n,o){void 0===n&&(n=""),void 0===o&&(o=0);var i=this.getBBox().w,a={width:this.em(t)};i!==t&&(a.left=this.em((i-t)/2)),e&&(a.transform="rotate("+this.fixed(e)+"rad)");var s=this.html("mjx-arrow",{style:a},[this.html("mjx-aline"),this.html("mjx-rthead"),this.html("mjx-rbhead")]);return r&&(this.adaptor.append(s,this.html("mjx-lthead")),this.adaptor.append(s,this.html("mjx-lbhead")),this.adaptor.setAttribute(s,"double","true")),this.adjustArrow(s,r),this.moveArrow(s,n,o),s},e.prototype.adjustArrow=function(t,e){var r=this,n=this.thickness,o=this.arrowhead;if(o.x!==h.ARROWX||o.y!==h.ARROWY||o.dx!==h.ARROWDX||n!==h.THICKNESS){var i=c([n*o.x,n*o.y].map((function(t){return r.em(t)})),2),a=i[0],s=i[1],l=m(o.dx,o.y),u=c(this.adaptor.childNodes(t),5),p=u[0],d=u[1],f=u[2],y=u[3],g=u[4];this.adjustHead(d,[s,"0","1px",a],l),this.adjustHead(f,["1px","0",s,a],"-"+l),this.adjustHead(y,[s,a,"1px","0"],"-"+l),this.adjustHead(g,["1px",a,s,"0"],l),this.adjustLine(p,n,o.x,e)}},e.prototype.adjustHead=function(t,e,r){t&&(this.adaptor.setStyle(t,"border-width",e.join(" ")),this.adaptor.setStyle(t,"transform","skewX("+r+"rad)"))},e.prototype.adjustLine=function(t,e,r,n){this.adaptor.setStyle(t,"borderTop",this.em(e)+" solid"),this.adaptor.setStyle(t,"top",this.em(-e/2)),this.adaptor.setStyle(t,"right",this.em(e*(r-1))),n&&this.adaptor.setStyle(t,"left",this.em(e*(r-1)))},e.prototype.moveArrow=function(t,e,r){if(r){var n=this.adaptor.getStyle(t,"transform");this.adaptor.setStyle(t,"transform","translate".concat(e,"(").concat(this.em(-r),")").concat(n?" "+n:""))}},e.prototype.adjustBorder=function(t){return this.thickness!==h.THICKNESS&&this.adaptor.setStyle(t,"borderWidth",this.em(this.thickness)),t},e.prototype.adjustThickness=function(t){return this.thickness!==h.THICKNESS&&this.adaptor.setStyle(t,"strokeWidth",this.fixed(this.thickness)),t},e.prototype.fixed=function(t,e){return void 0===e&&(e=3),Math.abs(t)<6e-4?"0":t.toFixed(e).replace(/\.?0+$/,"")},e.prototype.em=function(e){return t.prototype.em.call(this,e)},e.kind=d.MmlMenclose.prototype.kind,e.styles={"mjx-menclose":{position:"relative"},"mjx-menclose > mjx-dstrike":{display:"inline-block",left:0,top:0,position:"absolute","border-top":h.SOLID,"transform-origin":"top left"},"mjx-menclose > mjx-ustrike":{display:"inline-block",left:0,bottom:0,position:"absolute","border-top":h.SOLID,"transform-origin":"bottom left"},"mjx-menclose > mjx-hstrike":{"border-top":h.SOLID,position:"absolute",left:0,right:0,bottom:"50%",transform:"translateY("+(0,f.em)(h.THICKNESS/2)+")"},"mjx-menclose > mjx-vstrike":{"border-left":h.SOLID,position:"absolute",top:0,bottom:0,right:"50%",transform:"translateX("+(0,f.em)(h.THICKNESS/2)+")"},"mjx-menclose > mjx-rbox":{position:"absolute",top:0,bottom:0,right:0,left:0,border:h.SOLID,"border-radius":(0,f.em)(h.THICKNESS+h.PADDING)},"mjx-menclose > mjx-cbox":{position:"absolute",top:0,bottom:0,right:0,left:0,border:h.SOLID,"border-radius":"50%"},"mjx-menclose > mjx-arrow":{position:"absolute",left:0,bottom:"50%",height:0,width:0},"mjx-menclose > mjx-arrow > *":{display:"block",position:"absolute","transform-origin":"bottom","border-left":(0,f.em)(h.THICKNESS*h.ARROWX)+" solid","border-right":0,"box-sizing":"border-box"},"mjx-menclose > mjx-arrow > mjx-aline":{left:0,top:(0,f.em)(-h.THICKNESS/2),right:(0,f.em)(h.THICKNESS*(h.ARROWX-1)),height:0,"border-top":(0,f.em)(h.THICKNESS)+" solid","border-left":0},"mjx-menclose > mjx-arrow[double] > mjx-aline":{left:(0,f.em)(h.THICKNESS*(h.ARROWX-1)),height:0},"mjx-menclose > mjx-arrow > mjx-rthead":{transform:"skewX("+y+"rad)",right:0,bottom:"-1px","border-bottom":"1px solid transparent","border-top":(0,f.em)(h.THICKNESS*h.ARROWY)+" solid transparent"},"mjx-menclose > mjx-arrow > mjx-rbhead":{transform:"skewX(-"+y+"rad)","transform-origin":"top",right:0,top:"-1px","border-top":"1px solid transparent","border-bottom":(0,f.em)(h.THICKNESS*h.ARROWY)+" solid transparent"},"mjx-menclose > mjx-arrow > mjx-lthead":{transform:"skewX(-"+y+"rad)",left:0,bottom:"-1px","border-left":0,"border-right":(0,f.em)(h.THICKNESS*h.ARROWX)+" solid","border-bottom":"1px solid transparent","border-top":(0,f.em)(h.THICKNESS*h.ARROWY)+" solid transparent"},"mjx-menclose > mjx-arrow > mjx-lbhead":{transform:"skewX("+y+"rad)","transform-origin":"top",left:0,top:"-1px","border-left":0,"border-right":(0,f.em)(h.THICKNESS*h.ARROWX)+" solid","border-top":"1px solid transparent","border-bottom":(0,f.em)(h.THICKNESS*h.ARROWY)+" solid transparent"},"mjx-menclose > dbox":{position:"absolute",top:0,bottom:0,left:(0,f.em)(-1.5*h.PADDING),width:(0,f.em)(3*h.PADDING),border:(0,f.em)(h.THICKNESS)+" solid","border-radius":"50%","clip-path":"inset(0 0 0 "+(0,f.em)(1.5*h.PADDING)+")","box-sizing":"border-box"}},e.notations=new Map([h.Border("top"),h.Border("right"),h.Border("bottom"),h.Border("left"),h.Border2("actuarial","top","right"),h.Border2("madruwb","bottom","right"),h.DiagonalStrike("up",1),h.DiagonalStrike("down",-1),["horizontalstrike",{renderer:h.RenderElement("hstrike","Y"),bbox:function(t){return[0,t.padding,0,t.padding]}}],["verticalstrike",{renderer:h.RenderElement("vstrike","X"),bbox:function(t){return[t.padding,0,t.padding,0]}}],["box",{renderer:function(t,e){t.adaptor.setStyle(e,"border",t.em(t.thickness)+" solid")},bbox:h.fullBBox,border:h.fullBorder,remove:"left right top bottom"}],["roundedbox",{renderer:h.RenderElement("rbox"),bbox:h.fullBBox}],["circle",{renderer:h.RenderElement("cbox"),bbox:h.fullBBox}],["phasorangle",{renderer:function(t,e){var r=t.getBBox(),n=r.h,o=r.d,i=c(t.getArgMod(1.75*t.padding,n+o),2),a=i[0],s=i[1],l=t.thickness*Math.sin(a)*.9;t.adaptor.setStyle(e,"border-bottom",t.em(t.thickness)+" solid");var u=t.adjustBorder(t.html("mjx-ustrike",{style:{width:t.em(s),transform:"translateX("+t.em(l)+") rotate("+t.fixed(-a)+"rad)"}}));t.adaptor.append(t.chtml,u)},bbox:function(t){var e=t.padding/2,r=t.thickness;return[2*e,e,e+r,3*e+r]},border:function(t){return[0,0,t.thickness,0]},remove:"bottom"}],h.Arrow("up"),h.Arrow("down"),h.Arrow("left"),h.Arrow("right"),h.Arrow("updown"),h.Arrow("leftright"),h.DiagonalArrow("updiagonal"),h.DiagonalArrow("northeast"),h.DiagonalArrow("southeast"),h.DiagonalArrow("northwest"),h.DiagonalArrow("southwest"),h.DiagonalArrow("northeastsouthwest"),h.DiagonalArrow("northwestsoutheast"),["longdiv",{renderer:function(t,e){var r=t.adaptor;r.setStyle(e,"border-top",t.em(t.thickness)+" solid");var n=r.append(t.chtml,t.html("dbox")),o=t.thickness,i=t.padding;o!==h.THICKNESS&&r.setStyle(n,"border-width",t.em(o)),i!==h.PADDING&&(r.setStyle(n,"left",t.em(-1.5*i)),r.setStyle(n,"width",t.em(3*i)),r.setStyle(n,"clip-path","inset(0 0 0 "+t.em(1.5*i)+")"))},bbox:function(t){var e=t.padding,r=t.thickness;return[e+r,e,e,2*e+r/2]}}],["radical",{renderer:function(t,e){t.msqrt.toCHTML(e);var r=t.sqrtTRBL();t.adaptor.setStyle(t.msqrt.chtml,"margin",r.map((function(e){return t.em(-e)})).join(" "))},init:function(t){t.msqrt=t.createMsqrt(t.childNodes[0])},bbox:function(t){return t.sqrtTRBL()},renderChild:!0}]]),e}((0,p.CommonMencloseMixin)(u.CHTMLWrapper));e.CHTMLmenclose=g},2275:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmfenced=void 0;var i=r(5355),a=r(7555),s=r(5410),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(t){var e=this.standardCHTMLnode(t);this.mrow.toCHTML(e)},e.kind=s.MmlMfenced.prototype.kind,e}((0,a.CommonMfencedMixin)(i.CHTMLWrapper));e.CHTMLmfenced=l},9063:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmfrac=void 0;var a=r(5355),s=r(2688),l=r(6850),c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(t){this.standardCHTMLnode(t);var e=this.node.attributes.getList("linethickness","bevelled"),r=e.linethickness,n=e.bevelled,o=this.isDisplay();if(n)this.makeBevelled(o);else{var i=this.length2em(String(r),.06);0===i?this.makeAtop(o):this.makeFraction(o,i)}},e.prototype.makeFraction=function(t,e){var r,n,o=this.node.attributes.getList("numalign","denomalign"),a=o.numalign,s=o.denomalign,l=t?{type:"d"}:{},c=this.node.getProperty("withDelims")?i(i({},l),{delims:"true"}):i({},l),u="center"!==a?{align:a}:{},p="center"!==s?{align:s}:{},h=i({},l),d=i({},l),f=this.font.params;if(.06!==e){var m=f.axis_height,y=this.em(e),g=this.getTUV(t,e),b=g.T,v=g.u,_=g.v,S=(t?this.em(3*e):y)+" -.1em";l.style={height:y,"border-top":y+" solid",margin:S};var x=this.em(Math.max(0,v));d.style={height:x,"vertical-align":"-"+x},h.style={height:this.em(Math.max(0,_))},c.style={"vertical-align":this.em(m-b)}}this.adaptor.append(this.chtml,this.html("mjx-frac",c,[r=this.html("mjx-num",u,[this.html("mjx-nstrut",d)]),this.html("mjx-dbox",{},[this.html("mjx-dtable",{},[this.html("mjx-line",l),this.html("mjx-row",{},[n=this.html("mjx-den",p,[this.html("mjx-dstrut",h)])])])])])),this.childNodes[0].toCHTML(r),this.childNodes[1].toCHTML(n)},e.prototype.makeAtop=function(t){var e,r,n=this.node.attributes.getList("numalign","denomalign"),o=n.numalign,a=n.denomalign,s=t?{type:"d",atop:!0}:{atop:!0},l=this.node.getProperty("withDelims")?i(i({},s),{delims:!0}):i({},s),c="center"!==o?{align:o}:{},u="center"!==a?{align:a}:{},p=this.getUVQ(t),h=p.v,d=p.q;c.style={"padding-bottom":this.em(d)},l.style={"vertical-align":this.em(-h)},this.adaptor.append(this.chtml,this.html("mjx-frac",l,[e=this.html("mjx-num",c),r=this.html("mjx-den",u)])),this.childNodes[0].toCHTML(e),this.childNodes[1].toCHTML(r)},e.prototype.makeBevelled=function(t){var e=this.adaptor;e.setAttribute(this.chtml,"bevelled","ture");var r=e.append(this.chtml,this.html("mjx-num"));this.childNodes[0].toCHTML(r),this.bevel.toCHTML(this.chtml);var n=e.append(this.chtml,this.html("mjx-den"));this.childNodes[1].toCHTML(n);var o=this.getBevelData(t),i=o.u,a=o.v,s=o.delta,l=o.nbox,c=o.dbox;i&&e.setStyle(r,"verticalAlign",this.em(i/l.scale)),a&&e.setStyle(n,"verticalAlign",this.em(a/c.scale));var u=this.em(-s/2);e.setStyle(this.bevel.chtml,"marginLeft",u),e.setStyle(this.bevel.chtml,"marginRight",u)},e.kind=l.MmlMfrac.prototype.kind,e.styles={"mjx-frac":{display:"inline-block","vertical-align":"0.17em",padding:"0 .22em"},'mjx-frac[type="d"]':{"vertical-align":".04em"},"mjx-frac[delims]":{padding:"0 .1em"},"mjx-frac[atop]":{padding:"0 .12em"},"mjx-frac[atop][delims]":{padding:"0"},"mjx-dtable":{display:"inline-table",width:"100%"},"mjx-dtable > *":{"font-size":"2000%"},"mjx-dbox":{display:"block","font-size":"5%"},"mjx-num":{display:"block","text-align":"center"},"mjx-den":{display:"block","text-align":"center"},"mjx-mfrac[bevelled] > mjx-num":{display:"inline-block"},"mjx-mfrac[bevelled] > mjx-den":{display:"inline-block"},'mjx-den[align="right"], mjx-num[align="right"]':{"text-align":"right"},'mjx-den[align="left"], mjx-num[align="left"]':{"text-align":"left"},"mjx-nstrut":{display:"inline-block",height:".054em",width:0,"vertical-align":"-.054em"},'mjx-nstrut[type="d"]':{height:".217em","vertical-align":"-.217em"},"mjx-dstrut":{display:"inline-block",height:".505em",width:0},'mjx-dstrut[type="d"]':{height:".726em"},"mjx-line":{display:"block","box-sizing":"border-box","min-height":"1px",height:".06em","border-top":".06em solid",margin:".06em -.1em",overflow:"hidden"},'mjx-line[type="d"]':{margin:".18em -.1em"}},e}((0,s.CommonMfracMixin)(a.CHTMLWrapper));e.CHTMLmfrac=c},6911:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmglyph=void 0;var i=r(5355),a=r(5636),s=r(3985),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(t){var e=this.standardCHTMLnode(t);if(this.charWrapper)this.charWrapper.toCHTML(e);else{var r=this.node.attributes.getList("src","alt"),n=r.src,o=r.alt,i={width:this.em(this.width),height:this.em(this.height)};this.valign&&(i.verticalAlign=this.em(this.valign));var a=this.html("img",{src:n,style:i,alt:o,title:o});this.adaptor.append(e,a)}},e.kind=s.MmlMglyph.prototype.kind,e.styles={"mjx-mglyph > img":{display:"inline-block",border:0,padding:0}},e}((0,a.CommonMglyphMixin)(i.CHTMLWrapper));e.CHTMLmglyph=l},1653:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmi=void 0;var i=r(5355),a=r(5723),s=r(450),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.kind=s.MmlMi.prototype.kind,e}((0,a.CommonMiMixin)(i.CHTMLWrapper));e.CHTMLmi=l},6781:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmmultiscripts=void 0;var a=r(4300),s=r(8009),l=r(6405),c=r(505),u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(t){var e=this.standardCHTMLnode(t),r=this.scriptData,n=this.node.getProperty("scriptalign")||"right left",o=i((0,c.split)(n+" "+n),2),a=o[0],s=o[1],l=this.combinePrePost(r.sub,r.psub),u=this.combinePrePost(r.sup,r.psup),p=i(this.getUVQ(l,u),2),h=p[0],d=p[1];if(r.numPrescripts){var f=this.addScripts(h,-d,!0,r.psub,r.psup,this.firstPrescript,r.numPrescripts);"right"!==a&&this.adaptor.setAttribute(f,"script-align",a)}if(this.childNodes[0].toCHTML(e),r.numScripts){f=this.addScripts(h,-d,!1,r.sub,r.sup,1,r.numScripts);"left"!==s&&this.adaptor.setAttribute(f,"script-align",s)}},e.prototype.addScripts=function(t,e,r,n,o,i,a){for(var s=this.adaptor,l=t-o.d+(e-n.h),c=t<0&&0===e?n.h+t:t,u=l>0?{style:{height:this.em(l)}}:{},p=c?{style:{"vertical-align":this.em(c)}}:{},h=this.html("mjx-row"),d=this.html("mjx-row",u),f=this.html("mjx-row"),m="mjx-"+(r?"pre":"")+"scripts",y=i+2*a;i<y;)this.childNodes[i++].toCHTML(s.append(f,this.html("mjx-cell"))),this.childNodes[i++].toCHTML(s.append(h,this.html("mjx-cell")));return s.append(this.chtml,this.html(m,p,[h,d,f]))},e.kind=l.MmlMmultiscripts.prototype.kind,e.styles={"mjx-prescripts":{display:"inline-table","padding-left":".05em"},"mjx-scripts":{display:"inline-table","padding-right":".05em"},"mjx-prescripts > mjx-row > mjx-cell":{"text-align":"right"},'[script-align="left"] > mjx-row > mjx-cell':{"text-align":"left"},'[script-align="center"] > mjx-row > mjx-cell':{"text-align":"center"},'[script-align="right"] > mjx-row > mjx-cell':{"text-align":"right"}},e}((0,s.CommonMmultiscriptsMixin)(a.CHTMLmsubsup));e.CHTMLmmultiscripts=u},6460:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmn=void 0;var i=r(5355),a=r(5023),s=r(3050),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.kind=s.MmlMn.prototype.kind,e}((0,a.CommonMnMixin)(i.CHTMLWrapper));e.CHTMLmn=l},6287:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmo=void 0;var a=r(5355),s=r(7096),l=r(2756),c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(t){var e,r,n=this.node.attributes,o=n.get("symmetric")&&2!==this.stretch.dir,a=0!==this.stretch.dir;a&&null===this.size&&this.getStretchedVariant([]);var s=this.standardCHTMLnode(t);if(a&&this.size<0)this.stretchHTML(s);else{if(o||n.get("largeop")){var l=this.em(this.getCenterOffset());"0"!==l&&this.adaptor.setStyle(s,"verticalAlign",l)}this.node.getProperty("mathaccent")&&(this.adaptor.setStyle(s,"width","0"),this.adaptor.setStyle(s,"margin-left",this.em(this.getAccentOffset())));try{for(var c=i(this.childNodes),u=c.next();!u.done;u=c.next()){u.value.toCHTML(s)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(e)throw e.error}}}},e.prototype.stretchHTML=function(t){var e=this.getText().codePointAt(0);this.font.delimUsage.add(e),this.childNodes[0].markUsed();var r=this.stretch,n=r.stretch,o=[];n[0]&&o.push(this.html("mjx-beg",{},[this.html("mjx-c")])),o.push(this.html("mjx-ext",{},[this.html("mjx-c")])),4===n.length&&o.push(this.html("mjx-mid",{},[this.html("mjx-c")]),this.html("mjx-ext",{},[this.html("mjx-c")])),n[2]&&o.push(this.html("mjx-end",{},[this.html("mjx-c")]));var i={},a=this.bbox,l=a.h,c=a.d,u=a.w;1===r.dir?(o.push(this.html("mjx-mark")),i.height=this.em(l+c),i.verticalAlign=this.em(-c)):i.width=this.em(u);var p=s.DirectionVH[r.dir],h={class:this.char(r.c||e),style:i},d=this.html("mjx-stretchy-"+p,h,o);this.adaptor.append(t,d)},e.kind=l.MmlMo.prototype.kind,e.styles={"mjx-stretchy-h":{display:"inline-table",width:"100%"},"mjx-stretchy-h > *":{display:"table-cell",width:0},"mjx-stretchy-h > * > mjx-c":{display:"inline-block",transform:"scalex(1.0000001)"},"mjx-stretchy-h > * > mjx-c::before":{display:"inline-block",width:"initial"},"mjx-stretchy-h > mjx-ext":{"/* IE */ overflow":"hidden","/* others */ overflow":"clip visible",width:"100%"},"mjx-stretchy-h > mjx-ext > mjx-c::before":{transform:"scalex(500)"},"mjx-stretchy-h > mjx-ext > mjx-c":{width:0},"mjx-stretchy-h > mjx-beg > mjx-c":{"margin-right":"-.1em"},"mjx-stretchy-h > mjx-end > mjx-c":{"margin-left":"-.1em"},"mjx-stretchy-v":{display:"inline-block"},"mjx-stretchy-v > *":{display:"block"},"mjx-stretchy-v > mjx-beg":{height:0},"mjx-stretchy-v > mjx-end > mjx-c":{display:"block"},"mjx-stretchy-v > * > mjx-c":{transform:"scaley(1.0000001)","transform-origin":"left center",overflow:"hidden"},"mjx-stretchy-v > mjx-ext":{display:"block",height:"100%","box-sizing":"border-box",border:"0px solid transparent","/* IE */ overflow":"hidden","/* others */ overflow":"visible clip"},"mjx-stretchy-v > mjx-ext > mjx-c::before":{width:"initial","box-sizing":"border-box"},"mjx-stretchy-v > mjx-ext > mjx-c":{transform:"scaleY(500) translateY(.075em)",overflow:"visible"},"mjx-mark":{display:"inline-block",height:"0px"}},e}((0,s.CommonMoMixin)(a.CHTMLWrapper));e.CHTMLmo=c},5964:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmpadded=void 0;var s=r(5355),l=r(6898),c=r(7238),u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(t){var e,r,n=this.standardCHTMLnode(t),o=[],s={},l=i(this.getDimens(),9),c=l[2],u=l[3],p=l[4],h=l[5],d=l[6],f=l[7],m=l[8];if(h&&(s.width=this.em(c+h)),(u||p)&&(s.margin=this.em(u)+" 0 "+this.em(p)),d+m||f){s.position="relative";var y=this.html("mjx-rbox",{style:{left:this.em(d+m),top:this.em(-f),"max-width":s.width}});d+m&&this.childNodes[0].getBBox().pwidth&&(this.adaptor.setAttribute(y,"width","full"),this.adaptor.setStyle(y,"left",this.em(d))),o.push(y)}n=this.adaptor.append(n,this.html("mjx-block",{style:s},o));try{for(var g=a(this.childNodes),b=g.next();!b.done;b=g.next()){b.value.toCHTML(o[0]||n)}}catch(t){e={error:t}}finally{try{b&&!b.done&&(r=g.return)&&r.call(g)}finally{if(e)throw e.error}}},e.kind=c.MmlMpadded.prototype.kind,e.styles={"mjx-mpadded":{display:"inline-block"},"mjx-rbox":{display:"inline-block",position:"relative"}},e}((0,l.CommonMpaddedMixin)(s.CHTMLWrapper));e.CHTMLmpadded=u},8776:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmroot=void 0;var a=r(5610),s=r(6991),l=r(6145),c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.addRoot=function(t,e,r,n){e.toCHTML(t);var o=i(this.getRootDimens(r,n),3),a=o[0],s=o[1],l=o[2];this.adaptor.setStyle(t,"verticalAlign",this.em(s)),this.adaptor.setStyle(t,"width",this.em(a)),l&&this.adaptor.setStyle(this.adaptor.firstChild(t),"paddingLeft",this.em(l))},e.kind=l.MmlMroot.prototype.kind,e}((0,s.CommonMrootMixin)(a.CHTMLmsqrt));e.CHTMLmroot=c},4798:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLinferredMrow=e.CHTMLmrow=void 0;var a=r(5355),s=r(8411),l=r(8411),c=r(9878),u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(t){var e,r,n=this.node.isInferred?this.chtml=t:this.standardCHTMLnode(t),o=!1;try{for(var a=i(this.childNodes),s=a.next();!s.done;s=a.next()){var l=s.value;l.toCHTML(n),l.bbox.w<0&&(o=!0)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}if(o){var c=this.getBBox().w;c&&(this.adaptor.setStyle(n,"width",this.em(Math.max(0,c))),c<0&&this.adaptor.setStyle(n,"marginRight",this.em(c)))}},e.kind=c.MmlMrow.prototype.kind,e}((0,s.CommonMrowMixin)(a.CHTMLWrapper));e.CHTMLmrow=u;var p=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.kind=c.MmlInferredMrow.prototype.kind,e}((0,l.CommonInferredMrowMixin)(u));e.CHTMLinferredMrow=p},4597:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLms=void 0;var i=r(5355),a=r(4126),s=r(7265),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.kind=s.MmlMs.prototype.kind,e}((0,a.CommonMsMixin)(i.CHTMLWrapper));e.CHTMLms=l},2970:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmspace=void 0;var i=r(5355),a=r(258),s=r(6030),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(t){var e=this.standardCHTMLnode(t),r=this.getBBox(),n=r.w,o=r.h,i=r.d;n<0&&(this.adaptor.setStyle(e,"marginRight",this.em(n)),n=0),n&&this.adaptor.setStyle(e,"width",this.em(n)),(o=Math.max(0,o+i))&&this.adaptor.setStyle(e,"height",this.em(Math.max(0,o))),i&&this.adaptor.setStyle(e,"verticalAlign",this.em(-i))},e.kind=s.MmlMspace.prototype.kind,e}((0,a.CommonMspaceMixin)(i.CHTMLWrapper));e.CHTMLmspace=l},5610:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmsqrt=void 0;var a=r(5355),s=r(4093),l=r(7131),c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(t){var e,r,n,o,a=this.childNodes[this.surd],s=this.childNodes[this.base],l=a.getBBox(),c=s.getOuterBBox(),u=i(this.getPQ(l),2)[1],p=this.font.params.rule_thickness,h=c.h+u+p,d=this.standardCHTMLnode(t);null!=this.root&&(n=this.adaptor.append(d,this.html("mjx-root")),o=this.childNodes[this.root]);var f=this.adaptor.append(d,this.html("mjx-sqrt",{},[e=this.html("mjx-surd"),r=this.html("mjx-box",{style:{paddingTop:this.em(u)}})]));this.addRoot(n,o,l,h),a.toCHTML(e),s.toCHTML(r),a.size<0&&this.adaptor.addClass(f,"mjx-tall")},e.prototype.addRoot=function(t,e,r,n){},e.kind=l.MmlMsqrt.prototype.kind,e.styles={"mjx-root":{display:"inline-block","white-space":"nowrap"},"mjx-surd":{display:"inline-block","vertical-align":"top"},"mjx-sqrt":{display:"inline-block","padding-top":".07em"},"mjx-sqrt > mjx-box":{"border-top":".07em solid"},"mjx-sqrt.mjx-tall > mjx-box":{"padding-left":".3em","margin-left":"-.3em"}},e}((0,s.CommonMsqrtMixin)(a.CHTMLWrapper));e.CHTMLmsqrt=c},4300:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmsubsup=e.CHTMLmsup=e.CHTMLmsub=void 0;var a=r(8650),s=r(905),l=r(905),c=r(905),u=r(4461),p=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.kind=u.MmlMsub.prototype.kind,e}((0,s.CommonMsubMixin)(a.CHTMLscriptbase));e.CHTMLmsub=p;var h=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.kind=u.MmlMsup.prototype.kind,e}((0,l.CommonMsupMixin)(a.CHTMLscriptbase));e.CHTMLmsup=h;var d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(t){var e=this.adaptor,r=this.standardCHTMLnode(t),n=i([this.baseChild,this.supChild,this.subChild],3),o=n[0],a=n[1],s=n[2],l=i(this.getUVQ(),3),c=l[1],u=l[2],p={"vertical-align":this.em(c)};o.toCHTML(r);var h=e.append(r,this.html("mjx-script",{style:p}));a.toCHTML(h),e.append(h,this.html("mjx-spacer",{style:{"margin-top":this.em(u)}})),s.toCHTML(h);var d=this.getAdjustedIc();d&&e.setStyle(a.chtml,"marginLeft",this.em(d/a.bbox.rscale)),this.baseRemoveIc&&e.setStyle(h,"marginLeft",this.em(-this.baseIc))},e.kind=u.MmlMsubsup.prototype.kind,e.styles={"mjx-script":{display:"inline-block","padding-right":".05em","padding-left":".033em"},"mjx-script > mjx-spacer":{display:"block"}},e}((0,c.CommonMsubsupMixin)(a.CHTMLscriptbase));e.CHTMLmsubsup=d},8002:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmtable=void 0;var s=r(5355),l=r(6237),c=r(1349),u=r(505),p=function(t){function e(e,r,n){void 0===n&&(n=null);var o=t.call(this,e,r,n)||this;return o.itable=o.html("mjx-itable"),o.labels=o.html("mjx-itable"),o}return o(e,t),e.prototype.getAlignShift=function(){var e=t.prototype.getAlignShift.call(this);return this.isTop||(e[1]=0),e},e.prototype.toCHTML=function(t){var e,r,n=this.standardCHTMLnode(t);this.adaptor.append(n,this.html("mjx-table",{},[this.itable]));try{for(var o=i(this.childNodes),a=o.next();!a.done;a=o.next()){a.value.toCHTML(this.itable)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}this.padRows(),this.handleColumnSpacing(),this.handleColumnLines(),this.handleColumnWidths(),this.handleRowSpacing(),this.handleRowLines(),this.handleRowHeights(),this.handleFrame(),this.handleWidth(),this.handleLabels(),this.handleAlign(),this.handleJustify(),this.shiftColor()},e.prototype.shiftColor=function(){var t=this.adaptor,e=t.getStyle(this.chtml,"backgroundColor");e&&(t.setStyle(this.chtml,"backgroundColor",""),t.setStyle(this.itable,"backgroundColor",e))},e.prototype.padRows=function(){var t,e,r=this.adaptor;try{for(var n=i(r.childNodes(this.itable)),o=n.next();!o.done;o=n.next())for(var a=o.value;r.childNodes(a).length<this.numCols;)r.append(a,this.html("mjx-mtd",{extra:!0}))}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}},e.prototype.handleColumnSpacing=function(){var t,e,r,n,o=this.childNodes[0]?1/this.childNodes[0].getBBox().rscale:1,a=this.getEmHalfSpacing(this.fSpace[0],this.cSpace,o),s=this.frame;try{for(var l=i(this.tableRows),c=l.next();!c.done;c=l.next()){var u=c.value,p=0;try{for(var h=(r=void 0,i(u.tableCells)),d=h.next();!d.done;d=h.next()){var f=d.value,m=a[p++],y=a[p],g=f?f.chtml:this.adaptor.childNodes(u.chtml)[p];(p>1&&"0.4em"!==m||s&&1===p)&&this.adaptor.setStyle(g,"paddingLeft",m),(p<this.numCols&&"0.4em"!==y||s&&p===this.numCols)&&this.adaptor.setStyle(g,"paddingRight",y)}}catch(t){r={error:t}}finally{try{d&&!d.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(e=l.return)&&e.call(l)}finally{if(t)throw t.error}}},e.prototype.handleColumnLines=function(){var t,e,r,n;if("none"!==this.node.attributes.get("columnlines")){var o=this.getColumnAttributes("columnlines");try{for(var a=i(this.childNodes),s=a.next();!s.done;s=a.next()){var l=s.value,c=0;try{for(var u=(r=void 0,i(this.adaptor.childNodes(l.chtml).slice(1))),p=u.next();!p.done;p=u.next()){var h=p.value,d=o[c++];"none"!==d&&this.adaptor.setStyle(h,"borderLeft",".07em "+d)}}catch(t){r={error:t}}finally{try{p&&!p.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}}},e.prototype.handleColumnWidths=function(){var t,e,r,n;try{for(var o=i(this.childNodes),a=o.next();!a.done;a=o.next()){var s=a.value,l=0;try{for(var c=(r=void 0,i(this.adaptor.childNodes(s.chtml))),u=c.next();!u.done;u=c.next()){var p=u.value,h=this.cWidths[l++];if(null!==h){var d="number"==typeof h?this.em(h):h;this.adaptor.setStyle(p,"width",d),this.adaptor.setStyle(p,"maxWidth",d),this.adaptor.setStyle(p,"minWidth",d)}}}catch(t){r={error:t}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}},e.prototype.handleRowSpacing=function(){var t,e,r,n,o=this.childNodes[0]?1/this.childNodes[0].getBBox().rscale:1,a=this.getEmHalfSpacing(this.fSpace[1],this.rSpace,o),s=this.frame,l=0;try{for(var c=i(this.childNodes),u=c.next();!u.done;u=c.next()){var p=u.value,h=a[l++],d=a[l];try{for(var f=(r=void 0,i(p.childNodes)),m=f.next();!m.done;m=f.next()){var y=m.value;(l>1&&"0.215em"!==h||s&&1===l)&&this.adaptor.setStyle(y.chtml,"paddingTop",h),(l<this.numRows&&"0.215em"!==d||s&&l===this.numRows)&&this.adaptor.setStyle(y.chtml,"paddingBottom",d)}}catch(t){r={error:t}}finally{try{m&&!m.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(e=c.return)&&e.call(c)}finally{if(t)throw t.error}}},e.prototype.handleRowLines=function(){var t,e,r,n;if("none"!==this.node.attributes.get("rowlines")){var o=this.getRowAttributes("rowlines"),a=0;try{for(var s=i(this.childNodes.slice(1)),l=s.next();!l.done;l=s.next()){var c=l.value,u=o[a++];if("none"!==u)try{for(var p=(r=void 0,i(this.adaptor.childNodes(c.chtml))),h=p.next();!h.done;h=p.next()){var d=h.value;this.adaptor.setStyle(d,"borderTop",".07em "+u)}}catch(t){r={error:t}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}}},e.prototype.handleRowHeights=function(){this.node.attributes.get("equalrows")&&this.handleEqualRows()},e.prototype.handleEqualRows=function(){for(var t=this.getRowHalfSpacing(),e=this.getTableData(),r=e.H,n=e.D,o=e.NH,i=e.ND,a=this.getEqualRowHeight(),s=0;s<this.numRows;s++){var l=this.childNodes[s];this.setRowHeight(l,a+t[s]+t[s+1]+this.rLines[s]),a!==o[s]+i[s]&&this.setRowBaseline(l,a,(a-r[s]+n[s])/2)}},e.prototype.setRowHeight=function(t,e){this.adaptor.setStyle(t.chtml,"height",this.em(e))},e.prototype.setRowBaseline=function(t,e,r){var n,o,a=t.node.attributes.get("rowalign");try{for(var s=i(t.childNodes),l=s.next();!l.done;l=s.next()){var c=l.value;if(this.setCellBaseline(c,a,e,r))break}}catch(t){n={error:t}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}},e.prototype.setCellBaseline=function(t,e,r,n){var o=t.node.attributes.get("rowalign");if("baseline"===o||"axis"===o){var i=this.adaptor,a=i.lastChild(t.chtml);i.setStyle(a,"height",this.em(r)),i.setStyle(a,"verticalAlign",this.em(-n));var s=t.parent;if(!(s.node.isKind("mlabeledtr")&&t===s.childNodes[0]||"baseline"!==e&&"axis"!==e))return!0}return!1},e.prototype.handleFrame=function(){this.frame&&this.fLine&&this.adaptor.setStyle(this.itable,"border",".07em "+this.node.attributes.get("frame"))},e.prototype.handleWidth=function(){var t=this.adaptor,e=this.getBBox(),r=e.w,n=e.L,o=e.R;t.setStyle(this.chtml,"minWidth",this.em(n+r+o));var i=this.node.attributes.get("width");if((0,u.isPercent)(i))t.setStyle(this.chtml,"width",""),t.setAttribute(this.chtml,"width","full");else if(!this.hasLabels){if("auto"===i)return;i=this.em(this.length2em(i)+2*this.fLine)}var a=t.firstChild(this.chtml);if(t.setStyle(a,"width",i),t.setStyle(a,"minWidth",this.em(r)),n||o){t.setStyle(this.chtml,"margin","");var s=this.node.attributes.get("data-width-includes-label")?"padding":"margin";n===o?t.setStyle(a,s,"0 "+this.em(o)):t.setStyle(a,s,"0 "+this.em(o)+" 0 "+this.em(n))}t.setAttribute(this.itable,"width","full")},e.prototype.handleAlign=function(){var t=a(this.getAlignmentRow(),2),e=t[0],r=t[1];if(null===r)"axis"!==e&&this.adaptor.setAttribute(this.chtml,"align",e);else{var n=this.getVerticalPosition(r,e);this.adaptor.setAttribute(this.chtml,"align","top"),this.adaptor.setStyle(this.chtml,"verticalAlign",this.em(n))}},e.prototype.handleJustify=function(){var t=this.getAlignShift()[0];"center"!==t&&this.adaptor.setAttribute(this.chtml,"justify",t)},e.prototype.handleLabels=function(){if(this.hasLabels){var t=this.labels,e=this.node.attributes,r=this.adaptor,n=e.get("side");r.setAttribute(this.chtml,"side",n),r.setAttribute(t,"align",n),r.setStyle(t,n,"0");var o=a(this.addLabelPadding(n),2),i=o[0],s=o[1];if(s){var l=r.firstChild(this.chtml);this.setIndent(l,i,s)}this.updateRowHeights(),this.addLabelSpacing()}},e.prototype.addLabelPadding=function(t){var e=a(this.getPadAlignShift(t),3),r=e[1],n=e[2],o={};if("right"===t&&!this.node.attributes.get("data-width-includes-label")){var i=this.node.attributes.get("width"),s=this.getBBox(),l=s.w,c=s.L,p=s.R;o.style={width:(0,u.isPercent)(i)?"calc("+i+" + "+this.em(c+p)+")":this.em(c+l+p)}}return this.adaptor.append(this.chtml,this.html("mjx-labels",o,[this.labels])),[r,n]},e.prototype.updateRowHeights=function(){for(var t=this.getTableData(),e=t.H,r=t.D,n=t.NH,o=t.ND,i=this.getRowHalfSpacing(),a=0;a<this.numRows;a++){var s=this.childNodes[a];this.setRowHeight(s,e[a]+r[a]+i[a]+i[a+1]+this.rLines[a]),e[a]!==n[a]||r[a]!==o[a]?this.setRowBaseline(s,e[a]+r[a],r[a]):s.node.isKind("mlabeledtr")&&this.setCellBaseline(s.childNodes[0],"",e[a]+r[a],r[a])}},e.prototype.addLabelSpacing=function(){for(var t=this.adaptor,e=this.node.attributes.get("equalrows"),r=this.getTableData(),n=r.H,o=r.D,i=e?this.getEqualRowHeight():0,a=this.getRowHalfSpacing(),s=this.fLine,l=t.firstChild(this.labels),c=0;c<this.numRows;c++){this.childNodes[c].node.isKind("mlabeledtr")?(s&&t.insert(this.html("mjx-mtr",{style:{height:this.em(s)}}),l),t.setStyle(l,"height",this.em((e?i:n[c]+o[c])+a[c]+a[c+1])),l=t.next(l),s=this.rLines[c]):s+=a[c]+(e?i:n[c]+o[c])+a[c+1]+this.rLines[c]}},e.kind=c.MmlMtable.prototype.kind,e.styles={"mjx-mtable":{"vertical-align":".25em","text-align":"center",position:"relative","box-sizing":"border-box","border-spacing":0,"border-collapse":"collapse"},'mjx-mstyle[size="s"] mjx-mtable':{"vertical-align":".354em"},"mjx-labels":{position:"absolute",left:0,top:0},"mjx-table":{display:"inline-block","vertical-align":"-.5ex","box-sizing":"border-box"},"mjx-table > mjx-itable":{"vertical-align":"middle","text-align":"left","box-sizing":"border-box"},"mjx-labels > mjx-itable":{position:"absolute",top:0},'mjx-mtable[justify="left"]':{"text-align":"left"},'mjx-mtable[justify="right"]':{"text-align":"right"},'mjx-mtable[justify="left"][side="left"]':{"padding-right":"0 ! important"},'mjx-mtable[justify="left"][side="right"]':{"padding-left":"0 ! important"},'mjx-mtable[justify="right"][side="left"]':{"padding-right":"0 ! important"},'mjx-mtable[justify="right"][side="right"]':{"padding-left":"0 ! important"},"mjx-mtable[align]":{"vertical-align":"baseline"},'mjx-mtable[align="top"] > mjx-table':{"vertical-align":"top"},'mjx-mtable[align="bottom"] > mjx-table':{"vertical-align":"bottom"},'mjx-mtable[side="right"] mjx-labels':{"min-width":"100%"}},e}((0,l.CommonMtableMixin)(s.CHTMLWrapper));e.CHTMLmtable=p},7056:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmtd=void 0;var i=r(5355),a=r(5164),s=r(4359),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(e){t.prototype.toCHTML.call(this,e);var r=this.node.attributes.get("rowalign"),n=this.node.attributes.get("columnalign");r!==this.parent.node.attributes.get("rowalign")&&this.adaptor.setAttribute(this.chtml,"rowalign",r),"center"===n||"mlabeledtr"===this.parent.kind&&this===this.parent.childNodes[0]&&n===this.parent.parent.node.attributes.get("side")||this.adaptor.setStyle(this.chtml,"textAlign",n),this.parent.parent.node.getProperty("useHeight")&&this.adaptor.append(this.chtml,this.html("mjx-tstrut"))},e.kind=s.MmlMtd.prototype.kind,e.styles={"mjx-mtd":{display:"table-cell","text-align":"center",padding:".215em .4em"},"mjx-mtd:first-child":{"padding-left":0},"mjx-mtd:last-child":{"padding-right":0},"mjx-mtable > * > mjx-itable > *:first-child > mjx-mtd":{"padding-top":0},"mjx-mtable > * > mjx-itable > *:last-child > mjx-mtd":{"padding-bottom":0},"mjx-tstrut":{display:"inline-block",height:"1em","vertical-align":"-.25em"},'mjx-labels[align="left"] > mjx-mtr > mjx-mtd':{"text-align":"left"},'mjx-labels[align="right"] > mjx-mtr > mjx-mtd':{"text-align":"right"},"mjx-mtd[extra]":{padding:0},'mjx-mtd[rowalign="top"]':{"vertical-align":"top"},'mjx-mtd[rowalign="center"]':{"vertical-align":"middle"},'mjx-mtd[rowalign="bottom"]':{"vertical-align":"bottom"},'mjx-mtd[rowalign="baseline"]':{"vertical-align":"baseline"},'mjx-mtd[rowalign="axis"]':{"vertical-align":".25em"}},e}((0,a.CommonMtdMixin)(i.CHTMLWrapper));e.CHTMLmtd=l},1259:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmtext=void 0;var i=r(5355),a=r(6319),s=r(4770),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.kind=s.MmlMtext.prototype.kind,e}((0,a.CommonMtextMixin)(i.CHTMLWrapper));e.CHTMLmtext=l},3571:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmlabeledtr=e.CHTMLmtr=void 0;var i=r(5355),a=r(5766),s=r(5766),l=r(5022),c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(e){t.prototype.toCHTML.call(this,e);var r=this.node.attributes.get("rowalign");"baseline"!==r&&this.adaptor.setAttribute(this.chtml,"rowalign",r)},e.kind=l.MmlMtr.prototype.kind,e.styles={"mjx-mtr":{display:"table-row"},'mjx-mtr[rowalign="top"] > mjx-mtd':{"vertical-align":"top"},'mjx-mtr[rowalign="center"] > mjx-mtd':{"vertical-align":"middle"},'mjx-mtr[rowalign="bottom"] > mjx-mtd':{"vertical-align":"bottom"},'mjx-mtr[rowalign="baseline"] > mjx-mtd':{"vertical-align":"baseline"},'mjx-mtr[rowalign="axis"] > mjx-mtd':{"vertical-align":".25em"}},e}((0,a.CommonMtrMixin)(i.CHTMLWrapper));e.CHTMLmtr=c;var u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(e){t.prototype.toCHTML.call(this,e);var r=this.adaptor.firstChild(this.chtml);if(r){this.adaptor.remove(r);var n=this.node.attributes.get("rowalign"),o="baseline"!==n&&"axis"!==n?{rowalign:n}:{},i=this.html("mjx-mtr",o,[r]);this.adaptor.append(this.parent.labels,i)}},e.prototype.markUsed=function(){t.prototype.markUsed.call(this),this.jax.wrapperUsage.add(c.kind)},e.kind=l.MmlMlabeledtr.prototype.kind,e.styles={"mjx-mlabeledtr":{display:"table-row"},'mjx-mlabeledtr[rowalign="top"] > mjx-mtd':{"vertical-align":"top"},'mjx-mlabeledtr[rowalign="center"] > mjx-mtd':{"vertical-align":"middle"},'mjx-mlabeledtr[rowalign="bottom"] > mjx-mtd':{"vertical-align":"bottom"},'mjx-mlabeledtr[rowalign="baseline"] > mjx-mtd':{"vertical-align":"baseline"},'mjx-mlabeledtr[rowalign="axis"] > mjx-mtd':{"vertical-align":".25em"}},e}((0,s.CommonMlabeledtrMixin)(c));e.CHTMLmlabeledtr=u},6590:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLmunderover=e.CHTMLmover=e.CHTMLmunder=void 0;var i=r(4300),a=r(1971),s=r(1971),l=r(1971),c=r(5184),u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(e){if(this.hasMovableLimits())return t.prototype.toCHTML.call(this,e),void this.adaptor.setAttribute(this.chtml,"limits","false");this.chtml=this.standardCHTMLnode(e);var r=this.adaptor.append(this.adaptor.append(this.chtml,this.html("mjx-row")),this.html("mjx-base")),n=this.adaptor.append(this.adaptor.append(this.chtml,this.html("mjx-row")),this.html("mjx-under"));this.baseChild.toCHTML(r),this.scriptChild.toCHTML(n);var o=this.baseChild.getOuterBBox(),i=this.scriptChild.getOuterBBox(),a=this.getUnderKV(o,i)[0],s=this.isLineBelow?0:this.getDelta(!0);this.adaptor.setStyle(n,"paddingTop",this.em(a)),this.setDeltaW([r,n],this.getDeltaW([o,i],[0,-s])),this.adjustUnderDepth(n,i)},e.kind=c.MmlMunder.prototype.kind,e.styles={"mjx-over":{"text-align":"left"},'mjx-munder:not([limits="false"])':{display:"inline-table"},"mjx-munder > mjx-row":{"text-align":"left"},"mjx-under":{"padding-bottom":".1em"}},e}((0,a.CommonMunderMixin)(i.CHTMLmsub));e.CHTMLmunder=u;var p=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(e){if(this.hasMovableLimits())return t.prototype.toCHTML.call(this,e),void this.adaptor.setAttribute(this.chtml,"limits","false");this.chtml=this.standardCHTMLnode(e);var r=this.adaptor.append(this.chtml,this.html("mjx-over")),n=this.adaptor.append(this.chtml,this.html("mjx-base"));this.scriptChild.toCHTML(r),this.baseChild.toCHTML(n);var o=this.scriptChild.getOuterBBox(),i=this.baseChild.getOuterBBox();this.adjustBaseHeight(n,i);var a=this.getOverKU(i,o)[0],s=this.isLineAbove?0:this.getDelta();this.adaptor.setStyle(r,"paddingBottom",this.em(a)),this.setDeltaW([n,r],this.getDeltaW([i,o],[0,s])),this.adjustOverDepth(r,o)},e.kind=c.MmlMover.prototype.kind,e.styles={'mjx-mover:not([limits="false"])':{"padding-top":".1em"},'mjx-mover:not([limits="false"]) > *':{display:"block","text-align":"left"}},e}((0,s.CommonMoverMixin)(i.CHTMLmsup));e.CHTMLmover=p;var h=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(e){if(this.hasMovableLimits())return t.prototype.toCHTML.call(this,e),void this.adaptor.setAttribute(this.chtml,"limits","false");this.chtml=this.standardCHTMLnode(e);var r=this.adaptor.append(this.chtml,this.html("mjx-over")),n=this.adaptor.append(this.adaptor.append(this.chtml,this.html("mjx-box")),this.html("mjx-munder")),o=this.adaptor.append(this.adaptor.append(n,this.html("mjx-row")),this.html("mjx-base")),i=this.adaptor.append(this.adaptor.append(n,this.html("mjx-row")),this.html("mjx-under"));this.overChild.toCHTML(r),this.baseChild.toCHTML(o),this.underChild.toCHTML(i);var a=this.overChild.getOuterBBox(),s=this.baseChild.getOuterBBox(),l=this.underChild.getOuterBBox();this.adjustBaseHeight(o,s);var c=this.getOverKU(s,a)[0],u=this.getUnderKV(s,l)[0],p=this.getDelta();this.adaptor.setStyle(r,"paddingBottom",this.em(c)),this.adaptor.setStyle(i,"paddingTop",this.em(u)),this.setDeltaW([o,i,r],this.getDeltaW([s,l,a],[0,this.isLineBelow?0:-p,this.isLineAbove?0:p])),this.adjustOverDepth(r,a),this.adjustUnderDepth(i,l)},e.prototype.markUsed=function(){t.prototype.markUsed.call(this),this.jax.wrapperUsage.add(i.CHTMLmsubsup.kind)},e.kind=c.MmlMunderover.prototype.kind,e.styles={'mjx-munderover:not([limits="false"])':{"padding-top":".1em"},'mjx-munderover:not([limits="false"]) > *':{display:"block"}},e}((0,l.CommonMunderoverMixin)(i.CHTMLmsubsup));e.CHTMLmunderover=h},8650:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLscriptbase=void 0;var s=r(5355),l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(t){this.chtml=this.standardCHTMLnode(t);var e=i(this.getOffset(),2),r=e[0],n=e[1],o=r-(this.baseRemoveIc?this.baseIc:0),a={"vertical-align":this.em(n)};o&&(a["margin-left"]=this.em(o)),this.baseChild.toCHTML(this.chtml),this.scriptChild.toCHTML(this.adaptor.append(this.chtml,this.html("mjx-script",{style:a})))},e.prototype.setDeltaW=function(t,e){for(var r=0;r<e.length;r++)e[r]&&this.adaptor.setStyle(t[r],"paddingLeft",this.em(e[r]))},e.prototype.adjustOverDepth=function(t,e){e.d>=0||this.adaptor.setStyle(t,"marginBottom",this.em(e.d*e.rscale))},e.prototype.adjustUnderDepth=function(t,e){var r,n;if(!(e.d>=0)){var o=this.adaptor,i=this.em(e.d),s=this.html("mjx-box",{style:{"margin-bottom":i,"vertical-align":i}});try{for(var l=a(o.childNodes(o.firstChild(t))),c=l.next();!c.done;c=l.next()){var u=c.value;o.append(s,u)}}catch(t){r={error:t}}finally{try{c&&!c.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}o.append(o.firstChild(t),s)}},e.prototype.adjustBaseHeight=function(t,e){if(this.node.attributes.get("accent")){var r=this.font.params.x_height*e.scale;e.h<r&&(this.adaptor.setStyle(t,"paddingTop",this.em(r-e.h)),e.h=r)}},e.kind="scriptbase",e}((0,r(167).CommonScriptbaseMixin)(s.CHTMLWrapper));e.CHTMLscriptbase=l},421:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.CHTMLxml=e.CHTMLannotationXML=e.CHTMLannotation=e.CHTMLsemantics=void 0;var i=r(5355),a=r(5806),s=r(9102),l=r(9007),c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(t){var e=this.standardCHTMLnode(t);this.childNodes.length&&this.childNodes[0].toCHTML(e)},e.kind=s.MmlSemantics.prototype.kind,e}((0,a.CommonSemanticsMixin)(i.CHTMLWrapper));e.CHTMLsemantics=c;var u=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(e){t.prototype.toCHTML.call(this,e)},e.prototype.computeBBox=function(){return this.bbox},e.kind=s.MmlAnnotation.prototype.kind,e}(i.CHTMLWrapper);e.CHTMLannotation=u;var p=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.kind=s.MmlAnnotationXML.prototype.kind,e.styles={"mjx-annotation-xml":{"font-family":"initial","line-height":"normal"}},e}(i.CHTMLWrapper);e.CHTMLannotationXML=p;var h=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.toCHTML=function(t){this.chtml=this.adaptor.append(t,this.adaptor.clone(this.node.getXML()))},e.prototype.computeBBox=function(t,e){void 0===e&&(e=!1);var r=this.jax.measureXMLnode(this.node.getXML()),n=r.w,o=r.h,i=r.d;t.w=n,t.h=o,t.d=i},e.prototype.getStyles=function(){},e.prototype.getScale=function(){},e.prototype.getVariant=function(){},e.kind=l.XMLNode.prototype.kind,e.autoStyle=!1,e}(i.CHTMLWrapper);e.CHTMLxml=h},2760:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.TeXFont=void 0;var a=r(8042),s=r(5920),l=r(4005),c=r(1015),u=r(4515),p=r(6555),h=r(2183),d=r(3490),f=r(9056),m=r(3019),y=r(2713),g=r(7517),b=r(4182),v=r(2679),_=r(5469),S=r(7563),x=r(9409),M=r(775),O=r(9551),E=r(7907),A=r(9659),C=r(98),w=r(6275),T=r(6530),N=r(4409),L=r(5292),P=r(9124),I=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.defaultCssFamilyPrefix="MJXZERO",e.defaultVariantClasses={normal:"mjx-n",bold:"mjx-b",italic:"mjx-i","bold-italic":"mjx-b mjx-i","double-struck":"mjx-ds mjx-b",fraktur:"mjx-fr","bold-fraktur":"mjx-fr mjx-b",script:"mjx-sc mjx-i","bold-script":"mjx-sc mjx-b mjx-i","sans-serif":"mjx-ss","bold-sans-serif":"mjx-ss mjx-b","sans-serif-italic":"mjx-ss mjx-i","sans-serif-bold-italic":"mjx-ss mjx-b mjx-i",monospace:"mjx-ty","-smallop":"mjx-sop","-largeop":"mjx-lop","-size3":"mjx-s3","-size4":"mjx-s4","-tex-calligraphic":"mjx-cal mjx-i","-tex-bold-calligraphic":"mjx-cal mjx-b","-tex-mathit":"mjx-mit mjx-i","-tex-oldstyle":"mjx-os","-tex-bold-oldstyle":"mjx-os mjx-b","-tex-variant":"mjx-var"},e.defaultVariantLetters={normal:"",bold:"B",italic:"MI","bold-italic":"BI","double-struck":"A",fraktur:"FR","bold-fraktur":"FRB",script:"SC","bold-script":"SCB","sans-serif":"SS","bold-sans-serif":"SSB","sans-serif-italic":"SSI","sans-serif-bold-italic":"SSBI",monospace:"T","-smallop":"S1","-largeop":"S2","-size3":"S3","-size4":"S4","-tex-calligraphic":"C","-tex-bold-calligraphic":"CB","-tex-mathit":"MI","-tex-oldstyle":"C","-tex-bold-oldstyle":"CB","-tex-variant":"A"},e.defaultDelimiters=P.delimiters,e.defaultChars={normal:y.normal,bold:c.bold,italic:d.italic,"bold-italic":l.boldItalic,"double-struck":u.doubleStruck,fraktur:h.fraktur,"bold-fraktur":p.frakturBold,script:x.script,"bold-script":S.scriptBold,"sans-serif":_.sansSerif,"bold-sans-serif":b.sansSerifBold,"sans-serif-italic":v.sansSerifItalic,"sans-serif-bold-italic":g.sansSerifBoldItalic,monospace:m.monospace,"-smallop":M.smallop,"-largeop":f.largeop,"-size3":T.texSize3,"-size4":N.texSize4,"-tex-calligraphic":E.texCalligraphic,"-tex-bold-calligraphic":O.texCalligraphicBold,"-tex-mathit":A.texMathit,"-tex-oldstyle":w.texOldstyle,"-tex-bold-oldstyle":C.texOldstyleBold,"-tex-variant":L.texVariant},e.defaultStyles=i(i({},a.CHTMLFontData.defaultStyles),{".MJX-TEX":{"font-family":"MJXZERO, MJXTEX"},".TEX-B":{"font-family":"MJXZERO, MJXTEX-B"},".TEX-I":{"font-family":"MJXZERO, MJXTEX-I"},".TEX-MI":{"font-family":"MJXZERO, MJXTEX-MI"},".TEX-BI":{"font-family":"MJXZERO, MJXTEX-BI"},".TEX-S1":{"font-family":"MJXZERO, MJXTEX-S1"},".TEX-S2":{"font-family":"MJXZERO, MJXTEX-S2"},".TEX-S3":{"font-family":"MJXZERO, MJXTEX-S3"},".TEX-S4":{"font-family":"MJXZERO, MJXTEX-S4"},".TEX-A":{"font-family":"MJXZERO, MJXTEX-A"},".TEX-C":{"font-family":"MJXZERO, MJXTEX-C"},".TEX-CB":{"font-family":"MJXZERO, MJXTEX-CB"},".TEX-FR":{"font-family":"MJXZERO, MJXTEX-FR"},".TEX-FRB":{"font-family":"MJXZERO, MJXTEX-FRB"},".TEX-SS":{"font-family":"MJXZERO, MJXTEX-SS"},".TEX-SSB":{"font-family":"MJXZERO, MJXTEX-SSB"},".TEX-SSI":{"font-family":"MJXZERO, MJXTEX-SSI"},".TEX-SC":{"font-family":"MJXZERO, MJXTEX-SC"},".TEX-T":{"font-family":"MJXZERO, MJXTEX-T"},".TEX-V":{"font-family":"MJXZERO, MJXTEX-V"},".TEX-VB":{"font-family":"MJXZERO, MJXTEX-VB"},"mjx-stretchy-v mjx-c, mjx-stretchy-h mjx-c":{"font-family":"MJXZERO, MJXTEX-S1, MJXTEX-S4, MJXTEX, MJXTEX-A ! important"}}),e.defaultFonts=i(i({},a.CHTMLFontData.defaultFonts),{"@font-face /* 1 */":{"font-family":"MJXTEX",src:'url("%%URL%%/MathJax_Main-Regular.woff") format("woff")'},"@font-face /* 2 */":{"font-family":"MJXTEX-B",src:'url("%%URL%%/MathJax_Main-Bold.woff") format("woff")'},"@font-face /* 3 */":{"font-family":"MJXTEX-I",src:'url("%%URL%%/MathJax_Math-Italic.woff") format("woff")'},"@font-face /* 4 */":{"font-family":"MJXTEX-MI",src:'url("%%URL%%/MathJax_Main-Italic.woff") format("woff")'},"@font-face /* 5 */":{"font-family":"MJXTEX-BI",src:'url("%%URL%%/MathJax_Math-BoldItalic.woff") format("woff")'},"@font-face /* 6 */":{"font-family":"MJXTEX-S1",src:'url("%%URL%%/MathJax_Size1-Regular.woff") format("woff")'},"@font-face /* 7 */":{"font-family":"MJXTEX-S2",src:'url("%%URL%%/MathJax_Size2-Regular.woff") format("woff")'},"@font-face /* 8 */":{"font-family":"MJXTEX-S3",src:'url("%%URL%%/MathJax_Size3-Regular.woff") format("woff")'},"@font-face /* 9 */":{"font-family":"MJXTEX-S4",src:'url("%%URL%%/MathJax_Size4-Regular.woff") format("woff")'},"@font-face /* 10 */":{"font-family":"MJXTEX-A",src:'url("%%URL%%/MathJax_AMS-Regular.woff") format("woff")'},"@font-face /* 11 */":{"font-family":"MJXTEX-C",src:'url("%%URL%%/MathJax_Calligraphic-Regular.woff") format("woff")'},"@font-face /* 12 */":{"font-family":"MJXTEX-CB",src:'url("%%URL%%/MathJax_Calligraphic-Bold.woff") format("woff")'},"@font-face /* 13 */":{"font-family":"MJXTEX-FR",src:'url("%%URL%%/MathJax_Fraktur-Regular.woff") format("woff")'},"@font-face /* 14 */":{"font-family":"MJXTEX-FRB",src:'url("%%URL%%/MathJax_Fraktur-Bold.woff") format("woff")'},"@font-face /* 15 */":{"font-family":"MJXTEX-SS",src:'url("%%URL%%/MathJax_SansSerif-Regular.woff") format("woff")'},"@font-face /* 16 */":{"font-family":"MJXTEX-SSB",src:'url("%%URL%%/MathJax_SansSerif-Bold.woff") format("woff")'},"@font-face /* 17 */":{"font-family":"MJXTEX-SSI",src:'url("%%URL%%/MathJax_SansSerif-Italic.woff") format("woff")'},"@font-face /* 18 */":{"font-family":"MJXTEX-SC",src:'url("%%URL%%/MathJax_Script-Regular.woff") format("woff")'},"@font-face /* 19 */":{"font-family":"MJXTEX-T",src:'url("%%URL%%/MathJax_Typewriter-Regular.woff") format("woff")'},"@font-face /* 20 */":{"font-family":"MJXTEX-V",src:'url("%%URL%%/MathJax_Vector-Regular.woff") format("woff")'},"@font-face /* 21 */":{"font-family":"MJXTEX-VB",src:'url("%%URL%%/MathJax_Vector-Bold.woff") format("woff")'}}),e}((0,s.CommonTeXFontMixin)(a.CHTMLFontData));e.TeXFont=I},4005:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.boldItalic=void 0;var n=r(8042),o=r(5887);e.boldItalic=(0,n.AddCSS)(o.boldItalic,{305:{f:"B"},567:{f:"B"},8260:{c:"/"},8710:{c:"\\394"},10744:{c:"/"}})},1015:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.bold=void 0;var n=r(8042),o=r(1103);e.bold=(0,n.AddCSS)(o.bold,{183:{c:"\\22C5"},305:{f:""},567:{f:""},697:{c:"\\2032"},8194:{c:""},8195:{c:""},8196:{c:""},8197:{c:""},8198:{c:""},8201:{c:""},8202:{c:""},8213:{c:"\\2014"},8214:{c:"\\2225"},8215:{c:"_"},8226:{c:"\\2219"},8243:{c:"\\2032\\2032"},8244:{c:"\\2032\\2032\\2032"},8254:{c:"\\2C9"},8260:{c:"/"},8279:{c:"\\2032\\2032\\2032\\2032"},8407:{c:"\\2192",f:"VB"},8602:{c:"\\2190\\338"},8603:{c:"\\2192\\338"},8622:{c:"\\2194\\338"},8653:{c:"\\21D0\\338"},8654:{c:"\\21D4\\338"},8655:{c:"\\21D2\\338"},8708:{c:"\\2203\\338"},8710:{c:"\\394"},8716:{c:"\\220B\\338"},8740:{c:"\\2223\\338"},8742:{c:"\\2225\\338"},8769:{c:"\\223C\\338"},8772:{c:"\\2243\\338"},8775:{c:"\\2245\\338"},8777:{c:"\\2248\\338"},8802:{c:"\\2261\\338"},8813:{c:"\\224D\\338"},8814:{c:"<\\338"},8815:{c:">\\338"},8816:{c:"\\2264\\338"},8817:{c:"\\2265\\338"},8832:{c:"\\227A\\338"},8833:{c:"\\227B\\338"},8836:{c:"\\2282\\338"},8837:{c:"\\2283\\338"},8840:{c:"\\2286\\338"},8841:{c:"\\2287\\338"},8876:{c:"\\22A2\\338"},8877:{c:"\\22A8\\338"},8930:{c:"\\2291\\338"},8931:{c:"\\2292\\338"},9001:{c:"\\27E8"},9002:{c:"\\27E9"},9653:{c:"\\25B3"},9663:{c:"\\25BD"},10072:{c:"\\2223"},10744:{c:"/",f:"BI"},10799:{c:"\\D7"},12296:{c:"\\27E8"},12297:{c:"\\27E9"}})},4515:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.doubleStruck=void 0;var n=r(6001);Object.defineProperty(e,"doubleStruck",{enumerable:!0,get:function(){return n.doubleStruck}})},6555:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.frakturBold=void 0;var n=r(8042),o=r(3696);e.frakturBold=(0,n.AddCSS)(o.frakturBold,{8260:{c:"/"}})},2183:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.fraktur=void 0;var n=r(8042),o=r(9587);e.fraktur=(0,n.AddCSS)(o.fraktur,{8260:{c:"/"}})},3490:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.italic=void 0;var n=r(8042),o=r(8348);e.italic=(0,n.AddCSS)(o.italic,{47:{f:"I"},989:{c:"\\E008",f:"A"},8213:{c:"\\2014"},8215:{c:"_"},8260:{c:"/",f:"I"},8710:{c:"\\394",f:"I"},10744:{c:"/",f:"I"}})},9056:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.largeop=void 0;var n=r(8042),o=r(1376);e.largeop=(0,n.AddCSS)(o.largeop,{8214:{f:"S1"},8260:{c:"/"},8593:{f:"S1"},8595:{f:"S1"},8657:{f:"S1"},8659:{f:"S1"},8739:{f:"S1"},8741:{f:"S1"},9001:{c:"\\27E8"},9002:{c:"\\27E9"},9168:{f:"S1"},10072:{c:"\\2223",f:"S1"},10764:{c:"\\222C\\222C"},12296:{c:"\\27E8"},12297:{c:"\\27E9"}})},3019:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.monospace=void 0;var n=r(8042),o=r(1439);e.monospace=(0,n.AddCSS)(o.monospace,{697:{c:"\\2032"},913:{c:"A"},914:{c:"B"},917:{c:"E"},918:{c:"Z"},919:{c:"H"},921:{c:"I"},922:{c:"K"},924:{c:"M"},925:{c:"N"},927:{c:"O"},929:{c:"P"},932:{c:"T"},935:{c:"X"},8215:{c:"_"},8243:{c:"\\2032\\2032"},8244:{c:"\\2032\\2032\\2032"},8260:{c:"/"},8279:{c:"\\2032\\2032\\2032\\2032"},8710:{c:"\\394"}})},2713:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.normal=void 0;var n=r(8042),o=r(331);e.normal=(0,n.AddCSS)(o.normal,{163:{f:"MI"},165:{f:"A"},174:{f:"A"},183:{c:"\\22C5"},240:{f:"A"},697:{c:"\\2032"},913:{c:"A"},914:{c:"B"},917:{c:"E"},918:{c:"Z"},919:{c:"H"},921:{c:"I"},922:{c:"K"},924:{c:"M"},925:{c:"N"},927:{c:"O"},929:{c:"P"},932:{c:"T"},935:{c:"X"},8192:{c:""},8193:{c:""},8194:{c:""},8195:{c:""},8196:{c:""},8197:{c:""},8198:{c:""},8201:{c:""},8202:{c:""},8203:{c:""},8204:{c:""},8213:{c:"\\2014"},8214:{c:"\\2225"},8215:{c:"_"},8226:{c:"\\2219"},8243:{c:"\\2032\\2032"},8244:{c:"\\2032\\2032\\2032"},8245:{f:"A"},8246:{c:"\\2035\\2035",f:"A"},8247:{c:"\\2035\\2035\\2035",f:"A"},8254:{c:"\\2C9"},8260:{c:"/"},8279:{c:"\\2032\\2032\\2032\\2032"},8288:{c:""},8289:{c:""},8290:{c:""},8291:{c:""},8292:{c:""},8407:{c:"\\2192",f:"V"},8450:{c:"C",f:"A"},8459:{c:"H",f:"SC"},8460:{c:"H",f:"FR"},8461:{c:"H",f:"A"},8462:{c:"h",f:"I"},8463:{f:"A"},8464:{c:"I",f:"SC"},8465:{c:"I",f:"FR"},8466:{c:"L",f:"SC"},8469:{c:"N",f:"A"},8473:{c:"P",f:"A"},8474:{c:"Q",f:"A"},8475:{c:"R",f:"SC"},8476:{c:"R",f:"FR"},8477:{c:"R",f:"A"},8484:{c:"Z",f:"A"},8486:{c:"\\3A9"},8487:{f:"A"},8488:{c:"Z",f:"FR"},8492:{c:"B",f:"SC"},8493:{c:"C",f:"FR"},8496:{c:"E",f:"SC"},8497:{c:"F",f:"SC"},8498:{f:"A"},8499:{c:"M",f:"SC"},8502:{f:"A"},8503:{f:"A"},8504:{f:"A"},8513:{f:"A"},8602:{f:"A"},8603:{f:"A"},8606:{f:"A"},8608:{f:"A"},8610:{f:"A"},8611:{f:"A"},8619:{f:"A"},8620:{f:"A"},8621:{f:"A"},8622:{f:"A"},8624:{f:"A"},8625:{f:"A"},8630:{f:"A"},8631:{f:"A"},8634:{f:"A"},8635:{f:"A"},8638:{f:"A"},8639:{f:"A"},8642:{f:"A"},8643:{f:"A"},8644:{f:"A"},8646:{f:"A"},8647:{f:"A"},8648:{f:"A"},8649:{f:"A"},8650:{f:"A"},8651:{f:"A"},8653:{f:"A"},8654:{f:"A"},8655:{f:"A"},8666:{f:"A"},8667:{f:"A"},8669:{f:"A"},8672:{f:"A"},8674:{f:"A"},8705:{f:"A"},8708:{c:"\\2203\\338"},8710:{c:"\\394"},8716:{c:"\\220B\\338"},8717:{f:"A"},8719:{f:"S1"},8720:{f:"S1"},8721:{f:"S1"},8724:{f:"A"},8737:{f:"A"},8738:{f:"A"},8740:{f:"A"},8742:{f:"A"},8748:{f:"S1"},8749:{f:"S1"},8750:{f:"S1"},8756:{f:"A"},8757:{f:"A"},8765:{f:"A"},8769:{f:"A"},8770:{f:"A"},8772:{c:"\\2243\\338"},8775:{c:"\\2246",f:"A"},8777:{c:"\\2248\\338"},8778:{f:"A"},8782:{f:"A"},8783:{f:"A"},8785:{f:"A"},8786:{f:"A"},8787:{f:"A"},8790:{f:"A"},8791:{f:"A"},8796:{f:"A"},8802:{c:"\\2261\\338"},8806:{f:"A"},8807:{f:"A"},8808:{f:"A"},8809:{f:"A"},8812:{f:"A"},8813:{c:"\\224D\\338"},8814:{f:"A"},8815:{f:"A"},8816:{f:"A"},8817:{f:"A"},8818:{f:"A"},8819:{f:"A"},8820:{c:"\\2272\\338"},8821:{c:"\\2273\\338"},8822:{f:"A"},8823:{f:"A"},8824:{c:"\\2276\\338"},8825:{c:"\\2277\\338"},8828:{f:"A"},8829:{f:"A"},8830:{f:"A"},8831:{f:"A"},8832:{f:"A"},8833:{f:"A"},8836:{c:"\\2282\\338"},8837:{c:"\\2283\\338"},8840:{f:"A"},8841:{f:"A"},8842:{f:"A"},8843:{f:"A"},8847:{f:"A"},8848:{f:"A"},8858:{f:"A"},8859:{f:"A"},8861:{f:"A"},8862:{f:"A"},8863:{f:"A"},8864:{f:"A"},8865:{f:"A"},8873:{f:"A"},8874:{f:"A"},8876:{f:"A"},8877:{f:"A"},8878:{f:"A"},8879:{f:"A"},8882:{f:"A"},8883:{f:"A"},8884:{f:"A"},8885:{f:"A"},8888:{f:"A"},8890:{f:"A"},8891:{f:"A"},8892:{f:"A"},8896:{f:"S1"},8897:{f:"S1"},8898:{f:"S1"},8899:{f:"S1"},8903:{f:"A"},8905:{f:"A"},8906:{f:"A"},8907:{f:"A"},8908:{f:"A"},8909:{f:"A"},8910:{f:"A"},8911:{f:"A"},8912:{f:"A"},8913:{f:"A"},8914:{f:"A"},8915:{f:"A"},8916:{f:"A"},8918:{f:"A"},8919:{f:"A"},8920:{f:"A"},8921:{f:"A"},8922:{f:"A"},8923:{f:"A"},8926:{f:"A"},8927:{f:"A"},8928:{f:"A"},8929:{f:"A"},8930:{c:"\\2291\\338"},8931:{c:"\\2292\\338"},8934:{f:"A"},8935:{f:"A"},8936:{f:"A"},8937:{f:"A"},8938:{f:"A"},8939:{f:"A"},8940:{f:"A"},8941:{f:"A"},8965:{c:"\\22BC",f:"A"},8966:{c:"\\2A5E",f:"A"},8988:{c:"\\250C",f:"A"},8989:{c:"\\2510",f:"A"},8990:{c:"\\2514",f:"A"},8991:{c:"\\2518",f:"A"},9001:{c:"\\27E8"},9002:{c:"\\27E9"},9168:{f:"S1"},9416:{f:"A"},9484:{f:"A"},9488:{f:"A"},9492:{f:"A"},9496:{f:"A"},9585:{f:"A"},9586:{f:"A"},9632:{f:"A"},9633:{f:"A"},9642:{c:"\\25A0",f:"A"},9650:{f:"A"},9652:{c:"\\25B2",f:"A"},9653:{c:"\\25B3"},9654:{f:"A"},9656:{c:"\\25B6",f:"A"},9660:{f:"A"},9662:{c:"\\25BC",f:"A"},9663:{c:"\\25BD"},9664:{f:"A"},9666:{c:"\\25C0",f:"A"},9674:{f:"A"},9723:{c:"\\25A1",f:"A"},9724:{c:"\\25A0",f:"A"},9733:{f:"A"},10003:{f:"A"},10016:{f:"A"},10072:{c:"\\2223"},10731:{f:"A"},10744:{c:"/",f:"I"},10752:{f:"S1"},10753:{f:"S1"},10754:{f:"S1"},10756:{f:"S1"},10758:{f:"S1"},10764:{c:"\\222C\\222C",f:"S1"},10799:{c:"\\D7"},10846:{f:"A"},10877:{f:"A"},10878:{f:"A"},10885:{f:"A"},10886:{f:"A"},10887:{f:"A"},10888:{f:"A"},10889:{f:"A"},10890:{f:"A"},10891:{f:"A"},10892:{f:"A"},10901:{f:"A"},10902:{f:"A"},10933:{f:"A"},10934:{f:"A"},10935:{f:"A"},10936:{f:"A"},10937:{f:"A"},10938:{f:"A"},10949:{f:"A"},10950:{f:"A"},10955:{f:"A"},10956:{f:"A"},12296:{c:"\\27E8"},12297:{c:"\\27E9"},57350:{f:"A"},57351:{f:"A"},57352:{f:"A"},57353:{f:"A"},57356:{f:"A"},57357:{f:"A"},57358:{f:"A"},57359:{f:"A"},57360:{f:"A"},57361:{f:"A"},57366:{f:"A"},57367:{f:"A"},57368:{f:"A"},57369:{f:"A"},57370:{f:"A"},57371:{f:"A"},119808:{c:"A",f:"B"},119809:{c:"B",f:"B"},119810:{c:"C",f:"B"},119811:{c:"D",f:"B"},119812:{c:"E",f:"B"},119813:{c:"F",f:"B"},119814:{c:"G",f:"B"},119815:{c:"H",f:"B"},119816:{c:"I",f:"B"},119817:{c:"J",f:"B"},119818:{c:"K",f:"B"},119819:{c:"L",f:"B"},119820:{c:"M",f:"B"},119821:{c:"N",f:"B"},119822:{c:"O",f:"B"},119823:{c:"P",f:"B"},119824:{c:"Q",f:"B"},119825:{c:"R",f:"B"},119826:{c:"S",f:"B"},119827:{c:"T",f:"B"},119828:{c:"U",f:"B"},119829:{c:"V",f:"B"},119830:{c:"W",f:"B"},119831:{c:"X",f:"B"},119832:{c:"Y",f:"B"},119833:{c:"Z",f:"B"},119834:{c:"a",f:"B"},119835:{c:"b",f:"B"},119836:{c:"c",f:"B"},119837:{c:"d",f:"B"},119838:{c:"e",f:"B"},119839:{c:"f",f:"B"},119840:{c:"g",f:"B"},119841:{c:"h",f:"B"},119842:{c:"i",f:"B"},119843:{c:"j",f:"B"},119844:{c:"k",f:"B"},119845:{c:"l",f:"B"},119846:{c:"m",f:"B"},119847:{c:"n",f:"B"},119848:{c:"o",f:"B"},119849:{c:"p",f:"B"},119850:{c:"q",f:"B"},119851:{c:"r",f:"B"},119852:{c:"s",f:"B"},119853:{c:"t",f:"B"},119854:{c:"u",f:"B"},119855:{c:"v",f:"B"},119856:{c:"w",f:"B"},119857:{c:"x",f:"B"},119858:{c:"y",f:"B"},119859:{c:"z",f:"B"},119860:{c:"A",f:"I"},119861:{c:"B",f:"I"},119862:{c:"C",f:"I"},119863:{c:"D",f:"I"},119864:{c:"E",f:"I"},119865:{c:"F",f:"I"},119866:{c:"G",f:"I"},119867:{c:"H",f:"I"},119868:{c:"I",f:"I"},119869:{c:"J",f:"I"},119870:{c:"K",f:"I"},119871:{c:"L",f:"I"},119872:{c:"M",f:"I"},119873:{c:"N",f:"I"},119874:{c:"O",f:"I"},119875:{c:"P",f:"I"},119876:{c:"Q",f:"I"},119877:{c:"R",f:"I"},119878:{c:"S",f:"I"},119879:{c:"T",f:"I"},119880:{c:"U",f:"I"},119881:{c:"V",f:"I"},119882:{c:"W",f:"I"},119883:{c:"X",f:"I"},119884:{c:"Y",f:"I"},119885:{c:"Z",f:"I"},119886:{c:"a",f:"I"},119887:{c:"b",f:"I"},119888:{c:"c",f:"I"},119889:{c:"d",f:"I"},119890:{c:"e",f:"I"},119891:{c:"f",f:"I"},119892:{c:"g",f:"I"},119894:{c:"i",f:"I"},119895:{c:"j",f:"I"},119896:{c:"k",f:"I"},119897:{c:"l",f:"I"},119898:{c:"m",f:"I"},119899:{c:"n",f:"I"},119900:{c:"o",f:"I"},119901:{c:"p",f:"I"},119902:{c:"q",f:"I"},119903:{c:"r",f:"I"},119904:{c:"s",f:"I"},119905:{c:"t",f:"I"},119906:{c:"u",f:"I"},119907:{c:"v",f:"I"},119908:{c:"w",f:"I"},119909:{c:"x",f:"I"},119910:{c:"y",f:"I"},119911:{c:"z",f:"I"},119912:{c:"A",f:"BI"},119913:{c:"B",f:"BI"},119914:{c:"C",f:"BI"},119915:{c:"D",f:"BI"},119916:{c:"E",f:"BI"},119917:{c:"F",f:"BI"},119918:{c:"G",f:"BI"},119919:{c:"H",f:"BI"},119920:{c:"I",f:"BI"},119921:{c:"J",f:"BI"},119922:{c:"K",f:"BI"},119923:{c:"L",f:"BI"},119924:{c:"M",f:"BI"},119925:{c:"N",f:"BI"},119926:{c:"O",f:"BI"},119927:{c:"P",f:"BI"},119928:{c:"Q",f:"BI"},119929:{c:"R",f:"BI"},119930:{c:"S",f:"BI"},119931:{c:"T",f:"BI"},119932:{c:"U",f:"BI"},119933:{c:"V",f:"BI"},119934:{c:"W",f:"BI"},119935:{c:"X",f:"BI"},119936:{c:"Y",f:"BI"},119937:{c:"Z",f:"BI"},119938:{c:"a",f:"BI"},119939:{c:"b",f:"BI"},119940:{c:"c",f:"BI"},119941:{c:"d",f:"BI"},119942:{c:"e",f:"BI"},119943:{c:"f",f:"BI"},119944:{c:"g",f:"BI"},119945:{c:"h",f:"BI"},119946:{c:"i",f:"BI"},119947:{c:"j",f:"BI"},119948:{c:"k",f:"BI"},119949:{c:"l",f:"BI"},119950:{c:"m",f:"BI"},119951:{c:"n",f:"BI"},119952:{c:"o",f:"BI"},119953:{c:"p",f:"BI"},119954:{c:"q",f:"BI"},119955:{c:"r",f:"BI"},119956:{c:"s",f:"BI"},119957:{c:"t",f:"BI"},119958:{c:"u",f:"BI"},119959:{c:"v",f:"BI"},119960:{c:"w",f:"BI"},119961:{c:"x",f:"BI"},119962:{c:"y",f:"BI"},119963:{c:"z",f:"BI"},119964:{c:"A",f:"SC"},119966:{c:"C",f:"SC"},119967:{c:"D",f:"SC"},119970:{c:"G",f:"SC"},119973:{c:"J",f:"SC"},119974:{c:"K",f:"SC"},119977:{c:"N",f:"SC"},119978:{c:"O",f:"SC"},119979:{c:"P",f:"SC"},119980:{c:"Q",f:"SC"},119982:{c:"S",f:"SC"},119983:{c:"T",f:"SC"},119984:{c:"U",f:"SC"},119985:{c:"V",f:"SC"},119986:{c:"W",f:"SC"},119987:{c:"X",f:"SC"},119988:{c:"Y",f:"SC"},119989:{c:"Z",f:"SC"},120068:{c:"A",f:"FR"},120069:{c:"B",f:"FR"},120071:{c:"D",f:"FR"},120072:{c:"E",f:"FR"},120073:{c:"F",f:"FR"},120074:{c:"G",f:"FR"},120077:{c:"J",f:"FR"},120078:{c:"K",f:"FR"},120079:{c:"L",f:"FR"},120080:{c:"M",f:"FR"},120081:{c:"N",f:"FR"},120082:{c:"O",f:"FR"},120083:{c:"P",f:"FR"},120084:{c:"Q",f:"FR"},120086:{c:"S",f:"FR"},120087:{c:"T",f:"FR"},120088:{c:"U",f:"FR"},120089:{c:"V",f:"FR"},120090:{c:"W",f:"FR"},120091:{c:"X",f:"FR"},120092:{c:"Y",f:"FR"},120094:{c:"a",f:"FR"},120095:{c:"b",f:"FR"},120096:{c:"c",f:"FR"},120097:{c:"d",f:"FR"},120098:{c:"e",f:"FR"},120099:{c:"f",f:"FR"},120100:{c:"g",f:"FR"},120101:{c:"h",f:"FR"},120102:{c:"i",f:"FR"},120103:{c:"j",f:"FR"},120104:{c:"k",f:"FR"},120105:{c:"l",f:"FR"},120106:{c:"m",f:"FR"},120107:{c:"n",f:"FR"},120108:{c:"o",f:"FR"},120109:{c:"p",f:"FR"},120110:{c:"q",f:"FR"},120111:{c:"r",f:"FR"},120112:{c:"s",f:"FR"},120113:{c:"t",f:"FR"},120114:{c:"u",f:"FR"},120115:{c:"v",f:"FR"},120116:{c:"w",f:"FR"},120117:{c:"x",f:"FR"},120118:{c:"y",f:"FR"},120119:{c:"z",f:"FR"},120120:{c:"A",f:"A"},120121:{c:"B",f:"A"},120123:{c:"D",f:"A"},120124:{c:"E",f:"A"},120125:{c:"F",f:"A"},120126:{c:"G",f:"A"},120128:{c:"I",f:"A"},120129:{c:"J",f:"A"},120130:{c:"K",f:"A"},120131:{c:"L",f:"A"},120132:{c:"M",f:"A"},120134:{c:"O",f:"A"},120138:{c:"S",f:"A"},120139:{c:"T",f:"A"},120140:{c:"U",f:"A"},120141:{c:"V",f:"A"},120142:{c:"W",f:"A"},120143:{c:"X",f:"A"},120144:{c:"Y",f:"A"},120172:{c:"A",f:"FRB"},120173:{c:"B",f:"FRB"},120174:{c:"C",f:"FRB"},120175:{c:"D",f:"FRB"},120176:{c:"E",f:"FRB"},120177:{c:"F",f:"FRB"},120178:{c:"G",f:"FRB"},120179:{c:"H",f:"FRB"},120180:{c:"I",f:"FRB"},120181:{c:"J",f:"FRB"},120182:{c:"K",f:"FRB"},120183:{c:"L",f:"FRB"},120184:{c:"M",f:"FRB"},120185:{c:"N",f:"FRB"},120186:{c:"O",f:"FRB"},120187:{c:"P",f:"FRB"},120188:{c:"Q",f:"FRB"},120189:{c:"R",f:"FRB"},120190:{c:"S",f:"FRB"},120191:{c:"T",f:"FRB"},120192:{c:"U",f:"FRB"},120193:{c:"V",f:"FRB"},120194:{c:"W",f:"FRB"},120195:{c:"X",f:"FRB"},120196:{c:"Y",f:"FRB"},120197:{c:"Z",f:"FRB"},120198:{c:"a",f:"FRB"},120199:{c:"b",f:"FRB"},120200:{c:"c",f:"FRB"},120201:{c:"d",f:"FRB"},120202:{c:"e",f:"FRB"},120203:{c:"f",f:"FRB"},120204:{c:"g",f:"FRB"},120205:{c:"h",f:"FRB"},120206:{c:"i",f:"FRB"},120207:{c:"j",f:"FRB"},120208:{c:"k",f:"FRB"},120209:{c:"l",f:"FRB"},120210:{c:"m",f:"FRB"},120211:{c:"n",f:"FRB"},120212:{c:"o",f:"FRB"},120213:{c:"p",f:"FRB"},120214:{c:"q",f:"FRB"},120215:{c:"r",f:"FRB"},120216:{c:"s",f:"FRB"},120217:{c:"t",f:"FRB"},120218:{c:"u",f:"FRB"},120219:{c:"v",f:"FRB"},120220:{c:"w",f:"FRB"},120221:{c:"x",f:"FRB"},120222:{c:"y",f:"FRB"},120223:{c:"z",f:"FRB"},120224:{c:"A",f:"SS"},120225:{c:"B",f:"SS"},120226:{c:"C",f:"SS"},120227:{c:"D",f:"SS"},120228:{c:"E",f:"SS"},120229:{c:"F",f:"SS"},120230:{c:"G",f:"SS"},120231:{c:"H",f:"SS"},120232:{c:"I",f:"SS"},120233:{c:"J",f:"SS"},120234:{c:"K",f:"SS"},120235:{c:"L",f:"SS"},120236:{c:"M",f:"SS"},120237:{c:"N",f:"SS"},120238:{c:"O",f:"SS"},120239:{c:"P",f:"SS"},120240:{c:"Q",f:"SS"},120241:{c:"R",f:"SS"},120242:{c:"S",f:"SS"},120243:{c:"T",f:"SS"},120244:{c:"U",f:"SS"},120245:{c:"V",f:"SS"},120246:{c:"W",f:"SS"},120247:{c:"X",f:"SS"},120248:{c:"Y",f:"SS"},120249:{c:"Z",f:"SS"},120250:{c:"a",f:"SS"},120251:{c:"b",f:"SS"},120252:{c:"c",f:"SS"},120253:{c:"d",f:"SS"},120254:{c:"e",f:"SS"},120255:{c:"f",f:"SS"},120256:{c:"g",f:"SS"},120257:{c:"h",f:"SS"},120258:{c:"i",f:"SS"},120259:{c:"j",f:"SS"},120260:{c:"k",f:"SS"},120261:{c:"l",f:"SS"},120262:{c:"m",f:"SS"},120263:{c:"n",f:"SS"},120264:{c:"o",f:"SS"},120265:{c:"p",f:"SS"},120266:{c:"q",f:"SS"},120267:{c:"r",f:"SS"},120268:{c:"s",f:"SS"},120269:{c:"t",f:"SS"},120270:{c:"u",f:"SS"},120271:{c:"v",f:"SS"},120272:{c:"w",f:"SS"},120273:{c:"x",f:"SS"},120274:{c:"y",f:"SS"},120275:{c:"z",f:"SS"},120276:{c:"A",f:"SSB"},120277:{c:"B",f:"SSB"},120278:{c:"C",f:"SSB"},120279:{c:"D",f:"SSB"},120280:{c:"E",f:"SSB"},120281:{c:"F",f:"SSB"},120282:{c:"G",f:"SSB"},120283:{c:"H",f:"SSB"},120284:{c:"I",f:"SSB"},120285:{c:"J",f:"SSB"},120286:{c:"K",f:"SSB"},120287:{c:"L",f:"SSB"},120288:{c:"M",f:"SSB"},120289:{c:"N",f:"SSB"},120290:{c:"O",f:"SSB"},120291:{c:"P",f:"SSB"},120292:{c:"Q",f:"SSB"},120293:{c:"R",f:"SSB"},120294:{c:"S",f:"SSB"},120295:{c:"T",f:"SSB"},120296:{c:"U",f:"SSB"},120297:{c:"V",f:"SSB"},120298:{c:"W",f:"SSB"},120299:{c:"X",f:"SSB"},120300:{c:"Y",f:"SSB"},120301:{c:"Z",f:"SSB"},120302:{c:"a",f:"SSB"},120303:{c:"b",f:"SSB"},120304:{c:"c",f:"SSB"},120305:{c:"d",f:"SSB"},120306:{c:"e",f:"SSB"},120307:{c:"f",f:"SSB"},120308:{c:"g",f:"SSB"},120309:{c:"h",f:"SSB"},120310:{c:"i",f:"SSB"},120311:{c:"j",f:"SSB"},120312:{c:"k",f:"SSB"},120313:{c:"l",f:"SSB"},120314:{c:"m",f:"SSB"},120315:{c:"n",f:"SSB"},120316:{c:"o",f:"SSB"},120317:{c:"p",f:"SSB"},120318:{c:"q",f:"SSB"},120319:{c:"r",f:"SSB"},120320:{c:"s",f:"SSB"},120321:{c:"t",f:"SSB"},120322:{c:"u",f:"SSB"},120323:{c:"v",f:"SSB"},120324:{c:"w",f:"SSB"},120325:{c:"x",f:"SSB"},120326:{c:"y",f:"SSB"},120327:{c:"z",f:"SSB"},120328:{c:"A",f:"SSI"},120329:{c:"B",f:"SSI"},120330:{c:"C",f:"SSI"},120331:{c:"D",f:"SSI"},120332:{c:"E",f:"SSI"},120333:{c:"F",f:"SSI"},120334:{c:"G",f:"SSI"},120335:{c:"H",f:"SSI"},120336:{c:"I",f:"SSI"},120337:{c:"J",f:"SSI"},120338:{c:"K",f:"SSI"},120339:{c:"L",f:"SSI"},120340:{c:"M",f:"SSI"},120341:{c:"N",f:"SSI"},120342:{c:"O",f:"SSI"},120343:{c:"P",f:"SSI"},120344:{c:"Q",f:"SSI"},120345:{c:"R",f:"SSI"},120346:{c:"S",f:"SSI"},120347:{c:"T",f:"SSI"},120348:{c:"U",f:"SSI"},120349:{c:"V",f:"SSI"},120350:{c:"W",f:"SSI"},120351:{c:"X",f:"SSI"},120352:{c:"Y",f:"SSI"},120353:{c:"Z",f:"SSI"},120354:{c:"a",f:"SSI"},120355:{c:"b",f:"SSI"},120356:{c:"c",f:"SSI"},120357:{c:"d",f:"SSI"},120358:{c:"e",f:"SSI"},120359:{c:"f",f:"SSI"},120360:{c:"g",f:"SSI"},120361:{c:"h",f:"SSI"},120362:{c:"i",f:"SSI"},120363:{c:"j",f:"SSI"},120364:{c:"k",f:"SSI"},120365:{c:"l",f:"SSI"},120366:{c:"m",f:"SSI"},120367:{c:"n",f:"SSI"},120368:{c:"o",f:"SSI"},120369:{c:"p",f:"SSI"},120370:{c:"q",f:"SSI"},120371:{c:"r",f:"SSI"},120372:{c:"s",f:"SSI"},120373:{c:"t",f:"SSI"},120374:{c:"u",f:"SSI"},120375:{c:"v",f:"SSI"},120376:{c:"w",f:"SSI"},120377:{c:"x",f:"SSI"},120378:{c:"y",f:"SSI"},120379:{c:"z",f:"SSI"},120432:{c:"A",f:"T"},120433:{c:"B",f:"T"},120434:{c:"C",f:"T"},120435:{c:"D",f:"T"},120436:{c:"E",f:"T"},120437:{c:"F",f:"T"},120438:{c:"G",f:"T"},120439:{c:"H",f:"T"},120440:{c:"I",f:"T"},120441:{c:"J",f:"T"},120442:{c:"K",f:"T"},120443:{c:"L",f:"T"},120444:{c:"M",f:"T"},120445:{c:"N",f:"T"},120446:{c:"O",f:"T"},120447:{c:"P",f:"T"},120448:{c:"Q",f:"T"},120449:{c:"R",f:"T"},120450:{c:"S",f:"T"},120451:{c:"T",f:"T"},120452:{c:"U",f:"T"},120453:{c:"V",f:"T"},120454:{c:"W",f:"T"},120455:{c:"X",f:"T"},120456:{c:"Y",f:"T"},120457:{c:"Z",f:"T"},120458:{c:"a",f:"T"},120459:{c:"b",f:"T"},120460:{c:"c",f:"T"},120461:{c:"d",f:"T"},120462:{c:"e",f:"T"},120463:{c:"f",f:"T"},120464:{c:"g",f:"T"},120465:{c:"h",f:"T"},120466:{c:"i",f:"T"},120467:{c:"j",f:"T"},120468:{c:"k",f:"T"},120469:{c:"l",f:"T"},120470:{c:"m",f:"T"},120471:{c:"n",f:"T"},120472:{c:"o",f:"T"},120473:{c:"p",f:"T"},120474:{c:"q",f:"T"},120475:{c:"r",f:"T"},120476:{c:"s",f:"T"},120477:{c:"t",f:"T"},120478:{c:"u",f:"T"},120479:{c:"v",f:"T"},120480:{c:"w",f:"T"},120481:{c:"x",f:"T"},120482:{c:"y",f:"T"},120483:{c:"z",f:"T"},120488:{c:"A",f:"B"},120489:{c:"B",f:"B"},120490:{c:"\\393",f:"B"},120491:{c:"\\394",f:"B"},120492:{c:"E",f:"B"},120493:{c:"Z",f:"B"},120494:{c:"H",f:"B"},120495:{c:"\\398",f:"B"},120496:{c:"I",f:"B"},120497:{c:"K",f:"B"},120498:{c:"\\39B",f:"B"},120499:{c:"M",f:"B"},120500:{c:"N",f:"B"},120501:{c:"\\39E",f:"B"},120502:{c:"O",f:"B"},120503:{c:"\\3A0",f:"B"},120504:{c:"P",f:"B"},120506:{c:"\\3A3",f:"B"},120507:{c:"T",f:"B"},120508:{c:"\\3A5",f:"B"},120509:{c:"\\3A6",f:"B"},120510:{c:"X",f:"B"},120511:{c:"\\3A8",f:"B"},120512:{c:"\\3A9",f:"B"},120513:{c:"\\2207",f:"B"},120546:{c:"A",f:"I"},120547:{c:"B",f:"I"},120548:{c:"\\393",f:"I"},120549:{c:"\\394",f:"I"},120550:{c:"E",f:"I"},120551:{c:"Z",f:"I"},120552:{c:"H",f:"I"},120553:{c:"\\398",f:"I"},120554:{c:"I",f:"I"},120555:{c:"K",f:"I"},120556:{c:"\\39B",f:"I"},120557:{c:"M",f:"I"},120558:{c:"N",f:"I"},120559:{c:"\\39E",f:"I"},120560:{c:"O",f:"I"},120561:{c:"\\3A0",f:"I"},120562:{c:"P",f:"I"},120564:{c:"\\3A3",f:"I"},120565:{c:"T",f:"I"},120566:{c:"\\3A5",f:"I"},120567:{c:"\\3A6",f:"I"},120568:{c:"X",f:"I"},120569:{c:"\\3A8",f:"I"},120570:{c:"\\3A9",f:"I"},120572:{c:"\\3B1",f:"I"},120573:{c:"\\3B2",f:"I"},120574:{c:"\\3B3",f:"I"},120575:{c:"\\3B4",f:"I"},120576:{c:"\\3B5",f:"I"},120577:{c:"\\3B6",f:"I"},120578:{c:"\\3B7",f:"I"},120579:{c:"\\3B8",f:"I"},120580:{c:"\\3B9",f:"I"},120581:{c:"\\3BA",f:"I"},120582:{c:"\\3BB",f:"I"},120583:{c:"\\3BC",f:"I"},120584:{c:"\\3BD",f:"I"},120585:{c:"\\3BE",f:"I"},120586:{c:"\\3BF",f:"I"},120587:{c:"\\3C0",f:"I"},120588:{c:"\\3C1",f:"I"},120589:{c:"\\3C2",f:"I"},120590:{c:"\\3C3",f:"I"},120591:{c:"\\3C4",f:"I"},120592:{c:"\\3C5",f:"I"},120593:{c:"\\3C6",f:"I"},120594:{c:"\\3C7",f:"I"},120595:{c:"\\3C8",f:"I"},120596:{c:"\\3C9",f:"I"},120597:{c:"\\2202"},120598:{c:"\\3F5",f:"I"},120599:{c:"\\3D1",f:"I"},120600:{c:"\\E009",f:"A"},120601:{c:"\\3D5",f:"I"},120602:{c:"\\3F1",f:"I"},120603:{c:"\\3D6",f:"I"},120604:{c:"A",f:"BI"},120605:{c:"B",f:"BI"},120606:{c:"\\393",f:"BI"},120607:{c:"\\394",f:"BI"},120608:{c:"E",f:"BI"},120609:{c:"Z",f:"BI"},120610:{c:"H",f:"BI"},120611:{c:"\\398",f:"BI"},120612:{c:"I",f:"BI"},120613:{c:"K",f:"BI"},120614:{c:"\\39B",f:"BI"},120615:{c:"M",f:"BI"},120616:{c:"N",f:"BI"},120617:{c:"\\39E",f:"BI"},120618:{c:"O",f:"BI"},120619:{c:"\\3A0",f:"BI"},120620:{c:"P",f:"BI"},120622:{c:"\\3A3",f:"BI"},120623:{c:"T",f:"BI"},120624:{c:"\\3A5",f:"BI"},120625:{c:"\\3A6",f:"BI"},120626:{c:"X",f:"BI"},120627:{c:"\\3A8",f:"BI"},120628:{c:"\\3A9",f:"BI"},120630:{c:"\\3B1",f:"BI"},120631:{c:"\\3B2",f:"BI"},120632:{c:"\\3B3",f:"BI"},120633:{c:"\\3B4",f:"BI"},120634:{c:"\\3B5",f:"BI"},120635:{c:"\\3B6",f:"BI"},120636:{c:"\\3B7",f:"BI"},120637:{c:"\\3B8",f:"BI"},120638:{c:"\\3B9",f:"BI"},120639:{c:"\\3BA",f:"BI"},120640:{c:"\\3BB",f:"BI"},120641:{c:"\\3BC",f:"BI"},120642:{c:"\\3BD",f:"BI"},120643:{c:"\\3BE",f:"BI"},120644:{c:"\\3BF",f:"BI"},120645:{c:"\\3C0",f:"BI"},120646:{c:"\\3C1",f:"BI"},120647:{c:"\\3C2",f:"BI"},120648:{c:"\\3C3",f:"BI"},120649:{c:"\\3C4",f:"BI"},120650:{c:"\\3C5",f:"BI"},120651:{c:"\\3C6",f:"BI"},120652:{c:"\\3C7",f:"BI"},120653:{c:"\\3C8",f:"BI"},120654:{c:"\\3C9",f:"BI"},120655:{c:"\\2202",f:"B"},120656:{c:"\\3F5",f:"BI"},120657:{c:"\\3D1",f:"BI"},120658:{c:"\\E009",f:"A"},120659:{c:"\\3D5",f:"BI"},120660:{c:"\\3F1",f:"BI"},120661:{c:"\\3D6",f:"BI"},120662:{c:"A",f:"SSB"},120663:{c:"B",f:"SSB"},120664:{c:"\\393",f:"SSB"},120665:{c:"\\394",f:"SSB"},120666:{c:"E",f:"SSB"},120667:{c:"Z",f:"SSB"},120668:{c:"H",f:"SSB"},120669:{c:"\\398",f:"SSB"},120670:{c:"I",f:"SSB"},120671:{c:"K",f:"SSB"},120672:{c:"\\39B",f:"SSB"},120673:{c:"M",f:"SSB"},120674:{c:"N",f:"SSB"},120675:{c:"\\39E",f:"SSB"},120676:{c:"O",f:"SSB"},120677:{c:"\\3A0",f:"SSB"},120678:{c:"P",f:"SSB"},120680:{c:"\\3A3",f:"SSB"},120681:{c:"T",f:"SSB"},120682:{c:"\\3A5",f:"SSB"},120683:{c:"\\3A6",f:"SSB"},120684:{c:"X",f:"SSB"},120685:{c:"\\3A8",f:"SSB"},120686:{c:"\\3A9",f:"SSB"},120782:{c:"0",f:"B"},120783:{c:"1",f:"B"},120784:{c:"2",f:"B"},120785:{c:"3",f:"B"},120786:{c:"4",f:"B"},120787:{c:"5",f:"B"},120788:{c:"6",f:"B"},120789:{c:"7",f:"B"},120790:{c:"8",f:"B"},120791:{c:"9",f:"B"},120802:{c:"0",f:"SS"},120803:{c:"1",f:"SS"},120804:{c:"2",f:"SS"},120805:{c:"3",f:"SS"},120806:{c:"4",f:"SS"},120807:{c:"5",f:"SS"},120808:{c:"6",f:"SS"},120809:{c:"7",f:"SS"},120810:{c:"8",f:"SS"},120811:{c:"9",f:"SS"},120812:{c:"0",f:"SSB"},120813:{c:"1",f:"SSB"},120814:{c:"2",f:"SSB"},120815:{c:"3",f:"SSB"},120816:{c:"4",f:"SSB"},120817:{c:"5",f:"SSB"},120818:{c:"6",f:"SSB"},120819:{c:"7",f:"SSB"},120820:{c:"8",f:"SSB"},120821:{c:"9",f:"SSB"},120822:{c:"0",f:"T"},120823:{c:"1",f:"T"},120824:{c:"2",f:"T"},120825:{c:"3",f:"T"},120826:{c:"4",f:"T"},120827:{c:"5",f:"T"},120828:{c:"6",f:"T"},120829:{c:"7",f:"T"},120830:{c:"8",f:"T"},120831:{c:"9",f:"T"}})},7517:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.sansSerifBoldItalic=void 0;var n=r(8042),o=r(4886);e.sansSerifBoldItalic=(0,n.AddCSS)(o.sansSerifBoldItalic,{305:{f:"SSB"},567:{f:"SSB"}})},4182:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.sansSerifBold=void 0;var n=r(8042),o=r(4471);e.sansSerifBold=(0,n.AddCSS)(o.sansSerifBold,{8213:{c:"\\2014"},8215:{c:"_"},8260:{c:"/"},8710:{c:"\\394"}})},2679:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.sansSerifItalic=void 0;var n=r(8042),o=r(5181);e.sansSerifItalic=(0,n.AddCSS)(o.sansSerifItalic,{913:{c:"A"},914:{c:"B"},917:{c:"E"},918:{c:"Z"},919:{c:"H"},921:{c:"I"},922:{c:"K"},924:{c:"M"},925:{c:"N"},927:{c:"O"},929:{c:"P"},932:{c:"T"},935:{c:"X"},8213:{c:"\\2014"},8215:{c:"_"},8260:{c:"/"},8710:{c:"\\394"}})},5469:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.sansSerif=void 0;var n=r(8042),o=r(3526);e.sansSerif=(0,n.AddCSS)(o.sansSerif,{913:{c:"A"},914:{c:"B"},917:{c:"E"},918:{c:"Z"},919:{c:"H"},921:{c:"I"},922:{c:"K"},924:{c:"M"},925:{c:"N"},927:{c:"O"},929:{c:"P"},932:{c:"T"},935:{c:"X"},8213:{c:"\\2014"},8215:{c:"_"},8260:{c:"/"},8710:{c:"\\394"}})},7563:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.scriptBold=void 0;var n=r(5649);Object.defineProperty(e,"scriptBold",{enumerable:!0,get:function(){return n.scriptBold}})},9409:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.script=void 0;var n=r(7153);Object.defineProperty(e,"script",{enumerable:!0,get:function(){return n.script}})},775:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.smallop=void 0;var n=r(8042),o=r(5745);e.smallop=(0,n.AddCSS)(o.smallop,{8260:{c:"/"},9001:{c:"\\27E8"},9002:{c:"\\27E9"},10072:{c:"\\2223"},10764:{c:"\\222C\\222C"},12296:{c:"\\27E8"},12297:{c:"\\27E9"}})},9551:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.texCalligraphicBold=void 0;var n=r(8042),o=r(1411);e.texCalligraphicBold=(0,n.AddCSS)(o.texCalligraphicBold,{305:{f:"B"},567:{f:"B"}})},7907:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.texCalligraphic=void 0;var n=r(6384);Object.defineProperty(e,"texCalligraphic",{enumerable:!0,get:function(){return n.texCalligraphic}})},9659:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.texMathit=void 0;var n=r(6041);Object.defineProperty(e,"texMathit",{enumerable:!0,get:function(){return n.texMathit}})},98:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.texOldstyleBold=void 0;var n=r(8199);Object.defineProperty(e,"texOldstyleBold",{enumerable:!0,get:function(){return n.texOldstyleBold}})},6275:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.texOldstyle=void 0;var n=r(9848);Object.defineProperty(e,"texOldstyle",{enumerable:!0,get:function(){return n.texOldstyle}})},6530:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.texSize3=void 0;var n=r(8042),o=r(7906);e.texSize3=(0,n.AddCSS)(o.texSize3,{8260:{c:"/"},9001:{c:"\\27E8"},9002:{c:"\\27E9"},12296:{c:"\\27E8"},12297:{c:"\\27E9"}})},4409:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.texSize4=void 0;var n=r(8042),o=r(2644);e.texSize4=(0,n.AddCSS)(o.texSize4,{8260:{c:"/"},9001:{c:"\\27E8"},9002:{c:"\\27E9"},12296:{c:"\\27E8"},12297:{c:"\\27E9"},57685:{c:"\\E153\\E152"},57686:{c:"\\E151\\E150"}})},5292:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.texVariant=void 0;var n=r(8042),o=r(4926);e.texVariant=(0,n.AddCSS)(o.texVariant,{1008:{c:"\\E009"},8463:{f:""},8740:{c:"\\E006"},8742:{c:"\\E007"},8808:{c:"\\E00C"},8809:{c:"\\E00D"},8816:{c:"\\E011"},8817:{c:"\\E00E"},8840:{c:"\\E016"},8841:{c:"\\E018"},8842:{c:"\\E01A"},8843:{c:"\\E01B"},10887:{c:"\\E010"},10888:{c:"\\E00F"},10955:{c:"\\E017"},10956:{c:"\\E019"}})},5884:function(t,e,r){var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},n.apply(this,arguments)},o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},a=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.FontData=e.NOSTRETCH=e.H=e.V=void 0;var s=r(7233);e.V=1,e.H=2,e.NOSTRETCH={dir:0};var l=function(){function t(t){var e,r,l,c;void 0===t&&(t=null),this.variant={},this.delimiters={},this.cssFontMap={},this.remapChars={},this.skewIcFactor=.75;var u=this.constructor;this.options=(0,s.userOptions)((0,s.defaultOptions)({},u.OPTIONS),t),this.params=n({},u.defaultParams),this.sizeVariants=i([],o(u.defaultSizeVariants),!1),this.stretchVariants=i([],o(u.defaultStretchVariants),!1),this.cssFontMap=n({},u.defaultCssFonts);try{for(var p=a(Object.keys(this.cssFontMap)),h=p.next();!h.done;h=p.next()){var d=h.value;"unknown"===this.cssFontMap[d][0]&&(this.cssFontMap[d][0]=this.options.unknownFamily)}}catch(t){e={error:t}}finally{try{h&&!h.done&&(r=p.return)&&r.call(p)}finally{if(e)throw e.error}}this.cssFamilyPrefix=u.defaultCssFamilyPrefix,this.createVariants(u.defaultVariants),this.defineDelimiters(u.defaultDelimiters);try{for(var f=a(Object.keys(u.defaultChars)),m=f.next();!m.done;m=f.next()){var y=m.value;this.defineChars(y,u.defaultChars[y])}}catch(t){l={error:t}}finally{try{m&&!m.done&&(c=f.return)&&c.call(f)}finally{if(l)throw l.error}}this.defineRemap("accent",u.defaultAccentMap),this.defineRemap("mo",u.defaultMoMap),this.defineRemap("mn",u.defaultMnMap)}return t.charOptions=function(t,e){var r=t[e];return 3===r.length&&(r[3]={}),r[3]},Object.defineProperty(t.prototype,"styles",{get:function(){return this._styles},set:function(t){this._styles=t},enumerable:!1,configurable:!0}),t.prototype.createVariant=function(t,e,r){void 0===e&&(e=null),void 0===r&&(r=null);var n={linked:[],chars:e?Object.create(this.variant[e].chars):{}};r&&this.variant[r]&&(Object.assign(n.chars,this.variant[r].chars),this.variant[r].linked.push(n.chars),n.chars=Object.create(n.chars)),this.remapSmpChars(n.chars,t),this.variant[t]=n},t.prototype.remapSmpChars=function(t,e){var r,n,i,s,l=this.constructor;if(l.VariantSmp[e]){var c=l.SmpRemap,u=[null,null,l.SmpRemapGreekU,l.SmpRemapGreekL];try{for(var p=a(l.SmpRanges),h=p.next();!h.done;h=p.next()){var d=o(h.value,3),f=d[0],m=d[1],y=d[2],g=l.VariantSmp[e][f];if(g){for(var b=m;b<=y;b++)if(930!==b){var v=g+b-m;t[b]=this.smpChar(c[v]||v)}if(u[f])try{for(var _=(i=void 0,a(Object.keys(u[f]).map((function(t){return parseInt(t)})))),S=_.next();!S.done;S=_.next()){t[b=S.value]=this.smpChar(g+u[f][b])}}catch(t){i={error:t}}finally{try{S&&!S.done&&(s=_.return)&&s.call(_)}finally{if(i)throw i.error}}}}}catch(t){r={error:t}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}}"bold"===e&&(t[988]=this.smpChar(120778),t[989]=this.smpChar(120779))},t.prototype.smpChar=function(t){return[,,,{smp:t}]},t.prototype.createVariants=function(t){var e,r;try{for(var n=a(t),o=n.next();!o.done;o=n.next()){var i=o.value;this.createVariant(i[0],i[1],i[2])}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},t.prototype.defineChars=function(t,e){var r,n,o=this.variant[t];Object.assign(o.chars,e);try{for(var i=a(o.linked),s=i.next();!s.done;s=i.next()){var l=s.value;Object.assign(l,e)}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},t.prototype.defineDelimiters=function(t){Object.assign(this.delimiters,t)},t.prototype.defineRemap=function(t,e){this.remapChars.hasOwnProperty(t)||(this.remapChars[t]={}),Object.assign(this.remapChars[t],e)},t.prototype.getDelimiter=function(t){return this.delimiters[t]},t.prototype.getSizeVariant=function(t,e){return this.delimiters[t].variants&&(e=this.delimiters[t].variants[e]),this.sizeVariants[e]},t.prototype.getStretchVariant=function(t,e){return this.stretchVariants[this.delimiters[t].stretchv?this.delimiters[t].stretchv[e]:0]},t.prototype.getChar=function(t,e){return this.variant[t].chars[e]},t.prototype.getVariant=function(t){return this.variant[t]},t.prototype.getCssFont=function(t){return this.cssFontMap[t]||["serif",!1,!1]},t.prototype.getFamily=function(t){return this.cssFamilyPrefix?this.cssFamilyPrefix+", "+t:t},t.prototype.getRemappedChar=function(t,e){return(this.remapChars[t]||{})[e]},t.OPTIONS={unknownFamily:"serif"},t.JAX="common",t.NAME="",t.defaultVariants=[["normal"],["bold","normal"],["italic","normal"],["bold-italic","italic","bold"],["double-struck","bold"],["fraktur","normal"],["bold-fraktur","bold","fraktur"],["script","italic"],["bold-script","bold-italic","script"],["sans-serif","normal"],["bold-sans-serif","bold","sans-serif"],["sans-serif-italic","italic","sans-serif"],["sans-serif-bold-italic","bold-italic","bold-sans-serif"],["monospace","normal"]],t.defaultCssFonts={normal:["unknown",!1,!1],bold:["unknown",!1,!0],italic:["unknown",!0,!1],"bold-italic":["unknown",!0,!0],"double-struck":["unknown",!1,!0],fraktur:["unknown",!1,!1],"bold-fraktur":["unknown",!1,!0],script:["cursive",!1,!1],"bold-script":["cursive",!1,!0],"sans-serif":["sans-serif",!1,!1],"bold-sans-serif":["sans-serif",!1,!0],"sans-serif-italic":["sans-serif",!0,!1],"sans-serif-bold-italic":["sans-serif",!0,!0],monospace:["monospace",!1,!1]},t.defaultCssFamilyPrefix="",t.VariantSmp={bold:[119808,119834,120488,120514,120782],italic:[119860,119886,120546,120572],"bold-italic":[119912,119938,120604,120630],script:[119964,119990],"bold-script":[120016,120042],fraktur:[120068,120094],"double-struck":[120120,120146,,,120792],"bold-fraktur":[120172,120198],"sans-serif":[120224,120250,,,120802],"bold-sans-serif":[120276,120302,120662,120688,120812],"sans-serif-italic":[120328,120354],"sans-serif-bold-italic":[120380,120406,120720,120746],monospace:[120432,120458,,,120822]},t.SmpRanges=[[0,65,90],[1,97,122],[2,913,937],[3,945,969],[4,48,57]],t.SmpRemap={119893:8462,119965:8492,119968:8496,119969:8497,119971:8459,119972:8464,119975:8466,119976:8499,119981:8475,119994:8495,119996:8458,120004:8500,120070:8493,120075:8460,120076:8465,120085:8476,120093:8488,120122:8450,120127:8461,120133:8469,120135:8473,120136:8474,120137:8477,120145:8484},t.SmpRemapGreekU={8711:25,1012:17},t.SmpRemapGreekL={977:27,981:29,982:31,1008:28,1009:30,1013:26,8706:25},t.defaultAccentMap={768:"\u02cb",769:"\u02ca",770:"\u02c6",771:"\u02dc",772:"\u02c9",774:"\u02d8",775:"\u02d9",776:"\xa8",778:"\u02da",780:"\u02c7",8594:"\u20d7",8242:"'",8243:"''",8244:"'''",8245:"`",8246:"``",8247:"```",8279:"''''",8400:"\u21bc",8401:"\u21c0",8406:"\u2190",8417:"\u2194",8432:"*",8411:"...",8412:"....",8428:"\u21c1",8429:"\u21bd",8430:"\u2190",8431:"\u2192"},t.defaultMoMap={45:"\u2212"},t.defaultMnMap={45:"\u2212"},t.defaultParams={x_height:.442,quad:1,num1:.676,num2:.394,num3:.444,denom1:.686,denom2:.345,sup1:.413,sup2:.363,sup3:.289,sub1:.15,sub2:.247,sup_drop:.386,sub_drop:.05,delim1:2.39,delim2:1,axis_height:.25,rule_thickness:.06,big_op_spacing1:.111,big_op_spacing2:.167,big_op_spacing3:.2,big_op_spacing4:.6,big_op_spacing5:.1,surd_height:.075,scriptspace:.05,nulldelimiterspace:.12,delimiterfactor:901,delimitershortfall:.3,min_rule_thickness:1.25,separation_factor:1.75,extra_ic:.033},t.defaultDelimiters={},t.defaultChars={},t.defaultSizeVariants=[],t.defaultStretchVariants=[],t}();e.FontData=l},5552:function(t,e){var r=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.CommonArrow=e.CommonDiagonalArrow=e.CommonDiagonalStrike=e.CommonBorder2=e.CommonBorder=e.arrowBBox=e.diagonalArrowDef=e.arrowDef=e.arrowBBoxW=e.arrowBBoxHD=e.arrowHead=e.fullBorder=e.fullPadding=e.fullBBox=e.sideNames=e.sideIndex=e.SOLID=e.PADDING=e.THICKNESS=e.ARROWY=e.ARROWDX=e.ARROWX=void 0,e.ARROWX=4,e.ARROWDX=1,e.ARROWY=2,e.THICKNESS=.067,e.PADDING=.2,e.SOLID=e.THICKNESS+"em solid",e.sideIndex={top:0,right:1,bottom:2,left:3},e.sideNames=Object.keys(e.sideIndex),e.fullBBox=function(t){return new Array(4).fill(t.thickness+t.padding)},e.fullPadding=function(t){return new Array(4).fill(t.padding)},e.fullBorder=function(t){return new Array(4).fill(t.thickness)};e.arrowHead=function(t){return Math.max(t.padding,t.thickness*(t.arrowhead.x+t.arrowhead.dx+1))};e.arrowBBoxHD=function(t,e){if(t.childNodes[0]){var r=t.childNodes[0].getBBox(),n=r.h,o=r.d;e[0]=e[2]=Math.max(0,t.thickness*t.arrowhead.y-(n+o)/2)}return e};e.arrowBBoxW=function(t,e){if(t.childNodes[0]){var r=t.childNodes[0].getBBox().w;e[1]=e[3]=Math.max(0,t.thickness*t.arrowhead.y-r/2)}return e},e.arrowDef={up:[-Math.PI/2,!1,!0,"verticalstrike"],down:[Math.PI/2,!1,!0,"verticakstrike"],right:[0,!1,!1,"horizontalstrike"],left:[Math.PI,!1,!1,"horizontalstrike"],updown:[Math.PI/2,!0,!0,"verticalstrike uparrow downarrow"],leftright:[0,!0,!1,"horizontalstrike leftarrow rightarrow"]},e.diagonalArrowDef={updiagonal:[-1,0,!1,"updiagonalstrike northeastarrow"],northeast:[-1,0,!1,"updiagonalstrike updiagonalarrow"],southeast:[1,0,!1,"downdiagonalstrike"],northwest:[1,Math.PI,!1,"downdiagonalstrike"],southwest:[-1,Math.PI,!1,"updiagonalstrike"],northeastsouthwest:[-1,0,!0,"updiagonalstrike northeastarrow updiagonalarrow southwestarrow"],northwestsoutheast:[1,0,!0,"downdiagonalstrike northwestarrow southeastarrow"]},e.arrowBBox={up:function(t){return(0,e.arrowBBoxW)(t,[(0,e.arrowHead)(t),0,t.padding,0])},down:function(t){return(0,e.arrowBBoxW)(t,[t.padding,0,(0,e.arrowHead)(t),0])},right:function(t){return(0,e.arrowBBoxHD)(t,[0,(0,e.arrowHead)(t),0,t.padding])},left:function(t){return(0,e.arrowBBoxHD)(t,[0,t.padding,0,(0,e.arrowHead)(t)])},updown:function(t){return(0,e.arrowBBoxW)(t,[(0,e.arrowHead)(t),0,(0,e.arrowHead)(t),0])},leftright:function(t){return(0,e.arrowBBoxHD)(t,[0,(0,e.arrowHead)(t),0,(0,e.arrowHead)(t)])}};e.CommonBorder=function(t){return function(r){var n=e.sideIndex[r];return[r,{renderer:t,bbox:function(t){var e=[0,0,0,0];return e[n]=t.thickness+t.padding,e},border:function(t){var e=[0,0,0,0];return e[n]=t.thickness,e}}]}};e.CommonBorder2=function(t){return function(r,n,o){var i=e.sideIndex[n],a=e.sideIndex[o];return[r,{renderer:t,bbox:function(t){var e=t.thickness+t.padding,r=[0,0,0,0];return r[i]=r[a]=e,r},border:function(t){var e=[0,0,0,0];return e[i]=e[a]=t.thickness,e},remove:n+" "+o}]}};e.CommonDiagonalStrike=function(t){return function(r){var n="mjx-"+r.charAt(0)+"strike";return[r+"diagonalstrike",{renderer:t(n),bbox:e.fullBBox}]}};e.CommonDiagonalArrow=function(t){return function(n){var o=r(e.diagonalArrowDef[n],4),i=o[0],a=o[1],s=o[2];return[n+"arrow",{renderer:function(e,n){var o=r(e.arrowAW(),2),l=o[0],c=o[1],u=e.arrow(c,i*(l-a),s);t(e,u)},bbox:function(t){var e=t.arrowData(),n=e.a,o=e.x,i=e.y,a=r([t.arrowhead.x,t.arrowhead.y,t.arrowhead.dx],3),s=a[0],l=a[1],c=a[2],u=r(t.getArgMod(s+c,l),2),p=u[0],h=u[1],d=i+(p>n?t.thickness*h*Math.sin(p-n):0),f=o+(p>Math.PI/2-n?t.thickness*h*Math.sin(p+n-Math.PI/2):0);return[d,f,d,f]},remove:o[3]}]}};e.CommonArrow=function(t){return function(n){var o=r(e.arrowDef[n],4),i=o[0],a=o[1],s=o[2],l=o[3];return[n+"arrow",{renderer:function(e,n){var o=e.getBBox(),l=o.w,c=o.h,u=o.d,p=r(s?[c+u,"X"]:[l,"Y"],2),h=p[0],d=p[1],f=e.getOffset(d),m=e.arrow(h,i,a,d,f);t(e,m)},bbox:e.arrowBBox[n],remove:l}]}}},3055:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},s=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.CommonOutputJax=void 0;var l=r(2975),c=r(4474),u=r(7233),p=r(6010),h=r(8054),d=r(4139),f=function(t){function e(e,r,n){void 0===e&&(e=null),void 0===r&&(r=null),void 0===n&&(n=null);var o=this,i=a((0,u.separateOptions)(e,n.OPTIONS),2),s=i[0],l=i[1];return(o=t.call(this,s)||this).factory=o.options.wrapperFactory||new r,o.factory.jax=o,o.cssStyles=o.options.cssStyles||new d.CssStyles,o.font=o.options.font||new n(l),o.unknownCache=new Map,o}return o(e,t),e.prototype.typeset=function(t,e){this.setDocument(e);var r=this.createNode();return this.toDOM(t,r,e),r},e.prototype.createNode=function(){var t=this.constructor.NAME;return this.html("mjx-container",{class:"MathJax",jax:t})},e.prototype.setScale=function(t){var e=this.math.metrics.scale*this.options.scale;1!==e&&this.adaptor.setStyle(t,"fontSize",(0,p.percent)(e))},e.prototype.toDOM=function(t,e,r){void 0===r&&(r=null),this.setDocument(r),this.math=t,this.pxPerEm=t.metrics.ex/this.font.params.x_height,t.root.setTeXclass(null),this.setScale(e),this.nodeMap=new Map,this.container=e,this.processMath(t.root,e),this.nodeMap=null,this.executeFilters(this.postFilters,t,r,e)},e.prototype.getBBox=function(t,e){this.setDocument(e),this.math=t,t.root.setTeXclass(null),this.nodeMap=new Map;var r=this.factory.wrap(t.root).getOuterBBox();return this.nodeMap=null,r},e.prototype.getMetrics=function(t){var e,r;this.setDocument(t);var n=this.adaptor,o=this.getMetricMaps(t);try{for(var i=s(t.math),a=i.next();!a.done;a=i.next()){var l=a.value,u=n.parent(l.start.node);if(l.state()<c.STATE.METRICS&&u){var p=o[l.display?1:0].get(u),h=p.em,d=p.ex,f=p.containerWidth,m=p.lineWidth,y=p.scale,g=p.family;l.setMetrics(h,d,f,m,y),this.options.mtextInheritFont&&(l.outputData.mtextFamily=g),this.options.merrorInheritFont&&(l.outputData.merrorFamily=g),l.state(c.STATE.METRICS)}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},e.prototype.getMetricsFor=function(t,e){var r=this.options.mtextInheritFont||this.options.merrorInheritFont,n=this.getTestElement(t,e),o=this.measureMetrics(n,r);return this.adaptor.remove(n),o},e.prototype.getMetricMaps=function(t){var e,r,n,o,i,a,l,u,p,h,d=this.adaptor,f=[new Map,new Map];try{for(var m=s(t.math),y=m.next();!y.done;y=m.next()){var g=y.value;if((A=d.parent(g.start.node))&&g.state()<c.STATE.METRICS){var b=f[g.display?1:0];b.has(A)||b.set(A,this.getTestElement(A,g.display))}}}catch(t){e={error:t}}finally{try{y&&!y.done&&(r=m.return)&&r.call(m)}finally{if(e)throw e.error}}var v=this.options.mtextInheritFont||this.options.merrorInheritFont,_=[new Map,new Map];try{for(var S=s(_.keys()),x=S.next();!x.done;x=S.next()){var M=x.value;try{for(var O=(i=void 0,s(f[M].keys())),E=O.next();!E.done;E=O.next()){var A=E.value;_[M].set(A,this.measureMetrics(f[M].get(A),v))}}catch(t){i={error:t}}finally{try{E&&!E.done&&(a=O.return)&&a.call(O)}finally{if(i)throw i.error}}}}catch(t){n={error:t}}finally{try{x&&!x.done&&(o=S.return)&&o.call(S)}finally{if(n)throw n.error}}try{for(var C=s(_.keys()),w=C.next();!w.done;w=C.next()){M=w.value;try{for(var T=(p=void 0,s(f[M].values())),N=T.next();!N.done;N=T.next()){A=N.value;d.remove(A)}}catch(t){p={error:t}}finally{try{N&&!N.done&&(h=T.return)&&h.call(T)}finally{if(p)throw p.error}}}}catch(t){l={error:t}}finally{try{w&&!w.done&&(u=C.return)&&u.call(C)}finally{if(l)throw l.error}}return _},e.prototype.getTestElement=function(t,e){var r=this.adaptor;if(!this.testInline){this.testInline=this.html("mjx-test",{style:{display:"inline-block",width:"100%","font-style":"normal","font-weight":"normal","font-size":"100%","font-size-adjust":"none","text-indent":0,"text-transform":"none","letter-spacing":"normal","word-spacing":"normal",overflow:"hidden",height:"1px","margin-right":"-1px"}},[this.html("mjx-left-box",{style:{display:"inline-block",width:0,float:"left"}}),this.html("mjx-ex-box",{style:{position:"absolute",overflow:"hidden",width:"1px",height:"60ex"}}),this.html("mjx-right-box",{style:{display:"inline-block",width:0,float:"right"}})]),this.testDisplay=r.clone(this.testInline),r.setStyle(this.testDisplay,"display","table"),r.setStyle(this.testDisplay,"margin-right",""),r.setStyle(r.firstChild(this.testDisplay),"display","none");var n=r.lastChild(this.testDisplay);r.setStyle(n,"display","table-cell"),r.setStyle(n,"width","10000em"),r.setStyle(n,"float","")}return r.append(t,r.clone(e?this.testDisplay:this.testInline))},e.prototype.measureMetrics=function(t,e){var r=this.adaptor,n=e?r.fontFamily(t):"",o=r.fontSize(t),i=a(r.nodeSize(r.childNode(t,1)),2),s=i[0],l=i[1],c=s?l/60:o*this.options.exFactor;return{em:o,ex:c,containerWidth:s?"table"===r.getStyle(t,"display")?r.nodeSize(r.lastChild(t))[0]-1:r.nodeBBox(r.lastChild(t)).left-r.nodeBBox(r.firstChild(t)).left-2:1e6,lineWidth:1e6,scale:Math.max(this.options.minScale,this.options.matchFontHeight?c/this.font.params.x_height/o:1),family:n}},e.prototype.styleSheet=function(t){var e,r;if(this.setDocument(t),this.cssStyles.clear(),this.cssStyles.addStyles(this.constructor.commonStyles),"getStyles"in t)try{for(var n=s(t.getStyles()),o=n.next();!o.done;o=n.next()){var i=o.value;this.cssStyles.addStyles(i)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return this.addWrapperStyles(this.cssStyles),this.addFontStyles(this.cssStyles),this.html("style",{id:"MJX-styles"},[this.text("\n"+this.cssStyles.cssText+"\n")])},e.prototype.addFontStyles=function(t){t.addStyles(this.font.styles)},e.prototype.addWrapperStyles=function(t){var e,r;try{for(var n=s(this.factory.getKinds()),o=n.next();!o.done;o=n.next()){var i=o.value;this.addClassStyles(this.factory.getNodeClass(i),t)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},e.prototype.addClassStyles=function(t,e){e.addStyles(t.styles)},e.prototype.setDocument=function(t){t&&(this.document=t,this.adaptor.document=t.document)},e.prototype.html=function(t,e,r,n){return void 0===e&&(e={}),void 0===r&&(r=[]),this.adaptor.node(t,e,r,n)},e.prototype.text=function(t){return this.adaptor.text(t)},e.prototype.fixed=function(t,e){return void 0===e&&(e=3),Math.abs(t)<6e-4?"0":t.toFixed(e).replace(/\.?0+$/,"")},e.prototype.measureText=function(t,e,r){void 0===r&&(r=["",!1,!1]);var n=this.unknownText(t,e);if("-explicitFont"===e){var o=this.cssFontStyles(r);this.adaptor.setAttributes(n,{style:o})}return this.measureTextNodeWithCache(n,t,e,r)},e.prototype.measureTextNodeWithCache=function(t,e,r,n){void 0===n&&(n=["",!1,!1]),"-explicitFont"===r&&(r=[n[0],n[1]?"T":"F",n[2]?"T":"F",""].join("-")),this.unknownCache.has(r)||this.unknownCache.set(r,new Map);var o=this.unknownCache.get(r),i=o.get(e);if(i)return i;var a=this.measureTextNode(t);return o.set(e,a),a},e.prototype.measureXMLnode=function(t){var e=this.adaptor,r=this.html("mjx-xml-block",{style:{display:"inline-block"}},[e.clone(t)]),n=this.html("mjx-baseline",{style:{display:"inline-block",width:0,height:0}}),o=this.html("mjx-measure-xml",{style:{position:"absolute",display:"inline-block","font-family":"initial","line-height":"normal"}},[n,r]);e.append(e.parent(this.math.start.node),this.container),e.append(this.container,o);var i=this.math.metrics.em*this.math.metrics.scale,a=e.nodeBBox(r),s=a.left,l=a.right,c=a.bottom,u=a.top,p=(l-s)/i,h=(e.nodeBBox(n).top-u)/i,d=(c-u)/i-h;return e.remove(this.container),e.remove(o),{w:p,h:h,d:d}},e.prototype.cssFontStyles=function(t,e){void 0===e&&(e={});var r=a(t,3),n=r[0],o=r[1],i=r[2];return e["font-family"]=this.font.getFamily(n),o&&(e["font-style"]="italic"),i&&(e["font-weight"]="bold"),e},e.prototype.getFontData=function(t){return t||(t=new h.Styles),[this.font.getFamily(t.get("font-family")),"italic"===t.get("font-style"),"bold"===t.get("font-weight")]},e.NAME="Common",e.OPTIONS=i(i({},l.AbstractOutputJax.OPTIONS),{scale:1,minScale:.5,mtextInheritFont:!1,merrorInheritFont:!1,mtextFont:"",merrorFont:"serif",mathmlSpacing:!1,skipAttributes:{},exFactor:.5,displayAlign:"center",displayIndent:"0",wrapperFactory:null,font:null,cssStyles:null}),e.commonStyles={},e}(l.AbstractOutputJax);e.CommonOutputJax=f},7519:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),a=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&i(e,t,r);return a(e,t),e},l=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},c=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},u=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.CommonWrapper=void 0;var p=r(8912),h=r(9007),d=r(505),f=s(r(6010)),m=r(8054),y=r(6469),g=r(5884),b=2/18;function v(t,e){return t?e<b?0:b:e}var _=function(t){function e(e,r,n){void 0===n&&(n=null);var o=t.call(this,e,r)||this;return o.parent=null,o.removedStyles=null,o.styles=null,o.variant="",o.bboxComputed=!1,o.stretch=g.NOSTRETCH,o.font=null,o.parent=n,o.font=e.jax.font,o.bbox=y.BBox.zero(),o.getStyles(),o.getVariant(),o.getScale(),o.getSpace(),o.childNodes=r.childNodes.map((function(t){var e=o.wrap(t);return e.bbox.pwidth&&(r.notParent||r.isKind("math"))&&(o.bbox.pwidth=y.BBox.fullWidth),e})),o}return o(e,t),Object.defineProperty(e.prototype,"jax",{get:function(){return this.factory.jax},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"adaptor",{get:function(){return this.factory.jax.adaptor},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"metrics",{get:function(){return this.factory.jax.math.metrics},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fixesPWidth",{get:function(){return!this.node.notParent&&!this.node.isToken},enumerable:!1,configurable:!0}),e.prototype.wrap=function(t,e){void 0===e&&(e=null);var r=this.factory.wrap(t,e||this);return e&&e.childNodes.push(r),this.jax.nodeMap.set(t,r),r},e.prototype.getBBox=function(t){if(void 0===t&&(t=!0),this.bboxComputed)return this.bbox;var e=t?this.bbox:y.BBox.zero();return this.computeBBox(e),this.bboxComputed=t,e},e.prototype.getOuterBBox=function(t){var e,r;void 0===t&&(t=!0);var n=this.getBBox(t);if(!this.styles)return n;var o=new y.BBox;Object.assign(o,n);try{for(var i=l(y.BBox.StyleAdjust),a=i.next();!a.done;a=i.next()){var s=c(a.value,2),u=s[0],p=s[1],h=this.styles.get(u);h&&(o[p]+=this.length2em(h,1,o.rscale))}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return o},e.prototype.computeBBox=function(t,e){var r,n;void 0===e&&(e=!1),t.empty();try{for(var o=l(this.childNodes),i=o.next();!i.done;i=o.next()){var a=i.value;t.append(a.getOuterBBox())}}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.clean(),this.fixesPWidth&&this.setChildPWidths(e)&&this.computeBBox(t,!0)},e.prototype.setChildPWidths=function(t,e,r){var n,o;if(void 0===e&&(e=null),void 0===r&&(r=!0),t)return!1;r&&(this.bbox.pwidth="");var i=!1;try{for(var a=l(this.childNodes),s=a.next();!s.done;s=a.next()){var c=s.value,u=c.getOuterBBox();u.pwidth&&c.setChildPWidths(t,null===e?u.w:e,r)&&(i=!0)}}catch(t){n={error:t}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return i},e.prototype.invalidateBBox=function(){this.bboxComputed&&(this.bboxComputed=!1,this.parent&&this.parent.invalidateBBox())},e.prototype.copySkewIC=function(t){var e=this.childNodes[0];(null==e?void 0:e.bbox.sk)&&(t.sk=e.bbox.sk),(null==e?void 0:e.bbox.dx)&&(t.dx=e.bbox.dx);var r=this.childNodes[this.childNodes.length-1];(null==r?void 0:r.bbox.ic)&&(t.ic=r.bbox.ic,t.w+=t.ic)},e.prototype.getStyles=function(){var t=this.node.attributes.getExplicit("style");if(t)for(var r=this.styles=new m.Styles(t),n=0,o=e.removeStyles.length;n<o;n++){var i=e.removeStyles[n];r.get(i)&&(this.removedStyles||(this.removedStyles={}),this.removedStyles[i]=r.get(i),r.set(i,""))}},e.prototype.getVariant=function(){if(this.node.isToken){var t=this.node.attributes,r=t.get("mathvariant");if(!t.getExplicit("mathvariant")){var n=t.getList("fontfamily","fontweight","fontstyle");if(this.removedStyles){var o=this.removedStyles;o.fontFamily&&(n.family=o.fontFamily),o.fontWeight&&(n.weight=o.fontWeight),o.fontStyle&&(n.style=o.fontStyle)}n.fontfamily&&(n.family=n.fontfamily),n.fontweight&&(n.weight=n.fontweight),n.fontstyle&&(n.style=n.fontstyle),n.weight&&n.weight.match(/^\d+$/)&&(n.weight=parseInt(n.weight)>600?"bold":"normal"),n.family?r=this.explicitVariant(n.family,n.weight,n.style):(this.node.getProperty("variantForm")&&(r="-tex-variant"),r=(e.BOLDVARIANTS[n.weight]||{})[r]||r,r=(e.ITALICVARIANTS[n.style]||{})[r]||r)}this.variant=r}},e.prototype.explicitVariant=function(t,e,r){var n=this.styles;return n||(n=this.styles=new m.Styles),n.set("fontFamily",t),e&&n.set("fontWeight",e),r&&n.set("fontStyle",r),"-explicitFont"},e.prototype.getScale=function(){var t=1,e=this.parent,r=e?e.bbox.scale:1,n=this.node.attributes,o=Math.min(n.get("scriptlevel"),2),i=n.get("fontsize"),a=this.node.isToken||this.node.isKind("mstyle")?n.get("mathsize"):n.getInherited("mathsize");if(0!==o){t=Math.pow(n.get("scriptsizemultiplier"),o);var s=this.length2em(n.get("scriptminsize"),.8,1);t<s&&(t=s)}this.removedStyles&&this.removedStyles.fontSize&&!i&&(i=this.removedStyles.fontSize),i&&!n.getExplicit("mathsize")&&(a=i),"1"!==a&&(t*=this.length2em(a,1,1)),this.bbox.scale=t,this.bbox.rscale=t/r},e.prototype.getSpace=function(){var t=this.isTopEmbellished(),e=this.node.hasSpacingAttributes();this.jax.options.mathmlSpacing||e?t&&this.getMathMLSpacing():this.getTeXSpacing(t,e)},e.prototype.getMathMLSpacing=function(){var t=this.node.coreMO(),e=t.coreParent(),r=e.parent;if(r&&r.isKind("mrow")&&1!==r.childNodes.length){var n=t.attributes,o=n.get("scriptlevel")>0;this.bbox.L=n.isSet("lspace")?Math.max(0,this.length2em(n.get("lspace"))):v(o,t.lspace),this.bbox.R=n.isSet("rspace")?Math.max(0,this.length2em(n.get("rspace"))):v(o,t.rspace);var i=r.childIndex(e);if(0!==i){var a=r.childNodes[i-1];if(a.isEmbellished){var s=this.jax.nodeMap.get(a).getBBox();s.R&&(this.bbox.L=Math.max(0,this.bbox.L-s.R))}}}},e.prototype.getTeXSpacing=function(t,e){if(!e){var r=this.node.texSpacing();r&&(this.bbox.L=this.length2em(r))}if(t||e){var n=this.node.coreMO().attributes;n.isSet("lspace")&&(this.bbox.L=Math.max(0,this.length2em(n.get("lspace")))),n.isSet("rspace")&&(this.bbox.R=Math.max(0,this.length2em(n.get("rspace"))))}},e.prototype.isTopEmbellished=function(){return this.node.isEmbellished&&!(this.node.parent&&this.node.parent.isEmbellished)},e.prototype.core=function(){return this.jax.nodeMap.get(this.node.core())},e.prototype.coreMO=function(){return this.jax.nodeMap.get(this.node.coreMO())},e.prototype.getText=function(){var t,e,r="";if(this.node.isToken)try{for(var n=l(this.node.childNodes),o=n.next();!o.done;o=n.next()){var i=o.value;i instanceof h.TextNode&&(r+=i.getText())}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}return r},e.prototype.canStretch=function(t){if(this.stretch=g.NOSTRETCH,this.node.isEmbellished){var e=this.core();e&&e.node!==this.node&&e.canStretch(t)&&(this.stretch=e.stretch)}return 0!==this.stretch.dir},e.prototype.getAlignShift=function(){var t,e=(t=this.node.attributes).getList.apply(t,u([],c(h.indentAttributes),!1)),r=e.indentalign,n=e.indentshift,o=e.indentalignfirst,i=e.indentshiftfirst;return"indentalign"!==o&&(r=o),"auto"===r&&(r=this.jax.options.displayAlign),"indentshift"!==i&&(n=i),"auto"===n&&(n=this.jax.options.displayIndent,"right"!==r||n.match(/^\s*0[a-z]*\s*$/)||(n=("-"+n.trim()).replace(/^--/,""))),[r,this.length2em(n,this.metrics.containerWidth)]},e.prototype.getAlignX=function(t,e,r){return"right"===r?t-(e.w+e.R)*e.rscale:"left"===r?e.L*e.rscale:(t-e.w*e.rscale)/2},e.prototype.getAlignY=function(t,e,r,n,o){return"top"===o?t-r:"bottom"===o?n-e:"center"===o?(t-r-(e-n))/2:0},e.prototype.getWrapWidth=function(t){return this.childNodes[t].getBBox().w},e.prototype.getChildAlign=function(t){return"left"},e.prototype.percent=function(t){return f.percent(t)},e.prototype.em=function(t){return f.em(t)},e.prototype.px=function(t,e){return void 0===e&&(e=-f.BIGDIMEN),f.px(t,e,this.metrics.em)},e.prototype.length2em=function(t,e,r){return void 0===e&&(e=1),void 0===r&&(r=null),null===r&&(r=this.bbox.scale),f.length2em(t,e,r,this.jax.pxPerEm)},e.prototype.unicodeChars=function(t,e){void 0===e&&(e=this.variant);var r=(0,d.unicodeChars)(t),n=this.font.getVariant(e);if(n&&n.chars){var o=n.chars;r=r.map((function(t){return((o[t]||[])[3]||{}).smp||t}))}return r},e.prototype.remapChars=function(t){return t},e.prototype.mmlText=function(t){return this.node.factory.create("text").setText(t)},e.prototype.mmlNode=function(t,e,r){return void 0===e&&(e={}),void 0===r&&(r=[]),this.node.factory.create(t,e,r)},e.prototype.createMo=function(t){var e=this.node.factory,r=e.create("text").setText(t),n=e.create("mo",{stretchy:!0},[r]);n.inheritAttributesFrom(this.node);var o=this.wrap(n);return o.parent=this,o},e.prototype.getVariantChar=function(t,e){var r=this.font.getChar(t,e)||[0,0,0,{unknown:!0}];return 3===r.length&&(r[3]={}),r},e.kind="unknown",e.styles={},e.removeStyles=["fontSize","fontFamily","fontWeight","fontStyle","fontVariant","font"],e.skipAttributes={fontfamily:!0,fontsize:!0,fontweight:!0,fontstyle:!0,color:!0,background:!0,class:!0,href:!0,style:!0,xmlns:!0},e.BOLDVARIANTS={bold:{normal:"bold",italic:"bold-italic",fraktur:"bold-fraktur",script:"bold-script","sans-serif":"bold-sans-serif","sans-serif-italic":"sans-serif-bold-italic"},normal:{bold:"normal","bold-italic":"italic","bold-fraktur":"fraktur","bold-script":"script","bold-sans-serif":"sans-serif","sans-serif-bold-italic":"sans-serif-italic"}},e.ITALICVARIANTS={italic:{normal:"italic",bold:"bold-italic","sans-serif":"sans-serif-italic","bold-sans-serif":"sans-serif-bold-italic"},normal:{italic:"normal","bold-italic":"bold","sans-serif-italic":"sans-serif","sans-serif-bold-italic":"bold-sans-serif"}},e}(p.AbstractWrapper);e.CommonWrapper=_},4420:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.CommonWrapperFactory=void 0;var i=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.jax=null,e}return o(e,t),Object.defineProperty(e.prototype,"Wrappers",{get:function(){return this.node},enumerable:!1,configurable:!0}),e.defaultNodes={},e}(r(3811).AbstractWrapperFactory);e.CommonWrapperFactory=i},9800:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.CommonTeXAtomMixin=void 0;var i=r(9007);e.CommonTeXAtomMixin=function(t){return function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.computeBBox=function(e,r){if(void 0===r&&(r=!1),t.prototype.computeBBox.call(this,e,r),this.childNodes[0]&&this.childNodes[0].bbox.ic&&(e.ic=this.childNodes[0].bbox.ic),this.node.texClass===i.TEXCLASS.VCENTER){var n=e.h,o=(n+e.d)/2+this.font.params.axis_height-n;e.h+=o,e.d-=o}},e}(t)}},1160:function(t,e){var r,n=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.CommonTextNodeMixin=void 0,e.CommonTextNodeMixin=function(t){return function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.computeBBox=function(t,e){var r,n;void 0===e&&(e=!1);var a=this.parent.variant,s=this.node.getText();if("-explicitFont"===a){var l=this.jax.getFontData(this.parent.styles),c=this.jax.measureText(s,a,l),u=c.w,p=c.h,h=c.d;t.h=p,t.d=h,t.w=u}else{var d=this.remappedText(s,a);t.empty();try{for(var f=o(d),m=f.next();!m.done;m=f.next()){var y=m.value,g=i(this.getVariantChar(a,y),4),b=(p=g[0],h=g[1],u=g[2],g[3]);if(b.unknown){var v=this.jax.measureText(String.fromCodePoint(y),a);u=v.w,p=v.h,h=v.d}t.w+=u,p>t.h&&(t.h=p),h>t.d&&(t.d=h),t.ic=b.ic||0,t.sk=b.sk||0,t.dx=b.dx||0}}catch(t){r={error:t}}finally{try{m&&!m.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}d.length>1&&(t.sk=0),t.clean()}},e.prototype.remappedText=function(t,e){var r=this.parent.stretch.c;return r?[r]:this.parent.remapChars(this.unicodeChars(t,e))},e.prototype.getStyles=function(){},e.prototype.getVariant=function(){},e.prototype.getScale=function(){},e.prototype.getSpace=function(){},e}(t)}},1956:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMactionMixin=e.TooltipData=void 0;var s=r(505);e.TooltipData={dx:".2em",dy:".1em",postDelay:600,clearDelay:100,hoverTimer:new Map,clearTimer:new Map,stopTimers:function(t,e){e.clearTimer.has(t)&&(clearTimeout(e.clearTimer.get(t)),e.clearTimer.delete(t)),e.hoverTimer.has(t)&&(clearTimeout(e.hoverTimer.get(t)),e.hoverTimer.delete(t))}},e.CommonMactionMixin=function(t){return function(t){function r(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=t.apply(this,a([],i(e),!1))||this,o=n.constructor.actions,s=n.node.attributes.get("actiontype"),l=i(o.get(s)||[function(t,e){},{}],2),c=l[0],u=l[1];return n.action=c,n.data=u,n.getParameters(),n}return o(r,t),Object.defineProperty(r.prototype,"selected",{get:function(){var t=this.node.attributes.get("selection"),e=Math.max(1,Math.min(this.childNodes.length,t))-1;return this.childNodes[e]||this.wrap(this.node.selected)},enumerable:!1,configurable:!0}),r.prototype.getParameters=function(){var t=this.node.attributes.get("data-offsets"),r=i((0,s.split)(t||""),2),n=r[0],o=r[1];this.dx=this.length2em(n||e.TooltipData.dx),this.dy=this.length2em(o||e.TooltipData.dy)},r.prototype.computeBBox=function(t,e){void 0===e&&(e=!1),t.updateFrom(this.selected.getOuterBBox()),this.selected.setChildPWidths(e)},r}(t)}},7490:function(t,e){var r,n=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMathMixin=void 0,e.CommonMathMixin=function(t){return function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.getWrapWidth=function(t){return this.parent?this.getBBox().w:this.metrics.containerWidth/this.jax.pxPerEm},e}(t)}},7313:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),a=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&i(e,t,r);return a(e,t),e},l=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},c=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},u=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMencloseMixin=void 0;var p=s(r(5552)),h=r(505);e.CommonMencloseMixin=function(t){return function(t){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=t.apply(this,c([],l(e),!1))||this;return n.notations={},n.renderChild=null,n.msqrt=null,n.padding=p.PADDING,n.thickness=p.THICKNESS,n.arrowhead={x:p.ARROWX,y:p.ARROWY,dx:p.ARROWDX},n.TRBL=[0,0,0,0],n.getParameters(),n.getNotations(),n.removeRedundantNotations(),n.initializeNotations(),n.TRBL=n.getBBoxExtenders(),n}return o(e,t),e.prototype.getParameters=function(){var t=this.node.attributes,e=t.get("data-padding");void 0!==e&&(this.padding=this.length2em(e,p.PADDING));var r=t.get("data-thickness");void 0!==r&&(this.thickness=this.length2em(r,p.THICKNESS));var n=t.get("data-arrowhead");if(void 0!==n){var o=l((0,h.split)(n),3),i=o[0],a=o[1],s=o[2];this.arrowhead={x:i?parseFloat(i):p.ARROWX,y:a?parseFloat(a):p.ARROWY,dx:s?parseFloat(s):p.ARROWDX}}},e.prototype.getNotations=function(){var t,e,r=this.constructor.notations;try{for(var n=u((0,h.split)(this.node.attributes.get("notation"))),o=n.next();!o.done;o=n.next()){var i=o.value,a=r.get(i);a&&(this.notations[i]=a,a.renderChild&&(this.renderChild=a.renderer))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}},e.prototype.removeRedundantNotations=function(){var t,e,r,n;try{for(var o=u(Object.keys(this.notations)),i=o.next();!i.done;i=o.next()){var a=i.value;if(this.notations[a]){var s=this.notations[a].remove||"";try{for(var l=(r=void 0,u(s.split(/ /))),c=l.next();!c.done;c=l.next()){var p=c.value;delete this.notations[p]}}catch(t){r={error:t}}finally{try{c&&!c.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}},e.prototype.initializeNotations=function(){var t,e;try{for(var r=u(Object.keys(this.notations)),n=r.next();!n.done;n=r.next()){var o=n.value,i=this.notations[o].init;i&&i(this)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},e.prototype.computeBBox=function(t,e){void 0===e&&(e=!1);var r=l(this.TRBL,4),n=r[0],o=r[1],i=r[2],a=r[3],s=this.childNodes[0].getBBox();t.combine(s,a,0),t.h+=n,t.d+=i,t.w+=o,this.setChildPWidths(e)},e.prototype.getBBoxExtenders=function(){var t,e,r=[0,0,0,0];try{for(var n=u(Object.keys(this.notations)),o=n.next();!o.done;o=n.next()){var i=o.value;this.maximizeEntries(r,this.notations[i].bbox(this))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}return r},e.prototype.getPadding=function(){var t,e,r=this,n=[0,0,0,0];try{for(var o=u(Object.keys(this.notations)),i=o.next();!i.done;i=o.next()){var a=i.value,s=this.notations[a].border;s&&this.maximizeEntries(n,s(this))}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return[0,1,2,3].map((function(t){return r.TRBL[t]-n[t]}))},e.prototype.maximizeEntries=function(t,e){for(var r=0;r<t.length;r++)t[r]<e[r]&&(t[r]=e[r])},e.prototype.getOffset=function(t){var e=l(this.TRBL,4),r=e[0],n=e[1],o=e[2],i=e[3],a=("X"===t?n-i:o-r)/2;return Math.abs(a)>.001?a:0},e.prototype.getArgMod=function(t,e){return[Math.atan2(e,t),Math.sqrt(t*t+e*e)]},e.prototype.arrow=function(t,e,r,n,o){return void 0===n&&(n=""),void 0===o&&(o=0),null},e.prototype.arrowData=function(){var t=l([this.padding,this.thickness],2),e=t[0],r=t[1]*(this.arrowhead.x+Math.max(1,this.arrowhead.dx)),n=this.childNodes[0].getBBox(),o=n.h,i=n.d,a=n.w,s=o+i,c=Math.sqrt(s*s+a*a),u=Math.max(e,r*a/c),p=Math.max(e,r*s/c),h=l(this.getArgMod(a+2*u,s+2*p),2);return{a:h[0],W:h[1],x:u,y:p}},e.prototype.arrowAW=function(){var t=this.childNodes[0].getBBox(),e=t.h,r=t.d,n=t.w,o=l(this.TRBL,4),i=o[0],a=o[1],s=o[2],c=o[3];return this.getArgMod(c+n+a,i+e+r+s)},e.prototype.createMsqrt=function(t){var e=this.node.factory.create("msqrt");e.inheritAttributesFrom(this.node),e.childNodes[0]=t.node;var r=this.wrap(e);return r.parent=this,r},e.prototype.sqrtTRBL=function(){var t=this.msqrt.getBBox(),e=this.msqrt.childNodes[0].getBBox();return[t.h-e.h,0,t.d-e.d,t.w-e.w]},e}(t)}},7555:function(t,e){var r,n=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},a=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMfencedMixin=void 0,e.CommonMfencedMixin=function(t){return function(t){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=t.apply(this,i([],o(e),!1))||this;return n.mrow=null,n.createMrow(),n.addMrowChildren(),n}return n(e,t),e.prototype.createMrow=function(){var t=this.node.factory.create("inferredMrow");t.inheritAttributesFrom(this.node),this.mrow=this.wrap(t),this.mrow.parent=this},e.prototype.addMrowChildren=function(){var t,e,r=this.node,n=this.mrow;this.addMo(r.open),this.childNodes.length&&n.childNodes.push(this.childNodes[0]);var o=0;try{for(var i=a(this.childNodes.slice(1)),s=i.next();!s.done;s=i.next()){var l=s.value;this.addMo(r.separators[o++]),n.childNodes.push(l)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}this.addMo(r.close),n.stretchChildren()},e.prototype.addMo=function(t){if(t){var e=this.wrap(t);this.mrow.childNodes.push(e),e.parent=this.mrow}},e.prototype.computeBBox=function(t,e){void 0===e&&(e=!1),t.updateFrom(this.mrow.getOuterBBox()),this.setChildPWidths(e)},e}(t)}},2688:function(t,e){var r,n=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMfracMixin=void 0,e.CommonMfracMixin=function(t){return function(t){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=t.apply(this,i([],o(e),!1))||this;if(n.bevel=null,n.pad=n.node.getProperty("withDelims")?0:n.font.params.nulldelimiterspace,n.node.attributes.get("bevelled")){var a=n.getBevelData(n.isDisplay()).H,s=n.bevel=n.createMo("/");s.node.attributes.set("symmetric",!0),s.canStretch(1),s.getStretchedVariant([a],!0)}return n}return n(e,t),e.prototype.computeBBox=function(t,e){void 0===e&&(e=!1),t.empty();var r=this.node.attributes.getList("linethickness","bevelled"),n=r.linethickness,o=r.bevelled,i=this.isDisplay(),a=null;if(o)this.getBevelledBBox(t,i);else{var s=this.length2em(String(n),.06);a=-2*this.pad,0===s?this.getAtopBBox(t,i):(this.getFractionBBox(t,i,s),a-=.2),a+=t.w}t.clean(),this.setChildPWidths(e,a)},e.prototype.getFractionBBox=function(t,e,r){var n=this.childNodes[0].getOuterBBox(),o=this.childNodes[1].getOuterBBox(),i=this.font.params.axis_height,a=this.getTUV(e,r),s=a.T,l=a.u,c=a.v;t.combine(n,0,i+s+Math.max(n.d*n.rscale,l)),t.combine(o,0,i-s-Math.max(o.h*o.rscale,c)),t.w+=2*this.pad+.2},e.prototype.getTUV=function(t,e){var r=this.font.params,n=r.axis_height,o=(t?3.5:1.5)*e;return{T:(t?3.5:1.5)*e,u:(t?r.num1:r.num2)-n-o,v:(t?r.denom1:r.denom2)+n-o}},e.prototype.getAtopBBox=function(t,e){var r=this.getUVQ(e),n=r.u,o=r.v,i=r.nbox,a=r.dbox;t.combine(i,0,n),t.combine(a,0,-o),t.w+=2*this.pad},e.prototype.getUVQ=function(t){var e=this.childNodes[0].getOuterBBox(),r=this.childNodes[1].getOuterBBox(),n=this.font.params,i=o(t?[n.num1,n.denom1]:[n.num3,n.denom2],2),a=i[0],s=i[1],l=(t?7:3)*n.rule_thickness,c=a-e.d*e.scale-(r.h*r.scale-s);return c<l&&(a+=(l-c)/2,s+=(l-c)/2,c=l),{u:a,v:s,q:c,nbox:e,dbox:r}},e.prototype.getBevelledBBox=function(t,e){var r=this.getBevelData(e),n=r.u,o=r.v,i=r.delta,a=r.nbox,s=r.dbox,l=this.bevel.getOuterBBox();t.combine(a,0,n),t.combine(l,t.w-i/2,0),t.combine(s,t.w-i/2,o)},e.prototype.getBevelData=function(t){var e=this.childNodes[0].getOuterBBox(),r=this.childNodes[1].getOuterBBox(),n=t?.4:.15,o=Math.max(e.scale*(e.h+e.d),r.scale*(r.h+r.d))+2*n,i=this.font.params.axis_height;return{H:o,delta:n,u:e.scale*(e.d-e.h)/2+i+n,v:r.scale*(r.d-r.h)/2+i-n,nbox:e,dbox:r}},e.prototype.canStretch=function(t){return!1},e.prototype.isDisplay=function(){var t=this.node.attributes.getList("displaystyle","scriptlevel"),e=t.displaystyle,r=t.scriptlevel;return e&&0===r},e.prototype.getWrapWidth=function(t){var e=this.node.attributes;return e.get("bevelled")?this.childNodes[t].getOuterBBox().w:this.getBBox().w-(this.length2em(e.get("linethickness"))?.2:0)-2*this.pad},e.prototype.getChildAlign=function(t){var e=this.node.attributes;return e.get("bevelled")?"left":e.get(["numalign","denomalign"][t])},e}(t)}},5636:function(t,e){var r,n=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMglyphMixin=void 0,e.CommonMglyphMixin=function(t){return function(t){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=t.apply(this,i([],o(e),!1))||this;return n.getParameters(),n}return n(e,t),e.prototype.getParameters=function(){var t=this.node.attributes.getList("width","height","valign","src","index"),e=t.width,r=t.height,n=t.valign,o=t.src,i=t.index;if(o)this.width="auto"===e?1:this.length2em(e),this.height="auto"===r?1:this.length2em(r),this.valign=this.length2em(n||"0");else{var a=String.fromCodePoint(parseInt(i)),s=this.node.factory;this.charWrapper=this.wrap(s.create("text").setText(a)),this.charWrapper.parent=this}},e.prototype.computeBBox=function(t,e){void 0===e&&(e=!1),this.charWrapper?t.updateFrom(this.charWrapper.getBBox()):(t.w=this.width,t.h=this.height+this.valign,t.d=-this.valign)},e}(t)}},5723:function(t,e){var r,n=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMiMixin=void 0,e.CommonMiMixin=function(t){return function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.computeBBox=function(e,r){void 0===r&&(r=!1),t.prototype.computeBBox.call(this,e),this.copySkewIC(e)},e}(t)}},8009:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},s=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMmultiscriptsMixin=e.ScriptNames=e.NextScript=void 0;var l=r(6469);e.NextScript={base:"subList",subList:"supList",supList:"subList",psubList:"psupList",psupList:"psubList"},e.ScriptNames=["sup","sup","psup","psub"],e.CommonMmultiscriptsMixin=function(t){return function(t){function r(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=t.apply(this,a([],i(e),!1))||this;return n.scriptData=null,n.firstPrescript=0,n.getScriptData(),n}return o(r,t),r.prototype.combinePrePost=function(t,e){var r=new l.BBox(t);return r.combine(e,0,0),r},r.prototype.computeBBox=function(t,e){void 0===e&&(e=!1);var r=this.font.params.scriptspace,n=this.scriptData,o=this.combinePrePost(n.sub,n.psub),a=this.combinePrePost(n.sup,n.psup),s=i(this.getUVQ(o,a),2),l=s[0],c=s[1];if(t.empty(),n.numPrescripts&&(t.combine(n.psup,r,l),t.combine(n.psub,r,c)),t.append(n.base),n.numScripts){var u=t.w;t.combine(n.sup,u,l),t.combine(n.sub,u,c),t.w+=r}t.clean(),this.setChildPWidths(e)},r.prototype.getScriptData=function(){var t=this.scriptData={base:null,sub:l.BBox.empty(),sup:l.BBox.empty(),psub:l.BBox.empty(),psup:l.BBox.empty(),numPrescripts:0,numScripts:0},e=this.getScriptBBoxLists();this.combineBBoxLists(t.sub,t.sup,e.subList,e.supList),this.combineBBoxLists(t.psub,t.psup,e.psubList,e.psupList),t.base=e.base[0],t.numPrescripts=e.psubList.length,t.numScripts=e.subList.length},r.prototype.getScriptBBoxLists=function(){var t,r,n={base:[],subList:[],supList:[],psubList:[],psupList:[]},o="base";try{for(var i=s(this.childNodes),a=i.next();!a.done;a=i.next()){var l=a.value;l.node.isKind("mprescripts")?o="psubList":(n[o].push(l.getOuterBBox()),o=e.NextScript[o])}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return this.firstPrescript=n.subList.length+n.supList.length+2,this.padLists(n.subList,n.supList),this.padLists(n.psubList,n.psupList),n},r.prototype.padLists=function(t,e){t.length>e.length&&e.push(l.BBox.empty())},r.prototype.combineBBoxLists=function(t,e,r,n){for(var o=0;o<r.length;o++){var a=i(this.getScaledWHD(r[o]),3),s=a[0],l=a[1],c=a[2],u=i(this.getScaledWHD(n[o]),3),p=u[0],h=u[1],d=u[2],f=Math.max(s,p);t.w+=f,e.w+=f,l>t.h&&(t.h=l),c>t.d&&(t.d=c),h>e.h&&(e.h=h),d>e.d&&(e.d=d)}},r.prototype.getScaledWHD=function(t){var e=t.w,r=t.h,n=t.d,o=t.rscale;return[e*o,r*o,n*o]},r.prototype.getUVQ=function(e,r){var n;if(!this.UVQ){var o=i([0,0,0],3),a=o[0],s=o[1],l=o[2];0===e.h&&0===e.d?a=this.getU():0===r.h&&0===r.d?a=-this.getV():(a=(n=i(t.prototype.getUVQ.call(this,e,r),3))[0],s=n[1],l=n[2]),this.UVQ=[a,s,l]}return this.UVQ},r}(t)}},5023:function(t,e){var r,n=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMnMixin=void 0,e.CommonMnMixin=function(t){return function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.remapChars=function(t){if(t.length){var e=this.font.getRemappedChar("mn",t[0]);if(e){var r=this.unicodeChars(e,this.variant);1===r.length?t[0]=r[0]:t=r.concat(t.slice(1))}}return t},e}(t)}},7096:function(t,e,r){var n,o,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),a=this&&this.__assign||function(){return a=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},a.apply(this,arguments)},s=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},l=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},c=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMoMixin=e.DirectionVH=void 0;var u=r(6469),p=r(505),h=r(5884);e.DirectionVH=((o={})[1]="v",o[2]="h",o),e.CommonMoMixin=function(t){return function(t){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=t.apply(this,l([],s(e),!1))||this;return n.size=null,n.isAccent=n.node.isAccent,n}return i(e,t),e.prototype.computeBBox=function(t,e){if(void 0===e&&(e=!1),this.protoBBox(t),this.node.attributes.get("symmetric")&&2!==this.stretch.dir){var r=this.getCenterOffset(t);t.h+=r,t.d-=r}this.node.getProperty("mathaccent")&&(0===this.stretch.dir||this.size>=0)&&(t.w=0)},e.prototype.protoBBox=function(e){var r=0!==this.stretch.dir;r&&null===this.size&&this.getStretchedVariant([0]),r&&this.size<0||(t.prototype.computeBBox.call(this,e),this.copySkewIC(e))},e.prototype.getAccentOffset=function(){var t=u.BBox.empty();return this.protoBBox(t),-t.w/2},e.prototype.getCenterOffset=function(e){return void 0===e&&(e=null),e||(e=u.BBox.empty(),t.prototype.computeBBox.call(this,e)),(e.h+e.d)/2+this.font.params.axis_height-e.h},e.prototype.getVariant=function(){this.node.attributes.get("largeop")?this.variant=this.node.attributes.get("displaystyle")?"-largeop":"-smallop":this.node.attributes.getExplicit("mathvariant")||!1!==this.node.getProperty("pseudoscript")?t.prototype.getVariant.call(this):this.variant="-tex-variant"},e.prototype.canStretch=function(t){if(0!==this.stretch.dir)return this.stretch.dir===t;if(!this.node.attributes.get("stretchy"))return!1;var e=this.getText();if(1!==Array.from(e).length)return!1;var r=this.font.getDelimiter(e.codePointAt(0));return this.stretch=r&&r.dir===t?r:h.NOSTRETCH,0!==this.stretch.dir},e.prototype.getStretchedVariant=function(t,e){var r,n;if(void 0===e&&(e=!1),0!==this.stretch.dir){var o=this.getWH(t),i=this.getSize("minsize",0),s=this.getSize("maxsize",1/0),l=this.node.getProperty("mathaccent");o=Math.max(i,Math.min(s,o));var u=this.font.params.delimiterfactor/1e3,p=this.font.params.delimitershortfall,h=i||e?o:l?Math.min(o/u,o+p):Math.max(o*u,o-p),d=this.stretch,f=d.c||this.getText().codePointAt(0),m=0;if(d.sizes)try{for(var y=c(d.sizes),g=y.next();!g.done;g=y.next()){if(g.value>=h)return l&&m&&m--,this.variant=this.font.getSizeVariant(f,m),this.size=m,void(d.schar&&d.schar[m]&&(this.stretch=a(a({},this.stretch),{c:d.schar[m]})));m++}}catch(t){r={error:t}}finally{try{g&&!g.done&&(n=y.return)&&n.call(y)}finally{if(r)throw r.error}}d.stretch?(this.size=-1,this.invalidateBBox(),this.getStretchBBox(t,this.checkExtendedHeight(o,d),d)):(this.variant=this.font.getSizeVariant(f,m-1),this.size=m-1)}},e.prototype.getSize=function(t,e){var r=this.node.attributes;return r.isSet(t)&&(e=this.length2em(r.get(t),1,1)),e},e.prototype.getWH=function(t){if(0===t.length)return 0;if(1===t.length)return t[0];var e=s(t,2),r=e[0],n=e[1],o=this.font.params.axis_height;return this.node.attributes.get("symmetric")?2*Math.max(r-o,n+o):r+n},e.prototype.getStretchBBox=function(t,e,r){var n;r.hasOwnProperty("min")&&r.min>e&&(e=r.min);var o=s(r.HDW,3),i=o[0],a=o[1],l=o[2];1===this.stretch.dir?(i=(n=s(this.getBaseline(t,e,r),2))[0],a=n[1]):l=e,this.bbox.h=i,this.bbox.d=a,this.bbox.w=l},e.prototype.getBaseline=function(t,e,r){var n=2===t.length&&t[0]+t[1]===e,o=this.node.attributes.get("symmetric"),i=s(n?t:[e,0],2),a=i[0],l=i[1],c=s([a+l,0],2),u=c[0],p=c[1];if(o){var h=this.font.params.axis_height;n&&(u=2*Math.max(a-h,l+h)),p=u/2-h}else if(n)p=l;else{var d=s(r.HDW||[.75,.25],2),f=d[0],m=d[1];p=m*(u/(f+m))}return[u-p,p]},e.prototype.checkExtendedHeight=function(t,e){if(e.fullExt){var r=s(e.fullExt,2),n=r[0],o=r[1];t=o+Math.ceil(Math.max(0,t-o)/n)*n}return t},e.prototype.remapChars=function(t){var e=this.node.getProperty("primes");if(e)return(0,p.unicodeChars)(e);if(1===t.length){var r=this.node.coreParent().parent,n=this.isAccent&&!r.isKind("mrow")?"accent":"mo",o=this.font.getRemappedChar(n,t[0]);o&&(t=this.unicodeChars(o,this.variant))}return t},e}(t)}},6898:function(t,e){var r,n=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMpaddedMixin=void 0,e.CommonMpaddedMixin=function(t){return function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.getDimens=function(){var t=this.node.attributes.getList("width","height","depth","lspace","voffset"),e=this.childNodes[0].getBBox(),r=e.w,n=e.h,o=e.d,i=r,a=n,s=o,l=0,c=0,u=0;""!==t.width&&(r=this.dimen(t.width,e,"w",0)),""!==t.height&&(n=this.dimen(t.height,e,"h",0)),""!==t.depth&&(o=this.dimen(t.depth,e,"d",0)),""!==t.voffset&&(c=this.dimen(t.voffset,e)),""!==t.lspace&&(l=this.dimen(t.lspace,e));var p=this.node.attributes.get("data-align");return p&&(u=this.getAlignX(r,e,p)),[a,s,i,n-a,o-s,r-i,l,c,u]},e.prototype.dimen=function(t,e,r,n){void 0===r&&(r=""),void 0===n&&(n=null);var o=(t=String(t)).match(/width|height|depth/),i=o?e[o[0].charAt(0)]:r?e[r]:0,a=this.length2em(t,i)||0;return t.match(/^[-+]/)&&r&&(a+=i),null!=n&&(a=Math.max(n,a)),a},e.prototype.computeBBox=function(t,e){void 0===e&&(e=!1);var r=o(this.getDimens(),6),n=r[0],i=r[1],a=r[2],s=r[3],l=r[4],c=r[5];t.w=a+c,t.h=n+s,t.d=i+l,this.setChildPWidths(e,t.w)},e.prototype.getWrapWidth=function(t){return this.getBBox().w},e.prototype.getChildAlign=function(t){return this.node.attributes.get("data-align")||"left"},e}(t)}},6991:function(t,e){var r,n=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMrootMixin=void 0,e.CommonMrootMixin=function(t){return function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),Object.defineProperty(e.prototype,"surd",{get:function(){return 2},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"root",{get:function(){return 1},enumerable:!1,configurable:!0}),e.prototype.combineRootBBox=function(t,e,r){var n=this.childNodes[this.root].getOuterBBox(),o=this.getRootDimens(e,r)[1];t.combine(n,0,o)},e.prototype.getRootDimens=function(t,e){var r=this.childNodes[this.surd],n=this.childNodes[this.root].getOuterBBox(),o=(r.size<0?.5:.6)*t.w,i=n.w,a=n.rscale,s=Math.max(i,o/a),l=Math.max(0,s-i);return[s*a-o,this.rootHeight(n,t,r.size,e),l]},e.prototype.rootHeight=function(t,e,r,n){var o=e.h+e.d;return(r<0?1.9:.55*o)-(o-n)+Math.max(0,t.d*t.rscale)},e}(t)}},8411:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},s=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.CommonInferredMrowMixin=e.CommonMrowMixin=void 0;var l=r(6469);e.CommonMrowMixin=function(t){return function(t){function e(){for(var e,r,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var c=t.apply(this,a([],i(n),!1))||this;c.stretchChildren();try{for(var u=s(c.childNodes),p=u.next();!p.done;p=u.next()){var h=p.value;if(h.bbox.pwidth){c.bbox.pwidth=l.BBox.fullWidth;break}}}catch(t){e={error:t}}finally{try{p&&!p.done&&(r=u.return)&&r.call(u)}finally{if(e)throw e.error}}return c}return o(e,t),Object.defineProperty(e.prototype,"fixesPWidth",{get:function(){return!1},enumerable:!1,configurable:!0}),e.prototype.stretchChildren=function(){var t,e,r,n,o,i,a=[];try{for(var l=s(this.childNodes),c=l.next();!c.done;c=l.next()){(O=c.value).canStretch(1)&&a.push(O)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(e=l.return)&&e.call(l)}finally{if(t)throw t.error}}var u=a.length,p=this.childNodes.length;if(u&&p>1){var h=0,d=0,f=u>1&&u===p;try{for(var m=s(this.childNodes),y=m.next();!y.done;y=m.next()){var g=0===(O=y.value).stretch.dir;if(f||g){var b=O.getOuterBBox(g),v=b.h,_=b.d,S=b.rscale;(v*=S)>h&&(h=v),(_*=S)>d&&(d=_)}}}catch(t){r={error:t}}finally{try{y&&!y.done&&(n=m.return)&&n.call(m)}finally{if(r)throw r.error}}try{for(var x=s(a),M=x.next();!M.done;M=x.next()){var O;(O=M.value).coreMO().getStretchedVariant([h,d])}}catch(t){o={error:t}}finally{try{M&&!M.done&&(i=x.return)&&i.call(x)}finally{if(o)throw o.error}}}},e}(t)},e.CommonInferredMrowMixin=function(t){return function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.getScale=function(){this.bbox.scale=this.parent.bbox.scale,this.bbox.rscale=1},e}(t)}},4126:function(t,e){var r,n=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMsMixin=void 0,e.CommonMsMixin=function(t){return function(t){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=t.apply(this,i([],o(e),!1))||this,a=n.node.attributes,s=a.getList("lquote","rquote");return"monospace"!==n.variant&&(a.isSet("lquote")||'"'!==s.lquote||(s.lquote="\u201c"),a.isSet("rquote")||'"'!==s.rquote||(s.rquote="\u201d")),n.childNodes.unshift(n.createText(s.lquote)),n.childNodes.push(n.createText(s.rquote)),n}return n(e,t),e.prototype.createText=function(t){var e=this.wrap(this.mmlText(t));return e.parent=this,e},e}(t)}},258:function(t,e){var r,n=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMspaceMixin=void 0,e.CommonMspaceMixin=function(t){return function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.computeBBox=function(t,e){void 0===e&&(e=!1);var r=this.node.attributes;t.w=this.length2em(r.get("width"),0),t.h=this.length2em(r.get("height"),0),t.d=this.length2em(r.get("depth"),0)},e.prototype.handleVariant=function(){},e}(t)}},4093:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMsqrtMixin=void 0;var s=r(6469);e.CommonMsqrtMixin=function(t){return function(t){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=t.apply(this,a([],i(e),!1))||this,o=n.createMo("\u221a");o.canStretch(1);var s=n.childNodes[n.base].getOuterBBox(),l=s.h,c=s.d,u=n.font.params.rule_thickness,p=n.node.attributes.get("displaystyle")?n.font.params.x_height:u;return n.surdH=l+c+2*u+p/4,o.getStretchedVariant([n.surdH-c,c],!0),n}return o(e,t),Object.defineProperty(e.prototype,"base",{get:function(){return 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"surd",{get:function(){return 1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"root",{get:function(){return null},enumerable:!1,configurable:!0}),e.prototype.createMo=function(e){var r=t.prototype.createMo.call(this,e);return this.childNodes.push(r),r},e.prototype.computeBBox=function(t,e){void 0===e&&(e=!1);var r=this.childNodes[this.surd].getBBox(),n=new s.BBox(this.childNodes[this.base].getOuterBBox()),o=this.getPQ(r)[1],a=this.font.params.rule_thickness,l=n.h+o+a,c=i(this.getRootDimens(r,l),1)[0];t.h=l+a,this.combineRootBBox(t,r,l),t.combine(r,c,l-r.h),t.combine(n,c+r.w,0),t.clean(),this.setChildPWidths(e)},e.prototype.combineRootBBox=function(t,e,r){},e.prototype.getPQ=function(t){var e=this.font.params.rule_thickness,r=this.node.attributes.get("displaystyle")?this.font.params.x_height:e;return[r,t.h+t.d>this.surdH?(t.h+t.d-(this.surdH-2*e-r/2))/2:e+r/4]},e.prototype.getRootDimens=function(t,e){return[0,0,0,0]},e}(t)}},905:function(t,e){var r,n=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMsubsupMixin=e.CommonMsupMixin=e.CommonMsubMixin=void 0,e.CommonMsubMixin=function(t){var e;return e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),Object.defineProperty(e.prototype,"scriptChild",{get:function(){return this.childNodes[this.node.sub]},enumerable:!1,configurable:!0}),e.prototype.getOffset=function(){return[0,-this.getV()]},e}(t),e.useIC=!1,e},e.CommonMsupMixin=function(t){return function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),Object.defineProperty(e.prototype,"scriptChild",{get:function(){return this.childNodes[this.node.sup]},enumerable:!1,configurable:!0}),e.prototype.getOffset=function(){return[this.getAdjustedIc()-(this.baseRemoveIc?0:this.baseIc),this.getU()]},e}(t)},e.CommonMsubsupMixin=function(t){var e;return e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.UVQ=null,e}return n(e,t),Object.defineProperty(e.prototype,"subChild",{get:function(){return this.childNodes[this.node.sub]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"supChild",{get:function(){return this.childNodes[this.node.sup]},enumerable:!1,configurable:!0}),e.prototype.computeBBox=function(t,e){void 0===e&&(e=!1);var r=this.baseChild.getOuterBBox(),n=o([this.subChild.getOuterBBox(),this.supChild.getOuterBBox()],2),i=n[0],a=n[1];t.empty(),t.append(r);var s=this.getBaseWidth(),l=this.getAdjustedIc(),c=o(this.getUVQ(),2),u=c[0],p=c[1];t.combine(i,s,p),t.combine(a,s+l,u),t.w+=this.font.params.scriptspace,t.clean(),this.setChildPWidths(e)},e.prototype.getUVQ=function(t,e){void 0===t&&(t=this.subChild.getOuterBBox()),void 0===e&&(e=this.supChild.getOuterBBox());var r=this.baseCore.getOuterBBox();if(this.UVQ)return this.UVQ;var n=this.font.params,i=3*n.rule_thickness,a=this.length2em(this.node.attributes.get("subscriptshift"),n.sub2),s=this.baseCharZero(r.d*this.baseScale+n.sub_drop*t.rscale),l=o([this.getU(),Math.max(s,a)],2),c=l[0],u=l[1],p=c-e.d*e.rscale-(t.h*t.rscale-u);if(p<i){u+=i-p;var h=.8*n.x_height-(c-e.d*e.rscale);h>0&&(c+=h,u-=h)}return c=Math.max(this.length2em(this.node.attributes.get("superscriptshift"),c),c),u=Math.max(this.length2em(this.node.attributes.get("subscriptshift"),u),u),p=c-e.d*e.rscale-(t.h*t.rscale-u),this.UVQ=[c,-u,p],this.UVQ},e}(t),e.useIC=!1,e}},6237:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},s=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMtableMixin=void 0;var l=r(6469),c=r(505),u=r(7875);e.CommonMtableMixin=function(t){return function(t){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=t.apply(this,a([],i(e),!1))||this;n.numCols=0,n.numRows=0,n.data=null,n.pwidthCells=[],n.pWidth=0,n.numCols=(0,u.max)(n.tableRows.map((function(t){return t.numCells}))),n.numRows=n.childNodes.length,n.hasLabels=n.childNodes.reduce((function(t,e){return t||e.node.isKind("mlabeledtr")}),!1),n.findContainer(),n.isTop=!n.container||n.container.node.isKind("math")&&!n.container.parent,n.isTop&&(n.jax.table=n),n.getPercentageWidth();var o=n.node.attributes;return n.frame="none"!==o.get("frame"),n.fLine=n.frame&&o.get("frame")?.07:0,n.fSpace=n.frame?n.convertLengths(n.getAttributeArray("framespacing")):[0,0],n.cSpace=n.convertLengths(n.getColumnAttributes("columnspacing")),n.rSpace=n.convertLengths(n.getRowAttributes("rowspacing")),n.cLines=n.getColumnAttributes("columnlines").map((function(t){return"none"===t?0:.07})),n.rLines=n.getRowAttributes("rowlines").map((function(t){return"none"===t?0:.07})),n.cWidths=n.getColumnWidths(),n.stretchRows(),n.stretchColumns(),n}return o(e,t),Object.defineProperty(e.prototype,"tableRows",{get:function(){return this.childNodes},enumerable:!1,configurable:!0}),e.prototype.findContainer=function(){for(var t=this,e=t.parent;e&&(e.node.notParent||e.node.isKind("mrow"));)t=e,e=e.parent;this.container=e,this.containerI=t.node.childPosition()},e.prototype.getPercentageWidth=function(){if(this.hasLabels)this.bbox.pwidth=l.BBox.fullWidth;else{var t=this.node.attributes.get("width");(0,c.isPercent)(t)&&(this.bbox.pwidth=t)}},e.prototype.stretchRows=function(){for(var t=this.node.attributes.get("equalrows"),e=t?this.getEqualRowHeight():0,r=t?this.getTableData():{H:[0],D:[0]},n=r.H,o=r.D,i=this.tableRows,a=0;a<this.numRows;a++){var s=t?[(e+n[a]-o[a])/2,(e-n[a]+o[a])/2]:null;i[a].stretchChildren(s)}},e.prototype.stretchColumns=function(){for(var t=0;t<this.numCols;t++){var e="number"==typeof this.cWidths[t]?this.cWidths[t]:null;this.stretchColumn(t,e)}},e.prototype.stretchColumn=function(t,e){var r,n,o,i,a,l,c=[];try{for(var u=s(this.tableRows),p=u.next();!p.done;p=u.next()){if(g=p.value.getChild(t))0===(x=g.childNodes[0]).stretch.dir&&x.canStretch(2)&&c.push(x)}}catch(t){r={error:t}}finally{try{p&&!p.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}var h=c.length,d=this.childNodes.length;if(h&&d>1){if(null===e){e=0;var f=h>1&&h===d;try{for(var m=s(this.tableRows),y=m.next();!y.done;y=m.next()){var g;if(g=y.value.getChild(t)){var b=0===(x=g.childNodes[0]).stretch.dir;if(f||b){var v=x.getBBox(b).w;v>e&&(e=v)}}}}catch(t){o={error:t}}finally{try{y&&!y.done&&(i=m.return)&&i.call(m)}finally{if(o)throw o.error}}}try{for(var _=s(c),S=_.next();!S.done;S=_.next()){var x;(x=S.value).coreMO().getStretchedVariant([e])}}catch(t){a={error:t}}finally{try{S&&!S.done&&(l=_.return)&&l.call(_)}finally{if(a)throw a.error}}}},e.prototype.getTableData=function(){if(this.data)return this.data;for(var t=new Array(this.numRows).fill(0),e=new Array(this.numRows).fill(0),r=new Array(this.numCols).fill(0),n=new Array(this.numRows),o=new Array(this.numRows),i=[0],a=this.tableRows,s=0;s<a.length;s++){for(var l=0,c=a[s],u=c.node.attributes.get("rowalign"),p=0;p<c.numCells;p++){var h=c.getChild(p);l=this.updateHDW(h,p,s,u,t,e,r,l),this.recordPWidthCell(h,p)}n[s]=t[s],o[s]=e[s],c.labeled&&(l=this.updateHDW(c.childNodes[0],0,s,u,t,e,i,l)),this.extendHD(s,t,e,l),this.extendHD(s,n,o,l)}var d=i[0];return this.data={H:t,D:e,W:r,NH:n,ND:o,L:d},this.data},e.prototype.updateHDW=function(t,e,r,n,o,i,a,s){var l=t.getBBox(),c=l.h,u=l.d,p=l.w,h=t.parent.bbox.rscale;1!==t.parent.bbox.rscale&&(c*=h,u*=h,p*=h),this.node.getProperty("useHeight")&&(c<.75&&(c=.75),u<.25&&(u=.25));var d=0;return"baseline"!==(n=t.node.attributes.get("rowalign")||n)&&"axis"!==n&&(d=c+u,c=u=0),c>o[r]&&(o[r]=c),u>i[r]&&(i[r]=u),d>s&&(s=d),a&&p>a[e]&&(a[e]=p),s},e.prototype.extendHD=function(t,e,r,n){var o=(n-(e[t]+r[t]))/2;o<1e-5||(e[t]+=o,r[t]+=o)},e.prototype.recordPWidthCell=function(t,e){t.childNodes[0]&&t.childNodes[0].getBBox().pwidth&&this.pwidthCells.push([t,e])},e.prototype.computeBBox=function(t,e){void 0===e&&(e=!1);var r,n,o=this.getTableData(),a=o.H,s=o.D;if(this.node.attributes.get("equalrows")){var l=this.getEqualRowHeight();r=(0,u.sum)([].concat(this.rLines,this.rSpace))+l*this.numRows}else r=(0,u.sum)(a.concat(s,this.rLines,this.rSpace));r+=2*(this.fLine+this.fSpace[1]);var p=this.getComputedWidths();n=(0,u.sum)(p.concat(this.cLines,this.cSpace))+2*(this.fLine+this.fSpace[0]);var h=this.node.attributes.get("width");"auto"!==h&&(n=Math.max(this.length2em(h,0)+2*this.fLine,n));var d=i(this.getBBoxHD(r),2),f=d[0],m=d[1];t.h=f,t.d=m,t.w=n;var y=i(this.getBBoxLR(),2),g=y[0],b=y[1];t.L=g,t.R=b,(0,c.isPercent)(h)||this.setColumnPWidths()},e.prototype.setChildPWidths=function(t,e,r){var n=this.node.attributes.get("width");if(!(0,c.isPercent)(n))return!1;this.hasLabels||(this.bbox.pwidth="",this.container.bbox.pwidth="");var o=this.bbox,i=o.w,a=o.L,s=o.R,l=this.node.attributes.get("data-width-includes-label"),p=Math.max(i,this.length2em(n,Math.max(e,a+i+s)))-(l?a+s:0),h=this.node.attributes.get("equalcolumns")?Array(this.numCols).fill(this.percent(1/Math.max(1,this.numCols))):this.getColumnAttributes("columnwidth",0);this.cWidths=this.getColumnWidthsFixed(h,p);var d=this.getComputedWidths();return this.pWidth=(0,u.sum)(d.concat(this.cLines,this.cSpace))+2*(this.fLine+this.fSpace[0]),this.isTop&&(this.bbox.w=this.pWidth),this.setColumnPWidths(),this.pWidth!==i&&this.parent.invalidateBBox(),this.pWidth!==i},e.prototype.setColumnPWidths=function(){var t,e,r=this.cWidths;try{for(var n=s(this.pwidthCells),o=n.next();!o.done;o=n.next()){var a=i(o.value,2),l=a[0],c=a[1];l.setChildPWidths(!1,r[c])&&(l.invalidateBBox(),l.getBBox())}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}},e.prototype.getBBoxHD=function(t){var e=i(this.getAlignmentRow(),2),r=e[0],n=e[1];if(null===n){var o=this.font.params.axis_height,a=t/2;return{top:[0,t],center:[a,a],bottom:[t,0],baseline:[a,a],axis:[a+o,a-o]}[r]||[a,a]}var s=this.getVerticalPosition(n,r);return[s,t-s]},e.prototype.getBBoxLR=function(){if(this.hasLabels){var t=this.node.attributes,e=t.get("side"),r=i(this.getPadAlignShift(e),2),n=r[0],o=r[1],a=this.hasLabels&&!!t.get("data-width-includes-label");return a&&this.frame&&this.fSpace[0]&&(n-=this.fSpace[0]),"center"!==o||a?"left"===e?[n,0]:[0,n]:[n,n]}return[0,0]},e.prototype.getPadAlignShift=function(t){var e=this.getTableData().L+this.length2em(this.node.attributes.get("minlabelspacing")),r=i(null==this.styles?["",""]:[this.styles.get("padding-left"),this.styles.get("padding-right")],2),n=r[0],o=r[1];(n||o)&&(e=Math.max(e,this.length2em(n||"0"),this.length2em(o||"0")));var a=i(this.getAlignShift(),2),s=a[0],l=a[1];return s===t&&(l="left"===t?Math.max(e,l)-e:Math.min(-e,l)+e),[e,s,l]},e.prototype.getAlignShift=function(){return this.isTop?t.prototype.getAlignShift.call(this):[this.container.getChildAlign(this.containerI),0]},e.prototype.getWidth=function(){return this.pWidth||this.getBBox().w},e.prototype.getEqualRowHeight=function(){var t=this.getTableData(),e=t.H,r=t.D,n=Array.from(e.keys()).map((function(t){return e[t]+r[t]}));return Math.max.apply(Math,n)},e.prototype.getComputedWidths=function(){var t=this,e=this.getTableData().W,r=Array.from(e.keys()).map((function(r){return"number"==typeof t.cWidths[r]?t.cWidths[r]:e[r]}));return this.node.attributes.get("equalcolumns")&&(r=Array(r.length).fill((0,u.max)(r))),r},e.prototype.getColumnWidths=function(){var t=this.node.attributes.get("width");if(this.node.attributes.get("equalcolumns"))return this.getEqualColumns(t);var e=this.getColumnAttributes("columnwidth",0);return"auto"===t?this.getColumnWidthsAuto(e):(0,c.isPercent)(t)?this.getColumnWidthsPercent(e):this.getColumnWidthsFixed(e,this.length2em(t))},e.prototype.getEqualColumns=function(t){var e,r=Math.max(1,this.numCols);if("auto"===t){var n=this.getTableData().W;e=(0,u.max)(n)}else if((0,c.isPercent)(t))e=this.percent(1/r);else{var o=(0,u.sum)([].concat(this.cLines,this.cSpace))+2*this.fSpace[0];e=Math.max(0,this.length2em(t)-o)/r}return Array(this.numCols).fill(e)},e.prototype.getColumnWidthsAuto=function(t){var e=this;return t.map((function(t){return"auto"===t||"fit"===t?null:(0,c.isPercent)(t)?t:e.length2em(t)}))},e.prototype.getColumnWidthsPercent=function(t){var e=this,r=t.indexOf("fit")>=0,n=(r?this.getTableData():{W:null}).W;return Array.from(t.keys()).map((function(o){var i=t[o];return"fit"===i?null:"auto"===i?r?n[o]:null:(0,c.isPercent)(i)?i:e.length2em(i)}))},e.prototype.getColumnWidthsFixed=function(t,e){var r=this,n=Array.from(t.keys()),o=n.filter((function(e){return"fit"===t[e]})),i=n.filter((function(e){return"auto"===t[e]})),a=o.length||i.length,s=(a?this.getTableData():{W:null}).W,l=e-(0,u.sum)([].concat(this.cLines,this.cSpace))-2*this.fSpace[0],c=l;n.forEach((function(e){var n=t[e];c-="fit"===n||"auto"===n?s[e]:r.length2em(n,l)}));var p=a&&c>0?c/a:0;return n.map((function(e){var n=t[e];return"fit"===n?s[e]+p:"auto"===n?s[e]+(0===o.length?p:0):r.length2em(n,l)}))},e.prototype.getVerticalPosition=function(t,e){for(var r=this.node.attributes.get("equalrows"),n=this.getTableData(),o=n.H,a=n.D,s=r?this.getEqualRowHeight():0,l=this.getRowHalfSpacing(),c=this.fLine,u=0;u<t;u++)c+=l[u]+(r?s:o[u]+a[u])+l[u+1]+this.rLines[u];var p=i(r?[(s+o[t]-a[t])/2,(s-o[t]+a[t])/2]:[o[t],a[t]],2),h=p[0],d=p[1];return c+={top:0,center:l[t]+(h+d)/2,bottom:l[t]+h+d+l[t+1],baseline:l[t]+h,axis:l[t]+h-.25}[e]||0},e.prototype.getEmHalfSpacing=function(t,e,r){void 0===r&&(r=1);var n=this.em(t*r),o=this.addEm(e,2/r);return o.unshift(n),o.push(n),o},e.prototype.getRowHalfSpacing=function(){var t=this.rSpace.map((function(t){return t/2}));return t.unshift(this.fSpace[1]),t.push(this.fSpace[1]),t},e.prototype.getColumnHalfSpacing=function(){var t=this.cSpace.map((function(t){return t/2}));return t.unshift(this.fSpace[0]),t.push(this.fSpace[0]),t},e.prototype.getAlignmentRow=function(){var t=i((0,c.split)(this.node.attributes.get("align")),2),e=t[0],r=t[1];if(null==r)return[e,null];var n=parseInt(r);return n<0&&(n+=this.numRows+1),[e,n<1||n>this.numRows?null:n-1]},e.prototype.getColumnAttributes=function(t,e){void 0===e&&(e=1);var r=this.numCols-e,n=this.getAttributeArray(t);if(0===n.length)return null;for(;n.length<r;)n.push(n[n.length-1]);return n.length>r&&n.splice(r),n},e.prototype.getRowAttributes=function(t,e){void 0===e&&(e=1);var r=this.numRows-e,n=this.getAttributeArray(t);if(0===n.length)return null;for(;n.length<r;)n.push(n[n.length-1]);return n.length>r&&n.splice(r),n},e.prototype.getAttributeArray=function(t){var e=this.node.attributes.get(t);return e?(0,c.split)(e):[this.node.attributes.getDefault(t)]},e.prototype.addEm=function(t,e){var r=this;return void 0===e&&(e=1),t?t.map((function(t){return r.em(t/e)})):null},e.prototype.convertLengths=function(t){var e=this;return t?t.map((function(t){return e.length2em(t)})):null},e}(t)}},5164:function(t,e){var r,n=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMtdMixin=void 0,e.CommonMtdMixin=function(t){return function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),Object.defineProperty(e.prototype,"fixesPWidth",{get:function(){return!1},enumerable:!1,configurable:!0}),e.prototype.invalidateBBox=function(){this.bboxComputed=!1},e.prototype.getWrapWidth=function(t){var e=this.parent.parent,r=this.parent,n=this.node.childPosition()-(r.labeled?1:0);return"number"==typeof e.cWidths[n]?e.cWidths[n]:e.getTableData().W[n]},e.prototype.getChildAlign=function(t){return this.node.attributes.get("columnalign")},e}(t)}},6319:function(t,e){var r,n=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMtextMixin=void 0,e.CommonMtextMixin=function(t){var e;return e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.getVariant=function(){var e=this.jax.options,r=this.jax.math.outputData,n=(!!r.merrorFamily||!!e.merrorFont)&&this.node.Parent.isKind("merror");if(r.mtextFamily||e.mtextFont||n){var o=this.node.attributes.get("mathvariant"),i=this.constructor.INHERITFONTS[o]||this.jax.font.getCssFont(o),a=i[0]||(n?r.merrorFamily||e.merrorFont:r.mtextFamily||e.mtextFont);this.variant=this.explicitVariant(a,i[2]?"bold":"",i[1]?"italic":"")}else t.prototype.getVariant.call(this)},e}(t),e.INHERITFONTS={normal:["",!1,!1],bold:["",!1,!0],italic:["",!0,!1],"bold-italic":["",!0,!0]},e}},5766:function(t,e){var r,n=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMlabeledtrMixin=e.CommonMtrMixin=void 0,e.CommonMtrMixin=function(t){return function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),Object.defineProperty(e.prototype,"fixesPWidth",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"numCells",{get:function(){return this.childNodes.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"labeled",{get:function(){return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tableCells",{get:function(){return this.childNodes},enumerable:!1,configurable:!0}),e.prototype.getChild=function(t){return this.childNodes[t]},e.prototype.getChildBBoxes=function(){return this.childNodes.map((function(t){return t.getBBox()}))},e.prototype.stretchChildren=function(t){var e,r,n,i,a,s;void 0===t&&(t=null);var l=[],c=this.labeled?this.childNodes.slice(1):this.childNodes;try{for(var u=o(c),p=u.next();!p.done;p=u.next()){(E=p.value.childNodes[0]).canStretch(1)&&l.push(E)}}catch(t){e={error:t}}finally{try{p&&!p.done&&(r=u.return)&&r.call(u)}finally{if(e)throw e.error}}var h=l.length,d=this.childNodes.length;if(h&&d>1){if(null===t){var f=0,m=0,y=h>1&&h===d;try{for(var g=o(c),b=g.next();!b.done;b=g.next()){var v=0===(E=b.value.childNodes[0]).stretch.dir;if(y||v){var _=E.getBBox(v),S=_.h,x=_.d;S>f&&(f=S),x>m&&(m=x)}}}catch(t){n={error:t}}finally{try{b&&!b.done&&(i=g.return)&&i.call(g)}finally{if(n)throw n.error}}t=[f,m]}try{for(var M=o(l),O=M.next();!O.done;O=M.next()){var E;(E=O.value).coreMO().getStretchedVariant(t)}}catch(t){a={error:t}}finally{try{O&&!O.done&&(s=M.return)&&s.call(M)}finally{if(a)throw a.error}}}},e}(t)},e.CommonMlabeledtrMixin=function(t){return function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),Object.defineProperty(e.prototype,"numCells",{get:function(){return Math.max(0,this.childNodes.length-1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"labeled",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tableCells",{get:function(){return this.childNodes.slice(1)},enumerable:!1,configurable:!0}),e.prototype.getChild=function(t){return this.childNodes[t+1]},e.prototype.getChildBBoxes=function(){return this.childNodes.slice(1).map((function(t){return t.getBBox()}))},e}(t)}},1971:function(t,e){var r,n=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.CommonMunderoverMixin=e.CommonMoverMixin=e.CommonMunderMixin=void 0,e.CommonMunderMixin=function(t){return function(t){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=t.apply(this,i([],o(e),!1))||this;return n.stretchChildren(),n}return n(e,t),Object.defineProperty(e.prototype,"scriptChild",{get:function(){return this.childNodes[this.node.under]},enumerable:!1,configurable:!0}),e.prototype.computeBBox=function(e,r){if(void 0===r&&(r=!1),this.hasMovableLimits())t.prototype.computeBBox.call(this,e,r);else{e.empty();var n=this.baseChild.getOuterBBox(),i=this.scriptChild.getOuterBBox(),a=this.getUnderKV(n,i)[1],s=this.isLineBelow?0:this.getDelta(!0),l=o(this.getDeltaW([n,i],[0,-s]),2),c=l[0],u=l[1];e.combine(n,c,0),e.combine(i,u,a),e.d+=this.font.params.big_op_spacing5,e.clean(),this.setChildPWidths(r)}},e}(t)},e.CommonMoverMixin=function(t){return function(t){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=t.apply(this,i([],o(e),!1))||this;return n.stretchChildren(),n}return n(e,t),Object.defineProperty(e.prototype,"scriptChild",{get:function(){return this.childNodes[this.node.over]},enumerable:!1,configurable:!0}),e.prototype.computeBBox=function(e){if(this.hasMovableLimits())t.prototype.computeBBox.call(this,e);else{e.empty();var r=this.baseChild.getOuterBBox(),n=this.scriptChild.getOuterBBox();this.node.attributes.get("accent")&&(r.h=Math.max(r.h,this.font.params.x_height*r.scale));var i=this.getOverKU(r,n)[1],a=this.isLineAbove?0:this.getDelta(),s=o(this.getDeltaW([r,n],[0,a]),2),l=s[0],c=s[1];e.combine(r,l,0),e.combine(n,c,i),e.h+=this.font.params.big_op_spacing5,e.clean()}},e}(t)},e.CommonMunderoverMixin=function(t){return function(t){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=t.apply(this,i([],o(e),!1))||this;return n.stretchChildren(),n}return n(e,t),Object.defineProperty(e.prototype,"underChild",{get:function(){return this.childNodes[this.node.under]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"overChild",{get:function(){return this.childNodes[this.node.over]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subChild",{get:function(){return this.underChild},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"supChild",{get:function(){return this.overChild},enumerable:!1,configurable:!0}),e.prototype.computeBBox=function(e){if(this.hasMovableLimits())t.prototype.computeBBox.call(this,e);else{e.empty();var r=this.overChild.getOuterBBox(),n=this.baseChild.getOuterBBox(),i=this.underChild.getOuterBBox();this.node.attributes.get("accent")&&(n.h=Math.max(n.h,this.font.params.x_height*n.scale));var a=this.getOverKU(n,r)[1],s=this.getUnderKV(n,i)[1],l=this.getDelta(),c=o(this.getDeltaW([n,i,r],[0,this.isLineBelow?0:-l,this.isLineAbove?0:l]),3),u=c[0],p=c[1],h=c[2];e.combine(n,u,0),e.combine(r,h,a),e.combine(i,p,s);var d=this.font.params.big_op_spacing5;e.h+=d,e.d+=d,e.clean()}},e}(t)}},167:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},s=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.CommonScriptbaseMixin=void 0;var l=r(9007);e.CommonScriptbaseMixin=function(t){var e;return e=function(t){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=t.apply(this,a([],i(e),!1))||this;n.baseScale=1,n.baseIc=0,n.baseRemoveIc=!1,n.baseIsChar=!1,n.baseHasAccentOver=null,n.baseHasAccentUnder=null,n.isLineAbove=!1,n.isLineBelow=!1,n.isMathAccent=!1;var o=n.baseCore=n.getBaseCore();return o?(n.setBaseAccentsFor(o),n.baseScale=n.getBaseScale(),n.baseIc=n.getBaseIc(),n.baseIsChar=n.isCharBase(),n.isMathAccent=n.baseIsChar&&n.scriptChild&&!!n.scriptChild.coreMO().node.getProperty("mathaccent"),n.checkLineAccents(),n.baseRemoveIc=!n.isLineAbove&&!n.isLineBelow&&(!n.constructor.useIC||n.isMathAccent),n):n}return o(e,t),Object.defineProperty(e.prototype,"baseChild",{get:function(){return this.childNodes[this.node.base]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scriptChild",{get:function(){return this.childNodes[1]},enumerable:!1,configurable:!0}),e.prototype.getBaseCore=function(){for(var t=this.getSemanticBase()||this.childNodes[0];t&&(1===t.childNodes.length&&(t.node.isKind("mrow")||t.node.isKind("TeXAtom")&&t.node.texClass!==l.TEXCLASS.VCENTER||t.node.isKind("mstyle")||t.node.isKind("mpadded")||t.node.isKind("mphantom")||t.node.isKind("semantics"))||t.node.isKind("munderover")&&t.isMathAccent);)this.setBaseAccentsFor(t),t=t.childNodes[0];return t||(this.baseHasAccentOver=this.baseHasAccentUnder=!1),t||this.childNodes[0]},e.prototype.setBaseAccentsFor=function(t){t.node.isKind("munderover")&&(null===this.baseHasAccentOver&&(this.baseHasAccentOver=!!t.node.attributes.get("accent")),null===this.baseHasAccentUnder&&(this.baseHasAccentUnder=!!t.node.attributes.get("accentunder")))},e.prototype.getSemanticBase=function(){var t=this.node.attributes.getExplicit("data-semantic-fencepointer");return this.getBaseFence(this.baseChild,t)},e.prototype.getBaseFence=function(t,e){var r,n;if(!t||!t.node.attributes||!e)return null;if(t.node.attributes.getExplicit("data-semantic-id")===e)return t;try{for(var o=s(t.childNodes),i=o.next();!i.done;i=o.next()){var a=i.value,l=this.getBaseFence(a,e);if(l)return l}}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return null},e.prototype.getBaseScale=function(){for(var t=this.baseCore,e=1;t&&t!==this;){e*=t.getOuterBBox().rscale,t=t.parent}return e},e.prototype.getBaseIc=function(){return this.baseCore.getOuterBBox().ic*this.baseScale},e.prototype.getAdjustedIc=function(){var t=this.baseCore.getOuterBBox();return(t.ic?1.05*t.ic+.05:0)*this.baseScale},e.prototype.isCharBase=function(){var t=this.baseCore;return(t.node.isKind("mo")&&null===t.size||t.node.isKind("mi")||t.node.isKind("mn"))&&1===t.bbox.rscale&&1===Array.from(t.getText()).length},e.prototype.checkLineAccents=function(){if(this.node.isKind("munderover"))if(this.node.isKind("mover"))this.isLineAbove=this.isLineAccent(this.scriptChild);else if(this.node.isKind("munder"))this.isLineBelow=this.isLineAccent(this.scriptChild);else{this.isLineAbove=this.isLineAccent(this.overChild),this.isLineBelow=this.isLineAccent(this.underChild)}},e.prototype.isLineAccent=function(t){var e=t.coreMO().node;return e.isToken&&"\u2015"===e.getText()},e.prototype.getBaseWidth=function(){var t=this.baseChild.getOuterBBox();return t.w*t.rscale-(this.baseRemoveIc?this.baseIc:0)+this.font.params.extra_ic},e.prototype.computeBBox=function(t,e){void 0===e&&(e=!1);var r=this.getBaseWidth(),n=i(this.getOffset(),2),o=n[0],a=n[1];t.append(this.baseChild.getOuterBBox()),t.combine(this.scriptChild.getOuterBBox(),r+o,a),t.w+=this.font.params.scriptspace,t.clean(),this.setChildPWidths(e)},e.prototype.getOffset=function(){return[0,0]},e.prototype.baseCharZero=function(t){var e=!!this.baseCore.node.attributes.get("largeop"),r=this.baseScale;return this.baseIsChar&&!e&&1===r?0:t},e.prototype.getV=function(){var t=this.baseCore.getOuterBBox(),e=this.scriptChild.getOuterBBox(),r=this.font.params,n=this.length2em(this.node.attributes.get("subscriptshift"),r.sub1);return Math.max(this.baseCharZero(t.d*this.baseScale+r.sub_drop*e.rscale),n,e.h*e.rscale-.8*r.x_height)},e.prototype.getU=function(){var t=this.baseCore.getOuterBBox(),e=this.scriptChild.getOuterBBox(),r=this.font.params,n=this.node.attributes.getList("displaystyle","superscriptshift"),o=this.node.getProperty("texprimestyle")?r.sup3:n.displaystyle?r.sup1:r.sup2,i=this.length2em(n.superscriptshift,o);return Math.max(this.baseCharZero(t.h*this.baseScale-r.sup_drop*e.rscale),i,e.d*e.rscale+1/4*r.x_height)},e.prototype.hasMovableLimits=function(){var t=this.node.attributes.get("displaystyle"),e=this.baseChild.coreMO().node;return!t&&!!e.attributes.get("movablelimits")},e.prototype.getOverKU=function(t,e){var r=this.node.attributes.get("accent"),n=this.font.params,o=e.d*e.rscale,i=n.rule_thickness*n.separation_factor,a=this.baseHasAccentOver?i:0,s=this.isLineAbove?3*n.rule_thickness:i,l=(r?s:Math.max(n.big_op_spacing1,n.big_op_spacing3-Math.max(0,o)))-a;return[l,t.h*t.rscale+l+o]},e.prototype.getUnderKV=function(t,e){var r=this.node.attributes.get("accentunder"),n=this.font.params,o=e.h*e.rscale,i=n.rule_thickness*n.separation_factor,a=this.baseHasAccentUnder?i:0,s=this.isLineBelow?3*n.rule_thickness:i,l=(r?s:Math.max(n.big_op_spacing2,n.big_op_spacing4-o))-a;return[l,-(t.d*t.rscale+l+o)]},e.prototype.getDeltaW=function(t,e){var r,n,o,l;void 0===e&&(e=[0,0,0]);var c=this.node.attributes.get("align"),u=t.map((function(t){return t.w*t.rscale}));u[0]-=this.baseRemoveIc&&!this.baseCore.node.attributes.get("largeop")?this.baseIc:0;var p=Math.max.apply(Math,a([],i(u),!1)),h=[],d=0;try{for(var f=s(u.keys()),m=f.next();!m.done;m=f.next()){var y=m.value;h[y]=("center"===c?(p-u[y])/2:"right"===c?p-u[y]:0)+e[y],h[y]<d&&(d=-h[y])}}catch(t){r={error:t}}finally{try{m&&!m.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}if(d)try{for(var g=s(h.keys()),b=g.next();!b.done;b=g.next()){y=b.value;h[y]+=d}}catch(t){o={error:t}}finally{try{b&&!b.done&&(l=g.return)&&l.call(g)}finally{if(o)throw o.error}}return[1,2].map((function(e){return h[e]+=t[e]?t[e].dx*t[0].scale:0})),h},e.prototype.getDelta=function(t){void 0===t&&(t=!1);var e=this.node.attributes.get("accent"),r=this.baseCore.getOuterBBox(),n=r.sk,o=r.ic;return((e&&!t?n:0)+this.font.skewIcFactor*o)*this.baseScale},e.prototype.stretchChildren=function(){var t,e,r,n,o,i,a=[];try{for(var l=s(this.childNodes),c=l.next();!c.done;c=l.next()){(x=c.value).canStretch(2)&&a.push(x)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(e=l.return)&&e.call(l)}finally{if(t)throw t.error}}var u=a.length,p=this.childNodes.length;if(u&&p>1){var h=0,d=u>1&&u===p;try{for(var f=s(this.childNodes),m=f.next();!m.done;m=f.next()){var y=0===(x=m.value).stretch.dir;if(d||y){var g=x.getOuterBBox(y),b=g.w,v=g.rscale;b*v>h&&(h=b*v)}}}catch(t){r={error:t}}finally{try{m&&!m.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}try{for(var _=s(a),S=_.next();!S.done;S=_.next()){var x;(x=S.value).coreMO().getStretchedVariant([h/x.bbox.rscale])}}catch(t){o={error:t}}finally{try{S&&!S.done&&(i=_.return)&&i.call(_)}finally{if(o)throw o.error}}}},e}(t),e.useIC=!0,e}},5806:function(t,e){var r,n=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0}),e.CommonSemanticsMixin=void 0,e.CommonSemanticsMixin=function(t){return function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.computeBBox=function(t,e){if(void 0===e&&(e=!1),this.childNodes.length){var r=this.childNodes[0].getBBox(),n=r.w,o=r.h,i=r.d;t.w=n,t.h=o,t.d=i}},e}(t)}},5920:function(t,e){var r,n=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__assign||function(){return o=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},o.apply(this,arguments)},i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.CommonTeXFontMixin=void 0,e.CommonTeXFontMixin=function(t){var e;return e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e.prototype.getDelimiterData=function(t){return this.getChar("-smallop",t)||this.getChar("-size4",t)},e}(t),e.NAME="TeX",e.defaultVariants=a(a([],i(t.defaultVariants),!1),[["-smallop","normal"],["-largeop","normal"],["-size3","normal"],["-size4","normal"],["-tex-calligraphic","italic"],["-tex-bold-calligraphic","bold-italic"],["-tex-oldstyle","normal"],["-tex-bold-oldstyle","bold"],["-tex-mathit","italic"],["-tex-variant","normal"]],!1),e.defaultCssFonts=o(o({},t.defaultCssFonts),{"-smallop":["serif",!1,!1],"-largeop":["serif",!1,!1],"-size3":["serif",!1,!1],"-size4":["serif",!1,!1],"-tex-calligraphic":["cursive",!0,!1],"-tex-bold-calligraphic":["cursive",!0,!0],"-tex-oldstyle":["serif",!1,!1],"-tex-bold-oldstyle":["serif",!1,!0],"-tex-mathit":["serif",!0,!1]}),e.defaultSizeVariants=["normal","-smallop","-largeop","-size3","-size4","-tex-variant"],e.defaultStretchVariants=["-size4"],e}},5887:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.boldItalic=void 0,e.boldItalic={47:[.711,.21,.894],305:[.452,.008,.394,{sk:.0319}],567:[.451,.201,.439,{sk:.0958}],8260:[.711,.21,.894],8710:[.711,0,.958,{sk:.192}],10744:[.711,.21,.894]}},1103:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.bold=void 0,e.bold={33:[.705,0,.35],34:[.694,-.329,.603],35:[.694,.193,.958],36:[.75,.056,.575],37:[.75,.056,.958],38:[.705,.011,.894],39:[.694,-.329,.319],40:[.75,.249,.447],41:[.75,.249,.447],42:[.75,-.306,.575],43:[.633,.131,.894],44:[.171,.194,.319],45:[.278,-.166,.383],46:[.171,0,.319],47:[.75,.25,.575],58:[.444,0,.319],59:[.444,.194,.319],60:[.587,.085,.894],61:[.393,-.109,.894],62:[.587,.085,.894],63:[.7,0,.543],64:[.699,.006,.894],91:[.75,.25,.319],92:[.75,.25,.575],93:[.75,.25,.319],94:[.694,-.52,.575],95:[-.01,.061,.575],96:[.706,-.503,.575],123:[.75,.25,.575],124:[.75,.249,.319],125:[.75,.25,.575],126:[.344,-.202,.575],168:[.695,-.535,.575],172:[.371,-.061,.767],175:[.607,-.54,.575],176:[.702,-.536,.575],177:[.728,.035,.894],180:[.706,-.503,.575],183:[.336,-.166,.319],215:[.53,.028,.894],247:[.597,.096,.894],305:[.442,0,.278,{sk:.0278}],567:[.442,.205,.306,{sk:.0833}],697:[.563,-.033,.344],710:[.694,-.52,.575],711:[.66,-.515,.575],713:[.607,-.54,.575],714:[.706,-.503,.575],715:[.706,-.503,.575],728:[.694,-.5,.575],729:[.695,-.525,.575],730:[.702,-.536,.575],732:[.694,-.552,.575],768:[.706,-.503,0],769:[.706,-.503,0],770:[.694,-.52,0],771:[.694,-.552,0],772:[.607,-.54,0],774:[.694,-.5,0],775:[.695,-.525,0],776:[.695,-.535,0],778:[.702,-.536,0],779:[.714,-.511,0],780:[.66,-.515,0],824:[.711,.21,0],8194:[0,0,.5],8195:[0,0,.999],8196:[0,0,.333],8197:[0,0,.25],8198:[0,0,.167],8201:[0,0,.167],8202:[0,0,.083],8211:[.3,-.249,.575],8212:[.3,-.249,1.15],8213:[.3,-.249,1.15],8214:[.75,.248,.575],8215:[-.01,.061,.575],8216:[.694,-.329,.319],8217:[.694,-.329,.319],8220:[.694,-.329,.603],8221:[.694,-.329,.603],8224:[.702,.211,.511],8225:[.702,.202,.511],8226:[.474,-.028,.575],8230:[.171,0,1.295],8242:[.563,-.033,.344],8243:[.563,0,.688],8244:[.563,0,1.032],8254:[.607,-.54,.575],8260:[.75,.25,.575],8279:[.563,0,1.376],8407:[.723,-.513,.575],8463:[.694,.008,.668,{sk:-.0319}],8467:[.702,.019,.474,{sk:.128}],8472:[.461,.21,.74],8501:[.694,0,.703],8592:[.518,.017,1.15],8593:[.694,.193,.575],8594:[.518,.017,1.15],8595:[.694,.194,.575],8596:[.518,.017,1.15],8597:[.767,.267,.575],8598:[.724,.194,1.15],8599:[.724,.193,1.15],8600:[.694,.224,1.15],8601:[.694,.224,1.15],8602:[.711,.21,1.15],8603:[.711,.21,1.15],8614:[.518,.017,1.15],8617:[.518,.017,1.282],8618:[.518,.017,1.282],8622:[.711,.21,1.15],8636:[.518,-.22,1.15],8637:[.281,.017,1.15],8640:[.518,-.22,1.15],8641:[.281,.017,1.15],8652:[.718,.017,1.15],8653:[.711,.21,1.15],8654:[.711,.21,1.15],8655:[.711,.21,1.15],8656:[.547,.046,1.15],8657:[.694,.193,.703],8658:[.547,.046,1.15],8659:[.694,.194,.703],8660:[.547,.046,1.15],8661:[.767,.267,.703],8704:[.694,.016,.639],8707:[.694,0,.639],8708:[.711,.21,.639],8709:[.767,.073,.575],8710:[.698,0,.958],8712:[.587,.086,.767],8713:[.711,.21,.767],8715:[.587,.086,.767],8716:[.711,.21,.767],8722:[.281,-.221,.894],8723:[.537,.227,.894],8725:[.75,.25,.575],8726:[.75,.25,.575],8727:[.472,-.028,.575],8728:[.474,-.028,.575],8729:[.474,-.028,.575],8730:[.82,.18,.958,{ic:.03}],8733:[.451,.008,.894],8734:[.452,.008,1.15],8736:[.714,0,.722],8739:[.75,.249,.319],8740:[.75,.249,.319],8741:[.75,.248,.575],8742:[.75,.248,.575],8743:[.604,.017,.767],8744:[.604,.016,.767],8745:[.603,.016,.767],8746:[.604,.016,.767],8747:[.711,.211,.569,{ic:.063}],8764:[.391,-.109,.894],8768:[.583,.082,.319],8769:[.711,.21,.894],8771:[.502,0,.894],8772:[.711,.21,.894],8773:[.638,.027,.894],8775:[.711,.21,.894],8776:[.524,-.032,.894],8777:[.711,.21,.894],8781:[.533,.032,.894],8784:[.721,-.109,.894],8800:[.711,.21,.894],8801:[.505,0,.894],8802:[.711,.21,.894],8804:[.697,.199,.894],8805:[.697,.199,.894],8810:[.617,.116,1.15],8811:[.618,.116,1.15],8813:[.711,.21,.894],8814:[.711,.21,.894],8815:[.711,.21,.894],8816:[.711,.21,.894],8817:[.711,.21,.894],8826:[.585,.086,.894],8827:[.586,.086,.894],8832:[.711,.21,.894],8833:[.711,.21,.894],8834:[.587,.085,.894],8835:[.587,.086,.894],8836:[.711,.21,.894],8837:[.711,.21,.894],8838:[.697,.199,.894],8839:[.697,.199,.894],8840:[.711,.21,.894],8841:[.711,.21,.894],8846:[.604,.016,.767],8849:[.697,.199,.894],8850:[.697,.199,.894],8851:[.604,0,.767],8852:[.604,0,.767],8853:[.632,.132,.894],8854:[.632,.132,.894],8855:[.632,.132,.894],8856:[.632,.132,.894],8857:[.632,.132,.894],8866:[.693,0,.703],8867:[.693,0,.703],8868:[.694,0,.894],8869:[.693,0,.894],8872:[.75,.249,.974],8876:[.711,.21,.703],8877:[.75,.249,.974],8900:[.523,.021,.575],8901:[.336,-.166,.319],8902:[.502,0,.575],8904:[.54,.039,1],8930:[.711,.21,.894],8931:[.711,.21,.894],8942:[.951,.029,.319],8943:[.336,-.166,1.295],8945:[.871,-.101,1.323],8968:[.75,.248,.511],8969:[.75,.248,.511],8970:[.749,.248,.511],8971:[.749,.248,.511],8994:[.405,-.108,1.15],8995:[.392,-.126,1.15],9001:[.75,.249,.447],9002:[.75,.249,.447],9651:[.711,0,1.022],9653:[.711,0,1.022],9657:[.54,.039,.575],9661:[.5,.21,1.022],9663:[.5,.21,1.022],9667:[.539,.038,.575],9711:[.711,.211,1.15],9824:[.719,.129,.894],9825:[.711,.024,.894],9826:[.719,.154,.894],9827:[.719,.129,.894],9837:[.75,.017,.447],9838:[.741,.223,.447],9839:[.724,.224,.447],10072:[.75,.249,.319],10216:[.75,.249,.447],10217:[.75,.249,.447],10229:[.518,.017,1.805],10230:[.518,.017,1.833],10231:[.518,.017,2.126],10232:[.547,.046,1.868],10233:[.547,.046,1.87],10234:[.547,.046,2.126],10236:[.518,.017,1.833],10744:[.711,.21,.894],10799:[.53,.028,.894],10815:[.686,0,.9],10927:[.696,.199,.894],10928:[.697,.199,.894],12296:[.75,.249,.447],12297:[.75,.249,.447]}},9124:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.delimiters=e.VSIZES=e.HDW3=e.HDW2=e.HDW1=void 0;var n=r(5884);e.HDW1=[.75,.25,.875],e.HDW2=[.85,.349,.667],e.HDW3=[.583,.082,.5],e.VSIZES=[1,1.2,1.8,2.4,3];var o={c:47,dir:n.V,sizes:e.VSIZES},i={c:175,dir:n.H,sizes:[.5],stretch:[0,175],HDW:[.59,-.544,.5]},a={c:710,dir:n.H,sizes:[.5,.556,1,1.444,1.889]},s={c:732,dir:n.H,sizes:[.5,.556,1,1.444,1.889]},l={c:8211,dir:n.H,sizes:[.5],stretch:[0,8211],HDW:[.285,-.248,.5]},c={c:8592,dir:n.H,sizes:[1],stretch:[8592,8722],HDW:e.HDW3},u={c:8594,dir:n.H,sizes:[1],stretch:[0,8722,8594],HDW:e.HDW3},p={c:8596,dir:n.H,sizes:[1],stretch:[8592,8722,8594],HDW:e.HDW3},h={c:8612,dir:n.H,stretch:[8592,8722,8739],HDW:e.HDW3,min:1.278},d={c:8614,dir:n.H,sizes:[1],stretch:[8739,8722,8594],HDW:e.HDW3},f={c:8656,dir:n.H,sizes:[1],stretch:[8656,61],HDW:e.HDW3},m={c:8658,dir:n.H,sizes:[1],stretch:[0,61,8658],HDW:e.HDW3},y={c:8660,dir:n.H,sizes:[1],stretch:[8656,61,8658],HDW:e.HDW3},g={c:8722,dir:n.H,sizes:[.778],stretch:[0,8722],HDW:e.HDW3},b={c:8739,dir:n.V,sizes:[1],stretch:[0,8739],HDW:[.627,.015,.333]},v={c:9180,dir:n.H,sizes:[.778,1],schar:[8994,8994],variants:[5,0],stretch:[57680,57684,57681],HDW:[.32,.2,.5]},_={c:9181,dir:n.H,sizes:[.778,1],schar:[8995,8995],variants:[5,0],stretch:[57682,57684,57683],HDW:[.32,.2,.5]},S={c:9182,dir:n.H,stretch:[57680,57684,57681,57685],HDW:[.32,.2,.5],min:1.8},x={c:9183,dir:n.H,stretch:[57682,57684,57683,57686],HDW:[.32,.2,.5],min:1.8},M={c:10216,dir:n.V,sizes:e.VSIZES},O={c:10217,dir:n.V,sizes:e.VSIZES},E={c:10502,dir:n.H,stretch:[8656,61,8739],HDW:e.HDW3,min:1.278},A={c:10503,dir:n.H,stretch:[8872,61,8658],HDW:e.HDW3,min:1.278};e.delimiters={40:{dir:n.V,sizes:e.VSIZES,stretch:[9115,9116,9117],HDW:[.85,.349,.875]},41:{dir:n.V,sizes:e.VSIZES,stretch:[9118,9119,9120],HDW:[.85,.349,.875]},45:g,47:o,61:{dir:n.H,sizes:[.778],stretch:[0,61],HDW:e.HDW3},91:{dir:n.V,sizes:e.VSIZES,stretch:[9121,9122,9123],HDW:e.HDW2},92:{dir:n.V,sizes:e.VSIZES},93:{dir:n.V,sizes:e.VSIZES,stretch:[9124,9125,9126],HDW:e.HDW2},94:a,95:l,123:{dir:n.V,sizes:e.VSIZES,stretch:[9127,9130,9129,9128],HDW:[.85,.349,.889]},124:{dir:n.V,sizes:[1],stretch:[0,8739],HDW:[.75,.25,.333]},125:{dir:n.V,sizes:e.VSIZES,stretch:[9131,9130,9133,9132],HDW:[.85,.349,.889]},126:s,175:i,710:a,713:i,732:s,770:a,771:s,818:l,8211:l,8212:l,8213:l,8214:{dir:n.V,sizes:[.602,1],schar:[0,8741],variants:[1,0],stretch:[0,8741],HDW:[.602,0,.556]},8215:l,8254:i,8407:u,8592:c,8593:{dir:n.V,sizes:[.888],stretch:[8593,9168],HDW:[.6,0,.667]},8594:u,8595:{dir:n.V,sizes:[.888],stretch:[0,9168,8595],HDW:[.6,0,.667]},8596:p,8597:{dir:n.V,sizes:[1.044],stretch:[8593,9168,8595],HDW:e.HDW1},8606:{dir:n.H,sizes:[1],stretch:[8606,8722],HDW:e.HDW3},8608:{dir:n.H,sizes:[1],stretch:[0,8722,8608],HDW:e.HDW3},8612:h,8613:{dir:n.V,stretch:[8593,9168,8869],HDW:e.HDW1,min:1.555},8614:d,8615:{dir:n.V,stretch:[8868,9168,8595],HDW:e.HDW1,min:1.555},8624:{dir:n.V,sizes:[.722],stretch:[8624,9168],HDW:e.HDW1},8625:{dir:n.V,sizes:[.722],stretch:[8625,9168],HDW:e.HDW1},8636:{dir:n.H,sizes:[1],stretch:[8636,8722],HDW:e.HDW3},8637:{dir:n.H,sizes:[1],stretch:[8637,8722],HDW:e.HDW3},8638:{dir:n.V,sizes:[.888],stretch:[8638,9168],HDW:e.HDW1},8639:{dir:n.V,sizes:[.888],stretch:[8639,9168],HDW:e.HDW1},8640:{dir:n.H,sizes:[1],stretch:[0,8722,8640],HDW:e.HDW3},8641:{dir:n.H,sizes:[1],stretch:[0,8722,8641],HDW:e.HDW3},8642:{dir:n.V,sizes:[.888],stretch:[0,9168,8642],HDW:e.HDW1},8643:{dir:n.V,sizes:[.888],stretch:[0,9168,8643],HDW:e.HDW1},8656:f,8657:{dir:n.V,sizes:[.888],stretch:[8657,8214],HDW:[.599,0,.778]},8658:m,8659:{dir:n.V,sizes:[.888],stretch:[0,8214,8659],HDW:[.6,0,.778]},8660:y,8661:{dir:n.V,sizes:[1.044],stretch:[8657,8214,8659],HDW:[.75,.25,.778]},8666:{dir:n.H,sizes:[1],stretch:[8666,8801],HDW:[.464,-.036,.5]},8667:{dir:n.H,sizes:[1],stretch:[0,8801,8667],HDW:[.464,-.036,.5]},8722:g,8725:o,8730:{dir:n.V,sizes:e.VSIZES,stretch:[57345,57344,9143],fullExt:[.65,2.3],HDW:[.85,.35,1.056]},8739:b,8741:{dir:n.V,sizes:[1],stretch:[0,8741],HDW:[.627,.015,.556]},8968:{dir:n.V,sizes:e.VSIZES,stretch:[9121,9122],HDW:e.HDW2},8969:{dir:n.V,sizes:e.VSIZES,stretch:[9124,9125],HDW:e.HDW2},8970:{dir:n.V,sizes:e.VSIZES,stretch:[0,9122,9123],HDW:e.HDW2},8971:{dir:n.V,sizes:e.VSIZES,stretch:[0,9125,9126],HDW:e.HDW2},8978:v,8994:v,8995:_,9001:M,9002:O,9130:{dir:n.V,sizes:[.32],stretch:[9130,9130,9130],HDW:[.29,.015,.889]},9135:l,9136:{dir:n.V,sizes:[.989],stretch:[9127,9130,9133],HDW:[.75,.25,.889]},9137:{dir:n.V,sizes:[.989],stretch:[9131,9130,9129],HDW:[.75,.25,.889]},9140:{dir:n.H,stretch:[9484,8722,9488],HDW:e.HDW3,min:1},9141:{dir:n.H,stretch:[9492,8722,9496],HDW:e.HDW3,min:1},9168:{dir:n.V,sizes:[.602,1],schar:[0,8739],variants:[1,0],stretch:[0,8739],HDW:[.602,0,.333]},9180:v,9181:_,9182:S,9183:x,9184:{dir:n.H,stretch:[714,713,715],HDW:[.59,-.544,.5],min:1},9185:{dir:n.H,stretch:[715,713,714],HDW:[.59,-.544,.5],min:1},9472:l,10072:b,10216:M,10217:O,10222:{dir:n.V,sizes:[.989],stretch:[9127,9130,9129],HDW:[.75,.25,.889]},10223:{dir:n.V,sizes:[.989],stretch:[9131,9130,9133],HDW:[.75,.25,.889]},10229:c,10230:u,10231:p,10232:f,10233:m,10234:y,10235:h,10236:d,10237:E,10238:A,10502:E,10503:A,10574:{dir:n.H,stretch:[8636,8722,8640],HDW:e.HDW3,min:2},10575:{dir:n.V,stretch:[8638,9168,8642],HDW:e.HDW1,min:1.776},10576:{dir:n.H,stretch:[8637,8722,8641],HDW:e.HDW3,min:2},10577:{dir:n.V,stretch:[8639,9168,8643],HDW:e.HDW1,min:.5},10586:{dir:n.H,stretch:[8636,8722,8739],HDW:e.HDW3,min:1.278},10587:{dir:n.H,stretch:[8739,8722,8640],HDW:e.HDW3,min:1.278},10588:{dir:n.V,stretch:[8638,9168,8869],HDW:e.HDW1,min:1.556},10589:{dir:n.V,stretch:[8868,9168,8642],HDW:e.HDW1,min:1.556},10590:{dir:n.H,stretch:[8637,8722,8739],HDW:e.HDW3,min:1.278},10591:{dir:n.H,stretch:[8739,8722,8641],HDW:e.HDW3,min:1.278},10592:{dir:n.V,stretch:[8639,9168,8869],HDW:e.HDW1,min:1.776},10593:{dir:n.V,stretch:[8868,9168,8643],HDW:e.HDW1,min:1.776},12296:M,12297:O,65079:S,65080:x}},6001:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.doubleStruck=void 0,e.doubleStruck={}},3696:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.frakturBold=void 0,e.frakturBold={33:[.689,.012,.349],34:[.695,-.432,.254],38:[.696,.016,.871],39:[.695,-.436,.25],40:[.737,.186,.459],41:[.735,.187,.459],42:[.692,-.449,.328],43:[.598,.082,.893],44:[.107,.191,.328],45:[.275,-.236,.893],46:[.102,.015,.328],47:[.721,.182,.593],48:[.501,.012,.593],49:[.489,0,.593],50:[.491,0,.593],51:[.487,.193,.593],52:[.495,.196,.593],53:[.481,.19,.593],54:[.704,.012,.593],55:[.479,.197,.593],56:[.714,.005,.593],57:[.487,.195,.593],58:[.457,.012,.255],59:[.458,.19,.255],61:[.343,-.168,.582],63:[.697,.014,.428],91:[.74,.13,.257],93:[.738,.132,.257],94:[.734,-.452,.59],8216:[.708,-.411,.254],8217:[.692,-.394,.254],8260:[.721,.182,.593],58113:[.63,.027,.587],58114:[.693,.212,.394,{ic:.014}],58115:[.681,.219,.387],58116:[.473,.212,.593],58117:[.684,.027,.393],58120:[.679,.22,.981],58121:[.717,.137,.727]}},9587:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.fraktur=void 0,e.fraktur={33:[.689,.012,.296],34:[.695,-.432,.215],38:[.698,.011,.738],39:[.695,-.436,.212],40:[.737,.186,.389],41:[.735,.187,.389],42:[.692,-.449,.278],43:[.598,.082,.756],44:[.107,.191,.278],45:[.275,-.236,.756],46:[.102,.015,.278],47:[.721,.182,.502],48:[.492,.013,.502],49:[.468,0,.502],50:[.474,0,.502],51:[.473,.182,.502],52:[.476,.191,.502],53:[.458,.184,.502],54:[.7,.013,.502],55:[.468,.181,.502],56:[.705,.01,.502],57:[.469,.182,.502],58:[.457,.012,.216],59:[.458,.189,.216],61:[.368,-.132,.756],63:[.693,.011,.362],91:[.74,.13,.278],93:[.738,.131,.278],94:[.734,-.452,.5],8216:[.708,-.41,.215],8217:[.692,-.395,.215],8260:[.721,.182,.502],58112:[.683,.032,.497],58113:[.616,.03,.498],58114:[.68,.215,.333],58115:[.679,.224,.329],58116:[.471,.214,.503],58117:[.686,.02,.333],58118:[.577,.021,.334,{ic:.013}],58119:[.475,.022,.501,{ic:.013}]}},8348:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.italic=void 0,e.italic={33:[.716,0,.307,{ic:.073}],34:[.694,-.379,.514,{ic:.024}],35:[.694,.194,.818,{ic:.01}],37:[.75,.056,.818,{ic:.029}],38:[.716,.022,.767,{ic:.035}],39:[.694,-.379,.307,{ic:.07}],40:[.75,.25,.409,{ic:.108}],41:[.75,.25,.409],42:[.75,-.32,.511,{ic:.073}],43:[.557,.057,.767],44:[.121,.194,.307],45:[.251,-.18,.358],46:[.121,0,.307],47:[.716,.215,.778],48:[.665,.021,.511,{ic:.051}],49:[.666,0,.511],50:[.666,.022,.511,{ic:.04}],51:[.666,.022,.511,{ic:.051}],52:[.666,.194,.511],53:[.666,.022,.511,{ic:.056}],54:[.665,.022,.511,{ic:.054}],55:[.666,.022,.511,{ic:.123}],56:[.666,.021,.511,{ic:.042}],57:[.666,.022,.511,{ic:.042}],58:[.431,0,.307],59:[.431,.194,.307],61:[.367,-.133,.767],63:[.716,0,.511,{ic:.04}],64:[.705,.011,.767,{ic:.022}],91:[.75,.25,.307,{ic:.139}],93:[.75,.25,.307,{ic:.052}],94:[.694,-.527,.511,{ic:.017}],95:[-.025,.062,.511,{ic:.043}],126:[.318,-.208,.511,{ic:.06}],305:[.441,.01,.307,{ic:.033}],567:[.442,.204,.332],768:[.697,-.5,0],769:[.697,-.5,0,{ic:.039}],770:[.694,-.527,0,{ic:.017}],771:[.668,-.558,0,{ic:.06}],772:[.589,-.544,0,{ic:.054}],774:[.694,-.515,0,{ic:.062}],775:[.669,-.548,0],776:[.669,-.554,0,{ic:.045}],778:[.716,-.542,0],779:[.697,-.503,0,{ic:.065}],780:[.638,-.502,0,{ic:.029}],989:[.605,.085,.778],8211:[.285,-.248,.511,{ic:.043}],8212:[.285,-.248,1.022,{ic:.016}],8213:[.285,-.248,1.022,{ic:.016}],8215:[-.025,.062,.511,{ic:.043}],8216:[.694,-.379,.307,{ic:.055}],8217:[.694,-.379,.307,{ic:.07}],8220:[.694,-.379,.514,{ic:.092}],8221:[.694,-.379,.514,{ic:.024}],8260:[.716,.215,.778],8463:[.695,.013,.54,{ic:.022}],8710:[.716,0,.833,{sk:.167}],10744:[.716,.215,.778]}},1376:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.largeop=void 0,e.largeop={40:[1.15,.649,.597],41:[1.15,.649,.597],47:[1.15,.649,.811],91:[1.15,.649,.472],92:[1.15,.649,.811],93:[1.15,.649,.472],123:[1.15,.649,.667],125:[1.15,.649,.667],710:[.772,-.565,1],732:[.75,-.611,1],770:[.772,-.565,0],771:[.75,-.611,0],8214:[.602,0,.778],8260:[1.15,.649,.811],8593:[.6,0,.667],8595:[.6,0,.667],8657:[.599,0,.778],8659:[.6,0,.778],8719:[.95,.45,1.278],8720:[.95,.45,1.278],8721:[.95,.45,1.444],8730:[1.15,.65,1,{ic:.02}],8739:[.627,.015,.333],8741:[.627,.015,.556],8747:[1.36,.862,.556,{ic:.388}],8748:[1.36,.862,1.084,{ic:.388}],8749:[1.36,.862,1.592,{ic:.388}],8750:[1.36,.862,.556,{ic:.388}],8896:[.95,.45,1.111],8897:[.95,.45,1.111],8898:[.949,.45,1.111],8899:[.95,.449,1.111],8968:[1.15,.649,.528],8969:[1.15,.649,.528],8970:[1.15,.649,.528],8971:[1.15,.649,.528],9001:[1.15,.649,.611],9002:[1.15,.649,.611],9168:[.602,0,.667],10072:[.627,.015,.333],10216:[1.15,.649,.611],10217:[1.15,.649,.611],10752:[.949,.449,1.511],10753:[.949,.449,1.511],10754:[.949,.449,1.511],10756:[.95,.449,1.111],10758:[.95,.45,1.111],10764:[1.36,.862,2.168,{ic:.388}],12296:[1.15,.649,.611],12297:[1.15,.649,.611]}},1439:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.monospace=void 0,e.monospace={32:[0,0,.525],33:[.622,0,.525],34:[.623,-.333,.525],35:[.611,0,.525],36:[.694,.082,.525],37:[.694,.083,.525],38:[.622,.011,.525],39:[.611,-.287,.525],40:[.694,.082,.525],41:[.694,.082,.525],42:[.52,-.09,.525],43:[.531,-.081,.525],44:[.14,.139,.525],45:[.341,-.271,.525],46:[.14,0,.525],47:[.694,.083,.525],58:[.431,0,.525],59:[.431,.139,.525],60:[.557,-.055,.525],61:[.417,-.195,.525],62:[.557,-.055,.525],63:[.617,0,.525],64:[.617,.006,.525],91:[.694,.082,.525],92:[.694,.083,.525],93:[.694,.082,.525],94:[.611,-.46,.525],95:[-.025,.095,.525],96:[.681,-.357,.525],123:[.694,.083,.525],124:[.694,.082,.525],125:[.694,.083,.525],126:[.611,-.466,.525],127:[.612,-.519,.525],160:[0,0,.525],305:[.431,0,.525],567:[.431,.228,.525],697:[.623,-.334,.525],768:[.611,-.485,0],769:[.611,-.485,0],770:[.611,-.46,0],771:[.611,-.466,0],772:[.577,-.5,0],774:[.611,-.504,0],776:[.612,-.519,0],778:[.619,-.499,0],780:[.577,-.449,0],913:[.623,0,.525],914:[.611,0,.525],915:[.611,0,.525],916:[.623,0,.525],917:[.611,0,.525],918:[.611,0,.525],919:[.611,0,.525],920:[.621,.01,.525],921:[.611,0,.525],922:[.611,0,.525],923:[.623,0,.525],924:[.611,0,.525],925:[.611,0,.525],926:[.611,0,.525],927:[.621,.01,.525],928:[.611,0,.525],929:[.611,0,.525],931:[.611,0,.525],932:[.611,0,.525],933:[.622,0,.525],934:[.611,0,.525],935:[.611,0,.525],936:[.611,0,.525],937:[.622,0,.525],8215:[-.025,.095,.525],8242:[.623,-.334,.525],8243:[.623,0,1.05],8244:[.623,0,1.575],8260:[.694,.083,.525],8279:[.623,0,2.1],8710:[.623,0,.525]}},331:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.normal=void 0,e.normal={32:[0,0,.25],33:[.716,0,.278],34:[.694,-.379,.5],35:[.694,.194,.833],36:[.75,.056,.5],37:[.75,.056,.833],38:[.716,.022,.778],39:[.694,-.379,.278],40:[.75,.25,.389],41:[.75,.25,.389],42:[.75,-.32,.5],43:[.583,.082,.778],44:[.121,.194,.278],45:[.252,-.179,.333],46:[.12,0,.278],47:[.75,.25,.5],48:[.666,.022,.5],49:[.666,0,.5],50:[.666,0,.5],51:[.665,.022,.5],52:[.677,0,.5],53:[.666,.022,.5],54:[.666,.022,.5],55:[.676,.022,.5],56:[.666,.022,.5],57:[.666,.022,.5],58:[.43,0,.278],59:[.43,.194,.278],60:[.54,.04,.778],61:[.583,.082,.778],62:[.54,.04,.778],63:[.705,0,.472],64:[.705,.011,.778],65:[.716,0,.75],66:[.683,0,.708],67:[.705,.021,.722],68:[.683,0,.764],69:[.68,0,.681],70:[.68,0,.653],71:[.705,.022,.785],72:[.683,0,.75],73:[.683,0,.361],74:[.683,.022,.514],75:[.683,0,.778],76:[.683,0,.625],77:[.683,0,.917],78:[.683,0,.75],79:[.705,.022,.778],80:[.683,0,.681],81:[.705,.193,.778],82:[.683,.022,.736],83:[.705,.022,.556],84:[.677,0,.722],85:[.683,.022,.75],86:[.683,.022,.75],87:[.683,.022,1.028],88:[.683,0,.75],89:[.683,0,.75],90:[.683,0,.611],91:[.75,.25,.278],92:[.75,.25,.5],93:[.75,.25,.278],94:[.694,-.531,.5],95:[-.025,.062,.5],96:[.699,-.505,.5],97:[.448,.011,.5],98:[.694,.011,.556],99:[.448,.011,.444],100:[.694,.011,.556],101:[.448,.011,.444],102:[.705,0,.306,{ic:.066}],103:[.453,.206,.5],104:[.694,0,.556],105:[.669,0,.278],106:[.669,.205,.306],107:[.694,0,.528],108:[.694,0,.278],109:[.442,0,.833],110:[.442,0,.556],111:[.448,.01,.5],112:[.442,.194,.556],113:[.442,.194,.528],114:[.442,0,.392],115:[.448,.011,.394],116:[.615,.01,.389],117:[.442,.011,.556],118:[.431,.011,.528],119:[.431,.011,.722],120:[.431,0,.528],121:[.431,.204,.528],122:[.431,0,.444],123:[.75,.25,.5],124:[.75,.249,.278],125:[.75,.25,.5],126:[.318,-.215,.5],160:[0,0,.25],163:[.714,.011,.769],165:[.683,0,.75],168:[.669,-.554,.5],172:[.356,-.089,.667],174:[.709,.175,.947],175:[.59,-.544,.5],176:[.715,-.542,.5],177:[.666,0,.778],180:[.699,-.505,.5],183:[.31,-.19,.278],215:[.491,-.009,.778],240:[.749,.021,.556],247:[.537,.036,.778],305:[.442,0,.278,{sk:.0278}],567:[.442,.205,.306,{sk:.0833}],697:[.56,-.043,.275],710:[.694,-.531,.5],711:[.644,-.513,.5],713:[.59,-.544,.5],714:[.699,-.505,.5],715:[.699,-.505,.5],728:[.694,-.515,.5],729:[.669,-.549,.5],730:[.715,-.542,.5],732:[.668,-.565,.5],768:[.699,-.505,0],769:[.699,-.505,0],770:[.694,-.531,0],771:[.668,-.565,0],772:[.59,-.544,0],774:[.694,-.515,0],775:[.669,-.549,0],776:[.669,-.554,0],778:[.715,-.542,0],779:[.701,-.51,0],780:[.644,-.513,0],824:[.716,.215,0],913:[.716,0,.75],914:[.683,0,.708],915:[.68,0,.625],916:[.716,0,.833],917:[.68,0,.681],918:[.683,0,.611],919:[.683,0,.75],920:[.705,.022,.778],921:[.683,0,.361],922:[.683,0,.778],923:[.716,0,.694],924:[.683,0,.917],925:[.683,0,.75],926:[.677,0,.667],927:[.705,.022,.778],928:[.68,0,.75],929:[.683,0,.681],931:[.683,0,.722],932:[.677,0,.722],933:[.705,0,.778],934:[.683,0,.722],935:[.683,0,.75],936:[.683,0,.778],937:[.704,0,.722],8192:[0,0,.5],8193:[0,0,1],8194:[0,0,.5],8195:[0,0,1],8196:[0,0,.333],8197:[0,0,.25],8198:[0,0,.167],8201:[0,0,.167],8202:[0,0,.1],8203:[0,0,0],8204:[0,0,0],8211:[.285,-.248,.5],8212:[.285,-.248,1],8213:[.285,-.248,1],8214:[.75,.25,.5],8215:[-.025,.062,.5],8216:[.694,-.379,.278],8217:[.694,-.379,.278],8220:[.694,-.379,.5],8221:[.694,-.379,.5],8224:[.705,.216,.444],8225:[.705,.205,.444],8226:[.444,-.055,.5],8230:[.12,0,1.172],8242:[.56,-.043,.275],8243:[.56,0,.55],8244:[.56,0,.825],8245:[.56,-.043,.275],8246:[.56,0,.55],8247:[.56,0,.825],8254:[.59,-.544,.5],8260:[.75,.25,.5],8279:[.56,0,1.1],8288:[0,0,0],8289:[0,0,0],8290:[0,0,0],8291:[0,0,0],8292:[0,0,0],8407:[.714,-.516,.5],8450:[.702,.019,.722],8459:[.717,.036,.969,{ic:.272,sk:.333}],8460:[.666,.133,.72],8461:[.683,0,.778],8462:[.694,.011,.576,{sk:-.0278}],8463:[.695,.013,.54,{ic:.022}],8464:[.717,.017,.809,{ic:.137,sk:.333}],8465:[.686,.026,.554],8466:[.717,.017,.874,{ic:.161,sk:.306}],8467:[.705,.02,.417,{sk:.111}],8469:[.683,.02,.722],8472:[.453,.216,.636,{sk:.111}],8473:[.683,0,.611],8474:[.701,.181,.778],8475:[.717,.017,.85,{ic:.037,sk:.194}],8476:[.686,.026,.828],8477:[.683,0,.722],8484:[.683,0,.667],8486:[.704,0,.722],8487:[.684,.022,.722],8488:[.729,.139,.602],8492:[.708,.028,.908,{ic:.02,sk:.194}],8493:[.685,.024,.613],8496:[.707,.008,.562,{ic:.156,sk:.139}],8497:[.735,.036,.895,{ic:.095,sk:.222}],8498:[.695,0,.556],8499:[.721,.05,1.08,{ic:.136,sk:.444}],8501:[.694,0,.611],8502:[.763,.021,.667,{ic:.02}],8503:[.764,.043,.444],8504:[.764,.043,.667],8513:[.705,.023,.639],8592:[.511,.011,1],8593:[.694,.193,.5],8594:[.511,.011,1],8595:[.694,.194,.5],8596:[.511,.011,1],8597:[.772,.272,.5],8598:[.72,.195,1],8599:[.72,.195,1],8600:[.695,.22,1],8601:[.695,.22,1],8602:[.437,-.06,1],8603:[.437,-.06,1],8606:[.417,-.083,1],8608:[.417,-.083,1],8610:[.417,-.083,1.111],8611:[.417,-.083,1.111],8614:[.511,.011,1],8617:[.511,.011,1.126],8618:[.511,.011,1.126],8619:[.575,.041,1],8620:[.575,.041,1],8621:[.417,-.083,1.389],8622:[.437,-.06,1],8624:[.722,0,.5],8625:[.722,0,.5],8630:[.461,0,1],8631:[.46,0,1],8634:[.65,.083,.778],8635:[.65,.083,.778],8636:[.511,-.23,1],8637:[.27,.011,1],8638:[.694,.194,.417],8639:[.694,.194,.417],8640:[.511,-.23,1],8641:[.27,.011,1],8642:[.694,.194,.417],8643:[.694,.194,.417],8644:[.667,0,1],8646:[.667,0,1],8647:[.583,.083,1],8648:[.694,.193,.833],8649:[.583,.083,1],8650:[.694,.194,.833],8651:[.514,.014,1],8652:[.671,.011,1],8653:[.534,.035,1],8654:[.534,.037,1],8655:[.534,.035,1],8656:[.525,.024,1],8657:[.694,.194,.611],8658:[.525,.024,1],8659:[.694,.194,.611],8660:[.526,.025,1],8661:[.772,.272,.611],8666:[.611,.111,1],8667:[.611,.111,1],8669:[.417,-.083,1],8672:[.437,-.064,1.334],8674:[.437,-.064,1.334],8704:[.694,.022,.556],8705:[.846,.021,.5],8706:[.715,.022,.531,{ic:.035,sk:.0833}],8707:[.694,0,.556],8708:[.716,.215,.556],8709:[.772,.078,.5],8710:[.716,0,.833],8711:[.683,.033,.833],8712:[.54,.04,.667],8713:[.716,.215,.667],8715:[.54,.04,.667],8716:[.716,.215,.667],8717:[.44,0,.429,{ic:.027}],8719:[.75,.25,.944],8720:[.75,.25,.944],8721:[.75,.25,1.056],8722:[.583,.082,.778],8723:[.5,.166,.778],8724:[.766,.093,.778],8725:[.75,.25,.5],8726:[.75,.25,.5],8727:[.465,-.035,.5],8728:[.444,-.055,.5],8729:[.444,-.055,.5],8730:[.8,.2,.833,{ic:.02}],8733:[.442,.011,.778],8734:[.442,.011,1],8736:[.694,0,.722],8737:[.714,.02,.722],8738:[.551,.051,.722],8739:[.75,.249,.278],8740:[.75,.252,.278,{ic:.019}],8741:[.75,.25,.5],8742:[.75,.25,.5,{ic:.018}],8743:[.598,.022,.667],8744:[.598,.022,.667],8745:[.598,.022,.667],8746:[.598,.022,.667],8747:[.716,.216,.417,{ic:.055}],8748:[.805,.306,.819,{ic:.138}],8749:[.805,.306,1.166,{ic:.138}],8750:[.805,.306,.472,{ic:.138}],8756:[.471,.082,.667],8757:[.471,.082,.667],8764:[.367,-.133,.778],8765:[.367,-.133,.778],8768:[.583,.083,.278],8769:[.467,-.032,.778],8770:[.463,-.034,.778],8771:[.464,-.036,.778],8772:[.716,.215,.778],8773:[.589,-.022,.778],8775:[.652,.155,.778],8776:[.483,-.055,.778],8777:[.716,.215,.778],8778:[.579,.039,.778],8781:[.484,-.016,.778],8782:[.492,-.008,.778],8783:[.492,-.133,.778],8784:[.67,-.133,.778],8785:[.609,.108,.778],8786:[.601,.101,.778],8787:[.601,.102,.778],8790:[.367,-.133,.778],8791:[.721,-.133,.778],8796:[.859,-.133,.778],8800:[.716,.215,.778],8801:[.464,-.036,.778],8802:[.716,.215,.778],8804:[.636,.138,.778],8805:[.636,.138,.778],8806:[.753,.175,.778],8807:[.753,.175,.778],8808:[.752,.286,.778],8809:[.752,.286,.778],8810:[.568,.067,1],8811:[.567,.067,1],8812:[.75,.25,.5],8813:[.716,.215,.778],8814:[.708,.209,.778],8815:[.708,.209,.778],8816:[.801,.303,.778],8817:[.801,.303,.778],8818:[.732,.228,.778],8819:[.732,.228,.778],8820:[.732,.228,.778],8821:[.732,.228,.778],8822:[.681,.253,.778],8823:[.681,.253,.778],8824:[.716,.253,.778],8825:[.716,.253,.778],8826:[.539,.041,.778],8827:[.539,.041,.778],8828:[.58,.153,.778],8829:[.58,.154,.778],8830:[.732,.228,.778],8831:[.732,.228,.778],8832:[.705,.208,.778],8833:[.705,.208,.778],8834:[.54,.04,.778],8835:[.54,.04,.778],8836:[.716,.215,.778],8837:[.716,.215,.778],8838:[.636,.138,.778],8839:[.636,.138,.778],8840:[.801,.303,.778],8841:[.801,.303,.778],8842:[.635,.241,.778],8843:[.635,.241,.778],8846:[.598,.022,.667],8847:[.539,.041,.778],8848:[.539,.041,.778],8849:[.636,.138,.778],8850:[.636,.138,.778],8851:[.598,0,.667],8852:[.598,0,.667],8853:[.583,.083,.778],8854:[.583,.083,.778],8855:[.583,.083,.778],8856:[.583,.083,.778],8857:[.583,.083,.778],8858:[.582,.082,.778],8859:[.582,.082,.778],8861:[.582,.082,.778],8862:[.689,0,.778],8863:[.689,0,.778],8864:[.689,0,.778],8865:[.689,0,.778],8866:[.694,0,.611],8867:[.694,0,.611],8868:[.668,0,.778],8869:[.668,0,.778],8872:[.75,.249,.867],8873:[.694,0,.722],8874:[.694,0,.889],8876:[.695,0,.611],8877:[.695,0,.611],8878:[.695,0,.722],8879:[.695,0,.722],8882:[.539,.041,.778],8883:[.539,.041,.778],8884:[.636,.138,.778],8885:[.636,.138,.778],8888:[.408,-.092,1.111],8890:[.431,.212,.556],8891:[.716,0,.611],8892:[.716,0,.611],8896:[.75,.249,.833],8897:[.75,.249,.833],8898:[.75,.249,.833],8899:[.75,.249,.833],8900:[.488,-.012,.5],8901:[.31,-.19,.278],8902:[.486,-.016,.5],8903:[.545,.044,.778],8904:[.505,.005,.9],8905:[.492,-.008,.778],8906:[.492,-.008,.778],8907:[.694,.022,.778],8908:[.694,.022,.778],8909:[.464,-.036,.778],8910:[.578,.021,.76],8911:[.578,.022,.76],8912:[.54,.04,.778],8913:[.54,.04,.778],8914:[.598,.022,.667],8915:[.598,.022,.667],8916:[.736,.022,.667],8918:[.541,.041,.778],8919:[.541,.041,.778],8920:[.568,.067,1.333],8921:[.568,.067,1.333],8922:[.886,.386,.778],8923:[.886,.386,.778],8926:[.734,0,.778],8927:[.734,0,.778],8928:[.801,.303,.778],8929:[.801,.303,.778],8930:[.716,.215,.778],8931:[.716,.215,.778],8934:[.73,.359,.778],8935:[.73,.359,.778],8936:[.73,.359,.778],8937:[.73,.359,.778],8938:[.706,.208,.778],8939:[.706,.208,.778],8940:[.802,.303,.778],8941:[.801,.303,.778],8942:[1.3,.03,.278],8943:[.31,-.19,1.172],8945:[1.52,-.1,1.282],8965:[.716,0,.611],8966:[.813,.097,.611],8968:[.75,.25,.444],8969:[.75,.25,.444],8970:[.75,.25,.444],8971:[.75,.25,.444],8988:[.694,-.306,.5],8989:[.694,-.306,.5],8990:[.366,.022,.5],8991:[.366,.022,.5],8994:[.388,-.122,1],8995:[.378,-.134,1],9001:[.75,.25,.389],9002:[.75,.25,.389],9136:[.744,.244,.412],9137:[.744,.244,.412],9168:[.602,0,.667],9416:[.709,.175,.902],9484:[.694,-.306,.5],9488:[.694,-.306,.5],9492:[.366,.022,.5],9496:[.366,.022,.5],9585:[.694,.195,.889],9586:[.694,.195,.889],9632:[.689,0,.778],9633:[.689,0,.778],9642:[.689,0,.778],9650:[.575,.02,.722],9651:[.716,0,.889],9652:[.575,.02,.722],9653:[.716,0,.889],9654:[.539,.041,.778],9656:[.539,.041,.778],9657:[.505,.005,.5],9660:[.576,.019,.722],9661:[.5,.215,.889],9662:[.576,.019,.722],9663:[.5,.215,.889],9664:[.539,.041,.778],9666:[.539,.041,.778],9667:[.505,.005,.5],9674:[.716,.132,.667],9711:[.715,.215,1],9723:[.689,0,.778],9724:[.689,0,.778],9733:[.694,.111,.944],9824:[.727,.13,.778],9825:[.716,.033,.778],9826:[.727,.162,.778],9827:[.726,.13,.778],9837:[.75,.022,.389],9838:[.734,.223,.389],9839:[.723,.223,.389],10003:[.706,.034,.833],10016:[.716,.022,.833],10072:[.75,.249,.278],10216:[.75,.25,.389],10217:[.75,.25,.389],10222:[.744,.244,.412],10223:[.744,.244,.412],10229:[.511,.011,1.609],10230:[.511,.011,1.638],10231:[.511,.011,1.859],10232:[.525,.024,1.609],10233:[.525,.024,1.638],10234:[.525,.024,1.858],10236:[.511,.011,1.638],10731:[.716,.132,.667],10744:[.716,.215,.778],10752:[.75,.25,1.111],10753:[.75,.25,1.111],10754:[.75,.25,1.111],10756:[.75,.249,.833],10758:[.75,.249,.833],10764:[.805,.306,1.638,{ic:.138}],10799:[.491,-.009,.778],10815:[.683,0,.75],10846:[.813,.097,.611],10877:[.636,.138,.778],10878:[.636,.138,.778],10885:[.762,.29,.778],10886:[.762,.29,.778],10887:[.635,.241,.778],10888:[.635,.241,.778],10889:[.761,.387,.778],10890:[.761,.387,.778],10891:[1.003,.463,.778],10892:[1.003,.463,.778],10901:[.636,.138,.778],10902:[.636,.138,.778],10927:[.636,.138,.778],10928:[.636,.138,.778],10933:[.752,.286,.778],10934:[.752,.286,.778],10935:[.761,.294,.778],10936:[.761,.294,.778],10937:[.761,.337,.778],10938:[.761,.337,.778],10949:[.753,.215,.778],10950:[.753,.215,.778],10955:[.783,.385,.778],10956:[.783,.385,.778],12296:[.75,.25,.389],12297:[.75,.25,.389],57350:[.43,.023,.222,{ic:.018}],57351:[.431,.024,.389,{ic:.018}],57352:[.605,.085,.778],57353:[.434,.006,.667,{ic:.067}],57356:[.752,.284,.778],57357:[.752,.284,.778],57358:[.919,.421,.778],57359:[.801,.303,.778],57360:[.801,.303,.778],57361:[.919,.421,.778],57366:[.828,.33,.778],57367:[.752,.332,.778],57368:[.828,.33,.778],57369:[.752,.333,.778],57370:[.634,.255,.778],57371:[.634,.254,.778],119808:[.698,0,.869],119809:[.686,0,.818],119810:[.697,.011,.831],119811:[.686,0,.882],119812:[.68,0,.756],119813:[.68,0,.724],119814:[.697,.01,.904],119815:[.686,0,.9],119816:[.686,0,.436],119817:[.686,.011,.594],119818:[.686,0,.901],119819:[.686,0,.692],119820:[.686,0,1.092],119821:[.686,0,.9],119822:[.696,.01,.864],119823:[.686,0,.786],119824:[.696,.193,.864],119825:[.686,.011,.862],119826:[.697,.011,.639],119827:[.675,0,.8],119828:[.686,.011,.885],119829:[.686,.007,.869],119830:[.686,.007,1.189],119831:[.686,0,.869],119832:[.686,0,.869],119833:[.686,0,.703],119834:[.453,.006,.559],119835:[.694,.006,.639],119836:[.453,.006,.511],119837:[.694,.006,.639],119838:[.452,.006,.527],119839:[.7,0,.351,{ic:.101}],119840:[.455,.201,.575],119841:[.694,0,.639],119842:[.695,0,.319],119843:[.695,.2,.351],119844:[.694,0,.607],119845:[.694,0,.319],119846:[.45,0,.958],119847:[.45,0,.639],119848:[.452,.005,.575],119849:[.45,.194,.639],119850:[.45,.194,.607],119851:[.45,0,.474],119852:[.453,.006,.454],119853:[.635,.005,.447],119854:[.45,.006,.639],119855:[.444,0,.607],119856:[.444,0,.831],119857:[.444,0,.607],119858:[.444,.2,.607],119859:[.444,0,.511],119860:[.716,0,.75,{sk:.139}],119861:[.683,0,.759,{sk:.0833}],119862:[.705,.022,.715,{ic:.045,sk:.0833}],119863:[.683,0,.828,{sk:.0556}],119864:[.68,0,.738,{ic:.026,sk:.0833}],119865:[.68,0,.643,{ic:.106,sk:.0833}],119866:[.705,.022,.786,{sk:.0833}],119867:[.683,0,.831,{ic:.057,sk:.0556}],119868:[.683,0,.44,{ic:.064,sk:.111}],119869:[.683,.022,.555,{ic:.078,sk:.167}],119870:[.683,0,.849,{ic:.04,sk:.0556}],119871:[.683,0,.681,{sk:.0278}],119872:[.683,0,.97,{ic:.081,sk:.0833}],119873:[.683,0,.803,{ic:.085,sk:.0833}],119874:[.704,.022,.763,{sk:.0833}],119875:[.683,0,.642,{ic:.109,sk:.0833}],119876:[.704,.194,.791,{sk:.0833}],119877:[.683,.021,.759,{sk:.0833}],119878:[.705,.022,.613,{ic:.032,sk:.0833}],119879:[.677,0,.584,{ic:.12,sk:.0833}],119880:[.683,.022,.683,{ic:.084,sk:.0278}],119881:[.683,.022,.583,{ic:.186}],119882:[.683,.022,.944,{ic:.104}],119883:[.683,0,.828,{ic:.024,sk:.0833}],119884:[.683,0,.581,{ic:.182}],119885:[.683,0,.683,{ic:.04,sk:.0833}],119886:[.441,.01,.529],119887:[.694,.011,.429],119888:[.442,.011,.433,{sk:.0556}],119889:[.694,.01,.52,{sk:.167}],119890:[.442,.011,.466,{sk:.0556}],119891:[.705,.205,.49,{ic:.06,sk:.167}],119892:[.442,.205,.477,{sk:.0278}],119894:[.661,.011,.345],119895:[.661,.204,.412],119896:[.694,.011,.521],119897:[.694,.011,.298,{sk:.0833}],119898:[.442,.011,.878],119899:[.442,.011,.6],119900:[.441,.011,.485,{sk:.0556}],119901:[.442,.194,.503,{sk:.0833}],119902:[.442,.194,.446,{ic:.014,sk:.0833}],119903:[.442,.011,.451,{sk:.0556}],119904:[.442,.01,.469,{sk:.0556}],119905:[.626,.011,.361,{sk:.0833}],119906:[.442,.011,.572,{sk:.0278}],119907:[.443,.011,.485,{sk:.0278}],119908:[.443,.011,.716,{sk:.0833}],119909:[.442,.011,.572,{sk:.0278}],119910:[.442,.205,.49,{sk:.0556}],119911:[.442,.011,.465,{sk:.0556}],119912:[.711,0,.869,{sk:.16}],119913:[.686,0,.866,{sk:.0958}],119914:[.703,.017,.817,{ic:.038,sk:.0958}],119915:[.686,0,.938,{sk:.0639}],119916:[.68,0,.81,{ic:.015,sk:.0958}],119917:[.68,0,.689,{ic:.12,sk:.0958}],119918:[.703,.016,.887,{sk:.0958}],119919:[.686,0,.982,{ic:.045,sk:.0639}],119920:[.686,0,.511,{ic:.062,sk:.128}],119921:[.686,.017,.631,{ic:.063,sk:.192}],119922:[.686,0,.971,{ic:.032,sk:.0639}],119923:[.686,0,.756,{sk:.0319}],119924:[.686,0,1.142,{ic:.077,sk:.0958}],119925:[.686,0,.95,{ic:.077,sk:.0958}],119926:[.703,.017,.837,{sk:.0958}],119927:[.686,0,.723,{ic:.124,sk:.0958}],119928:[.703,.194,.869,{sk:.0958}],119929:[.686,.017,.872,{sk:.0958}],119930:[.703,.017,.693,{ic:.021,sk:.0958}],119931:[.675,0,.637,{ic:.135,sk:.0958}],119932:[.686,.016,.8,{ic:.077,sk:.0319}],119933:[.686,.016,.678,{ic:.208}],119934:[.686,.017,1.093,{ic:.114}],119935:[.686,0,.947,{sk:.0958}],119936:[.686,0,.675,{ic:.201}],119937:[.686,0,.773,{ic:.032,sk:.0958}],119938:[.452,.008,.633],119939:[.694,.008,.521],119940:[.451,.008,.513,{sk:.0639}],119941:[.694,.008,.61,{sk:.192}],119942:[.452,.008,.554,{sk:.0639}],119943:[.701,.201,.568,{ic:.056,sk:.192}],119944:[.452,.202,.545,{sk:.0319}],119945:[.694,.008,.668,{sk:-.0319}],119946:[.694,.008,.405],119947:[.694,.202,.471],119948:[.694,.008,.604],119949:[.694,.008,.348,{sk:.0958}],119950:[.452,.008,1.032],119951:[.452,.008,.713],119952:[.452,.008,.585,{sk:.0639}],119953:[.452,.194,.601,{sk:.0958}],119954:[.452,.194,.542,{sk:.0958}],119955:[.452,.008,.529,{sk:.0639}],119956:[.451,.008,.531,{sk:.0639}],119957:[.643,.007,.415,{sk:.0958}],119958:[.452,.008,.681,{sk:.0319}],119959:[.453,.008,.567,{sk:.0319}],119960:[.453,.008,.831,{sk:.0958}],119961:[.452,.008,.659,{sk:.0319}],119962:[.452,.202,.59,{sk:.0639}],119963:[.452,.008,.555,{sk:.0639}],119964:[.717,.008,.803,{ic:.213,sk:.389}],119966:[.728,.026,.666,{ic:.153,sk:.278}],119967:[.708,.031,.774,{ic:.081,sk:.111}],119970:[.717,.037,.61,{ic:.128,sk:.25}],119973:[.717,.314,1.052,{ic:.081,sk:.417}],119974:[.717,.037,.914,{ic:.29,sk:.361}],119977:[.726,.036,.902,{ic:.306,sk:.389}],119978:[.707,.008,.738,{ic:.067,sk:.167}],119979:[.716,.037,1.013,{ic:.018,sk:.222}],119980:[.717,.017,.883,{sk:.278}],119982:[.708,.036,.868,{ic:.148,sk:.333}],119983:[.735,.037,.747,{ic:.249,sk:.222}],119984:[.717,.017,.8,{ic:.16,sk:.25}],119985:[.717,.017,.622,{ic:.228,sk:.222}],119986:[.717,.017,.805,{ic:.221,sk:.25}],119987:[.717,.017,.944,{ic:.187,sk:.278}],119988:[.716,.017,.71,{ic:.249,sk:.194}],119989:[.717,.016,.821,{ic:.211,sk:.306}],120068:[.696,.026,.718],120069:[.691,.027,.884],120071:[.685,.027,.832],120072:[.685,.024,.663],120073:[.686,.153,.611],120074:[.69,.026,.785],120077:[.686,.139,.552],120078:[.68,.027,.668,{ic:.014}],120079:[.686,.026,.666],120080:[.692,.027,1.05],120081:[.686,.025,.832],120082:[.729,.027,.827],120083:[.692,.218,.828],120084:[.729,.069,.827],120086:[.692,.027,.829],120087:[.701,.027,.669],120088:[.697,.027,.646,{ic:.019}],120089:[.686,.026,.831],120090:[.686,.027,1.046],120091:[.688,.027,.719],120092:[.686,.218,.833],120094:[.47,.035,.5],120095:[.685,.031,.513],120096:[.466,.029,.389],120097:[.609,.033,.499],120098:[.467,.03,.401],120099:[.681,.221,.326],120100:[.47,.209,.504],120101:[.688,.205,.521],120102:[.673,.02,.279],120103:[.672,.208,.281],120104:[.689,.025,.389],120105:[.685,.02,.28],120106:[.475,.026,.767],120107:[.475,.022,.527],120108:[.48,.028,.489],120109:[.541,.212,.5],120110:[.479,.219,.489],120111:[.474,.021,.389],120112:[.478,.029,.443],120113:[.64,.02,.333,{ic:.015}],120114:[.474,.023,.517],120115:[.53,.028,.512],120116:[.532,.028,.774],120117:[.472,.188,.389],120118:[.528,.218,.499],120119:[.471,.214,.391],120120:[.701,0,.722],120121:[.683,0,.667],120123:[.683,0,.722],120124:[.683,0,.667],120125:[.683,0,.611],120126:[.702,.019,.778],120128:[.683,0,.389],120129:[.683,.077,.5],120130:[.683,0,.778],120131:[.683,0,.667],120132:[.683,0,.944],120134:[.701,.019,.778],120138:[.702,.012,.556],120139:[.683,0,.667],120140:[.683,.019,.722],120141:[.683,.02,.722],120142:[.683,.019,1],120143:[.683,0,.722],120144:[.683,0,.722],120172:[.686,.031,.847],120173:[.684,.031,1.044],120174:[.676,.032,.723],120175:[.683,.029,.982],120176:[.686,.029,.783],120177:[.684,.146,.722],120178:[.687,.029,.927],120179:[.683,.126,.851],120180:[.681,.025,.655],120181:[.68,.141,.652],120182:[.681,.026,.789,{ic:.017}],120183:[.683,.028,.786],120184:[.683,.032,1.239],120185:[.679,.03,.983],120186:[.726,.03,.976],120187:[.688,.223,.977],120188:[.726,.083,.976],120189:[.688,.028,.978],120190:[.685,.031,.978],120191:[.686,.03,.79,{ic:.012}],120192:[.688,.039,.851,{ic:.02}],120193:[.685,.029,.982],120194:[.683,.03,1.235],120195:[.681,.035,.849],120196:[.688,.214,.984],120197:[.677,.148,.711],120198:[.472,.032,.603],120199:[.69,.032,.59],120200:[.473,.026,.464],120201:[.632,.028,.589],120202:[.471,.027,.472],120203:[.687,.222,.388],120204:[.472,.208,.595],120205:[.687,.207,.615],120206:[.686,.025,.331],120207:[.682,.203,.332],120208:[.682,.025,.464],120209:[.681,.024,.337],120210:[.476,.031,.921],120211:[.473,.028,.654],120212:[.482,.034,.609],120213:[.557,.207,.604],120214:[.485,.211,.596],120215:[.472,.026,.46],120216:[.479,.034,.523],120217:[.648,.027,.393,{ic:.014}],120218:[.472,.032,.589,{ic:.014}],120219:[.546,.027,.604],120220:[.549,.032,.918],120221:[.471,.188,.459],120222:[.557,.221,.589],120223:[.471,.214,.461],120224:[.694,0,.667],120225:[.694,0,.667],120226:[.705,.011,.639],120227:[.694,0,.722],120228:[.691,0,.597],120229:[.691,0,.569],120230:[.704,.011,.667],120231:[.694,0,.708],120232:[.694,0,.278],120233:[.694,.022,.472],120234:[.694,0,.694],120235:[.694,0,.542],120236:[.694,0,.875],120237:[.694,0,.708],120238:[.715,.022,.736],120239:[.694,0,.639],120240:[.715,.125,.736],120241:[.694,0,.646],120242:[.716,.022,.556],120243:[.688,0,.681],120244:[.694,.022,.688],120245:[.694,0,.667],120246:[.694,0,.944],120247:[.694,0,.667],120248:[.694,0,.667],120249:[.694,0,.611],120250:[.46,.01,.481],120251:[.694,.011,.517],120252:[.46,.01,.444],120253:[.694,.01,.517],120254:[.461,.01,.444],120255:[.705,0,.306,{ic:.041}],120256:[.455,.206,.5],120257:[.694,0,.517],120258:[.68,0,.239],120259:[.68,.205,.267],120260:[.694,0,.489],120261:[.694,0,.239],120262:[.455,0,.794],120263:[.455,0,.517],120264:[.46,.01,.5],120265:[.455,.194,.517],120266:[.455,.194,.517],120267:[.455,0,.342],120268:[.46,.01,.383],120269:[.571,.01,.361],120270:[.444,.01,.517],120271:[.444,0,.461],120272:[.444,0,.683],120273:[.444,0,.461],120274:[.444,.204,.461],120275:[.444,0,.435],120276:[.694,0,.733],120277:[.694,0,.733],120278:[.704,.011,.703],120279:[.694,0,.794],120280:[.691,0,.642],120281:[.691,0,.611],120282:[.705,.011,.733],120283:[.694,0,.794],120284:[.694,0,.331],120285:[.694,.022,.519],120286:[.694,0,.764],120287:[.694,0,.581],120288:[.694,0,.978],120289:[.694,0,.794],120290:[.716,.022,.794],120291:[.694,0,.703],120292:[.716,.106,.794],120293:[.694,0,.703],120294:[.716,.022,.611],120295:[.688,0,.733],120296:[.694,.022,.764],120297:[.694,0,.733],120298:[.694,0,1.039],120299:[.694,0,.733],120300:[.694,0,.733],120301:[.694,0,.672],120302:[.475,.011,.525],120303:[.694,.01,.561],120304:[.475,.011,.489],120305:[.694,.011,.561],120306:[.474,.01,.511],120307:[.705,0,.336,{ic:.045}],120308:[.469,.206,.55],120309:[.694,0,.561],120310:[.695,0,.256],120311:[.695,.205,.286],120312:[.694,0,.531],120313:[.694,0,.256],120314:[.469,0,.867],120315:[.468,0,.561],120316:[.474,.011,.55],120317:[.469,.194,.561],120318:[.469,.194,.561],120319:[.469,0,.372],120320:[.474,.01,.422],120321:[.589,.01,.404],120322:[.458,.011,.561],120323:[.458,0,.5],120324:[.458,0,.744],120325:[.458,0,.5],120326:[.458,.205,.5],120327:[.458,0,.476],120328:[.694,0,.667],120329:[.694,0,.667,{ic:.029}],120330:[.705,.01,.639,{ic:.08}],120331:[.694,0,.722,{ic:.025}],120332:[.691,0,.597,{ic:.091}],120333:[.691,0,.569,{ic:.104}],120334:[.705,.011,.667,{ic:.063}],120335:[.694,0,.708,{ic:.06}],120336:[.694,0,.278,{ic:.06}],120337:[.694,.022,.472,{ic:.063}],120338:[.694,0,.694,{ic:.091}],120339:[.694,0,.542],120340:[.694,0,.875,{ic:.054}],120341:[.694,0,.708,{ic:.058}],120342:[.716,.022,.736,{ic:.027}],120343:[.694,0,.639,{ic:.051}],120344:[.716,.125,.736,{ic:.027}],120345:[.694,0,.646,{ic:.052}],120346:[.716,.022,.556,{ic:.053}],120347:[.688,0,.681,{ic:.109}],120348:[.694,.022,.688,{ic:.059}],120349:[.694,0,.667,{ic:.132}],120350:[.694,0,.944,{ic:.132}],120351:[.694,0,.667,{ic:.091}],120352:[.694,0,.667,{ic:.143}],120353:[.694,0,.611,{ic:.091}],120354:[.461,.01,.481],120355:[.694,.011,.517,{ic:.022}],120356:[.46,.011,.444,{ic:.055}],120357:[.694,.01,.517,{ic:.071}],120358:[.46,.011,.444,{ic:.028}],120359:[.705,0,.306,{ic:.188}],120360:[.455,.206,.5,{ic:.068}],120361:[.694,0,.517],120362:[.68,0,.239,{ic:.076}],120363:[.68,.204,.267,{ic:.069}],120364:[.694,0,.489,{ic:.054}],120365:[.694,0,.239,{ic:.072}],120366:[.455,0,.794],120367:[.454,0,.517],120368:[.461,.011,.5,{ic:.023}],120369:[.455,.194,.517,{ic:.021}],120370:[.455,.194,.517,{ic:.021}],120371:[.455,0,.342,{ic:.082}],120372:[.461,.011,.383,{ic:.053}],120373:[.571,.011,.361,{ic:.049}],120374:[.444,.01,.517,{ic:.02}],120375:[.444,0,.461,{ic:.079}],120376:[.444,0,.683,{ic:.079}],120377:[.444,0,.461,{ic:.076}],120378:[.444,.205,.461,{ic:.079}],120379:[.444,0,.435,{ic:.059}],120432:[.623,0,.525],120433:[.611,0,.525],120434:[.622,.011,.525],120435:[.611,0,.525],120436:[.611,0,.525],120437:[.611,0,.525],120438:[.622,.011,.525],120439:[.611,0,.525],120440:[.611,0,.525],120441:[.611,.011,.525],120442:[.611,0,.525],120443:[.611,0,.525],120444:[.611,0,.525],120445:[.611,0,.525],120446:[.621,.01,.525],120447:[.611,0,.525],120448:[.621,.138,.525],120449:[.611,.011,.525],120450:[.622,.011,.525],120451:[.611,0,.525],120452:[.611,.011,.525],120453:[.611,.007,.525],120454:[.611,.007,.525],120455:[.611,0,.525],120456:[.611,0,.525],120457:[.611,0,.525],120458:[.439,.006,.525],120459:[.611,.006,.525],120460:[.44,.006,.525],120461:[.611,.006,.525],120462:[.44,.006,.525],120463:[.617,0,.525],120464:[.442,.229,.525],120465:[.611,0,.525],120466:[.612,0,.525],120467:[.612,.228,.525],120468:[.611,0,.525],120469:[.611,0,.525],120470:[.436,0,.525,{ic:.011}],120471:[.436,0,.525],120472:[.44,.006,.525],120473:[.437,.221,.525],120474:[.437,.221,.525,{ic:.02}],120475:[.437,0,.525],120476:[.44,.006,.525],120477:[.554,.006,.525],120478:[.431,.005,.525],120479:[.431,0,.525],120480:[.431,0,.525],120481:[.431,0,.525],120482:[.431,.228,.525],120483:[.431,0,.525],120488:[.698,0,.869],120489:[.686,0,.818],120490:[.68,0,.692],120491:[.698,0,.958],120492:[.68,0,.756],120493:[.686,0,.703],120494:[.686,0,.9],120495:[.696,.01,.894],120496:[.686,0,.436],120497:[.686,0,.901],120498:[.698,0,.806],120499:[.686,0,1.092],120500:[.686,0,.9],120501:[.675,0,.767],120502:[.696,.01,.864],120503:[.68,0,.9],120504:[.686,0,.786],120506:[.686,0,.831],120507:[.675,0,.8],120508:[.697,0,.894],120509:[.686,0,.831],120510:[.686,0,.869],120511:[.686,0,.894],120512:[.696,0,.831],120513:[.686,.024,.958],120546:[.716,0,.75,{sk:.139}],120547:[.683,0,.759,{sk:.0833}],120548:[.68,0,.615,{ic:.106,sk:.0833}],120549:[.716,0,.833,{sk:.167}],120550:[.68,0,.738,{ic:.026,sk:.0833}],120551:[.683,0,.683,{ic:.04,sk:.0833}],120552:[.683,0,.831,{ic:.057,sk:.0556}],120553:[.704,.022,.763,{sk:.0833}],120554:[.683,0,.44,{ic:.064,sk:.111}],120555:[.683,0,.849,{ic:.04,sk:.0556}],120556:[.716,0,.694,{sk:.167}],120557:[.683,0,.97,{ic:.081,sk:.0833}],120558:[.683,0,.803,{ic:.085,sk:.0833}],120559:[.677,0,.742,{ic:.035,sk:.0833}],120560:[.704,.022,.763,{sk:.0833}],120561:[.68,0,.831,{ic:.056,sk:.0556}],120562:[.683,0,.642,{ic:.109,sk:.0833}],120564:[.683,0,.78,{ic:.026,sk:.0833}],120565:[.677,0,.584,{ic:.12,sk:.0833}],120566:[.705,0,.583,{ic:.117,sk:.0556}],120567:[.683,0,.667,{sk:.0833}],120568:[.683,0,.828,{ic:.024,sk:.0833}],120569:[.683,0,.612,{ic:.08,sk:.0556}],120570:[.704,0,.772,{ic:.014,sk:.0833}],120572:[.442,.011,.64,{sk:.0278}],120573:[.705,.194,.566,{sk:.0833}],120574:[.441,.216,.518,{ic:.025}],120575:[.717,.01,.444,{sk:.0556}],120576:[.452,.022,.466,{sk:.0833}],120577:[.704,.204,.438,{ic:.033,sk:.0833}],120578:[.442,.216,.497,{sk:.0556}],120579:[.705,.01,.469,{sk:.0833}],120580:[.442,.01,.354,{sk:.0556}],120581:[.442,.011,.576],120582:[.694,.012,.583],120583:[.442,.216,.603,{sk:.0278}],120584:[.442,0,.494,{ic:.036,sk:.0278}],120585:[.704,.205,.438,{sk:.111}],120586:[.441,.011,.485,{sk:.0556}],120587:[.431,.011,.57],120588:[.442,.216,.517,{sk:.0833}],120589:[.442,.107,.363,{ic:.042,sk:.0833}],120590:[.431,.011,.571],120591:[.431,.013,.437,{ic:.08,sk:.0278}],120592:[.443,.01,.54,{sk:.0278}],120593:[.442,.218,.654,{sk:.0833}],120594:[.442,.204,.626,{sk:.0556}],120595:[.694,.205,.651,{sk:.111}],120596:[.443,.011,.622],120597:[.715,.022,.531,{ic:.035,sk:.0833}],120598:[.431,.011,.406,{sk:.0556}],120599:[.705,.011,.591,{sk:.0833}],120600:[.434,.006,.667,{ic:.067}],120601:[.694,.205,.596,{sk:.0833}],120602:[.442,.194,.517,{sk:.0833}],120603:[.431,.01,.828],120604:[.711,0,.869,{sk:.16}],120605:[.686,0,.866,{sk:.0958}],120606:[.68,0,.657,{ic:.12,sk:.0958}],120607:[.711,0,.958,{sk:.192}],120608:[.68,0,.81,{ic:.015,sk:.0958}],120609:[.686,0,.773,{ic:.032,sk:.0958}],120610:[.686,0,.982,{ic:.045,sk:.0639}],120611:[.702,.017,.867,{sk:.0958}],120612:[.686,0,.511,{ic:.062,sk:.128}],120613:[.686,0,.971,{ic:.032,sk:.0639}],120614:[.711,0,.806,{sk:.192}],120615:[.686,0,1.142,{ic:.077,sk:.0958}],120616:[.686,0,.95,{ic:.077,sk:.0958}],120617:[.675,0,.841,{ic:.026,sk:.0958}],120618:[.703,.017,.837,{sk:.0958}],120619:[.68,0,.982,{ic:.044,sk:.0639}],120620:[.686,0,.723,{ic:.124,sk:.0958}],120622:[.686,0,.885,{ic:.017,sk:.0958}],120623:[.675,0,.637,{ic:.135,sk:.0958}],120624:[.703,0,.671,{ic:.131,sk:.0639}],120625:[.686,0,.767,{sk:.0958}],120626:[.686,0,.947,{sk:.0958}],120627:[.686,0,.714,{ic:.076,sk:.0639}],120628:[.703,0,.879,{sk:.0958}],120630:[.452,.008,.761,{sk:.0319}],120631:[.701,.194,.66,{sk:.0958}],120632:[.451,.211,.59,{ic:.027}],120633:[.725,.008,.522,{sk:.0639}],120634:[.461,.017,.529,{sk:.0958}],120635:[.711,.202,.508,{ic:.013,sk:.0958}],120636:[.452,.211,.6,{sk:.0639}],120637:[.702,.008,.562,{sk:.0958}],120638:[.452,.008,.412,{sk:.0639}],120639:[.452,.008,.668],120640:[.694,.013,.671],120641:[.452,.211,.708,{sk:.0319}],120642:[.452,0,.577,{ic:.031,sk:.0319}],120643:[.711,.201,.508,{sk:.128}],120644:[.452,.008,.585,{sk:.0639}],120645:[.444,.008,.682],120646:[.451,.211,.612,{sk:.0958}],120647:[.451,.105,.424,{ic:.033,sk:.0958}],120648:[.444,.008,.686],120649:[.444,.013,.521,{ic:.089,sk:.0319}],120650:[.453,.008,.631,{sk:.0319}],120651:[.452,.216,.747,{sk:.0958}],120652:[.452,.201,.718,{sk:.0639}],120653:[.694,.202,.758,{sk:.128}],120654:[.453,.008,.718],120655:[.71,.017,.628,{ic:.029,sk:.0958}],120656:[.444,.007,.483,{sk:.0639}],120657:[.701,.008,.692,{sk:.0958}],120658:[.434,.006,.667,{ic:.067}],120659:[.694,.202,.712,{sk:.0958}],120660:[.451,.194,.612,{sk:.0958}],120661:[.444,.008,.975],120662:[.694,0,.733],120663:[.694,0,.733],120664:[.691,0,.581],120665:[.694,0,.917],120666:[.691,0,.642],120667:[.694,0,.672],120668:[.694,0,.794],120669:[.716,.022,.856],120670:[.694,0,.331],120671:[.694,0,.764],120672:[.694,0,.672],120673:[.694,0,.978],120674:[.694,0,.794],120675:[.688,0,.733],120676:[.716,.022,.794],120677:[.691,0,.794],120678:[.694,0,.703],120680:[.694,0,.794],120681:[.688,0,.733],120682:[.715,0,.856],120683:[.694,0,.794],120684:[.694,0,.733],120685:[.694,0,.856],120686:[.716,0,.794],120782:[.654,.01,.575],120783:[.655,0,.575],120784:[.654,0,.575],120785:[.655,.011,.575],120786:[.656,0,.575],120787:[.655,.011,.575],120788:[.655,.011,.575],120789:[.676,.011,.575],120790:[.654,.011,.575],120791:[.654,.011,.575],120802:[.678,.022,.5],120803:[.678,0,.5],120804:[.677,0,.5],120805:[.678,.022,.5],120806:[.656,0,.5],120807:[.656,.021,.5],120808:[.677,.022,.5],120809:[.656,.011,.5],120810:[.678,.022,.5],120811:[.677,.022,.5],120812:[.715,.022,.55],120813:[.716,0,.55],120814:[.716,0,.55],120815:[.716,.022,.55],120816:[.694,0,.55],120817:[.694,.022,.55],120818:[.716,.022,.55],120819:[.695,.011,.55],120820:[.715,.022,.55],120821:[.716,.022,.55],120822:[.621,.01,.525],120823:[.622,0,.525],120824:[.622,0,.525],120825:[.622,.011,.525],120826:[.624,0,.525],120827:[.611,.01,.525],120828:[.622,.011,.525],120829:[.627,.01,.525],120830:[.621,.01,.525],120831:[.622,.011,.525]}},4886:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.sansSerifBoldItalic=void 0,e.sansSerifBoldItalic={305:[.458,0,.256],567:[.458,.205,.286]}},4471:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.sansSerifBold=void 0,e.sansSerifBold={33:[.694,0,.367],34:[.694,-.442,.558],35:[.694,.193,.917],36:[.75,.056,.55],37:[.75,.056,1.029],38:[.716,.022,.831],39:[.694,-.442,.306],40:[.75,.249,.428],41:[.75,.25,.428],42:[.75,-.293,.55],43:[.617,.116,.856],44:[.146,.106,.306],45:[.273,-.186,.367],46:[.146,0,.306],47:[.75,.249,.55],58:[.458,0,.306],59:[.458,.106,.306],61:[.407,-.094,.856],63:[.705,0,.519],64:[.704,.011,.733],91:[.75,.25,.343],93:[.75,.25,.343],94:[.694,-.537,.55],95:[-.023,.11,.55],126:[.344,-.198,.55],305:[.458,0,.256],567:[.458,.205,.286],768:[.694,-.537,0],769:[.694,-.537,0],770:[.694,-.537,0],771:[.694,-.548,0],772:[.66,-.56,0],774:[.694,-.552,0],775:[.695,-.596,0],776:[.695,-.595,0],778:[.694,-.538,0],779:[.694,-.537,0],780:[.657,-.5,0],8211:[.327,-.24,.55],8212:[.327,-.24,1.1],8213:[.327,-.24,1.1],8215:[-.023,.11,.55],8216:[.694,-.443,.306],8217:[.694,-.442,.306],8220:[.694,-.443,.558],8221:[.694,-.442,.558],8260:[.75,.249,.55],8710:[.694,0,.917]}},5181:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.sansSerifItalic=void 0,e.sansSerifItalic={33:[.694,0,.319,{ic:.036}],34:[.694,-.471,.5],35:[.694,.194,.833,{ic:.018}],36:[.75,.056,.5,{ic:.065}],37:[.75,.056,.833],38:[.716,.022,.758],39:[.694,-.471,.278,{ic:.057}],40:[.75,.25,.389,{ic:.102}],41:[.75,.25,.389],42:[.75,-.306,.5,{ic:.068}],43:[.583,.083,.778],44:[.098,.125,.278],45:[.259,-.186,.333],46:[.098,0,.278],47:[.75,.25,.5,{ic:.1}],48:[.678,.022,.5,{ic:.049}],49:[.678,0,.5],50:[.678,0,.5,{ic:.051}],51:[.678,.022,.5,{ic:.044}],52:[.656,0,.5,{ic:.021}],53:[.656,.022,.5,{ic:.055}],54:[.678,.022,.5,{ic:.048}],55:[.656,.011,.5,{ic:.096}],56:[.678,.022,.5,{ic:.054}],57:[.677,.022,.5,{ic:.045}],58:[.444,0,.278],59:[.444,.125,.278],61:[.37,-.13,.778,{ic:.018}],63:[.704,0,.472,{ic:.064}],64:[.705,.01,.667,{ic:.04}],91:[.75,.25,.289,{ic:.136}],93:[.75,.25,.289,{ic:.064}],94:[.694,-.527,.5,{ic:.033}],95:[-.038,.114,.5,{ic:.065}],126:[.327,-.193,.5,{ic:.06}],305:[.444,0,.239,{ic:.019}],567:[.444,.204,.267,{ic:.019}],768:[.694,-.527,0],769:[.694,-.527,0,{ic:.063}],770:[.694,-.527,0,{ic:.033}],771:[.677,-.543,0,{ic:.06}],772:[.631,-.552,0,{ic:.064}],774:[.694,-.508,0,{ic:.073}],775:[.68,-.576,0],776:[.68,-.582,0,{ic:.04}],778:[.693,-.527,0],779:[.694,-.527,0,{ic:.063}],780:[.654,-.487,0,{ic:.06}],913:[.694,0,.667],914:[.694,0,.667,{ic:.029}],915:[.691,0,.542,{ic:.104}],916:[.694,0,.833],917:[.691,0,.597,{ic:.091}],918:[.694,0,.611,{ic:.091}],919:[.694,0,.708,{ic:.06}],920:[.715,.022,.778,{ic:.026}],921:[.694,0,.278,{ic:.06}],922:[.694,0,.694,{ic:.091}],923:[.694,0,.611],924:[.694,0,.875,{ic:.054}],925:[.694,0,.708,{ic:.058}],926:[.688,0,.667,{ic:.098}],927:[.716,.022,.736,{ic:.027}],928:[.691,0,.708,{ic:.06}],929:[.694,0,.639,{ic:.051}],931:[.694,0,.722,{ic:.091}],932:[.688,0,.681,{ic:.109}],933:[.716,0,.778,{ic:.065}],934:[.694,0,.722,{ic:.021}],935:[.694,0,.667,{ic:.091}],936:[.694,0,.778,{ic:.076}],937:[.716,0,.722,{ic:.047}],8211:[.312,-.236,.5,{ic:.065}],8212:[.312,-.236,1,{ic:.065}],8213:[.312,-.236,1,{ic:.065}],8215:[-.038,.114,.5,{ic:.065}],8216:[.694,-.471,.278,{ic:.058}],8217:[.694,-.471,.278,{ic:.057}],8220:[.694,-.471,.5,{ic:.114}],8221:[.694,-.471,.5],8260:[.75,.25,.5,{ic:.1}],8710:[.694,0,.833]}},3526:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.sansSerif=void 0,e.sansSerif={33:[.694,0,.319],34:[.694,-.471,.5],35:[.694,.194,.833],36:[.75,.056,.5],37:[.75,.056,.833],38:[.716,.022,.758],39:[.694,-.471,.278],40:[.75,.25,.389],41:[.75,.25,.389],42:[.75,-.306,.5],43:[.583,.082,.778],44:[.098,.125,.278],45:[.259,-.186,.333],46:[.098,0,.278],47:[.75,.25,.5],58:[.444,0,.278],59:[.444,.125,.278],61:[.37,-.13,.778],63:[.704,0,.472],64:[.704,.011,.667],91:[.75,.25,.289],93:[.75,.25,.289],94:[.694,-.527,.5],95:[-.038,.114,.5],126:[.327,-.193,.5],305:[.444,0,.239],567:[.444,.205,.267],768:[.694,-.527,0],769:[.694,-.527,0],770:[.694,-.527,0],771:[.677,-.543,0],772:[.631,-.552,0],774:[.694,-.508,0],775:[.68,-.576,0],776:[.68,-.582,0],778:[.694,-.527,0],779:[.694,-.527,0],780:[.654,-.487,0],913:[.694,0,.667],914:[.694,0,.667],915:[.691,0,.542],916:[.694,0,.833],917:[.691,0,.597],918:[.694,0,.611],919:[.694,0,.708],920:[.716,.021,.778],921:[.694,0,.278],922:[.694,0,.694],923:[.694,0,.611],924:[.694,0,.875],925:[.694,0,.708],926:[.688,0,.667],927:[.715,.022,.736],928:[.691,0,.708],929:[.694,0,.639],931:[.694,0,.722],932:[.688,0,.681],933:[.716,0,.778],934:[.694,0,.722],935:[.694,0,.667],936:[.694,0,.778],937:[.716,0,.722],8211:[.312,-.236,.5],8212:[.312,-.236,1],8213:[.312,-.236,1],8215:[-.038,.114,.5],8216:[.694,-.471,.278],8217:[.694,-.471,.278],8220:[.694,-.471,.5],8221:[.694,-.471,.5],8260:[.75,.25,.5],8710:[.694,0,.833]}},5649:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.scriptBold=void 0,e.scriptBold={}},7153:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.script=void 0,e.script={}},5745:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.smallop=void 0,e.smallop={40:[.85,.349,.458],41:[.85,.349,.458],47:[.85,.349,.578],91:[.85,.349,.417],92:[.85,.349,.578],93:[.85,.349,.417],123:[.85,.349,.583],125:[.85,.349,.583],710:[.744,-.551,.556],732:[.722,-.597,.556],770:[.744,-.551,0],771:[.722,-.597,0],8214:[.602,0,.778],8260:[.85,.349,.578],8593:[.6,0,.667],8595:[.6,0,.667],8657:[.599,0,.778],8659:[.6,0,.778],8719:[.75,.25,.944],8720:[.75,.25,.944],8721:[.75,.25,1.056],8730:[.85,.35,1,{ic:.02}],8739:[.627,.015,.333],8741:[.627,.015,.556],8747:[.805,.306,.472,{ic:.138}],8748:[.805,.306,.819,{ic:.138}],8749:[.805,.306,1.166,{ic:.138}],8750:[.805,.306,.472,{ic:.138}],8896:[.75,.249,.833],8897:[.75,.249,.833],8898:[.75,.249,.833],8899:[.75,.249,.833],8968:[.85,.349,.472],8969:[.85,.349,.472],8970:[.85,.349,.472],8971:[.85,.349,.472],9001:[.85,.35,.472],9002:[.85,.35,.472],9168:[.602,0,.667],10072:[.627,.015,.333],10216:[.85,.35,.472],10217:[.85,.35,.472],10752:[.75,.25,1.111],10753:[.75,.25,1.111],10754:[.75,.25,1.111],10756:[.75,.249,.833],10758:[.75,.249,.833],10764:[.805,.306,1.638,{ic:.138}],12296:[.85,.35,.472],12297:[.85,.35,.472]}},1411:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.texCalligraphicBold=void 0,e.texCalligraphicBold={65:[.751,.049,.921,{ic:.068,sk:.224}],66:[.705,.017,.748,{sk:.16}],67:[.703,.02,.613,{sk:.16}],68:[.686,0,.892,{sk:.0958}],69:[.703,.016,.607,{ic:.02,sk:.128}],70:[.686,.03,.814,{ic:.116,sk:.128}],71:[.703,.113,.682,{sk:.128}],72:[.686,.048,.987,{sk:.128}],73:[.686,0,.642,{ic:.104,sk:.0319}],74:[.686,.114,.779,{ic:.158,sk:.192}],75:[.703,.017,.871,{sk:.0639}],76:[.703,.017,.788,{sk:.16}],77:[.703,.049,1.378,{sk:.16}],78:[.84,.049,.937,{ic:.168,sk:.0958}],79:[.703,.017,.906,{sk:.128}],80:[.686,.067,.81,{ic:.036,sk:.0958}],81:[.703,.146,.939,{sk:.128}],82:[.686,.017,.99,{sk:.0958}],83:[.703,.016,.696,{ic:.025,sk:.16}],84:[.72,.069,.644,{ic:.303,sk:.0319}],85:[.686,.024,.715,{ic:.056,sk:.0958}],86:[.686,.077,.737,{ic:.037,sk:.0319}],87:[.686,.077,1.169,{ic:.037,sk:.0958}],88:[.686,0,.817,{ic:.089,sk:.16}],89:[.686,.164,.759,{ic:.038,sk:.0958}],90:[.686,0,.818,{ic:.035,sk:.16}],305:[.452,.008,.394,{sk:.0319}],567:[.451,.201,.439,{sk:.0958}]}},6384:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.texCalligraphic=void 0,e.texCalligraphic={65:[.728,.05,.798,{ic:.021,sk:.194}],66:[.705,.022,.657,{sk:.139}],67:[.705,.025,.527,{sk:.139}],68:[.683,0,.771,{sk:.0833}],69:[.705,.022,.528,{ic:.036,sk:.111}],70:[.683,.032,.719,{ic:.11,sk:.111}],71:[.704,.119,.595,{sk:.111}],72:[.683,.048,.845,{sk:.111}],73:[.683,0,.545,{ic:.097,sk:.0278}],74:[.683,.119,.678,{ic:.161,sk:.167}],75:[.705,.022,.762,{sk:.0556}],76:[.705,.022,.69,{sk:.139}],77:[.705,.05,1.201,{sk:.139}],78:[.789,.05,.82,{ic:.159,sk:.0833}],79:[.705,.022,.796,{sk:.111}],80:[.683,.057,.696,{ic:.037,sk:.0833}],81:[.705,.131,.817,{sk:.111}],82:[.682,.022,.848,{sk:.0833}],83:[.705,.022,.606,{ic:.036,sk:.139}],84:[.717,.068,.545,{ic:.288,sk:.0278}],85:[.683,.028,.626,{ic:.061,sk:.0833}],86:[.683,.052,.613,{ic:.045,sk:.0278}],87:[.683,.053,.988,{ic:.046,sk:.0833}],88:[.683,0,.713,{ic:.094,sk:.139}],89:[.683,.143,.668,{ic:.046,sk:.0833}],90:[.683,0,.725,{ic:.042,sk:.139}]}},6041:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.texMathit=void 0,e.texMathit={65:[.716,0,.743],66:[.683,0,.704],67:[.705,.021,.716],68:[.683,0,.755],69:[.68,0,.678],70:[.68,0,.653],71:[.705,.022,.774],72:[.683,0,.743],73:[.683,0,.386],74:[.683,.021,.525],75:[.683,0,.769],76:[.683,0,.627],77:[.683,0,.897],78:[.683,0,.743],79:[.704,.022,.767],80:[.683,0,.678],81:[.704,.194,.767],82:[.683,.022,.729],83:[.705,.022,.562],84:[.677,0,.716],85:[.683,.022,.743],86:[.683,.022,.743],87:[.683,.022,.999],88:[.683,0,.743],89:[.683,0,.743],90:[.683,0,.613],97:[.442,.011,.511],98:[.694,.011,.46],99:[.441,.01,.46],100:[.694,.011,.511],101:[.442,.01,.46],102:[.705,.204,.307],103:[.442,.205,.46],104:[.694,.011,.511],105:[.656,.01,.307],106:[.656,.204,.307],107:[.694,.011,.46],108:[.694,.011,.256],109:[.442,.011,.818],110:[.442,.011,.562],111:[.442,.011,.511],112:[.442,.194,.511],113:[.442,.194,.46],114:[.442,.011,.422],115:[.442,.011,.409],116:[.626,.011,.332],117:[.441,.011,.537],118:[.443,.01,.46],119:[.443,.011,.664],120:[.442,.011,.464],121:[.441,.205,.486],122:[.442,.011,.409]}},8199:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.texOldstyleBold=void 0,e.texOldstyleBold={48:[.46,.017,.575],49:[.461,0,.575],50:[.46,0,.575],51:[.461,.211,.575],52:[.469,.194,.575],53:[.461,.211,.575],54:[.66,.017,.575],55:[.476,.211,.575],56:[.661,.017,.575],57:[.461,.21,.575],65:[.751,.049,.921,{ic:.068,sk:.224}],66:[.705,.017,.748,{sk:.16}],67:[.703,.02,.613,{sk:.16}],68:[.686,0,.892,{sk:.0958}],69:[.703,.016,.607,{ic:.02,sk:.128}],70:[.686,.03,.814,{ic:.116,sk:.128}],71:[.703,.113,.682,{sk:.128}],72:[.686,.048,.987,{sk:.128}],73:[.686,0,.642,{ic:.104,sk:.0319}],74:[.686,.114,.779,{ic:.158,sk:.192}],75:[.703,.017,.871,{sk:.0639}],76:[.703,.017,.788,{sk:.16}],77:[.703,.049,1.378,{sk:.16}],78:[.84,.049,.937,{ic:.168,sk:.0958}],79:[.703,.017,.906,{sk:.128}],80:[.686,.067,.81,{ic:.036,sk:.0958}],81:[.703,.146,.939,{sk:.128}],82:[.686,.017,.99,{sk:.0958}],83:[.703,.016,.696,{ic:.025,sk:.16}],84:[.72,.069,.644,{ic:.303,sk:.0319}],85:[.686,.024,.715,{ic:.056,sk:.0958}],86:[.686,.077,.737,{ic:.037,sk:.0319}],87:[.686,.077,1.169,{ic:.037,sk:.0958}],88:[.686,0,.817,{ic:.089,sk:.16}],89:[.686,.164,.759,{ic:.038,sk:.0958}],90:[.686,0,.818,{ic:.035,sk:.16}]}},9848:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.texOldstyle=void 0,e.texOldstyle={48:[.452,.022,.5],49:[.453,0,.5],50:[.453,0,.5],51:[.452,.216,.5],52:[.464,.194,.5],53:[.453,.216,.5],54:[.665,.022,.5],55:[.463,.216,.5],56:[.666,.021,.5],57:[.453,.216,.5],65:[.728,.05,.798,{ic:.021,sk:.194}],66:[.705,.022,.657,{sk:.139}],67:[.705,.025,.527,{sk:.139}],68:[.683,0,.771,{sk:.0833}],69:[.705,.022,.528,{ic:.036,sk:.111}],70:[.683,.032,.719,{ic:.11,sk:.111}],71:[.704,.119,.595,{sk:.111}],72:[.683,.048,.845,{sk:.111}],73:[.683,0,.545,{ic:.097,sk:.0278}],74:[.683,.119,.678,{ic:.161,sk:.167}],75:[.705,.022,.762,{sk:.0556}],76:[.705,.022,.69,{sk:.139}],77:[.705,.05,1.201,{sk:.139}],78:[.789,.05,.82,{ic:.159,sk:.0833}],79:[.705,.022,.796,{sk:.111}],80:[.683,.057,.696,{ic:.037,sk:.0833}],81:[.705,.131,.817,{sk:.111}],82:[.682,.022,.848,{sk:.0833}],83:[.705,.022,.606,{ic:.036,sk:.139}],84:[.717,.068,.545,{ic:.288,sk:.0278}],85:[.683,.028,.626,{ic:.061,sk:.0833}],86:[.683,.052,.613,{ic:.045,sk:.0278}],87:[.683,.053,.988,{ic:.046,sk:.0833}],88:[.683,0,.713,{ic:.094,sk:.139}],89:[.683,.143,.668,{ic:.046,sk:.0833}],90:[.683,0,.725,{ic:.042,sk:.139}]}},7906:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.texSize3=void 0,e.texSize3={40:[1.45,.949,.736],41:[1.45,.949,.736],47:[1.45,.949,1.044],91:[1.45,.949,.528],92:[1.45,.949,1.044],93:[1.45,.949,.528],123:[1.45,.949,.75],125:[1.45,.949,.75],710:[.772,-.564,1.444],732:[.749,-.61,1.444],770:[.772,-.564,0],771:[.749,-.61,0],8260:[1.45,.949,1.044],8730:[1.45,.95,1,{ic:.02}],8968:[1.45,.949,.583],8969:[1.45,.949,.583],8970:[1.45,.949,.583],8971:[1.45,.949,.583],9001:[1.45,.95,.75],9002:[1.45,.949,.75],10216:[1.45,.95,.75],10217:[1.45,.949,.75],12296:[1.45,.95,.75],12297:[1.45,.949,.75]}},2644:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.texSize4=void 0,e.texSize4={40:[1.75,1.249,.792],41:[1.75,1.249,.792],47:[1.75,1.249,1.278],91:[1.75,1.249,.583],92:[1.75,1.249,1.278],93:[1.75,1.249,.583],123:[1.75,1.249,.806],125:[1.75,1.249,.806],710:[.845,-.561,1.889,{ic:.013}],732:[.823,-.583,1.889],770:[.845,-.561,0,{ic:.013}],771:[.823,-.583,0],8260:[1.75,1.249,1.278],8730:[1.75,1.25,1,{ic:.02}],8968:[1.75,1.249,.639],8969:[1.75,1.249,.639],8970:[1.75,1.249,.639],8971:[1.75,1.249,.639],9001:[1.75,1.248,.806],9002:[1.75,1.248,.806],9115:[1.154,.655,.875],9116:[.61,.01,.875],9117:[1.165,.644,.875],9118:[1.154,.655,.875],9119:[.61,.01,.875],9120:[1.165,.644,.875],9121:[1.154,.645,.667],9122:[.602,0,.667],9123:[1.155,.644,.667],9124:[1.154,.645,.667],9125:[.602,0,.667],9126:[1.155,.644,.667],9127:[.899,.01,.889],9128:[1.16,.66,.889],9129:[.01,.899,.889],9130:[.29,.015,.889],9131:[.899,.01,.889],9132:[1.16,.66,.889],9133:[.01,.899,.889],9143:[.935,.885,1.056],10216:[1.75,1.248,.806],10217:[1.75,1.248,.806],12296:[1.75,1.248,.806],12297:[1.75,1.248,.806],57344:[.625,.014,1.056],57345:[.605,.014,1.056,{ic:.02}],57680:[.12,.213,.45,{ic:.01}],57681:[.12,.213,.45,{ic:.024}],57682:[.333,0,.45,{ic:.01}],57683:[.333,0,.45,{ic:.024}],57684:[.32,.2,.4,{ic:.01}],57685:[.333,0,.9,{ic:.01}],57686:[.12,.213,.9,{ic:.01}]}},4926:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.texVariant=void 0,e.texVariant={710:[.845,-.561,2.333,{ic:.013}],732:[.899,-.628,2.333],770:[.845,-.561,0,{ic:.013}],771:[.899,-.628,0],1008:[.434,.006,.667,{ic:.067}],8463:[.695,.013,.54,{ic:.022}],8592:[.437,-.064,.5],8594:[.437,-.064,.5],8652:[.514,.014,1],8708:[.86,.166,.556],8709:[.587,0,.778],8722:[.27,-.23,.5],8726:[.43,.023,.778],8733:[.472,-.028,.778],8739:[.43,.023,.222],8740:[.43,.023,.222,{ic:.018}],8741:[.431,.023,.389],8742:[.431,.024,.389,{ic:.018}],8764:[.365,-.132,.778],8776:[.481,-.05,.778],8808:[.752,.284,.778],8809:[.752,.284,.778],8816:[.919,.421,.778],8817:[.919,.421,.778],8840:[.828,.33,.778],8841:[.828,.33,.778],8842:[.634,.255,.778],8843:[.634,.254,.778],8872:[.694,0,.611],8901:[.189,0,.278],8994:[.378,-.122,.778],8995:[.378,-.143,.778],9651:[.575,.02,.722],9661:[.576,.019,.722],10887:[.801,.303,.778],10888:[.801,.303,.778],10955:[.752,.332,.778],10956:[.752,.333,.778]}},5865:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.MJContextMenu=void 0;var s=r(5073),l=r(6186),c=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.mathItem=null,e.annotation="",e.annotationTypes={},e}return o(e,t),e.prototype.post=function(e,r){if(this.mathItem){if(void 0!==r){var n=this.mathItem.inputJax.name,o=this.findID("Show","Original");o.content="MathML"===n?"Original MathML":n+" Commands",this.findID("Copy","Original").content=o.content;var i=this.findID("Settings","semantics");"MathML"===n?i.disable():i.enable(),this.getAnnotationMenu(),this.dynamicSubmenus()}t.prototype.post.call(this,e,r)}},e.prototype.unpost=function(){t.prototype.unpost.call(this),this.mathItem=null},e.prototype.findID=function(){for(var t,e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=this,a=null;try{for(var s=i(r),c=s.next();!c.done;c=s.next()){var u=c.value;o?(a=o.find(u),o=a instanceof l.Submenu?a.submenu:null):a=null}}catch(e){t={error:e}}finally{try{c&&!c.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}return a},e.prototype.getAnnotationMenu=function(){var t=this,e=this.getAnnotations(this.getSemanticNode());this.createAnnotationMenu("Show",e,(function(){return t.showAnnotation.post()})),this.createAnnotationMenu("Copy",e,(function(){return t.copyAnnotation()}))},e.prototype.getSemanticNode=function(){for(var t=this.mathItem.root;t&&!t.isKind("semantics");){if(t.isToken||1!==t.childNodes.length)return null;t=t.childNodes[0]}return t},e.prototype.getAnnotations=function(t){var e,r,n=[];if(!t)return n;try{for(var o=i(t.childNodes),a=o.next();!a.done;a=o.next()){var s=a.value;if(s.isKind("annotation")){var l=this.annotationMatch(s);if(l){var c=s.childNodes.reduce((function(t,e){return t+e.toString()}),"");n.push([l,c])}}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return n},e.prototype.annotationMatch=function(t){var e,r,n=t.attributes.get("encoding");try{for(var o=i(Object.keys(this.annotationTypes)),a=o.next();!a.done;a=o.next()){var s=a.value;if(this.annotationTypes[s].indexOf(n)>=0)return s}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return null},e.prototype.createAnnotationMenu=function(t,e,r){var n=this,o=this.findID(t,"Annotation");o.submenu=this.factory.get("subMenu")(this.factory,{items:e.map((function(t){var e=a(t,2),o=e[0],i=e[1];return{type:"command",id:o,content:o,action:function(){n.annotation=i,r()}}})),id:"annotations"},o),e.length?o.enable():o.disable()},e.prototype.dynamicSubmenus=function(){var t,r;try{for(var n=i(e.DynamicSubmenus),o=n.next();!o.done;o=n.next()){var s=a(o.value,2),l=s[0],c=s[1],u=this.find(l);if(u){var p=c(this,u);u.submenu=p,p.items.length?u.enable():u.disable()}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},e.DynamicSubmenus=new Map,e}(s.ContextMenu);e.MJContextMenu=c},8310:function(t,e,r){var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Menu=void 0;var a=r(5713),s=r(4474),l=r(9515),c=r(7233),u=r(5865),p=r(473),h=r(4414),d=r(4922),f=r(6914),m=r(3463),y=r(7309),g=i(r(5445)),b=l.MathJax,v="undefined"!=typeof window&&window.navigator&&"Mac"===window.navigator.platform.substr(0,3),_=function(){function t(t,e){void 0===e&&(e={});var r=this;this.settings=null,this.defaultSettings=null,this.menu=null,this.MmlVisitor=new p.MmlVisitor,this.jax={CHTML:null,SVG:null},this.rerenderStart=s.STATE.LAST,this.about=new d.Info('<b style="font-size:120%;">MathJax</b> v'+a.mathjax.version,(function(){var t=[];return t.push("Input Jax: "+r.document.inputJax.map((function(t){return t.name})).join(", ")),t.push("Output Jax: "+r.document.outputJax.name),t.push("Document Type: "+r.document.kind),t.join("<br/>")}),'<a href="https://www.mathjax.org">www.mathjax.org</a>'),this.help=new d.Info("<b>MathJax Help</b>",(function(){return["<p><b>MathJax</b> is a JavaScript library that allows page"," authors to include mathematics within their web pages."," As a reader, you don't need to do anything to make that happen.</p>","<p><b>Browsers</b>: MathJax works with all modern browsers including"," Edge, Firefox, Chrome, Safari, Opera, and most mobile browsers.</p>","<p><b>Math Menu</b>: MathJax adds a contextual menu to equations."," Right-click or CTRL-click on any mathematics to access the menu.</p>",'<div style="margin-left: 1em;">',"<p><b>Show Math As:</b> These options allow you to view the formula's"," source markup (as MathML or in its original format).</p>","<p><b>Copy to Clipboard:</b> These options copy the formula's source markup,"," as MathML or in its original format, to the clipboard"," (in browsers that support that).</p>","<p><b>Math Settings:</b> These give you control over features of MathJax,"," such the size of the mathematics, and the mechanism used"," to display equations.</p>","<p><b>Accessibility</b>: MathJax can work with screen"," readers to make mathematics accessible to the visually impaired."," Turn on the explorer to enable generation of speech strings"," and the ability to investigate expressions interactively.</p>","<p><b>Language</b>: This menu lets you select the language used by MathJax"," for its menus and warning messages. (Not yet implemented in version 3.)</p>","</div>","<p><b>Math Zoom</b>: If you are having difficulty reading an"," equation, MathJax can enlarge it to help you see it better, or"," you can scall all the math on the page to make it larger."," Turn these features on in the <b>Math Settings</b> menu.</p>","<p><b>Preferences</b>: MathJax uses your browser's localStorage database"," to save the preferences set via this menu locally in your browser.  These"," are not used to track you, and are not transferred or used remotely by"," MathJax in any way.</p>"].join("\n")}),'<a href="https://www.mathjax.org">www.mathjax.org</a>'),this.mathmlCode=new h.SelectableInfo("MathJax MathML Expression",(function(){if(!r.menu.mathItem)return"";var t=r.toMML(r.menu.mathItem);return"<pre>"+r.formatSource(t)+"</pre>"}),""),this.originalText=new h.SelectableInfo("MathJax Original Source",(function(){if(!r.menu.mathItem)return"";var t=r.menu.mathItem.math;return'<pre style="font-size:125%; margin:0">'+r.formatSource(t)+"</pre>"}),""),this.annotationText=new h.SelectableInfo("MathJax Annotation Text",(function(){if(!r.menu.mathItem)return"";var t=r.menu.annotation;return'<pre style="font-size:125%; margin:0">'+r.formatSource(t)+"</pre>"}),""),this.zoomBox=new d.Info("MathJax Zoomed Expression",(function(){if(!r.menu.mathItem)return"";var t=r.menu.mathItem.typesetRoot.cloneNode(!0);return t.style.margin="0",'<div style="font-size: '+1.25*parseFloat(r.settings.zscale)+'%">'+t.outerHTML+"</div>"}),""),this.document=t,this.options=(0,c.userOptions)((0,c.defaultOptions)({},this.constructor.OPTIONS),e),this.initSettings(),this.mergeUserSettings(),this.initMenu(),this.applySettings()}return Object.defineProperty(t.prototype,"isLoading",{get:function(){return t.loading>0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"loadingPromise",{get:function(){return this.isLoading?(t._loadingPromise||(t._loadingPromise=new Promise((function(e,r){t._loadingOK=e,t._loadingFailed=r}))),t._loadingPromise):Promise.resolve()},enumerable:!1,configurable:!0}),t.prototype.initSettings=function(){this.settings=this.options.settings,this.jax=this.options.jax;var t=this.document.outputJax;this.jax[t.name]=t,this.settings.renderer=t.name,b._.a11y&&b._.a11y.explorer&&Object.assign(this.settings,this.document.options.a11y),this.settings.scale=t.options.scale,this.defaultSettings=Object.assign({},this.settings)},t.prototype.initMenu=function(){var t=this,e=new f.Parser([["contextMenu",u.MJContextMenu.fromJson.bind(u.MJContextMenu)]]);this.menu=e.parse({type:"contextMenu",id:"MathJax_Menu",pool:[this.variable("texHints"),this.variable("semantics"),this.variable("zoom"),this.variable("zscale"),this.variable("renderer",(function(e){return t.setRenderer(e)})),this.variable("alt"),this.variable("cmd"),this.variable("ctrl"),this.variable("shift"),this.variable("scale",(function(e){return t.setScale(e)})),this.variable("explorer",(function(e){return t.setExplorer(e)})),this.a11yVar("highlight"),this.a11yVar("backgroundColor"),this.a11yVar("backgroundOpacity"),this.a11yVar("foregroundColor"),this.a11yVar("foregroundOpacity"),this.a11yVar("speech"),this.a11yVar("subtitles"),this.a11yVar("braille"),this.a11yVar("viewBraille"),this.a11yVar("locale",(function(t){return g.default.setupEngine({locale:t})})),this.a11yVar("speechRules",(function(e){var r=n(e.split("-"),2),o=r[0],i=r[1];t.document.options.sre.domain=o,t.document.options.sre.style=i})),this.a11yVar("magnification"),this.a11yVar("magnify"),this.a11yVar("treeColoring"),this.a11yVar("infoType"),this.a11yVar("infoRole"),this.a11yVar("infoPrefix"),this.variable("autocollapse"),this.variable("collapsible",(function(e){return t.setCollapsible(e)})),this.variable("inTabOrder",(function(e){return t.setTabOrder(e)})),this.variable("assistiveMml",(function(e){return t.setAssistiveMml(e)}))],items:[this.submenu("Show","Show Math As",[this.command("MathMLcode","MathML Code",(function(){return t.mathmlCode.post()})),this.command("Original","Original Form",(function(){return t.originalText.post()})),this.submenu("Annotation","Annotation")]),this.submenu("Copy","Copy to Clipboard",[this.command("MathMLcode","MathML Code",(function(){return t.copyMathML()})),this.command("Original","Original Form",(function(){return t.copyOriginal()})),this.submenu("Annotation","Annotation")]),this.rule(),this.submenu("Settings","Math Settings",[this.submenu("Renderer","Math Renderer",this.radioGroup("renderer",[["CHTML"],["SVG"]])),this.rule(),this.submenu("ZoomTrigger","Zoom Trigger",[this.command("ZoomNow","Zoom Once Now",(function(){return t.zoom(null,"",t.menu.mathItem)})),this.rule(),this.radioGroup("zoom",[["Click"],["DoubleClick","Double-Click"],["NoZoom","No Zoom"]]),this.rule(),this.label("TriggerRequires","Trigger Requires:"),this.checkbox(v?"Option":"Alt",v?"Option":"Alt","alt"),this.checkbox("Command","Command","cmd",{hidden:!v}),this.checkbox("Control","Control","ctrl",{hiddne:v}),this.checkbox("Shift","Shift","shift")]),this.submenu("ZoomFactor","Zoom Factor",this.radioGroup("zscale",[["150%"],["175%"],["200%"],["250%"],["300%"],["400%"]])),this.rule(),this.command("Scale","Scale All Math...",(function(){return t.scaleAllMath()})),this.rule(),this.checkbox("texHints","Add TeX hints to MathML","texHints"),this.checkbox("semantics","Add original as annotation","semantics"),this.rule(),this.command("Reset","Reset to defaults",(function(){return t.resetDefaults()}))]),this.submenu("Accessibility","Accessibility",[this.checkbox("Activate","Activate","explorer"),this.submenu("Speech","Speech",[this.checkbox("Speech","Speech Output","speech"),this.checkbox("Subtitles","Speech Subtitles","subtitles"),this.checkbox("Braille","Braille Output","braille"),this.checkbox("View Braille","Braille Subtitles","viewBraille"),this.rule(),this.submenu("A11yLanguage","Language"),this.rule(),this.submenu("Mathspeak","Mathspeak Rules",this.radioGroup("speechRules",[["mathspeak-default","Verbose"],["mathspeak-brief","Brief"],["mathspeak-sbrief","Superbrief"]])),this.submenu("Clearspeak","Clearspeak Rules",this.radioGroup("speechRules",[["clearspeak-default","Auto"]])),this.submenu("ChromeVox","ChromeVox Rules",this.radioGroup("speechRules",[["chromevox-default","Standard"],["chromevox-alternative","Alternative"]]))]),this.submenu("Highlight","Highlight",[this.submenu("Background","Background",this.radioGroup("backgroundColor",[["Blue"],["Red"],["Green"],["Yellow"],["Cyan"],["Magenta"],["White"],["Black"]])),{type:"slider",variable:"backgroundOpacity",content:" "},this.submenu("Foreground","Foreground",this.radioGroup("foregroundColor",[["Black"],["White"],["Magenta"],["Cyan"],["Yellow"],["Green"],["Red"],["Blue"]])),{type:"slider",variable:"foregroundOpacity",content:" "},this.rule(),this.radioGroup("highlight",[["None"],["Hover"],["Flame"]]),this.rule(),this.checkbox("TreeColoring","Tree Coloring","treeColoring")]),this.submenu("Magnification","Magnification",[this.radioGroup("magnification",[["None"],["Keyboard"],["Mouse"]]),this.rule(),this.radioGroup("magnify",[["200%"],["300%"],["400%"],["500%"]])]),this.submenu("Semantic Info","Semantic Info",[this.checkbox("Type","Type","infoType"),this.checkbox("Role","Role","infoRole"),this.checkbox("Prefix","Prefix","infoPrefix")],!0),this.rule(),this.checkbox("Collapsible","Collapsible Math","collapsible"),this.checkbox("AutoCollapse","Auto Collapse","autocollapse",{disabled:!0}),this.rule(),this.checkbox("InTabOrder","Include in Tab Order","inTabOrder"),this.checkbox("AssistiveMml","Include Hidden MathML","assistiveMml")]),this.submenu("Language","Language"),this.rule(),this.command("About","About MathJax",(function(){return t.about.post()})),this.command("Help","MathJax Help",(function(){return t.help.post()}))]});var r=this.menu;this.about.attachMenu(r),this.help.attachMenu(r),this.originalText.attachMenu(r),this.annotationText.attachMenu(r),this.mathmlCode.attachMenu(r),this.zoomBox.attachMenu(r),this.checkLoadableItems(),this.enableExplorerItems(this.settings.explorer),r.showAnnotation=this.annotationText,r.copyAnnotation=this.copyAnnotation.bind(this),r.annotationTypes=this.options.annotationTypes,y.CssStyles.addInfoStyles(this.document.document),y.CssStyles.addMenuStyles(this.document.document)},t.prototype.checkLoadableItems=function(){var t,e;if(b&&b._&&b.loader&&b.startup)!this.settings.collapsible||b._.a11y&&b._.a11y.complexity||this.loadA11y("complexity"),!this.settings.explorer||b._.a11y&&b._.a11y.explorer||this.loadA11y("explorer"),!this.settings.assistiveMml||b._.a11y&&b._.a11y["assistive-mml"]||this.loadA11y("assistive-mml");else{var r=this.menu;try{for(var n=o(Object.keys(this.jax)),i=n.next();!i.done;i=n.next()){var a=i.value;this.jax[a]||r.findID("Settings","Renderer",a).disable()}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}r.findID("Accessibility","Activate").disable(),r.findID("Accessibility","AutoCollapse").disable(),r.findID("Accessibility","Collapsible").disable()}},t.prototype.enableExplorerItems=function(t){var e,r,n=this.menu.findID("Accessibility","Activate").menu;try{for(var i=o(n.items.slice(1)),a=i.next();!a.done;a=i.next()){var s=a.value;if(s instanceof m.Rule)break;t?s.enable():s.disable()}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},t.prototype.mergeUserSettings=function(){try{var e=localStorage.getItem(t.MENU_STORAGE);if(!e)return;Object.assign(this.settings,JSON.parse(e)),this.setA11y(this.settings)}catch(t){console.log("MathJax localStorage error: "+t.message)}},t.prototype.saveUserSettings=function(){var e,r,n={};try{for(var i=o(Object.keys(this.settings)),a=i.next();!a.done;a=i.next()){var s=a.value;this.settings[s]!==this.defaultSettings[s]&&(n[s]=this.settings[s])}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}try{Object.keys(n).length?localStorage.setItem(t.MENU_STORAGE,JSON.stringify(n)):localStorage.removeItem(t.MENU_STORAGE)}catch(t){console.log("MathJax localStorage error: "+t.message)}},t.prototype.setA11y=function(t){b._.a11y&&b._.a11y.explorer&&b._.a11y.explorer_ts.setA11yOptions(this.document,t)},t.prototype.getA11y=function(t){if(b._.a11y&&b._.a11y.explorer)return void 0!==this.document.options.a11y[t]?this.document.options.a11y[t]:this.document.options.sre[t]},t.prototype.applySettings=function(){this.setTabOrder(this.settings.inTabOrder),this.document.options.enableAssistiveMml=this.settings.assistiveMml,this.document.outputJax.options.scale=parseFloat(this.settings.scale),this.settings.renderer!==this.defaultSettings.renderer&&this.setRenderer(this.settings.renderer)},t.prototype.setScale=function(t){this.document.outputJax.options.scale=parseFloat(t),this.document.rerender()},t.prototype.setRenderer=function(t){var e=this;if(this.jax[t])this.setOutputJax(t);else{var r=t.toLowerCase();this.loadComponent("output/"+r,(function(){var n=b.startup;r in n.constructors&&(n.useOutput(r,!0),n.output=n.getOutputJax(),e.jax[t]=n.output,e.setOutputJax(t))}))}},t.prototype.setOutputJax=function(t){this.jax[t].setAdaptor(this.document.adaptor),this.document.outputJax=this.jax[t],this.rerender()},t.prototype.setTabOrder=function(t){this.menu.store.inTaborder(t)},t.prototype.setAssistiveMml=function(t){this.document.options.enableAssistiveMml=t,!t||b._.a11y&&b._.a11y["assistive-mml"]?this.rerender():this.loadA11y("assistive-mml")},t.prototype.setExplorer=function(t){this.enableExplorerItems(t),this.document.options.enableExplorer=t,!t||b._.a11y&&b._.a11y.explorer?this.rerender(this.settings.collapsible?s.STATE.RERENDER:s.STATE.COMPILED):this.loadA11y("explorer")},t.prototype.setCollapsible=function(t){this.document.options.enableComplexity=t,!t||b._.a11y&&b._.a11y.complexity?this.rerender(s.STATE.COMPILED):this.loadA11y("complexity")},t.prototype.scaleAllMath=function(){var t=(100*parseFloat(this.settings.scale)).toFixed(1).replace(/.0$/,""),e=prompt("Scale all mathematics (compared to surrounding text) by",t+"%");if(e)if(e.match(/^\s*\d+(\.\d*)?\s*%?\s*$/)){var r=parseFloat(e)/100;r?this.menu.pool.lookup("scale").setValue(String(r)):alert("The scale should not be zero")}else alert("The scale should be a percentage (e.g., 120%)")},t.prototype.resetDefaults=function(){var e,r;t.loading++;var n=this.menu.pool,i=this.defaultSettings;try{for(var a=o(Object.keys(this.settings)),l=a.next();!l.done;l=a.next()){var c=l.value,u=n.lookup(c);if(u){u.setValue(i[c]);var p=u.items[0];p&&p.executeCallbacks_()}else this.settings[c]=i[c]}}catch(t){e={error:t}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}t.loading--,this.rerender(s.STATE.COMPILED)},t.prototype.checkComponent=function(e){var r=t.loadingPromises.get(e);r&&a.mathjax.retryAfter(r)},t.prototype.loadComponent=function(e,r){if(!t.loadingPromises.has(e)){var n=b.loader;if(n){t.loading++;var o=n.load(e).then((function(){t.loading--,t.loadingPromises.delete(e),r(),0===t.loading&&t._loadingPromise&&(t._loadingPromise=null,t._loadingOK())})).catch((function(e){t._loadingPromise?(t._loadingPromise=null,t._loadingFailed(e)):console.log(e)}));t.loadingPromises.set(e,o)}}},t.prototype.loadA11y=function(e){var r=this,n=!s.STATE.ENRICHED;this.loadComponent("a11y/"+e,(function(){var o=b.startup;a.mathjax.handlers.unregister(o.handler),o.handler=o.getHandler(),a.mathjax.handlers.register(o.handler);var i=r.document;r.document=o.document=o.getDocument(),r.document.menu=r,r.document.outputJax.reset(),r.transferMathList(i),r.document.processed=i.processed,t._loadingPromise||(r.document.outputJax.reset(),r.rerender("complexity"===e||n?s.STATE.COMPILED:s.STATE.TYPESET))}))},t.prototype.transferMathList=function(t){var e,r,n=this.document.options.MathItem;try{for(var i=o(t.math),a=i.next();!a.done;a=i.next()){var s=a.value,l=new n;Object.assign(l,s),this.document.math.push(l)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},t.prototype.formatSource=function(t){return t.trim().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},t.prototype.toMML=function(t){return this.MmlVisitor.visitTree(t.root,t,{texHints:this.settings.texHints,semantics:this.settings.semantics&&"MathML"!==t.inputJax.name})},t.prototype.zoom=function(t,e,r){t&&!this.isZoomEvent(t,e)||(this.menu.mathItem=r,t&&this.menu.post(t),this.zoomBox.post())},t.prototype.isZoomEvent=function(t,e){return this.settings.zoom===e&&(!this.settings.alt||t.altKey)&&(!this.settings.ctrl||t.ctrlKey)&&(!this.settings.cmd||t.metaKey)&&(!this.settings.shift||t.shiftKey)},t.prototype.rerender=function(e){void 0===e&&(e=s.STATE.TYPESET),this.rerenderStart=Math.min(e,this.rerenderStart),t.loading||(this.rerenderStart<=s.STATE.COMPILED&&this.document.reset({inputJax:[]}),this.document.rerender(this.rerenderStart),this.rerenderStart=s.STATE.LAST)},t.prototype.copyMathML=function(){this.copyToClipboard(this.toMML(this.menu.mathItem))},t.prototype.copyOriginal=function(){this.copyToClipboard(this.menu.mathItem.math.trim())},t.prototype.copyAnnotation=function(){this.copyToClipboard(this.menu.annotation.trim())},t.prototype.copyToClipboard=function(t){var e=document.createElement("textarea");e.value=t,e.setAttribute("readonly",""),e.style.cssText="height: 1px; width: 1px; padding: 1px; position: absolute; left: -10px",document.body.appendChild(e),e.select();try{document.execCommand("copy")}catch(t){alert("Can't copy to clipboard: "+t.message)}document.body.removeChild(e)},t.prototype.addMenu=function(t){var e=this,r=t.typesetRoot;r.addEventListener("contextmenu",(function(){return e.menu.mathItem=t}),!0),r.addEventListener("keydown",(function(){return e.menu.mathItem=t}),!0),r.addEventListener("click",(function(r){return e.zoom(r,"Click",t)}),!0),r.addEventListener("dblclick",(function(r){return e.zoom(r,"DoubleClick",t)}),!0),this.menu.store.insert(r)},t.prototype.clear=function(){this.menu.store.clear()},t.prototype.variable=function(t,e){var r=this;return{name:t,getter:function(){return r.settings[t]},setter:function(n){r.settings[t]=n,e&&e(n),r.saveUserSettings()}}},t.prototype.a11yVar=function(t,e){var r=this;return{name:t,getter:function(){return r.getA11y(t)},setter:function(n){r.settings[t]=n;var o={};o[t]=n,r.setA11y(o),e&&e(n),r.saveUserSettings()}}},t.prototype.submenu=function(t,e,r,n){var i,a;void 0===r&&(r=[]),void 0===n&&(n=!1);var s=[];try{for(var l=o(r),c=l.next();!c.done;c=l.next()){var u=c.value;Array.isArray(u)?s=s.concat(u):s.push(u)}}catch(t){i={error:t}}finally{try{c&&!c.done&&(a=l.return)&&a.call(l)}finally{if(i)throw i.error}}return{type:"submenu",id:t,content:e,menu:{items:s},disabled:0===s.length||n}},t.prototype.command=function(t,e,r,n){return void 0===n&&(n={}),Object.assign({type:"command",id:t,content:e,action:r},n)},t.prototype.checkbox=function(t,e,r,n){return void 0===n&&(n={}),Object.assign({type:"checkbox",id:t,content:e,variable:r},n)},t.prototype.radioGroup=function(t,e){var r=this;return e.map((function(e){return r.radio(e[0],e[1]||e[0],t)}))},t.prototype.radio=function(t,e,r,n){return void 0===n&&(n={}),Object.assign({type:"radio",id:t,content:e,variable:r},n)},t.prototype.label=function(t,e){return{type:"label",id:t,content:e}},t.prototype.rule=function(){return{type:"rule"}},t.MENU_STORAGE="MathJax-Menu-Settings",t.OPTIONS={settings:{texHints:!0,semantics:!1,zoom:"NoZoom",zscale:"200%",renderer:"CHTML",alt:!1,cmd:!1,ctrl:!1,shift:!1,scale:1,autocollapse:!1,collapsible:!1,inTabOrder:!0,assistiveMml:!0,explorer:!1},jax:{CHTML:null,SVG:null},annotationTypes:(0,c.expandable)({TeX:["TeX","LaTeX","application/x-tex"],StarMath:["StarMath 5.0"],Maple:["Maple"],ContentMathML:["MathML-Content","application/mathml-content+xml"],OpenMath:["OpenMath"]})},t.loading=0,t.loadingPromises=new Map,t._loadingPromise=null,t._loadingOK=null,t._loadingFailed=null,t}();e.Menu=_},4001:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__assign||function(){return i=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},i.apply(this,arguments)},a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},s=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},l=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.MenuHandler=e.MenuMathDocumentMixin=e.MenuMathItemMixin=void 0;var c=r(5713),u=r(4474),p=r(7233),h=r(8310);function d(t){return function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.addMenu=function(t,e){void 0===e&&(e=!1),this.state()>=u.STATE.CONTEXT_MENU||(this.isEscaped||!t.options.enableMenu&&!e||t.menu.addMenu(this),this.state(u.STATE.CONTEXT_MENU))},e.prototype.checkLoading=function(t){t.checkLoading()},e}(t)}function f(t){var e;return e=function(t){function e(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=t.apply(this,s([],a(e),!1))||this;n.menu=new n.options.MenuClass(n,n.options.menuOptions);var o=n.constructor.ProcessBits;return o.has("context-menu")||o.allocate("context-menu"),n.options.MathItem=d(n.options.MathItem),n}return o(e,t),e.prototype.addMenu=function(){var t,e;if(!this.processed.isSet("context-menu")){try{for(var r=l(this.math),n=r.next();!n.done;n=r.next()){n.value.addMenu(this)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}this.processed.set("context-menu")}return this},e.prototype.checkLoading=function(){this.menu.isLoading&&c.mathjax.retryAfter(this.menu.loadingPromise.catch((function(t){return console.log(t)})));var t=this.menu.settings;return t.collapsible&&(this.options.enableComplexity=!0,this.menu.checkComponent("a11y/complexity")),t.explorer&&(this.options.enableEnrichment=!0,this.options.enableExplorer=!0,this.menu.checkComponent("a11y/explorer")),this},e.prototype.state=function(e,r){return void 0===r&&(r=!1),t.prototype.state.call(this,e,r),e<u.STATE.CONTEXT_MENU&&this.processed.clear("context-menu"),this},e.prototype.updateDocument=function(){return t.prototype.updateDocument.call(this),this.menu.menu.store.sort(),this},e}(t),e.OPTIONS=i(i({enableEnrichment:!0,enableComplexity:!0,enableExplorer:!0,enrichSpeech:"none",enrichError:function(t,e,r){return console.warn("Enrichment Error:",r)}},t.OPTIONS),{MenuClass:h.Menu,menuOptions:h.Menu.OPTIONS,enableMenu:!0,sre:t.OPTIONS.sre||(0,p.expandable)({}),a11y:t.OPTIONS.a11y||(0,p.expandable)({}),renderActions:(0,p.expandable)(i(i({},t.OPTIONS.renderActions),{addMenu:[u.STATE.CONTEXT_MENU],checkLoading:[u.STATE.UNPROCESSED+1]}))}),e}(0,u.newState)("CONTEXT_MENU",170),e.MenuMathItemMixin=d,e.MenuMathDocumentMixin=f,e.MenuHandler=function(t){return t.documentClass=f(t.documentClass),t}},473:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.MmlVisitor=void 0;var i=r(9259),a=r(7233),s=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.options={texHints:!0,semantics:!1},e.mathItem=null,e}return o(e,t),e.prototype.visitTree=function(t,e,r){return void 0===e&&(e=null),void 0===r&&(r={}),this.mathItem=e,(0,a.userOptions)(this.options,r),this.visitNode(t,"")},e.prototype.visitTeXAtomNode=function(e,r){return this.options.texHints?t.prototype.visitTeXAtomNode.call(this,e,r):e.childNodes[0]&&1===e.childNodes[0].childNodes.length?this.visitNode(e.childNodes[0],r):r+"<mrow"+this.getAttributes(e)+">\n"+this.childNodeMml(e,r+"  ","\n")+r+"</mrow>"},e.prototype.visitMathNode=function(e,r){if(!this.options.semantics||"TeX"!==this.mathItem.inputJax.name)return t.prototype.visitDefault.call(this,e,r);var n=e.childNodes.length&&e.childNodes[0].childNodes.length>1;return r+"<math"+this.getAttributes(e)+">\n"+r+"  <semantics>\n"+(n?r+"    <mrow>\n":"")+this.childNodeMml(e,r+(n?"      ":"    "),"\n")+(n?r+"    </mrow>\n":"")+r+'    <annotation encoding="application/x-tex">'+this.mathItem.math+"</annotation>\n"+r+"  </semantics>\n"+r+"</math>"},e}(i.SerializedMmlVisitor);e.MmlVisitor=s},4414:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.SelectableInfo=void 0;var i=r(4922),a=r(2165),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.addEvents=function(t){var e=this;t.addEventListener("keypress",(function(t){"a"===t.key&&(t.ctrlKey||t.metaKey)&&(e.selectAll(),e.stop(t))}))},e.prototype.selectAll=function(){document.getSelection().selectAllChildren(this.html.querySelector("pre"))},e.prototype.copyToClipboard=function(){this.selectAll();try{document.execCommand("copy")}catch(t){alert("Can't copy to clipboard: "+t.message)}document.getSelection().removeAllRanges()},e.prototype.generateHtml=function(){var e=this;t.prototype.generateHtml.call(this);var r=this.html.querySelector("span."+a.HtmlClasses.INFOSIGNATURE).appendChild(document.createElement("input"));r.type="button",r.value="Copy to Clipboard",r.addEventListener("click",(function(t){return e.copyToClipboard()}))},e}(i.Info);e.SelectableInfo=s},9923:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.asyncLoad=void 0;var n=r(5713);e.asyncLoad=function(t){return n.mathjax.asyncLoad?new Promise((function(e,r){var o=n.mathjax.asyncLoad(t);o instanceof Promise?o.then((function(t){return e(t)})).catch((function(t){return r(t)})):e(o)})):Promise.reject("Can't load '".concat(t,"': No asyncLoad method specified"))}},6469:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.BBox=void 0;var n=r(6010),o=function(){function t(t){void 0===t&&(t={w:0,h:-n.BIGDIMEN,d:-n.BIGDIMEN}),this.w=t.w||0,this.h="h"in t?t.h:-n.BIGDIMEN,this.d="d"in t?t.d:-n.BIGDIMEN,this.L=this.R=this.ic=this.sk=this.dx=0,this.scale=this.rscale=1,this.pwidth=""}return t.zero=function(){return new t({h:0,d:0,w:0})},t.empty=function(){return new t},t.prototype.empty=function(){return this.w=0,this.h=this.d=-n.BIGDIMEN,this},t.prototype.clean=function(){this.w===-n.BIGDIMEN&&(this.w=0),this.h===-n.BIGDIMEN&&(this.h=0),this.d===-n.BIGDIMEN&&(this.d=0)},t.prototype.rescale=function(t){this.w*=t,this.h*=t,this.d*=t},t.prototype.combine=function(t,e,r){void 0===e&&(e=0),void 0===r&&(r=0);var n=t.rscale,o=e+n*(t.w+t.L+t.R),i=r+n*t.h,a=n*t.d-r;o>this.w&&(this.w=o),i>this.h&&(this.h=i),a>this.d&&(this.d=a)},t.prototype.append=function(t){var e=t.rscale;this.w+=e*(t.w+t.L+t.R),e*t.h>this.h&&(this.h=e*t.h),e*t.d>this.d&&(this.d=e*t.d)},t.prototype.updateFrom=function(t){this.h=t.h,this.d=t.d,this.w=t.w,t.pwidth&&(this.pwidth=t.pwidth)},t.fullWidth="100%",t.StyleAdjust=[["borderTopWidth","h"],["borderRightWidth","w"],["borderBottomWidth","d"],["borderLeftWidth","w",0],["paddingTop","h"],["paddingRight","w"],["paddingBottom","d"],["paddingLeft","w",0]],t}();e.BBox=o},6751:function(t,e){var r,n=this&&this.__extends||(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},a=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.BitFieldClass=e.BitField=void 0;var s=function(){function t(){this.bits=0}return t.allocate=function(){for(var e,r,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];try{for(var a=o(n),s=a.next();!s.done;s=a.next()){var l=s.value;if(this.has(l))throw new Error("Bit already allocated for "+l);if(this.next===t.MAXBIT)throw new Error("Maximum number of bits already allocated");this.names.set(l,this.next),this.next<<=1}}catch(t){e={error:t}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}},t.has=function(t){return this.names.has(t)},t.prototype.set=function(t){this.bits|=this.getBit(t)},t.prototype.clear=function(t){this.bits&=~this.getBit(t)},t.prototype.isSet=function(t){return!!(this.bits&this.getBit(t))},t.prototype.reset=function(){this.bits=0},t.prototype.getBit=function(t){var e=this.constructor.names.get(t);if(!e)throw new Error("Unknown bit-field name: "+t);return e},t.MAXBIT=1<<31,t.next=1,t.names=new Map,t}();e.BitField=s,e.BitFieldClass=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(s);return r.allocate.apply(r,a([],i(t),!1)),r}},5368:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.numeric=e.translate=e.remove=e.add=e.entities=e.options=void 0;var n=r(4542),o=r(9923);e.options={loadMissingEntities:!0},e.entities={ApplyFunction:"\u2061",Backslash:"\u2216",Because:"\u2235",Breve:"\u02d8",Cap:"\u22d2",CenterDot:"\xb7",CircleDot:"\u2299",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",Congruent:"\u2261",ContourIntegral:"\u222e",Coproduct:"\u2210",Cross:"\u2a2f",Cup:"\u22d3",CupCap:"\u224d",Dagger:"\u2021",Del:"\u2207",Delta:"\u0394",Diamond:"\u22c4",DifferentialD:"\u2146",DotEqual:"\u2250",DoubleDot:"\xa8",DoubleRightTee:"\u22a8",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",DownLeftVector:"\u21bd",DownRightVector:"\u21c1",DownTee:"\u22a4",Downarrow:"\u21d3",Element:"\u2208",EqualTilde:"\u2242",Equilibrium:"\u21cc",Exists:"\u2203",ExponentialE:"\u2147",FilledVerySmallSquare:"\u25aa",ForAll:"\u2200",Gamma:"\u0393",Gg:"\u22d9",GreaterEqual:"\u2265",GreaterEqualLess:"\u22db",GreaterFullEqual:"\u2267",GreaterLess:"\u2277",GreaterSlantEqual:"\u2a7e",GreaterTilde:"\u2273",Hacek:"\u02c7",Hat:"^",HumpDownHump:"\u224e",HumpEqual:"\u224f",Im:"\u2111",ImaginaryI:"\u2148",Integral:"\u222b",Intersection:"\u22c2",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",Lambda:"\u039b",Larr:"\u219e",LeftAngleBracket:"\u27e8",LeftArrow:"\u2190",LeftArrowRightArrow:"\u21c6",LeftCeiling:"\u2308",LeftDownVector:"\u21c3",LeftFloor:"\u230a",LeftRightArrow:"\u2194",LeftTee:"\u22a3",LeftTriangle:"\u22b2",LeftTriangleEqual:"\u22b4",LeftUpVector:"\u21bf",LeftVector:"\u21bc",Leftarrow:"\u21d0",Leftrightarrow:"\u21d4",LessEqualGreater:"\u22da",LessFullEqual:"\u2266",LessGreater:"\u2276",LessSlantEqual:"\u2a7d",LessTilde:"\u2272",Ll:"\u22d8",Lleftarrow:"\u21da",LongLeftArrow:"\u27f5",LongLeftRightArrow:"\u27f7",LongRightArrow:"\u27f6",Longleftarrow:"\u27f8",Longleftrightarrow:"\u27fa",Longrightarrow:"\u27f9",Lsh:"\u21b0",MinusPlus:"\u2213",NestedGreaterGreater:"\u226b",NestedLessLess:"\u226a",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotExists:"\u2204",NotGreater:"\u226f",NotGreaterEqual:"\u2271",NotLeftTriangle:"\u22ea",NotLeftTriangleEqual:"\u22ec",NotLess:"\u226e",NotLessEqual:"\u2270",NotPrecedes:"\u2280",NotPrecedesSlantEqual:"\u22e0",NotRightTriangle:"\u22eb",NotRightTriangleEqual:"\u22ed",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsSlantEqual:"\u22e1",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotVerticalBar:"\u2224",Omega:"\u03a9",OverBar:"\u203e",OverBrace:"\u23de",PartialD:"\u2202",Phi:"\u03a6",Pi:"\u03a0",PlusMinus:"\xb1",Precedes:"\u227a",PrecedesEqual:"\u2aaf",PrecedesSlantEqual:"\u227c",PrecedesTilde:"\u227e",Product:"\u220f",Proportional:"\u221d",Psi:"\u03a8",Rarr:"\u21a0",Re:"\u211c",ReverseEquilibrium:"\u21cb",RightAngleBracket:"\u27e9",RightArrow:"\u2192",RightArrowLeftArrow:"\u21c4",RightCeiling:"\u2309",RightDownVector:"\u21c2",RightFloor:"\u230b",RightTee:"\u22a2",RightTeeArrow:"\u21a6",RightTriangle:"\u22b3",RightTriangleEqual:"\u22b5",RightUpVector:"\u21be",RightVector:"\u21c0",Rightarrow:"\u21d2",Rrightarrow:"\u21db",Rsh:"\u21b1",Sigma:"\u03a3",SmallCircle:"\u2218",Sqrt:"\u221a",Square:"\u25a1",SquareIntersection:"\u2293",SquareSubset:"\u228f",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",Star:"\u22c6",Subset:"\u22d0",SubsetEqual:"\u2286",Succeeds:"\u227b",SucceedsEqual:"\u2ab0",SucceedsSlantEqual:"\u227d",SucceedsTilde:"\u227f",SuchThat:"\u220b",Sum:"\u2211",Superset:"\u2283",SupersetEqual:"\u2287",Supset:"\u22d1",Therefore:"\u2234",Theta:"\u0398",Tilde:"\u223c",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",UnderBar:"_",UnderBrace:"\u23df",Union:"\u22c3",UnionPlus:"\u228e",UpArrow:"\u2191",UpDownArrow:"\u2195",UpTee:"\u22a5",Uparrow:"\u21d1",Updownarrow:"\u21d5",Upsilon:"\u03a5",Vdash:"\u22a9",Vee:"\u22c1",VerticalBar:"\u2223",VerticalTilde:"\u2240",Vvdash:"\u22aa",Wedge:"\u22c0",Xi:"\u039e",amp:"&",acute:"\xb4",aleph:"\u2135",alpha:"\u03b1",amalg:"\u2a3f",and:"\u2227",ang:"\u2220",angmsd:"\u2221",angsph:"\u2222",ape:"\u224a",backprime:"\u2035",backsim:"\u223d",backsimeq:"\u22cd",beta:"\u03b2",beth:"\u2136",between:"\u226c",bigcirc:"\u25ef",bigodot:"\u2a00",bigoplus:"\u2a01",bigotimes:"\u2a02",bigsqcup:"\u2a06",bigstar:"\u2605",bigtriangledown:"\u25bd",bigtriangleup:"\u25b3",biguplus:"\u2a04",blacklozenge:"\u29eb",blacktriangle:"\u25b4",blacktriangledown:"\u25be",blacktriangleleft:"\u25c2",bowtie:"\u22c8",boxdl:"\u2510",boxdr:"\u250c",boxminus:"\u229f",boxplus:"\u229e",boxtimes:"\u22a0",boxul:"\u2518",boxur:"\u2514",bsol:"\\",bull:"\u2022",cap:"\u2229",check:"\u2713",chi:"\u03c7",circ:"\u02c6",circeq:"\u2257",circlearrowleft:"\u21ba",circlearrowright:"\u21bb",circledR:"\xae",circledS:"\u24c8",circledast:"\u229b",circledcirc:"\u229a",circleddash:"\u229d",clubs:"\u2663",colon:":",comp:"\u2201",ctdot:"\u22ef",cuepr:"\u22de",cuesc:"\u22df",cularr:"\u21b6",cup:"\u222a",curarr:"\u21b7",curlyvee:"\u22ce",curlywedge:"\u22cf",dagger:"\u2020",daleth:"\u2138",ddarr:"\u21ca",deg:"\xb0",delta:"\u03b4",digamma:"\u03dd",div:"\xf7",divideontimes:"\u22c7",dot:"\u02d9",doteqdot:"\u2251",dotplus:"\u2214",dotsquare:"\u22a1",dtdot:"\u22f1",ecir:"\u2256",efDot:"\u2252",egs:"\u2a96",ell:"\u2113",els:"\u2a95",empty:"\u2205",epsi:"\u03b5",epsiv:"\u03f5",erDot:"\u2253",eta:"\u03b7",eth:"\xf0",flat:"\u266d",fork:"\u22d4",frown:"\u2322",gEl:"\u2a8c",gamma:"\u03b3",gap:"\u2a86",gimel:"\u2137",gnE:"\u2269",gnap:"\u2a8a",gne:"\u2a88",gnsim:"\u22e7",gt:">",gtdot:"\u22d7",harrw:"\u21ad",hbar:"\u210f",hellip:"\u2026",hookleftarrow:"\u21a9",hookrightarrow:"\u21aa",imath:"\u0131",infin:"\u221e",intcal:"\u22ba",iota:"\u03b9",jmath:"\u0237",kappa:"\u03ba",kappav:"\u03f0",lEg:"\u2a8b",lambda:"\u03bb",lap:"\u2a85",larrlp:"\u21ab",larrtl:"\u21a2",lbrace:"{",lbrack:"[",le:"\u2264",leftleftarrows:"\u21c7",leftthreetimes:"\u22cb",lessdot:"\u22d6",lmoust:"\u23b0",lnE:"\u2268",lnap:"\u2a89",lne:"\u2a87",lnsim:"\u22e6",longmapsto:"\u27fc",looparrowright:"\u21ac",lowast:"\u2217",loz:"\u25ca",lt:"<",ltimes:"\u22c9",ltri:"\u25c3",macr:"\xaf",malt:"\u2720",mho:"\u2127",mu:"\u03bc",multimap:"\u22b8",nLeftarrow:"\u21cd",nLeftrightarrow:"\u21ce",nRightarrow:"\u21cf",nVDash:"\u22af",nVdash:"\u22ae",natur:"\u266e",nearr:"\u2197",nharr:"\u21ae",nlarr:"\u219a",not:"\xac",nrarr:"\u219b",nu:"\u03bd",nvDash:"\u22ad",nvdash:"\u22ac",nwarr:"\u2196",omega:"\u03c9",omicron:"\u03bf",or:"\u2228",osol:"\u2298",period:".",phi:"\u03c6",phiv:"\u03d5",pi:"\u03c0",piv:"\u03d6",prap:"\u2ab7",precnapprox:"\u2ab9",precneqq:"\u2ab5",precnsim:"\u22e8",prime:"\u2032",psi:"\u03c8",quot:'"',rarrtl:"\u21a3",rbrace:"}",rbrack:"]",rho:"\u03c1",rhov:"\u03f1",rightrightarrows:"\u21c9",rightthreetimes:"\u22cc",ring:"\u02da",rmoust:"\u23b1",rtimes:"\u22ca",rtri:"\u25b9",scap:"\u2ab8",scnE:"\u2ab6",scnap:"\u2aba",scnsim:"\u22e9",sdot:"\u22c5",searr:"\u2198",sect:"\xa7",sharp:"\u266f",sigma:"\u03c3",sigmav:"\u03c2",simne:"\u2246",smile:"\u2323",spades:"\u2660",sub:"\u2282",subE:"\u2ac5",subnE:"\u2acb",subne:"\u228a",supE:"\u2ac6",supnE:"\u2acc",supne:"\u228b",swarr:"\u2199",tau:"\u03c4",theta:"\u03b8",thetav:"\u03d1",tilde:"\u02dc",times:"\xd7",triangle:"\u25b5",triangleq:"\u225c",upsi:"\u03c5",upuparrows:"\u21c8",veebar:"\u22bb",vellip:"\u22ee",weierp:"\u2118",xi:"\u03be",yen:"\xa5",zeta:"\u03b6",zigrarr:"\u21dd",nbsp:"\xa0",rsquo:"\u2019",lsquo:"\u2018"};var i={};function a(t,r){if("#"===r.charAt(0))return s(r.slice(1));if(e.entities[r])return e.entities[r];if(e.options.loadMissingEntities){var a=r.match(/^[a-zA-Z](fr|scr|opf)$/)?RegExp.$1:r.charAt(0).toLowerCase();i[a]||(i[a]=!0,(0,n.retryAfter)((0,o.asyncLoad)("./util/entities/"+a+".js")))}return t}function s(t){var e="x"===t.charAt(0)?parseInt(t.slice(1),16):parseInt(t);return String.fromCodePoint(e)}e.add=function(t,r){Object.assign(e.entities,t),i[r]=!0},e.remove=function(t){delete e.entities[t]},e.translate=function(t){return t.replace(/&([a-z][a-z0-9]*|#(?:[0-9]+|x[0-9a-f]+));/gi,a)},e.numeric=s},7525:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},s=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.FunctionList=void 0;var l=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.execute=function(){for(var t,e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];try{for(var o=i(this),l=o.next();!l.done;l=o.next()){var c=l.value,u=c.item.apply(c,s([],a(r),!1));if(!1===u)return!1}}catch(e){t={error:e}}finally{try{l&&!l.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return!0},e.prototype.asyncExecute=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=-1,n=this.items;return new Promise((function(e,o){!function i(){for(var l;++r<n.length;){var c=(l=n[r]).item.apply(l,s([],a(t),!1));if(c instanceof Promise)return void c.then(i).catch((function(t){return o(t)}));if(!1===c)return void e(!1)}e(!0)}()}))},e}(r(8666).PrioritizedList);e.FunctionList=l},103:function(t,e){var r=this&&this.__generator||function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))},i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.LinkedList=e.ListItem=e.END=void 0,e.END=Symbol();var a=function(t){void 0===t&&(t=null),this.next=null,this.prev=null,this.data=t};e.ListItem=a;var s=function(){function t(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.list=new a(e.END),this.list.next=this.list.prev=this.list,this.push.apply(this,o([],n(t),!1))}return t.prototype.isBefore=function(t,e){return t<e},t.prototype.push=function(){for(var t,e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];try{for(var o=i(r),s=o.next();!s.done;s=o.next()){var l=s.value,c=new a(l);c.next=this.list,c.prev=this.list.prev,this.list.prev=c,c.prev.next=c}}catch(e){t={error:e}}finally{try{s&&!s.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return this},t.prototype.pop=function(){var t=this.list.prev;return t.data===e.END?null:(this.list.prev=t.prev,t.prev.next=this.list,t.next=t.prev=null,t.data)},t.prototype.unshift=function(){for(var t,e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];try{for(var o=i(r.slice(0).reverse()),s=o.next();!s.done;s=o.next()){var l=s.value,c=new a(l);c.next=this.list.next,c.prev=this.list,this.list.next=c,c.next.prev=c}}catch(e){t={error:e}}finally{try{s&&!s.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return this},t.prototype.shift=function(){var t=this.list.next;return t.data===e.END?null:(this.list.next=t.next,t.next.prev=this.list,t.next=t.prev=null,t.data)},t.prototype.remove=function(){for(var t,r,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var a=new Map;try{for(var s=i(n),l=s.next();!l.done;l=s.next()){var c=l.value;a.set(c,!0)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}for(var u=this.list.next;u.data!==e.END;){var p=u.next;a.has(u.data)&&(u.prev.next=u.next,u.next.prev=u.prev,u.next=u.prev=null),u=p}},t.prototype.clear=function(){return this.list.next.prev=this.list.prev.next=null,this.list.next=this.list.prev=this.list,this},t.prototype[Symbol.iterator]=function(){var t;return r(this,(function(r){switch(r.label){case 0:t=this.list.next,r.label=1;case 1:return t.data===e.END?[3,3]:[4,t.data];case 2:return r.sent(),t=t.next,[3,1];case 3:return[2]}}))},t.prototype.reversed=function(){var t;return r(this,(function(r){switch(r.label){case 0:t=this.list.prev,r.label=1;case 1:return t.data===e.END?[3,3]:[4,t.data];case 2:return r.sent(),t=t.prev,[3,1];case 3:return[2]}}))},t.prototype.insert=function(t,r){void 0===r&&(r=null),null===r&&(r=this.isBefore.bind(this));for(var n=new a(t),o=this.list.next;o.data!==e.END&&r(o.data,n.data);)o=o.next;return n.prev=o.prev,n.next=o,o.prev.next=o.prev=n,this},t.prototype.sort=function(e){var r,n;void 0===e&&(e=null),null===e&&(e=this.isBefore.bind(this));var o=[];try{for(var a=i(this),s=a.next();!s.done;s=a.next()){var l=s.value;o.push(new t(l))}}catch(t){r={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}for(this.list.next=this.list.prev=this.list;o.length>1;){var c=o.shift(),u=o.shift();c.merge(u,e),o.push(c)}return o.length&&(this.list=o[0].list),this},t.prototype.merge=function(t,r){var o,i,a,s,l;void 0===r&&(r=null),null===r&&(r=this.isBefore.bind(this));for(var c=this.list.next,u=t.list.next;c.data!==e.END&&u.data!==e.END;)r(u.data,c.data)?(o=n([c,u],2),u.prev.next=o[0],c.prev.next=o[1],i=n([c.prev,u.prev],2),u.prev=i[0],c.prev=i[1],a=n([t.list,this.list],2),this.list.prev.next=a[0],t.list.prev.next=a[1],s=n([t.list.prev,this.list.prev],2),this.list.prev=s[0],t.list.prev=s[1],c=(l=n([u.next,c],2))[0],u=l[1]):c=c.next;return u.data!==e.END&&(this.list.prev.next=t.list.next,t.list.next.prev=this.list.prev,t.list.prev.next=this.list,this.list.prev=t.list.prev,t.list.next=t.list.prev=t.list),this},t}();e.LinkedList=s},7233:function(t,e){var r=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.lookup=e.separateOptions=e.selectOptionsFromKeys=e.selectOptions=e.userOptions=e.defaultOptions=e.insert=e.copy=e.keys=e.makeArray=e.expandable=e.Expandable=e.OPTIONS=e.REMOVE=e.APPEND=e.isObject=void 0;var i={}.constructor;function a(t){return"object"==typeof t&&null!==t&&(t.constructor===i||t.constructor===s)}e.isObject=a,e.APPEND="[+]",e.REMOVE="[-]",e.OPTIONS={invalidOption:"warn",optionError:function(t,r){if("fatal"===e.OPTIONS.invalidOption)throw new Error(t);console.warn("MathJax: "+t)}};var s=function(){};function l(t){return Object.assign(Object.create(s.prototype),t)}function c(t){return t?Object.keys(t).concat(Object.getOwnPropertySymbols(t)):[]}function u(t){var e,n,o={};try{for(var i=r(c(t)),h=i.next();!h.done;h=i.next()){var d=h.value,f=Object.getOwnPropertyDescriptor(t,d),m=f.value;Array.isArray(m)?f.value=p([],m,!1):a(m)&&(f.value=u(m)),f.enumerable&&(o[d]=f)}}catch(t){e={error:t}}finally{try{h&&!h.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return Object.defineProperties(t.constructor===s?l({}):{},o)}function p(t,i,l){var h,d;void 0===l&&(l=!0);var f=function(r){if(l&&void 0===t[r]&&t.constructor!==s)return"symbol"==typeof r&&(r=r.toString()),e.OPTIONS.optionError('Invalid option "'.concat(r,'" (no default value).'),r),"continue";var h=i[r],d=t[r];if(!a(h)||null===d||"object"!=typeof d&&"function"!=typeof d)Array.isArray(h)?(t[r]=[],p(t[r],h,!1)):a(h)?t[r]=u(h):t[r]=h;else{var f=c(h);Array.isArray(d)&&(1===f.length&&(f[0]===e.APPEND||f[0]===e.REMOVE)&&Array.isArray(h[f[0]])||2===f.length&&f.sort().join(",")===e.APPEND+","+e.REMOVE&&Array.isArray(h[e.APPEND])&&Array.isArray(h[e.REMOVE]))?(h[e.REMOVE]&&(d=t[r]=d.filter((function(t){return h[e.REMOVE].indexOf(t)<0}))),h[e.APPEND]&&(t[r]=o(o([],n(d),!1),n(h[e.APPEND]),!1))):p(d,h,l)}};try{for(var m=r(c(i)),y=m.next();!y.done;y=m.next()){f(y.value)}}catch(t){h={error:t}}finally{try{y&&!y.done&&(d=m.return)&&d.call(m)}finally{if(h)throw h.error}}return t}function h(t){for(var e,n,o=[],i=1;i<arguments.length;i++)o[i-1]=arguments[i];var a={};try{for(var s=r(o),l=s.next();!l.done;l=s.next()){var c=l.value;t.hasOwnProperty(c)&&(a[c]=t[c])}}catch(t){e={error:t}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return a}e.Expandable=s,e.expandable=l,e.makeArray=function(t){return Array.isArray(t)?t:[t]},e.keys=c,e.copy=u,e.insert=p,e.defaultOptions=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return e.forEach((function(e){return p(t,e,!1)})),t},e.userOptions=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return e.forEach((function(e){return p(t,e,!0)})),t},e.selectOptions=h,e.selectOptionsFromKeys=function(t,e){return h.apply(void 0,o([t],n(Object.keys(e)),!1))},e.separateOptions=function(t){for(var e,n,o,i,a=[],s=1;s<arguments.length;s++)a[s-1]=arguments[s];var l=[];try{for(var c=r(a),u=c.next();!u.done;u=c.next()){var p=u.value,h={},d={};try{for(var f=(o=void 0,r(Object.keys(t||{}))),m=f.next();!m.done;m=f.next()){var y=m.value;(void 0===p[y]?d:h)[y]=t[y]}}catch(t){o={error:t}}finally{try{m&&!m.done&&(i=f.return)&&i.call(f)}finally{if(o)throw o.error}}l.push(h),t=d}}catch(t){e={error:t}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(e)throw e.error}}return l.unshift(t),l},e.lookup=function(t,e,r){return void 0===r&&(r=null),e.hasOwnProperty(t)?e[t]:r}},8666:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.PrioritizedList=void 0;var r=function(){function t(){this.items=[],this.items=[]}return t.prototype[Symbol.iterator]=function(){var t=0,e=this.items;return{next:function(){return{value:e[t++],done:t>e.length}}}},t.prototype.add=function(e,r){void 0===r&&(r=t.DEFAULTPRIORITY);var n=this.items.length;do{n--}while(n>=0&&r<this.items[n].priority);return this.items.splice(n+1,0,{item:e,priority:r}),e},t.prototype.remove=function(t){var e=this.items.length;do{e--}while(e>=0&&this.items[e].item!==t);e>=0&&this.items.splice(e,1)},t.DEFAULTPRIORITY=5,t}();e.PrioritizedList=r},4542:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.retryAfter=e.handleRetriesFor=void 0,e.handleRetriesFor=function(t){return new Promise((function e(r,n){try{r(t())}catch(t){t.retry&&t.retry instanceof Promise?t.retry.then((function(){return e(r,n)})).catch((function(t){return n(t)})):t.restart&&t.restart.isCallback?MathJax.Callback.After((function(){return e(r,n)}),t.restart):n(t)}}))},e.retryAfter=function(t){var e=new Error("MathJax retry");throw e.retry=t,e}},4139:function(t,e){var r=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.CssStyles=void 0;var n=function(){function t(t){void 0===t&&(t=null),this.styles={},this.addStyles(t)}return Object.defineProperty(t.prototype,"cssText",{get:function(){return this.getStyleString()},enumerable:!1,configurable:!0}),t.prototype.addStyles=function(t){var e,n;if(t)try{for(var o=r(Object.keys(t)),i=o.next();!i.done;i=o.next()){var a=i.value;this.styles[a]||(this.styles[a]={}),Object.assign(this.styles[a],t[a])}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}},t.prototype.removeStyles=function(){for(var t,e,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];try{for(var i=r(n),a=i.next();!a.done;a=i.next()){var s=a.value;delete this.styles[s]}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}},t.prototype.clear=function(){this.styles={}},t.prototype.getStyleString=function(){return this.getStyleRules().join("\n\n")},t.prototype.getStyleRules=function(){var t,e,n=Object.keys(this.styles),o=new Array(n.length),i=0;try{for(var a=r(n),s=a.next();!s.done;s=a.next()){var l=s.value;o[i++]=l+" {\n"+this.getStyleDefString(this.styles[l])+"\n}"}}catch(e){t={error:e}}finally{try{s&&!s.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}return o},t.prototype.getStyleDefString=function(t){var e,n,o=Object.keys(t),i=new Array(o.length),a=0;try{for(var s=r(o),l=s.next();!l.done;l=s.next()){var c=l.value;i[a++]="  "+c+": "+t[c]+";"}}catch(t){e={error:t}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return i.join("\n")},t}();e.CssStyles=n},8054:function(t,e){var r=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},o=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.Styles=void 0;var i=["top","right","bottom","left"],a=["width","style","color"];function s(t){for(var e=t.split(/((?:'[^']*'|"[^"]*"|,[\s\n]|[^\s\n])*)/g),r=[];e.length>1;)e.shift(),r.push(e.shift());return r}function l(t){var e,n,o=s(this.styles[t]);0===o.length&&o.push(""),1===o.length&&o.push(o[0]),2===o.length&&o.push(o[0]),3===o.length&&o.push(o[1]);try{for(var i=r(v.connect[t].children),a=i.next();!a.done;a=i.next()){var l=a.value;this.setStyle(this.childName(t,l),o.shift())}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}}function c(t){var e,n,o=v.connect[t].children,i=[];try{for(var a=r(o),s=a.next();!s.done;s=a.next()){var l=s.value,c=this.styles[t+"-"+l];if(!c)return void delete this.styles[t];i.push(c)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}i[3]===i[1]&&(i.pop(),i[2]===i[0]&&(i.pop(),i[1]===i[0]&&i.pop())),this.styles[t]=i.join(" ")}function u(t){var e,n;try{for(var o=r(v.connect[t].children),i=o.next();!i.done;i=o.next()){var a=i.value;this.setStyle(this.childName(t,a),this.styles[t])}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}}function p(t){var e,i,a=o([],n(v.connect[t].children),!1),s=this.styles[this.childName(t,a.shift())];try{for(var l=r(a),c=l.next();!c.done;c=l.next()){var u=c.value;if(this.styles[this.childName(t,u)]!==s)return void delete this.styles[t]}}catch(t){e={error:t}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(e)throw e.error}}this.styles[t]=s}var h=/^(?:[\d.]+(?:[a-z]+)|thin|medium|thick|inherit|initial|unset)$/,d=/^(?:none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset|inherit|initial|unset)$/;function f(t){var e,n,o,i,a={width:"",style:"",color:""};try{for(var l=r(s(this.styles[t])),c=l.next();!c.done;c=l.next()){var u=c.value;u.match(h)&&""===a.width?a.width=u:u.match(d)&&""===a.style?a.style=u:a.color=u}}catch(t){e={error:t}}finally{try{c&&!c.done&&(n=l.return)&&n.call(l)}finally{if(e)throw e.error}}try{for(var p=r(v.connect[t].children),f=p.next();!f.done;f=p.next()){var m=f.value;this.setStyle(this.childName(t,m),a[m])}}catch(t){o={error:t}}finally{try{f&&!f.done&&(i=p.return)&&i.call(p)}finally{if(o)throw o.error}}}function m(t){var e,n,o=[];try{for(var i=r(v.connect[t].children),a=i.next();!a.done;a=i.next()){var s=a.value,l=this.styles[this.childName(t,s)];l&&o.push(l)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}o.length?this.styles[t]=o.join(" "):delete this.styles[t]}var y={style:/^(?:normal|italic|oblique|inherit|initial|unset)$/,variant:new RegExp("^(?:"+["normal|none","inherit|initial|unset","common-ligatures|no-common-ligatures","discretionary-ligatures|no-discretionary-ligatures","historical-ligatures|no-historical-ligatures","contextual|no-contextual","(?:stylistic|character-variant|swash|ornaments|annotation)\\([^)]*\\)","small-caps|all-small-caps|petite-caps|all-petite-caps|unicase|titling-caps","lining-nums|oldstyle-nums|proportional-nums|tabular-nums","diagonal-fractions|stacked-fractions","ordinal|slashed-zero","jis78|jis83|jis90|jis04|simplified|traditional","full-width|proportional-width","ruby"].join("|")+")$"),weight:/^(?:normal|bold|bolder|lighter|[1-9]00|inherit|initial|unset)$/,stretch:new RegExp("^(?:"+["normal","(?:(?:ultra|extra|semi)-)?condensed","(?:(?:semi|extra|ulta)-)?expanded","inherit|initial|unset"].join("|")+")$"),size:new RegExp("^(?:"+["xx-small|x-small|small|medium|large|x-large|xx-large|larger|smaller","[d.]+%|[d.]+[a-z]+","inherit|initial|unset"].join("|")+")(?:/(?:normal|[d.+](?:%|[a-z]+)?))?$")};function g(t){var e,o,i,a,l=s(this.styles[t]),c={style:"",variant:[],weight:"",stretch:"",size:"",family:"","line-height":""};try{for(var u=r(l),p=u.next();!p.done;p=u.next()){var h=p.value;c.family=h;try{for(var d=(i=void 0,r(Object.keys(y))),f=d.next();!f.done;f=d.next()){var m=f.value;if((Array.isArray(c[m])||""===c[m])&&h.match(y[m]))if("size"===m){var g=n(h.split(/\//),2),b=g[0],_=g[1];c[m]=b,_&&(c["line-height"]=_)}else""===c.size&&(Array.isArray(c[m])?c[m].push(h):c[m]=h)}}catch(t){i={error:t}}finally{try{f&&!f.done&&(a=d.return)&&a.call(d)}finally{if(i)throw i.error}}}}catch(t){e={error:t}}finally{try{p&&!p.done&&(o=u.return)&&o.call(u)}finally{if(e)throw e.error}}!function(t,e){var n,o;try{for(var i=r(v.connect[t].children),a=i.next();!a.done;a=i.next()){var s=a.value,l=this.childName(t,s);if(Array.isArray(e[s])){var c=e[s];c.length&&(this.styles[l]=c.join(" "))}else""!==e[s]&&(this.styles[l]=e[s])}}catch(t){n={error:t}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}}(t,c),delete this.styles[t]}function b(t){}var v=function(){function t(t){void 0===t&&(t=""),this.parse(t)}return Object.defineProperty(t.prototype,"cssText",{get:function(){var t,e,n=[];try{for(var o=r(Object.keys(this.styles)),i=o.next();!i.done;i=o.next()){var a=i.value,s=this.parentName(a);this.styles[s]||n.push(a+": "+this.styles[a]+";")}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return n.join(" ")},enumerable:!1,configurable:!0}),t.prototype.set=function(e,r){for(e=this.normalizeName(e),this.setStyle(e,r),t.connect[e]&&!t.connect[e].combine&&(this.combineChildren(e),delete this.styles[e]);e.match(/-/)&&(e=this.parentName(e),t.connect[e]);)t.connect[e].combine.call(this,e)},t.prototype.get=function(t){return t=this.normalizeName(t),this.styles.hasOwnProperty(t)?this.styles[t]:""},t.prototype.setStyle=function(e,r){this.styles[e]=r,t.connect[e]&&t.connect[e].children&&t.connect[e].split.call(this,e),""===r&&delete this.styles[e]},t.prototype.combineChildren=function(e){var n,o,i=this.parentName(e);try{for(var a=r(t.connect[e].children),s=a.next();!s.done;s=a.next()){var l=s.value,c=this.childName(i,l);t.connect[c].combine.call(this,c)}}catch(t){n={error:t}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}},t.prototype.parentName=function(t){var e=t.replace(/-[^-]*$/,"");return t===e?"":e},t.prototype.childName=function(e,r){return r.match(/-/)?r:(t.connect[e]&&!t.connect[e].combine&&(r+=e.replace(/.*-/,"-"),e=this.parentName(e)),e+"-"+r)},t.prototype.normalizeName=function(t){return t.replace(/[A-Z]/g,(function(t){return"-"+t.toLowerCase()}))},t.prototype.parse=function(t){void 0===t&&(t="");var e=this.constructor.pattern;this.styles={};for(var r=t.replace(e.comment,"").split(e.style);r.length>1;){var o=n(r.splice(0,3),3),i=o[0],a=o[1],s=o[2];if(i.match(/[^\s\n]/))return;this.set(a,s)}},t.pattern={style:/([-a-z]+)[\s\n]*:[\s\n]*((?:'[^']*'|"[^"]*"|\n|.)*?)[\s\n]*(?:;|$)/g,comment:/\/\*[^]*?\*\//g},t.connect={padding:{children:i,split:l,combine:c},border:{children:i,split:u,combine:p},"border-top":{children:a,split:f,combine:m},"border-right":{children:a,split:f,combine:m},"border-bottom":{children:a,split:f,combine:m},"border-left":{children:a,split:f,combine:m},"border-width":{children:i,split:l,combine:null},"border-style":{children:i,split:l,combine:null},"border-color":{children:i,split:l,combine:null},font:{children:["style","variant","weight","stretch","line-height","size","family"],split:g,combine:b}},t}();e.Styles=v},6010:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.px=e.emRounded=e.em=e.percent=e.length2em=e.MATHSPACE=e.RELUNITS=e.UNITS=e.BIGDIMEN=void 0,e.BIGDIMEN=1e6,e.UNITS={px:1,in:96,cm:96/2.54,mm:96/25.4},e.RELUNITS={em:1,ex:.431,pt:.1,pc:1.2,mu:1/18},e.MATHSPACE={veryverythinmathspace:1/18,verythinmathspace:2/18,thinmathspace:3/18,mediummathspace:4/18,thickmathspace:5/18,verythickmathspace:6/18,veryverythickmathspace:7/18,negativeveryverythinmathspace:-1/18,negativeverythinmathspace:-2/18,negativethinmathspace:-3/18,negativemediummathspace:-4/18,negativethickmathspace:-5/18,negativeverythickmathspace:-6/18,negativeveryverythickmathspace:-7/18,thin:.04,medium:.06,thick:.1,normal:1,big:2,small:1/Math.sqrt(2),infinity:e.BIGDIMEN},e.length2em=function(t,r,n,o){if(void 0===r&&(r=0),void 0===n&&(n=1),void 0===o&&(o=16),"string"!=typeof t&&(t=String(t)),""===t||null==t)return r;if(e.MATHSPACE[t])return e.MATHSPACE[t];var i=t.match(/^\s*([-+]?(?:\.\d+|\d+(?:\.\d*)?))?(pt|em|ex|mu|px|pc|in|mm|cm|%)?/);if(!i)return r;var a=parseFloat(i[1]||"1"),s=i[2];return e.UNITS.hasOwnProperty(s)?a*e.UNITS[s]/o/n:e.RELUNITS.hasOwnProperty(s)?a*e.RELUNITS[s]:"%"===s?a/100*r:a*r},e.percent=function(t){return(100*t).toFixed(1).replace(/\.?0+$/,"")+"%"},e.em=function(t){return Math.abs(t)<.001?"0":t.toFixed(3).replace(/\.?0+$/,"")+"em"},e.emRounded=function(t,e){return void 0===e&&(e=16),t=(Math.round(t*e)+.05)/e,Math.abs(t)<.001?"0em":t.toFixed(3).replace(/\.?0+$/,"")+"em"},e.px=function(t,r,n){return void 0===r&&(r=-e.BIGDIMEN),void 0===n&&(n=16),t*=n,r&&t<r&&(t=r),Math.abs(t)<.1?"0":t.toFixed(1).replace(/\.0$/,"")+"px"}},7875:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.max=e.sum=void 0,e.sum=function(t){return t.reduce((function(t,e){return t+e}),0)},e.max=function(t){return t.reduce((function(t,e){return Math.max(t,e)}),0)}},505:function(t,e){var r=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},n=this&&this.__spreadArray||function(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(e,"__esModule",{value:!0}),e.split=e.isPercent=e.unicodeString=e.unicodeChars=e.quotePattern=e.sortLength=void 0,e.sortLength=function(t,e){return t.length!==e.length?e.length-t.length:t===e?0:t<e?-1:1},e.quotePattern=function(t){return t.replace(/([\^$(){}+*?\-|\[\]\:\\])/g,"\\$1")},e.unicodeChars=function(t){return Array.from(t).map((function(t){return t.codePointAt(0)}))},e.unicodeString=function(t){return String.fromCodePoint.apply(String,n([],r(t),!1))},e.isPercent=function(t){return!!t.match(/%\s*$/)},e.split=function(t){return t.trim().split(/\s+/)}},7718:function(t,e){
/*!
 *************************************************************************
 *
 *  mhchemParser.ts
 *  4.1.1
 *
 *  Parser for the \ce command and \pu command for MathJax and Co.
 *
 *  mhchem's \ce is a tool for writing beautiful chemical equations easily.
 *  mhchem's \pu is a tool for writing physical units easily.
 *
 *  ----------------------------------------------------------------------
 *
 *  Copyright (c) 2015-2021 Martin Hensel
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 *  ----------------------------------------------------------------------
 *
 *  https://github.com/mhchem/mhchemParser
 *
 */
Object.defineProperty(e,"__esModule",{value:!0}),e.mhchemParser=void 0;var r=function(){function t(){}return t.toTex=function(t,e){return i.go(o.go(t,e),"tex"!==e)},t}();function n(t){var e,r,n={};for(e in t)for(r in t[e]){var o=r.split("|");t[e][r].stateArray=o;for(var i=0;i<o.length;i++)n[o[i]]=[]}for(e in t)for(r in t[e])for(o=t[e][r].stateArray||[],i=0;i<o.length;i++){var a=t[e][r];a.action_=[].concat(a.action_);for(var s=0;s<a.action_.length;s++)"string"==typeof a.action_[s]&&(a.action_[s]={type_:a.action_[s]});for(var l=e.split("|"),c=0;c<l.length;c++)if("*"===o[i]){var u=void 0;for(u in n)n[u].push({pattern:l[c],task:a})}else n[o[i]].push({pattern:l[c],task:a})}return n}e.mhchemParser=r;var o={go:function(t,e){if(!t)return[];void 0===e&&(e="ce");var r,n="0",i={};i.parenthesisLevel=0,t=(t=(t=t.replace(/\n/g," ")).replace(/[\u2212\u2013\u2014\u2010]/g,"-")).replace(/[\u2026]/g,"...");for(var a=10,s=[];;){r!==t?(a=10,r=t):a--;var l=o.stateMachines[e],c=l.transitions[n]||l.transitions["*"];t:for(var u=0;u<c.length;u++){var p=o.patterns.match_(c[u].pattern,t);if(p){for(var h=c[u].task,d=0;d<h.action_.length;d++){var f=void 0;if(l.actions[h.action_[d].type_])f=l.actions[h.action_[d].type_](i,p.match_,h.action_[d].option);else{if(!o.actions[h.action_[d].type_])throw["MhchemBugA","mhchem bug A. Please report. ("+h.action_[d].type_+")"];f=o.actions[h.action_[d].type_](i,p.match_,h.action_[d].option)}o.concatArray(s,f)}if(n=h.nextState||n,!(t.length>0))return s;if(h.revisit||(t=p.remainder),!h.toContinue)break t}}if(a<=0)throw["MhchemBugU","mhchem bug U. Please report."]}},concatArray:function(t,e){if(e)if(Array.isArray(e))for(var r=0;r<e.length;r++)t.push(e[r]);else t.push(e)},patterns:{patterns:{empty:/^$/,else:/^./,else2:/^./,space:/^\s/,"space A":/^\s(?=[A-Z\\$])/,space$:/^\s$/,"a-z":/^[a-z]/,x:/^x/,x$:/^x$/,i$:/^i$/,letters:/^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,"\\greek":/^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,"one lowercase latin letter $":/^(?:([a-z])(?:$|[^a-zA-Z]))$/,"$one lowercase latin letter$ $":/^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,"one lowercase greek letter $":/^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,digits:/^[0-9]+/,"-9.,9":/^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,"-9.,9 no missing 0":/^[+\-]?[0-9]+(?:[.,][0-9]+)?/,"(-)(9.,9)(e)(99)":function(t){var e=t.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:(?:([eE])|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);return e&&e[0]?{match_:e.slice(1),remainder:t.substr(e[0].length)}:null},"(-)(9)^(-9)":/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/,"state of aggregation $":function(t){var e=o.patterns.findObserveGroups(t,"",/^\([a-z]{1,3}(?=[\),])/,")","");if(e&&e.remainder.match(/^($|[\s,;\)\]\}])/))return e;var r=t.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);return r?{match_:r[0],remainder:t.substr(r[0].length)}:null},"_{(state of aggregation)}$":/^_\{(\([a-z]{1,3}\))\}/,"{[(":/^(?:\\\{|\[|\()/,")]}":/^(?:\)|\]|\\\})/,", ":/^[,;]\s*/,",":/^[,;]/,".":/^[.]/,". __* ":/^([.\u22C5\u00B7\u2022]|[*])\s*/,"...":/^\.\.\.(?=$|[^.])/,"^{(...)}":function(t){return o.patterns.findObserveGroups(t,"^{","","","}")},"^($...$)":function(t){return o.patterns.findObserveGroups(t,"^","$","$","")},"^a":/^\^([0-9]+|[^\\_])/,"^\\x{}{}":function(t){return o.patterns.findObserveGroups(t,"^",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"^\\x{}":function(t){return o.patterns.findObserveGroups(t,"^",/^\\[a-zA-Z]+\{/,"}","")},"^\\x":/^\^(\\[a-zA-Z]+)\s*/,"^(-1)":/^\^(-?\d+)/,"'":/^'/,"_{(...)}":function(t){return o.patterns.findObserveGroups(t,"_{","","","}")},"_($...$)":function(t){return o.patterns.findObserveGroups(t,"_","$","$","")},_9:/^_([+\-]?[0-9]+|[^\\])/,"_\\x{}{}":function(t){return o.patterns.findObserveGroups(t,"_",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"_\\x{}":function(t){return o.patterns.findObserveGroups(t,"_",/^\\[a-zA-Z]+\{/,"}","")},"_\\x":/^_(\\[a-zA-Z]+)\s*/,"^_":/^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,"{}^":/^\{\}(?=\^)/,"{}":/^\{\}/,"{...}":function(t){return o.patterns.findObserveGroups(t,"","{","}","")},"{(...)}":function(t){return o.patterns.findObserveGroups(t,"{","","","}")},"$...$":function(t){return o.patterns.findObserveGroups(t,"","$","$","")},"${(...)}$__$(...)$":function(t){return o.patterns.findObserveGroups(t,"${","","","}$")||o.patterns.findObserveGroups(t,"$","","","$")},"=<>":/^[=<>]/,"#":/^[#\u2261]/,"+":/^\+/,"-$":/^-(?=[\s_},;\]/]|$|\([a-z]+\))/,"-9":/^-(?=[0-9])/,"- orbital overlap":/^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,"-":/^-/,"pm-operator":/^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,operator:/^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,arrowUpDown:/^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,"\\bond{(...)}":function(t){return o.patterns.findObserveGroups(t,"\\bond{","","","}")},"->":/^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,CMT:/^[CMT](?=\[)/,"[(...)]":function(t){return o.patterns.findObserveGroups(t,"[","","","]")},"1st-level escape":/^(&|\\\\|\\hline)\s*/,"\\,":/^(?:\\[,\ ;:])/,"\\x{}{}":function(t){return o.patterns.findObserveGroups(t,"",/^\\[a-zA-Z]+\{/,"}","","","{","}","",!0)},"\\x{}":function(t){return o.patterns.findObserveGroups(t,"",/^\\[a-zA-Z]+\{/,"}","")},"\\ca":/^\\ca(?:\s+|(?![a-zA-Z]))/,"\\x":/^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,orbital:/^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,others:/^[\/~|]/,"\\frac{(...)}":function(t){return o.patterns.findObserveGroups(t,"\\frac{","","","}","{","","","}")},"\\overset{(...)}":function(t){return o.patterns.findObserveGroups(t,"\\overset{","","","}","{","","","}")},"\\underset{(...)}":function(t){return o.patterns.findObserveGroups(t,"\\underset{","","","}","{","","","}")},"\\underbrace{(...)}":function(t){return o.patterns.findObserveGroups(t,"\\underbrace{","","","}_","{","","","}")},"\\color{(...)}":function(t){return o.patterns.findObserveGroups(t,"\\color{","","","}")},"\\color{(...)}{(...)}":function(t){return o.patterns.findObserveGroups(t,"\\color{","","","}","{","","","}")||o.patterns.findObserveGroups(t,"\\color","\\","",/^(?=\{)/,"{","","","}")},"\\ce{(...)}":function(t){return o.patterns.findObserveGroups(t,"\\ce{","","","}")},"\\pu{(...)}":function(t){return o.patterns.findObserveGroups(t,"\\pu{","","","}")},oxidation$:/^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"d-oxidation$":/^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"roman numeral":/^[IVX]+/,"1/2$":/^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,amount:function(t){var e;if(e=t.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/))return{match_:e[0],remainder:t.substr(e[0].length)};var r=o.patterns.findObserveGroups(t,"","$","$","");return r&&(e=r.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/))?{match_:e[0],remainder:t.substr(e[0].length)}:null},amount2:function(t){return this.amount(t)},"(KV letters),":/^(?:[A-Z][a-z]{0,2}|i)(?=,)/,formula$:function(t){if(t.match(/^\([a-z]+\)$/))return null;var e=t.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);return e?{match_:e[0],remainder:t.substr(e[0].length)}:null},uprightEntities:/^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,"/":/^\s*(\/)\s*/,"//":/^\s*(\/\/)\s*/,"*":/^\s*[*.]\s*/},findObserveGroups:function(t,e,r,n,o,i,a,s,l,c){var u=function(t,e){if("string"==typeof e)return 0!==t.indexOf(e)?null:e;var r=t.match(e);return r?r[0]:null},p=u(t,e);if(null===p)return null;if(t=t.substr(p.length),null===(p=u(t,r)))return null;var h=function(t,e,r){for(var n=0;e<t.length;){var o=t.charAt(e),i=u(t.substr(e),r);if(null!==i&&0===n)return{endMatchBegin:e,endMatchEnd:e+i.length};if("{"===o)n++;else if("}"===o){if(0===n)throw["ExtraCloseMissingOpen","Extra close brace or missing open brace"];n--}e++}return null}(t,p.length,n||o);if(null===h)return null;var d=t.substring(0,n?h.endMatchEnd:h.endMatchBegin);if(i||a){var f=this.findObserveGroups(t.substr(h.endMatchEnd),i,a,s,l);if(null===f)return null;var m=[d,f.match_];return{match_:c?m.join(""):m,remainder:f.remainder}}return{match_:d,remainder:t.substr(h.endMatchEnd)}},match_:function(t,e){var r=o.patterns.patterns[t];if(void 0===r)throw["MhchemBugP","mhchem bug P. Please report. ("+t+")"];if("function"==typeof r)return o.patterns.patterns[t](e);var n=e.match(r);return n?n.length>2?{match_:n.slice(1),remainder:e.substr(n[0].length)}:{match_:n[1]||n[0],remainder:e.substr(n[0].length)}:null}},actions:{"a=":function(t,e){t.a=(t.a||"")+e},"b=":function(t,e){t.b=(t.b||"")+e},"p=":function(t,e){t.p=(t.p||"")+e},"o=":function(t,e){t.o=(t.o||"")+e},"q=":function(t,e){t.q=(t.q||"")+e},"d=":function(t,e){t.d=(t.d||"")+e},"rm=":function(t,e){t.rm=(t.rm||"")+e},"text=":function(t,e){t.text_=(t.text_||"")+e},insert:function(t,e,r){return{type_:r}},"insert+p1":function(t,e,r){return{type_:r,p1:e}},"insert+p1+p2":function(t,e,r){return{type_:r,p1:e[0],p2:e[1]}},copy:function(t,e){return e},write:function(t,e,r){return r},rm:function(t,e){return{type_:"rm",p1:e}},text:function(t,e){return o.go(e,"text")},"tex-math":function(t,e){return o.go(e,"tex-math")},"tex-math tight":function(t,e){return o.go(e,"tex-math tight")},bond:function(t,e,r){return{type_:"bond",kind_:r||e}},"color0-output":function(t,e){return{type_:"color0",color:e}},ce:function(t,e){return o.go(e,"ce")},pu:function(t,e){return o.go(e,"pu")},"1/2":function(t,e){var r=[];e.match(/^[+\-]/)&&(r.push(e.substr(0,1)),e=e.substr(1));var n=e.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);return n[1]=n[1].replace(/\$/g,""),r.push({type_:"frac",p1:n[1],p2:n[2]}),n[3]&&(n[3]=n[3].replace(/\$/g,""),r.push({type_:"tex-math",p1:n[3]})),r},"9,9":function(t,e){return o.go(e,"9,9")}},stateMachines:{tex:{transitions:n({empty:{0:{action_:"copy"}},"\\ce{(...)}":{0:{action_:[{type_:"write",option:"{"},"ce",{type_:"write",option:"}"}]}},"\\pu{(...)}":{0:{action_:[{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}]}},else:{0:{action_:"copy"}}}),actions:{}},ce:{transitions:n({empty:{"*":{action_:"output"}},else:{"0|1|2":{action_:"beginsWithBond=false",revisit:!0,toContinue:!0}},oxidation$:{0:{action_:"oxidation-output"}},CMT:{r:{action_:"rdt=",nextState:"rt"},rd:{action_:"rqt=",nextState:"rdt"}},arrowUpDown:{"0|1|2|as":{action_:["sb=false","output","operator"],nextState:"1"}},uprightEntities:{"0|1|2":{action_:["o=","output"],nextState:"1"}},orbital:{"0|1|2|3":{action_:"o=",nextState:"o"}},"->":{"0|1|2|3":{action_:"r=",nextState:"r"},"a|as":{action_:["output","r="],nextState:"r"},"*":{action_:["output","r="],nextState:"r"}},"+":{o:{action_:"d= kv",nextState:"d"},"d|D":{action_:"d=",nextState:"d"},q:{action_:"d=",nextState:"qd"},"qd|qD":{action_:"d=",nextState:"qd"},dq:{action_:["output","d="],nextState:"d"},3:{action_:["sb=false","output","operator"],nextState:"0"}},amount:{"0|2":{action_:"a=",nextState:"a"}},"pm-operator":{"0|1|2|a|as":{action_:["sb=false","output",{type_:"operator",option:"\\pm"}],nextState:"0"}},operator:{"0|1|2|a|as":{action_:["sb=false","output","operator"],nextState:"0"}},"-$":{"o|q":{action_:["charge or bond","output"],nextState:"qd"},d:{action_:"d=",nextState:"d"},D:{action_:["output",{type_:"bond",option:"-"}],nextState:"3"},q:{action_:"d=",nextState:"qd"},qd:{action_:"d=",nextState:"qd"},"qD|dq":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},"-9":{"3|o":{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"3"}},"- orbital overlap":{o:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},d:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"}},"-":{"0|1|2":{action_:[{type_:"output",option:1},"beginsWithBond=true",{type_:"bond",option:"-"}],nextState:"3"},3:{action_:{type_:"bond",option:"-"}},a:{action_:["output",{type_:"insert",option:"hyphen"}],nextState:"2"},as:{action_:[{type_:"output",option:2},{type_:"bond",option:"-"}],nextState:"3"},b:{action_:"b="},o:{action_:{type_:"- after o/d",option:!1},nextState:"2"},q:{action_:{type_:"- after o/d",option:!1},nextState:"2"},"d|qd|dq":{action_:{type_:"- after o/d",option:!0},nextState:"2"},"D|qD|p":{action_:["output",{type_:"bond",option:"-"}],nextState:"3"}},amount2:{"1|3":{action_:"a=",nextState:"a"}},letters:{"0|1|2|3|a|as|b|p|bp|o":{action_:"o=",nextState:"o"},"q|dq":{action_:["output","o="],nextState:"o"},"d|D|qd|qD":{action_:"o after d",nextState:"o"}},digits:{o:{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},q:{action_:["output","o="],nextState:"o"},a:{action_:"o=",nextState:"o"}},"space A":{"b|p|bp":{action_:[]}},space:{a:{action_:[],nextState:"as"},0:{action_:"sb=false"},"1|2":{action_:"sb=true"},"r|rt|rd|rdt|rdq":{action_:"output",nextState:"0"},"*":{action_:["output","sb=true"],nextState:"1"}},"1st-level escape":{"1|2":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}]},"*":{action_:["output",{type_:"insert+p1",option:"1st-level escape"}],nextState:"0"}},"[(...)]":{"r|rt":{action_:"rd=",nextState:"rd"},"rd|rdt":{action_:"rq=",nextState:"rdq"}},"...":{"o|d|D|dq|qd|qD":{action_:["output",{type_:"bond",option:"..."}],nextState:"3"},"*":{action_:[{type_:"output",option:1},{type_:"insert",option:"ellipsis"}],nextState:"1"}},". __* ":{"*":{action_:["output",{type_:"insert",option:"addition compound"}],nextState:"1"}},"state of aggregation $":{"*":{action_:["output","state of aggregation"],nextState:"1"}},"{[(":{"a|as|o":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"0|1|2|3":{action_:["o=","output","parenthesisLevel++"],nextState:"2"},"*":{action_:["output","o=","output","parenthesisLevel++"],nextState:"2"}},")]}":{"0|1|2|3|b|p|bp|o":{action_:["o=","parenthesisLevel--"],nextState:"o"},"a|as|d|D|q|qd|qD|dq":{action_:["output","o=","parenthesisLevel--"],nextState:"o"}},", ":{"*":{action_:["output","comma"],nextState:"0"}},"^_":{"*":{action_:[]}},"^{(...)}|^($...$)":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"D"},q:{action_:"d=",nextState:"qD"},"d|D|qd|qD|dq":{action_:["output","d="],nextState:"D"}},"^a|^\\x{}{}|^\\x{}|^\\x|'":{"0|1|2|as":{action_:"b=",nextState:"b"},p:{action_:"b=",nextState:"bp"},"3|o":{action_:"d= kv",nextState:"d"},q:{action_:"d=",nextState:"qd"},"d|qd|D|qD":{action_:"d="},dq:{action_:["output","d="],nextState:"d"}},"_{(state of aggregation)}$":{"d|D|q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x":{"0|1|2|as":{action_:"p=",nextState:"p"},b:{action_:"p=",nextState:"bp"},"3|o":{action_:"q=",nextState:"q"},"d|D":{action_:"q=",nextState:"dq"},"q|qd|qD|dq":{action_:["output","q="],nextState:"q"}},"=<>":{"0|1|2|3|a|as|o|q|d|D|qd|qD|dq":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"#":{"0|1|2|3|a|as|o":{action_:[{type_:"output",option:2},{type_:"bond",option:"#"}],nextState:"3"}},"{}^":{"*":{action_:[{type_:"output",option:1},{type_:"insert",option:"tinySkip"}],nextState:"1"}},"{}":{"*":{action_:{type_:"output",option:1},nextState:"1"}},"{...}":{"0|1|2|3|a|as|b|p|bp":{action_:"o=",nextState:"o"},"o|d|D|q|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"$...$":{a:{action_:"a="},"0|1|2|3|as|b|p|bp|o":{action_:"o=",nextState:"o"},"as|o":{action_:"o="},"q|d|D|qd|qD|dq":{action_:["output","o="],nextState:"o"}},"\\bond{(...)}":{"*":{action_:[{type_:"output",option:2},"bond"],nextState:"3"}},"\\frac{(...)}":{"*":{action_:[{type_:"output",option:1},"frac-output"],nextState:"3"}},"\\overset{(...)}":{"*":{action_:[{type_:"output",option:2},"overset-output"],nextState:"3"}},"\\underset{(...)}":{"*":{action_:[{type_:"output",option:2},"underset-output"],nextState:"3"}},"\\underbrace{(...)}":{"*":{action_:[{type_:"output",option:2},"underbrace-output"],nextState:"3"}},"\\color{(...)}{(...)}":{"*":{action_:[{type_:"output",option:2},"color-output"],nextState:"3"}},"\\color{(...)}":{"*":{action_:[{type_:"output",option:2},"color0-output"]}},"\\ce{(...)}":{"*":{action_:[{type_:"output",option:2},"ce"],nextState:"3"}},"\\,":{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"1"}},"\\pu{(...)}":{"*":{action_:["output",{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}],nextState:"3"}},"\\x{}{}|\\x{}|\\x":{"0|1|2|3|a|as|b|p|bp|o|c0":{action_:["o=","output"],nextState:"3"},"*":{action_:["output","o=","output"],nextState:"3"}},others:{"*":{action_:[{type_:"output",option:1},"copy"],nextState:"3"}},else2:{a:{action_:"a to o",nextState:"o",revisit:!0},as:{action_:["output","sb=true"],nextState:"1",revisit:!0},"r|rt|rd|rdt|rdq":{action_:["output"],nextState:"0",revisit:!0},"*":{action_:["output","copy"],nextState:"3"}}}),actions:{"o after d":function(t,e){var r;if((t.d||"").match(/^[1-9][0-9]*$/)){var n=t.d;t.d=void 0,(r=this.output(t)).push({type_:"tinySkip"}),t.b=n}else r=this.output(t);return o.actions["o="](t,e),r},"d= kv":function(t,e){t.d=e,t.dType="kv"},"charge or bond":function(t,e){if(t.beginsWithBond){var r=[];return o.concatArray(r,this.output(t)),o.concatArray(r,o.actions.bond(t,e,"-")),r}t.d=e},"- after o/d":function(t,e,r){var n=o.patterns.match_("orbital",t.o||""),i=o.patterns.match_("one lowercase greek letter $",t.o||""),a=o.patterns.match_("one lowercase latin letter $",t.o||""),s=o.patterns.match_("$one lowercase latin letter$ $",t.o||""),l="-"===e&&(n&&""===n.remainder||i||a||s);!l||t.a||t.b||t.p||t.d||t.q||n||!a||(t.o="$"+t.o+"$");var c=[];return l?(o.concatArray(c,this.output(t)),c.push({type_:"hyphen"})):(n=o.patterns.match_("digits",t.d||""),r&&n&&""===n.remainder?(o.concatArray(c,o.actions["d="](t,e)),o.concatArray(c,this.output(t))):(o.concatArray(c,this.output(t)),o.concatArray(c,o.actions.bond(t,e,"-")))),c},"a to o":function(t){t.o=t.a,t.a=void 0},"sb=true":function(t){t.sb=!0},"sb=false":function(t){t.sb=!1},"beginsWithBond=true":function(t){t.beginsWithBond=!0},"beginsWithBond=false":function(t){t.beginsWithBond=!1},"parenthesisLevel++":function(t){t.parenthesisLevel++},"parenthesisLevel--":function(t){t.parenthesisLevel--},"state of aggregation":function(t,e){return{type_:"state of aggregation",p1:o.go(e,"o")}},comma:function(t,e){var r=e.replace(/\s*$/,"");return r!==e&&0===t.parenthesisLevel?{type_:"comma enumeration L",p1:r}:{type_:"comma enumeration M",p1:r}},output:function(t,e,r){var n;if(t.r){var i=void 0;i="M"===t.rdt?o.go(t.rd,"tex-math"):"T"===t.rdt?[{type_:"text",p1:t.rd||""}]:o.go(t.rd,"ce");var a=void 0;a="M"===t.rqt?o.go(t.rq,"tex-math"):"T"===t.rqt?[{type_:"text",p1:t.rq||""}]:o.go(t.rq,"ce"),n={type_:"arrow",r:t.r,rd:i,rq:a}}else n=[],(t.a||t.b||t.p||t.o||t.q||t.d||r)&&(t.sb&&n.push({type_:"entitySkip"}),t.o||t.q||t.d||t.b||t.p||2===r?t.o||t.q||t.d||!t.b&&!t.p?t.o&&"kv"===t.dType&&o.patterns.match_("d-oxidation$",t.d||"")?t.dType="oxidation":t.o&&"kv"===t.dType&&!t.q&&(t.dType=void 0):(t.o=t.a,t.d=t.b,t.q=t.p,t.a=t.b=t.p=void 0):(t.o=t.a,t.a=void 0),n.push({type_:"chemfive",a:o.go(t.a,"a"),b:o.go(t.b,"bd"),p:o.go(t.p,"pq"),o:o.go(t.o,"o"),q:o.go(t.q,"pq"),d:o.go(t.d,"oxidation"===t.dType?"oxidation":"bd"),dType:t.dType}));for(var s in t)"parenthesisLevel"!==s&&"beginsWithBond"!==s&&delete t[s];return n},"oxidation-output":function(t,e){var r=["{"];return o.concatArray(r,o.go(e,"oxidation")),r.push("}"),r},"frac-output":function(t,e){return{type_:"frac-ce",p1:o.go(e[0],"ce"),p2:o.go(e[1],"ce")}},"overset-output":function(t,e){return{type_:"overset",p1:o.go(e[0],"ce"),p2:o.go(e[1],"ce")}},"underset-output":function(t,e){return{type_:"underset",p1:o.go(e[0],"ce"),p2:o.go(e[1],"ce")}},"underbrace-output":function(t,e){return{type_:"underbrace",p1:o.go(e[0],"ce"),p2:o.go(e[1],"ce")}},"color-output":function(t,e){return{type_:"color",color1:e[0],color2:o.go(e[1],"ce")}},"r=":function(t,e){t.r=e},"rdt=":function(t,e){t.rdt=e},"rd=":function(t,e){t.rd=e},"rqt=":function(t,e){t.rqt=e},"rq=":function(t,e){t.rq=e},operator:function(t,e,r){return{type_:"operator",kind_:r||e}}}},a:{transitions:n({empty:{"*":{action_:[]}},"1/2$":{0:{action_:"1/2"}},else:{0:{action_:[],nextState:"1",revisit:!0}},"${(...)}$__$(...)$":{"*":{action_:"tex-math tight",nextState:"1"}},",":{"*":{action_:{type_:"insert",option:"commaDecimal"}}},else2:{"*":{action_:"copy"}}}),actions:{}},o:{transitions:n({empty:{"*":{action_:[]}},"1/2$":{0:{action_:"1/2"}},else:{0:{action_:[],nextState:"1",revisit:!0}},letters:{"*":{action_:"rm"}},"\\ca":{"*":{action_:{type_:"insert",option:"circa"}}},"\\pu{(...)}":{"*":{action_:[{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}]}},"\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},"${(...)}$__$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:[{type_:"write",option:"{"},"text",{type_:"write",option:"}"}]}},else2:{"*":{action_:"copy"}}}),actions:{}},text:{transitions:n({empty:{"*":{action_:"output"}},"{...}":{"*":{action_:"text="}},"${(...)}$__$(...)$":{"*":{action_:"tex-math"}},"\\greek":{"*":{action_:["output","rm"]}},"\\pu{(...)}":{"*":{action_:["output",{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:["output","copy"]}},else:{"*":{action_:"text="}}}),actions:{output:function(t){if(t.text_){var e={type_:"text",p1:t.text_};for(var r in t)delete t[r];return e}}}},pq:{transitions:n({empty:{"*":{action_:[]}},"state of aggregation $":{"*":{action_:"state of aggregation"}},i$:{0:{action_:[],nextState:"!f",revisit:!0}},"(KV letters),":{0:{action_:"rm",nextState:"0"}},formula$:{0:{action_:[],nextState:"f",revisit:!0}},"1/2$":{0:{action_:"1/2"}},else:{0:{action_:[],nextState:"!f",revisit:!0}},"${(...)}$__$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"a-z":{f:{action_:"tex-math"}},letters:{"*":{action_:"rm"}},"-9.,9":{"*":{action_:"9,9"}},",":{"*":{action_:{type_:"insert+p1",option:"comma enumeration S"}}},"\\color{(...)}{(...)}":{"*":{action_:"color-output"}},"\\color{(...)}":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\pu{(...)}":{"*":{action_:[{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"state of aggregation":function(t,e){return{type_:"state of aggregation subscript",p1:o.go(e,"o")}},"color-output":function(t,e){return{type_:"color",color1:e[0],color2:o.go(e[1],"pq")}}}},bd:{transitions:n({empty:{"*":{action_:[]}},x$:{0:{action_:[],nextState:"!f",revisit:!0}},formula$:{0:{action_:[],nextState:"f",revisit:!0}},else:{0:{action_:[],nextState:"!f",revisit:!0}},"-9.,9 no missing 0":{"*":{action_:"9,9"}},".":{"*":{action_:{type_:"insert",option:"electron dot"}}},"a-z":{f:{action_:"tex-math"}},x:{"*":{action_:{type_:"insert",option:"KV x"}}},letters:{"*":{action_:"rm"}},"'":{"*":{action_:{type_:"insert",option:"prime"}}},"${(...)}$__$(...)$":{"*":{action_:"tex-math"}},"{(...)}":{"*":{action_:"text"}},"\\color{(...)}{(...)}":{"*":{action_:"color-output"}},"\\color{(...)}":{"*":{action_:"color0-output"}},"\\ce{(...)}":{"*":{action_:"ce"}},"\\pu{(...)}":{"*":{action_:[{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"copy"}},else2:{"*":{action_:"copy"}}}),actions:{"color-output":function(t,e){return{type_:"color",color1:e[0],color2:o.go(e[1],"bd")}}}},oxidation:{transitions:n({empty:{"*":{action_:[]}},"roman numeral":{"*":{action_:"roman-numeral"}},"${(...)}$__$(...)$":{"*":{action_:"tex-math"}},else:{"*":{action_:"copy"}}}),actions:{"roman-numeral":function(t,e){return{type_:"roman numeral",p1:e}}}},"tex-math":{transitions:n({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"\\pu{(...)}":{"*":{action_:["output",{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},else:{"*":{action_:"o="}}}),actions:{output:function(t){if(t.o){var e={type_:"tex-math",p1:t.o};for(var r in t)delete t[r];return e}}}},"tex-math tight":{transitions:n({empty:{"*":{action_:"output"}},"\\ce{(...)}":{"*":{action_:["output","ce"]}},"\\pu{(...)}":{"*":{action_:["output",{type_:"write",option:"{"},"pu",{type_:"write",option:"}"}]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:"o="}},"-|+":{"*":{action_:"tight operator"}},else:{"*":{action_:"o="}}}),actions:{"tight operator":function(t,e){t.o=(t.o||"")+"{"+e+"}"},output:function(t){if(t.o){var e={type_:"tex-math",p1:t.o};for(var r in t)delete t[r];return e}}}},"9,9":{transitions:n({empty:{"*":{action_:[]}},",":{"*":{action_:"comma"}},else:{"*":{action_:"copy"}}}),actions:{comma:function(){return{type_:"commaDecimal"}}}},pu:{transitions:n({empty:{"*":{action_:"output"}},space$:{"*":{action_:["output","space"]}},"{[(|)]}":{"0|a":{action_:"copy"}},"(-)(9)^(-9)":{0:{action_:"number^",nextState:"a"}},"(-)(9.,9)(e)(99)":{0:{action_:"enumber",nextState:"a"}},space:{"0|a":{action_:[]}},"pm-operator":{"0|a":{action_:{type_:"operator",option:"\\pm"},nextState:"0"}},operator:{"0|a":{action_:"copy",nextState:"0"}},"//":{d:{action_:"o=",nextState:"/"}},"/":{d:{action_:"o=",nextState:"/"}},"{...}|else":{"0|d":{action_:"d=",nextState:"d"},a:{action_:["space","d="],nextState:"d"},"/|q":{action_:"q=",nextState:"q"}}}),actions:{enumber:function(t,e){var r=[];return"+-"===e[0]||"+/-"===e[0]?r.push("\\pm "):e[0]&&r.push(e[0]),e[1]&&(o.concatArray(r,o.go(e[1],"pu-9,9")),e[2]&&(e[2].match(/[,.]/)?o.concatArray(r,o.go(e[2],"pu-9,9")):r.push(e[2])),(e[3]||e[4])&&("e"===e[3]||"*"===e[4]?r.push({type_:"cdot"}):r.push({type_:"times"}))),e[5]&&r.push("10^{"+e[5]+"}"),r},"number^":function(t,e){var r=[];return"+-"===e[0]||"+/-"===e[0]?r.push("\\pm "):e[0]&&r.push(e[0]),o.concatArray(r,o.go(e[1],"pu-9,9")),r.push("^{"+e[2]+"}"),r},operator:function(t,e,r){return{type_:"operator",kind_:r||e}},space:function(){return{type_:"pu-space-1"}},output:function(t){var e,r=o.patterns.match_("{(...)}",t.d||"");r&&""===r.remainder&&(t.d=r.match_);var n=o.patterns.match_("{(...)}",t.q||"");if(n&&""===n.remainder&&(t.q=n.match_),t.d&&(t.d=t.d.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),t.d=t.d.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F")),t.q){t.q=t.q.replace(/\u00B0C|\^oC|\^{o}C/g,"{}^{\\circ}C"),t.q=t.q.replace(/\u00B0F|\^oF|\^{o}F/g,"{}^{\\circ}F");var i={d:o.go(t.d,"pu"),q:o.go(t.q,"pu")};"//"===t.o?e={type_:"pu-frac",p1:i.d,p2:i.q}:(e=i.d,i.d.length>1||i.q.length>1?e.push({type_:" / "}):e.push({type_:"/"}),o.concatArray(e,i.q))}else e=o.go(t.d,"pu-2");for(var a in t)delete t[a];return e}}},"pu-2":{transitions:n({empty:{"*":{action_:"output"}},"*":{"*":{action_:["output","cdot"],nextState:"0"}},"\\x":{"*":{action_:"rm="}},space:{"*":{action_:["output","space"],nextState:"0"}},"^{(...)}|^(-1)":{1:{action_:"^(-1)"}},"-9.,9":{0:{action_:"rm=",nextState:"0"},1:{action_:"^(-1)",nextState:"0"}},"{...}|else":{"*":{action_:"rm=",nextState:"1"}}}),actions:{cdot:function(){return{type_:"tight cdot"}},"^(-1)":function(t,e){t.rm+="^{"+e+"}"},space:function(){return{type_:"pu-space-2"}},output:function(t){var e=[];if(t.rm){var r=o.patterns.match_("{(...)}",t.rm||"");e=r&&""===r.remainder?o.go(r.match_,"pu"):{type_:"rm",p1:t.rm}}for(var n in t)delete t[n];return e}}},"pu-9,9":{transitions:n({empty:{0:{action_:"output-0"},o:{action_:"output-o"}},",":{0:{action_:["output-0","comma"],nextState:"o"}},".":{0:{action_:["output-0","copy"],nextState:"o"}},else:{"*":{action_:"text="}}}),actions:{comma:function(){return{type_:"commaDecimal"}},"output-0":function(t){var e=[];if(t.text_=t.text_||"",t.text_.length>4){var r=t.text_.length%3;0===r&&(r=3);for(var n=t.text_.length-3;n>0;n-=3)e.push(t.text_.substr(n,3)),e.push({type_:"1000 separator"});e.push(t.text_.substr(0,r)),e.reverse()}else e.push(t.text_);for(var o in t)delete t[o];return e},"output-o":function(t){var e=[];if(t.text_=t.text_||"",t.text_.length>4){var r=t.text_.length-3,n=void 0;for(n=0;n<r;n+=3)e.push(t.text_.substr(n,3)),e.push({type_:"1000 separator"});e.push(t.text_.substr(n))}else e.push(t.text_);for(var o in t)delete t[o];return e}}}}},i={go:function(t,e){if(!t)return"";for(var r="",n=!1,o=0;o<t.length;o++){var a=t[o];"string"==typeof a?r+=a:(r+=i._go2(a),"1st-level escape"===a.type_&&(n=!0))}return e&&!n&&r&&(r="{"+r+"}"),r},_goInner:function(t){return i.go(t,!1)},_go2:function(t){var e;switch(t.type_){case"chemfive":e="";var r={a:i._goInner(t.a),b:i._goInner(t.b),p:i._goInner(t.p),o:i._goInner(t.o),q:i._goInner(t.q),d:i._goInner(t.d)};r.a&&(r.a.match(/^[+\-]/)&&(r.a="{"+r.a+"}"),e+=r.a+"\\,"),(r.b||r.p)&&(e+="{\\vphantom{A}}",e+="^{\\hphantom{"+(r.b||"")+"}}_{\\hphantom{"+(r.p||"")+"}}",e+="\\mkern-1.5mu",e+="{\\vphantom{A}}",e+="^{\\smash[t]{\\vphantom{2}}\\llap{"+(r.b||"")+"}}",e+="_{\\vphantom{2}\\llap{\\smash[t]{"+(r.p||"")+"}}}"),r.o&&(r.o.match(/^[+\-]/)&&(r.o="{"+r.o+"}"),e+=r.o),"kv"===t.dType?((r.d||r.q)&&(e+="{\\vphantom{A}}"),r.d&&(e+="^{"+r.d+"}"),r.q&&(e+="_{\\smash[t]{"+r.q+"}}")):"oxidation"===t.dType?(r.d&&(e+="{\\vphantom{A}}",e+="^{"+r.d+"}"),r.q&&(e+="{\\vphantom{A}}",e+="_{\\smash[t]{"+r.q+"}}")):(r.q&&(e+="{\\vphantom{A}}",e+="_{\\smash[t]{"+r.q+"}}"),r.d&&(e+="{\\vphantom{A}}",e+="^{"+r.d+"}"));break;case"rm":case"roman numeral":e="\\mathrm{"+t.p1+"}";break;case"text":t.p1.match(/[\^_]/)?(t.p1=t.p1.replace(" ","~").replace("-","\\text{-}"),e="\\mathrm{"+t.p1+"}"):e="\\text{"+t.p1+"}";break;case"state of aggregation":e="\\mskip2mu "+i._goInner(t.p1);break;case"state of aggregation subscript":e="\\mskip1mu "+i._goInner(t.p1);break;case"bond":if(!(e=i._getBond(t.kind_)))throw["MhchemErrorBond","mhchem Error. Unknown bond type ("+t.kind_+")"];break;case"frac":var n="\\frac{"+t.p1+"}{"+t.p2+"}";e="\\mathchoice{\\textstyle"+n+"}{"+n+"}{"+n+"}{"+n+"}";break;case"pu-frac":var o="\\frac{"+i._goInner(t.p1)+"}{"+i._goInner(t.p2)+"}";e="\\mathchoice{\\textstyle"+o+"}{"+o+"}{"+o+"}{"+o+"}";break;case"tex-math":case"1st-level escape":e=t.p1+" ";break;case"frac-ce":e="\\frac{"+i._goInner(t.p1)+"}{"+i._goInner(t.p2)+"}";break;case"overset":e="\\overset{"+i._goInner(t.p1)+"}{"+i._goInner(t.p2)+"}";break;case"underset":e="\\underset{"+i._goInner(t.p1)+"}{"+i._goInner(t.p2)+"}";break;case"underbrace":e="\\underbrace{"+i._goInner(t.p1)+"}_{"+i._goInner(t.p2)+"}";break;case"color":e="{\\color{"+t.color1+"}{"+i._goInner(t.color2)+"}}";break;case"color0":e="\\color{"+t.color+"}";break;case"arrow":var a={rd:i._goInner(t.rd),rq:i._goInner(t.rq)},s=i._getArrow(t.r);a.rd||a.rq?"<=>"===t.r||"<=>>"===t.r||"<<=>"===t.r||"<--\x3e"===t.r?(s="\\long"+s,a.rd&&(s="\\overset{"+a.rd+"}{"+s+"}"),a.rq&&(s="<--\x3e"===t.r?"\\underset{\\lower2mu{"+a.rq+"}}{"+s+"}":"\\underset{\\lower6mu{"+a.rq+"}}{"+s+"}"),s=" {}\\mathrel{"+s+"}{} "):(a.rq&&(s+="[{"+a.rq+"}]"),s=" {}\\mathrel{\\x"+(s+="{"+a.rd+"}")+"}{} "):s=" {}\\mathrel{\\long"+s+"}{} ",e=s;break;case"operator":e=i._getOperator(t.kind_);break;case"space":e=" ";break;case"tinySkip":e="\\mkern2mu";break;case"entitySkip":case"pu-space-1":e="~";break;case"pu-space-2":e="\\mkern3mu ";break;case"1000 separator":e="\\mkern2mu ";break;case"commaDecimal":e="{,}";break;case"comma enumeration L":e="{"+t.p1+"}\\mkern6mu ";break;case"comma enumeration M":e="{"+t.p1+"}\\mkern3mu ";break;case"comma enumeration S":e="{"+t.p1+"}\\mkern1mu ";break;case"hyphen":e="\\text{-}";break;case"addition compound":e="\\,{\\cdot}\\,";break;case"electron dot":e="\\mkern1mu \\bullet\\mkern1mu ";break;case"KV x":e="{\\times}";break;case"prime":e="\\prime ";break;case"cdot":e="\\cdot ";break;case"tight cdot":e="\\mkern1mu{\\cdot}\\mkern1mu ";break;case"times":e="\\times ";break;case"circa":e="{\\sim}";break;case"^":e="uparrow";break;case"v":e="downarrow";break;case"ellipsis":e="\\ldots ";break;case"/":e="/";break;case" / ":e="\\,/\\,";break;default:throw["MhchemBugT","mhchem bug T. Please report."]}return e},_getArrow:function(t){switch(t){case"->":case"\u2192":case"\u27f6":return"rightarrow";case"<-":return"leftarrow";case"<->":return"leftrightarrow";case"<--\x3e":return"leftrightarrows";case"<=>":case"\u21cc":return"rightleftharpoons";case"<=>>":return"Rightleftharpoons";case"<<=>":return"Leftrightharpoons";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getBond:function(t){switch(t){case"-":case"1":return"{-}";case"=":case"2":return"{=}";case"#":case"3":return"{\\equiv}";case"~":return"{\\tripledash}";case"~-":return"{\\rlap{\\lower.1em{-}}\\raise.1em{\\tripledash}}";case"~=":case"~--":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{\\tripledash}}-}";case"-~-":return"{\\rlap{\\lower.2em{-}}\\rlap{\\raise.2em{-}}\\tripledash}";case"...":return"{{\\cdot}{\\cdot}{\\cdot}}";case"....":return"{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}";case"->":return"{\\rightarrow}";case"<-":return"{\\leftarrow}";case"<":return"{<}";case">":return"{>}";default:throw["MhchemBugT","mhchem bug T. Please report."]}},_getOperator:function(t){switch(t){case"+":return" {}+{} ";case"-":return" {}-{} ";case"=":return" {}={} ";case"<":return" {}<{} ";case">":return" {}>{} ";case"<<":return" {}\\ll{} ";case">>":return" {}\\gg{} ";case"\\pm":return" {}\\pm{} ";case"\\approx":case"$\\approx$":return" {}\\approx{} ";case"v":case"(v)":return" \\downarrow{} ";case"^":case"(^)":return" \\uparrow{} ";default:throw["MhchemBugT","mhchem bug T. Please report."]}}}},9329:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},n(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractEntry=void 0;var i=r(9328),a=r(2165),s=function(t){function e(e,r){var n=t.call(this)||this;return n._menu=e,n._type=r,n.className=a.HtmlClasses.MENUITEM,n.role="menuitem",n.hidden=!1,n}return o(e,t),Object.defineProperty(e.prototype,"menu",{get:function(){return this._menu},set:function(t){this._menu=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),e.prototype.hide=function(){this.hidden=!0,this.menu.generateMenu()},e.prototype.show=function(){this.hidden=!1,this.menu.generateMenu()},e.prototype.isHidden=function(){return this.hidden},e}(i.MenuElement);e.AbstractEntry=s},1340:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},n(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractItem=void 0;var a=r(9329),s=r(2556),l=r(2165),c=function(t){function e(e,r,n,o){var i=t.call(this,e,r)||this;return i._content=n,i.disabled=!1,i.callbacks=[],i._id=o||n,i}return o(e,t),Object.defineProperty(e.prototype,"content",{get:function(){return this._content},set:function(t){this._content=t,this.generateHtml(),this.menu&&this.menu.generateHtml()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),e.prototype.press=function(){this.disabled||(this.executeAction(),this.executeCallbacks_())},e.prototype.executeAction=function(){},e.prototype.registerCallback=function(t){-1===this.callbacks.indexOf(t)&&this.callbacks.push(t)},e.prototype.unregisterCallback=function(t){var e=this.callbacks.indexOf(t);-1!==e&&this.callbacks.splice(e,1)},e.prototype.mousedown=function(t){this.press(),this.stop(t)},e.prototype.mouseover=function(t){this.focus(),this.stop(t)},e.prototype.mouseout=function(t){this.deactivate(),this.stop(t)},e.prototype.generateHtml=function(){t.prototype.generateHtml.call(this);var e=this.html;e.setAttribute("aria-disabled","false"),e.textContent=this.content},e.prototype.activate=function(){this.disabled||this.html.classList.add(l.HtmlClasses.MENUACTIVE)},e.prototype.deactivate=function(){this.html.classList.remove(l.HtmlClasses.MENUACTIVE)},e.prototype.focus=function(){this.menu.focused=this,t.prototype.focus.call(this),this.activate()},e.prototype.unfocus=function(){this.deactivate(),t.prototype.unfocus.call(this)},e.prototype.escape=function(t){s.MenuUtil.close(this)},e.prototype.up=function(t){this.menu.up(t)},e.prototype.down=function(t){this.menu.down(t)},e.prototype.left=function(t){this.menu.left(t)},e.prototype.right=function(t){this.menu.right(t)},e.prototype.space=function(t){this.press()},e.prototype.disable=function(){this.disabled=!0;var t=this.html;t.classList.add(l.HtmlClasses.MENUDISABLED),t.setAttribute("aria-disabled","true")},e.prototype.enable=function(){this.disabled=!1;var t=this.html;t.classList.remove(l.HtmlClasses.MENUDISABLED),t.removeAttribute("aria-disabled")},e.prototype.executeCallbacks_=function(){var t,e;try{for(var r=i(this.callbacks),n=r.next();!n.done;n=r.next()){var o=n.value;try{o(this)}catch(t){s.MenuUtil.error(t,"Callback for menu entry "+this.id+" failed.")}}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},e}(a.AbstractEntry);e.AbstractItem=c},1484:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},n(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractMenu=void 0;var a=r(8372),s=r(1340),l=r(2165),c=r(6186),u=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.className=l.HtmlClasses.CONTEXTMENU,e.role="menu",e._items=[],e._baseMenu=null,e}return o(e,t),Object.defineProperty(e.prototype,"baseMenu",{get:function(){return this._baseMenu},set:function(t){this._baseMenu=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"items",{get:function(){return this._items},set:function(t){this._items=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pool",{get:function(){return this.variablePool},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"focused",{get:function(){return this._focused},set:function(t){if(this._focused!==t){this._focused||this.unfocus();var e=this._focused;this._focused=t,e&&e.unfocus()}},enumerable:!1,configurable:!0}),e.prototype.up=function(t){var e=this.items.filter((function(t){return t instanceof s.AbstractItem&&!t.isHidden()}));if(0!==e.length)if(this.focused){var r=e.indexOf(this.focused);-1!==r&&e[r=r?--r:e.length-1].focus()}else e[e.length-1].focus()},e.prototype.down=function(t){var e=this.items.filter((function(t){return t instanceof s.AbstractItem&&!t.isHidden()}));if(0!==e.length)if(this.focused){var r=e.indexOf(this.focused);-1!==r&&e[r=++r===e.length?0:r].focus()}else e[0].focus()},e.prototype.generateHtml=function(){t.prototype.generateHtml.call(this),this.generateMenu()},e.prototype.generateMenu=function(){var t,e,r=this.html;r.classList.add(l.HtmlClasses.MENU);try{for(var n=i(this.items),o=n.next();!o.done;o=n.next()){var a=o.value;if(a.isHidden()){var s=a.html;s.parentNode&&s.parentNode.removeChild(s)}else r.appendChild(a.html)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}},e.prototype.post=function(e,r){this.variablePool.update(),t.prototype.post.call(this,e,r)},e.prototype.unpostSubmenus=function(){var t,e,r=this.items.filter((function(t){return t instanceof c.Submenu}));try{for(var n=i(r),o=n.next();!o.done;o=n.next()){var a=o.value;a.submenu.unpost(),a!==this.focused&&a.unfocus()}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}},e.prototype.unpost=function(){t.prototype.unpost.call(this),this.unpostSubmenus(),this.focused=null},e.prototype.find=function(t){var e,r;try{for(var n=i(this.items),o=n.next();!o.done;o=n.next()){var a=o.value;if("rule"!==a.type){if(a.id===t)return a;if("submenu"===a.type){var s=a.submenu.find(t);if(s)return s}}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return null},e}(a.AbstractPostable);e.AbstractMenu=u},2868:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractNavigatable=void 0;var n=r(3205),o=r(8853),i=function(){function t(){this.bubble=!1}return t.prototype.bubbleKey=function(){this.bubble=!0},t.prototype.keydown=function(t){switch(t.keyCode){case n.KEY.ESCAPE:this.escape(t);break;case n.KEY.RIGHT:this.right(t);break;case n.KEY.LEFT:this.left(t);break;case n.KEY.UP:this.up(t);break;case n.KEY.DOWN:this.down(t);break;case n.KEY.RETURN:case n.KEY.SPACE:this.space(t);break;default:return}this.bubble?this.bubble=!1:this.stop(t)},t.prototype.escape=function(t){},t.prototype.space=function(t){},t.prototype.left=function(t){},t.prototype.right=function(t){},t.prototype.up=function(t){},t.prototype.down=function(t){},t.prototype.stop=function(t){t&&(t.stopPropagation(),t.preventDefault(),t.cancelBubble=!0)},t.prototype.mousedown=function(t){return this.stop(t)},t.prototype.mouseup=function(t){return this.stop(t)},t.prototype.mouseover=function(t){return this.stop(t)},t.prototype.mouseout=function(t){return this.stop(t)},t.prototype.click=function(t){return this.stop(t)},t.prototype.addEvents=function(t){t.addEventListener(o.MOUSE.DOWN,this.mousedown.bind(this)),t.addEventListener(o.MOUSE.UP,this.mouseup.bind(this)),t.addEventListener(o.MOUSE.OVER,this.mouseover.bind(this)),t.addEventListener(o.MOUSE.OUT,this.mouseout.bind(this)),t.addEventListener(o.MOUSE.CLICK,this.click.bind(this)),t.addEventListener("keydown",this.keydown.bind(this)),t.addEventListener("dragstart",this.stop.bind(this)),t.addEventListener(o.MOUSE.SELECTSTART,this.stop.bind(this)),t.addEventListener("contextmenu",this.stop.bind(this)),t.addEventListener(o.MOUSE.DBLCLICK,this.stop.bind(this))},t}();e.AbstractNavigatable=i},8372:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},n(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractPostable=void 0;var i=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.posted=!1,e}return o(e,t),e.prototype.isPosted=function(){return this.posted},e.prototype.post=function(t,e){this.posted||(void 0!==t&&void 0!==e&&this.html.setAttribute("style","left: "+t+"px; top: "+e+"px;"),this.display(),this.posted=!0)},e.prototype.unpost=function(){if(this.posted){var t=this.html;t.parentNode&&t.parentNode.removeChild(t),this.posted=!1}},e}(r(9328).MenuElement);e.AbstractPostable=i},6765:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},n(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractVariableItem=void 0;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.generateHtml=function(){t.prototype.generateHtml.call(this);var e=this.html;this.span||this.generateSpan(),e.appendChild(this.span),this.update()},e.prototype.register=function(){this.variable.register(this)},e.prototype.unregister=function(){this.variable.unregister(this)},e.prototype.update=function(){this.updateAria(),this.span&&this.updateSpan()},e}(r(1340).AbstractItem);e.AbstractVariableItem=i},5179:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},n(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.CloseButton=void 0;var i=r(8372),a=r(2165),s=function(t){function e(e){var r=t.call(this)||this;return r.element=e,r.className=a.HtmlClasses.MENUCLOSE,r.role="button",r}return o(e,t),e.prototype.generateHtml=function(){var t=document.createElement("span");t.classList.add(this.className),t.setAttribute("role",this.role),t.setAttribute("tabindex","0");var e=document.createElement("span");e.textContent="\xd7",t.appendChild(e),this.html=t},e.prototype.display=function(){},e.prototype.unpost=function(){t.prototype.unpost.call(this),this.element.unpost()},e.prototype.keydown=function(e){this.bubbleKey(),t.prototype.keydown.call(this,e)},e.prototype.space=function(t){this.unpost(),this.stop(t)},e.prototype.mousedown=function(t){this.unpost(),this.stop(t)},e}(i.AbstractPostable);e.CloseButton=s},5073:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},n(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.ContextMenu=void 0;var i=r(1484),a=r(2165),s=r(1932),l=r(2358),c=function(t){function e(e){var r=t.call(this)||this;return r.factory=e,r.id="",r.moving=!1,r._store=new s.MenuStore(r),r.widgets=[],r.variablePool=new l.VariablePool,r}return o(e,t),e.fromJson=function(t,e){var r=e.pool,n=e.items,o=e.id,i=void 0===o?"":o,a=new this(t);a.id=i;var s=t.get("variable");r.forEach((function(e){return s(t,e,a.pool)}));var l=t.get("items")(t,n,a);return a.items=l,a},e.prototype.generateHtml=function(){this.isPosted()&&this.unpost(),t.prototype.generateHtml.call(this),this._frame=document.createElement("div"),this._frame.classList.add(a.HtmlClasses.MENUFRAME);var e="left: 0px; top: 0px; z-index: 200; width: 100%; height: 100%; border: 0px; padding: 0px; margin: 0px;";this._frame.setAttribute("style","position: absolute; "+e);var r=document.createElement("div");r.setAttribute("style","position: fixed; "+e),this._frame.appendChild(r),r.addEventListener("mousedown",function(t){this.unpost(),this.unpostWidgets(),this.stop(t)}.bind(this))},e.prototype.display=function(){document.body.appendChild(this.frame),this.frame.appendChild(this.html),this.focus()},e.prototype.escape=function(t){this.unpost(),this.unpostWidgets()},e.prototype.unpost=function(){if(t.prototype.unpost.call(this),!(this.widgets.length>0)){this.frame.parentNode.removeChild(this.frame);var e=this.store;this.moving||e.insertTaborder(),e.active.focus()}},e.prototype.left=function(t){this.move_(this.store.previous())},e.prototype.right=function(t){this.move_(this.store.next())},Object.defineProperty(e.prototype,"frame",{get:function(){return this._frame},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"store",{get:function(){return this._store},enumerable:!1,configurable:!0}),e.prototype.post=function(e,r){if(void 0!==r)return this.moving||this.store.removeTaborder(),void t.prototype.post.call(this,e,r);var n,o,i,a=e;if(a instanceof Event?(n=a.target,this.stop(a)):n=a,a instanceof MouseEvent&&(o=a.pageX,i=a.pageY,o||i||!a.clientX||(o=a.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,i=a.clientY+document.body.scrollTop+document.documentElement.scrollTop)),!o&&!i&&n){var s=window.pageXOffset||document.documentElement.scrollLeft,l=window.pageYOffset||document.documentElement.scrollTop,c=n.getBoundingClientRect();o=(c.right+c.left)/2+s,i=(c.bottom+c.top)/2+l}this.store.active=n,this.anchor=this.store.active;var u=this.html;o+u.offsetWidth>document.body.offsetWidth-5&&(o=document.body.offsetWidth-u.offsetWidth-5),this.post(o,i)},e.prototype.registerWidget=function(t){this.widgets.push(t)},e.prototype.unregisterWidget=function(t){var e=this.widgets.indexOf(t);e>-1&&this.widgets.splice(e,1),0===this.widgets.length&&this.unpost()},e.prototype.unpostWidgets=function(){this.widgets.forEach((function(t){return t.unpost()}))},e.prototype.toJson=function(){return{type:""}},e.prototype.move_=function(t){this.anchor&&t!==this.anchor&&(this.moving=!0,this.unpost(),this.post(t),this.moving=!1)},e}(i.AbstractMenu);e.ContextMenu=c},7309:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.CssStyles=void 0;var n=r(2165);!function(t){function e(t){return"."+(n.HtmlClasses[t]||t)}var r={};r[e("INFOCLOSE")]="{  top:.2em; right:.2em;}",r[e("INFOCONTENT")]="{  overflow:auto; text-align:left; font-size:80%;  padding:.4em .6em; border:1px inset; margin:1em 0px;  max-height:20em; max-width:30em; background-color:#EEEEEE;  white-space:normal;}",r[e("INFO")+e("MOUSEPOST")]="{outline:none;}",r[e("INFO")]='{  position:fixed; left:50%; width:auto; text-align:center;  border:3px outset; padding:1em 2em; background-color:#DDDDDD;  color:black;  cursor:default; font-family:message-box; font-size:120%;  font-style:normal; text-indent:0; text-transform:none;  line-height:normal; letter-spacing:normal; word-spacing:normal;  word-wrap:normal; white-space:nowrap; float:none; z-index:201;  border-radius: 15px;                     /* Opera 10.5 and IE9 */  -webkit-border-radius:15px;               /* Safari and Chrome */  -moz-border-radius:15px;                  /* Firefox */  -khtml-border-radius:15px;                /* Konqueror */  box-shadow:0px 10px 20px #808080;         /* Opera 10.5 and IE9 */  -webkit-box-shadow:0px 10px 20px #808080; /* Safari 3 & Chrome */  -moz-box-shadow:0px 10px 20px #808080;    /* Forefox 3.5 */  -khtml-box-shadow:0px 10px 20px #808080;  /* Konqueror */  filter:progid:DXImageTransform.Microsoft.dropshadow(OffX=2, OffY=2, Color="gray", Positive="true"); /* IE */}';var o={};o[e("MENU")]="{  position:absolute;  background-color:white;  color:black;  width:auto; padding:5px 0px;  border:1px solid #CCCCCC; margin:0; cursor:default;  font: menu; text-align:left; text-indent:0; text-transform:none;  line-height:normal; letter-spacing:normal; word-spacing:normal;  word-wrap:normal; white-space:nowrap; float:none; z-index:201;  border-radius: 5px;                     /* Opera 10.5 and IE9 */  -webkit-border-radius: 5px;             /* Safari and Chrome */  -moz-border-radius: 5px;                /* Firefox */  -khtml-border-radius: 5px;              /* Konqueror */  box-shadow:0px 10px 20px #808080;         /* Opera 10.5 and IE9 */  -webkit-box-shadow:0px 10px 20px #808080; /* Safari 3 & Chrome */  -moz-box-shadow:0px 10px 20px #808080;    /* Forefox 3.5 */  -khtml-box-shadow:0px 10px 20px #808080;  /* Konqueror */}",o[e("MENUITEM")]="{  padding: 1px 2em;  background:transparent;}",o[e("MENUARROW")]="{  position:absolute; right:.5em; padding-top:.25em; color:#666666;  font-family: null; font-size: .75em}",o[e("MENUACTIVE")+" "+e("MENUARROW")]="{color:white}",o[e("MENUARROW")+e("RTL")]="{left:.5em; right:auto}",o[e("MENUCHECK")]="{  position:absolute; left:.7em;  font-family: null}",o[e("MENUCHECK")+e("RTL")]="{ right:.7em; left:auto }",o[e("MENURADIOCHECK")]="{  position:absolute; left: .7em;}",o[e("MENURADIOCHECK")+e("RTL")]="{  right: .7em; left:auto}",o[e("MENUINPUTBOX")]="{  padding-left: 1em; right:.5em; color:#666666;  font-family: null;}",o[e("MENUINPUTBOX")+e("RTL")]="{  left: .1em;}",o[e("MENUCOMBOBOX")]="{  left:.1em; padding-bottom:.5em;}",o[e("MENUSLIDER")]="{  left: .1em;}",o[e("SLIDERVALUE")]="{  position:absolute; right:.1em; padding-top:.25em; color:#333333;  font-size: .75em}",o[e("SLIDERBAR")]="{  outline: none; background: #d3d3d3}",o[e("MENULABEL")]="{  padding: 1px 2em 3px 1.33em;  font-style:italic}",o[e("MENURULE")]="{  border-top: 1px solid #DDDDDD;  margin: 4px 3px;}",o[e("MENUDISABLED")]="{  color:GrayText}",o[e("MENUACTIVE")]="{  background-color: #606872;  color: white;}",o[e("MENUDISABLED")+":focus"]="{  background-color: #E8E8E8}",o[e("MENULABEL")+":focus"]="{  background-color: #E8E8E8}",o[e("CONTEXTMENU")+":focus"]="{  outline:none}",o[e("CONTEXTMENU")+" "+e("MENUITEM")+":focus"]="{  outline:none}",o[e("SELECTIONMENU")]="{  position:relative; float:left;  border-bottom: none; -webkit-box-shadow:none; -webkit-border-radius:0px; }",o[e("SELECTIONITEM")]="{  padding-right: 1em;}",o[e("SELECTION")]="{  right: 40%; width:50%; }",o[e("SELECTIONBOX")]="{  padding: 0em; max-height:20em; max-width: none;  background-color:#FFFFFF;}",o[e("SELECTIONDIVIDER")]="{  clear: both; border-top: 2px solid #000000;}",o[e("MENU")+" "+e("MENUCLOSE")]="{  top:-10px; left:-10px}";var i={};i[e("MENUCLOSE")]='{  position:absolute;  cursor:pointer;  display:inline-block;  border:2px solid #AAA;  border-radius:18px;  -webkit-border-radius: 18px;             /* Safari and Chrome */  -moz-border-radius: 18px;                /* Firefox */  -khtml-border-radius: 18px;              /* Konqueror */  font-family: "Courier New", Courier;  font-size:24px;  color:#F0F0F0}',i[e("MENUCLOSE")+" span"]="{  display:block; background-color:#AAA; border:1.5px solid;  border-radius:18px;  -webkit-border-radius: 18px;             /* Safari and Chrome */  -moz-border-radius: 18px;                /* Firefox */  -khtml-border-radius: 18px;              /* Konqueror */  line-height:0;  padding:8px 0 6px     /* may need to be browser-specific */}",i[e("MENUCLOSE")+":hover"]="{  color:white!important;  border:2px solid #CCC!important}",i[e("MENUCLOSE")+":hover span"]="{  background-color:#CCC!important}",i[e("MENUCLOSE")+":hover:focus"]="{  outline:none}";var a=!1,s=!1,l=!1;function c(t){l||(u(i,t),l=!0)}function u(t,e){var r=e||document,n=r.createElement("style");n.type="text/css";var o="";for(var i in t)o+=i,o+=" ",o+=t[i],o+="\n";n.innerHTML=o,r.head.appendChild(n)}t.addMenuStyles=function(t){s||(u(o,t),s=!0,c(t))},t.addInfoStyles=function(t){a||(u(r,t),a=!0,c(t))}}(e.CssStyles||(e.CssStyles={}))},2165:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.HtmlAttrs=e.HtmlClasses=void 0;function r(t){return"CtxtMenu_"+t}function n(t){return r(t)}function o(t){return r(t)}e.HtmlClasses={ATTACHED:n("Attached"),CONTEXTMENU:n("ContextMenu"),MENU:n("Menu"),MENUARROW:n("MenuArrow"),MENUACTIVE:n("MenuActive"),MENUCHECK:n("MenuCheck"),MENUCLOSE:n("MenuClose"),MENUCOMBOBOX:n("MenuComboBox"),MENUDISABLED:n("MenuDisabled"),MENUFRAME:n("MenuFrame"),MENUITEM:n("MenuItem"),MENULABEL:n("MenuLabel"),MENURADIOCHECK:n("MenuRadioCheck"),MENUINPUTBOX:n("MenuInputBox"),MENURULE:n("MenuRule"),MENUSLIDER:n("MenuSlider"),MOUSEPOST:n("MousePost"),RTL:n("RTL"),INFO:n("Info"),INFOCLOSE:n("InfoClose"),INFOCONTENT:n("InfoContent"),INFOSIGNATURE:n("InfoSignature"),INFOTITLE:n("InfoTitle"),SLIDERVALUE:n("SliderValue"),SLIDERBAR:n("SliderBar"),SELECTION:n("Selection"),SELECTIONBOX:n("SelectionBox"),SELECTIONMENU:n("SelectionMenu"),SELECTIONDIVIDER:n("SelectionDivider"),SELECTIONITEM:n("SelectionItem")},e.HtmlAttrs={COUNTER:o("Counter"),KEYDOWNFUNC:o("keydownFunc"),CONTEXTMENUFUNC:o("contextmenuFunc"),OLDTAB:o("Oldtabindex"),TOUCHFUNC:o("TouchFunc")}},4922:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},n(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Info=void 0;var i=r(5179),a=r(2165),s=function(t){function e(e,r,n){var o=t.call(this)||this;return o.title=e,o.signature=n,o.className=a.HtmlClasses.INFO,o.role="dialog",o.contentDiv=o.generateContent(),o.close=o.generateClose(),o.content=r||function(){return""},o}return o(e,t),e.prototype.attachMenu=function(t){this.menu=t},e.prototype.generateHtml=function(){t.prototype.generateHtml.call(this);var e=this.html;e.appendChild(this.generateTitle()),e.appendChild(this.contentDiv),e.appendChild(this.generateSignature()),e.appendChild(this.close.html),e.setAttribute("tabindex","0")},e.prototype.post=function(){t.prototype.post.call(this);var e=document.documentElement,r=this.html,n=window.innerHeight||e.clientHeight||e.scrollHeight||0,o=Math.floor(-r.offsetWidth/2),i=Math.floor((n-r.offsetHeight)/3);r.setAttribute("style","margin-left: "+o+"px; top: "+i+"px;"),window.event instanceof MouseEvent&&r.classList.add(a.HtmlClasses.MOUSEPOST),r.focus()},e.prototype.display=function(){this.menu.registerWidget(this),this.contentDiv.innerHTML=this.content();var t=this.menu.html;t.parentNode&&t.parentNode.removeChild(t),this.menu.frame.appendChild(this.html)},e.prototype.click=function(t){},e.prototype.keydown=function(e){this.bubbleKey(),t.prototype.keydown.call(this,e)},e.prototype.escape=function(t){this.unpost()},e.prototype.unpost=function(){t.prototype.unpost.call(this),this.html.classList.remove(a.HtmlClasses.MOUSEPOST),this.menu.unregisterWidget(this)},e.prototype.generateClose=function(){var t=new i.CloseButton(this),e=t.html;return e.classList.add(a.HtmlClasses.INFOCLOSE),e.setAttribute("aria-label","Close Dialog Box"),t},e.prototype.generateTitle=function(){var t=document.createElement("span");return t.innerHTML=this.title,t.classList.add(a.HtmlClasses.INFOTITLE),t},e.prototype.generateContent=function(){var t=document.createElement("div");return t.classList.add(a.HtmlClasses.INFOCONTENT),t.setAttribute("tabindex","0"),t},e.prototype.generateSignature=function(){var t=document.createElement("span");return t.innerHTML=this.signature,t.classList.add(a.HtmlClasses.INFOSIGNATURE),t},e.prototype.toJson=function(){return{type:""}},e}(r(8372).AbstractPostable);e.Info=s},1409:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},n(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Checkbox=void 0;var i=r(6765),a=r(2556),s=r(2165),l=function(t){function e(e,r,n,o){var i=t.call(this,e,"checkbox",r,o)||this;return i.role="menuitemcheckbox",i.variable=e.pool.lookup(n),i.register(),i}return o(e,t),e.fromJson=function(t,e,r){return new this(r,e.content,e.variable,e.id)},e.prototype.executeAction=function(){this.variable.setValue(!this.variable.getValue()),a.MenuUtil.close(this)},e.prototype.generateSpan=function(){this.span=document.createElement("span"),this.span.textContent="\u2713",this.span.classList.add(s.HtmlClasses.MENUCHECK)},e.prototype.updateAria=function(){this.html.setAttribute("aria-checked",this.variable.getValue()?"true":"false")},e.prototype.updateSpan=function(){this.span.style.display=this.variable.getValue()?"":"none"},e.prototype.toJson=function(){return{type:""}},e}(i.AbstractVariableItem);e.Checkbox=l},9886:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},n(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Combo=void 0;var i=r(6765),a=r(2556),s=r(2165),l=r(3205),c=function(t){function e(e,r,n,o){var i=t.call(this,e,"combobox",r,o)||this;return i.role="combobox",i.inputEvent=!1,i.variable=e.pool.lookup(n),i.register(),i}return o(e,t),e.fromJson=function(t,e,r){return new this(r,e.content,e.variable,e.id)},e.prototype.executeAction=function(){this.variable.setValue(this.input.value,a.MenuUtil.getActiveElement(this))},e.prototype.space=function(e){t.prototype.space.call(this,e),a.MenuUtil.close(this)},e.prototype.focus=function(){t.prototype.focus.call(this),this.input.focus()},e.prototype.unfocus=function(){t.prototype.unfocus.call(this),this.updateSpan()},e.prototype.generateHtml=function(){t.prototype.generateHtml.call(this),this.html.classList.add(s.HtmlClasses.MENUCOMBOBOX)},e.prototype.generateSpan=function(){this.span=document.createElement("span"),this.span.classList.add(s.HtmlClasses.MENUINPUTBOX),this.input=document.createElement("input"),this.input.addEventListener("keydown",this.inputKey.bind(this)),this.input.setAttribute("size","10em"),this.input.setAttribute("type","text"),this.input.setAttribute("tabindex","-1"),this.span.appendChild(this.input)},e.prototype.inputKey=function(t){this.bubbleKey(),this.inputEvent=!0},e.prototype.keydown=function(e){if(this.inputEvent&&e.keyCode!==l.KEY.ESCAPE&&e.keyCode!==l.KEY.RETURN)return this.inputEvent=!1,void e.stopPropagation();t.prototype.keydown.call(this,e),e.stopPropagation()},e.prototype.updateAria=function(){},e.prototype.updateSpan=function(){var t;try{t=this.variable.getValue(a.MenuUtil.getActiveElement(this))}catch(e){t=""}this.input.value=t},e.prototype.toJson=function(){return{type:""}},e}(i.AbstractVariableItem);e.Combo=c},3467:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},n(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Command=void 0;var i=r(1340),a=r(2556),s=function(t){function e(e,r,n,o){var i=t.call(this,e,"command",r,o)||this;return i.command=n,i}return o(e,t),e.fromJson=function(t,e,r){return new this(r,e.content,e.action,e.id)},e.prototype.executeAction=function(){try{this.command(a.MenuUtil.getActiveElement(this))}catch(t){a.MenuUtil.error(t,"Illegal command callback.")}a.MenuUtil.close(this)},e.prototype.toJson=function(){return{type:""}},e}(i.AbstractItem);e.Command=s},2965:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},n(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Label=void 0;var i=r(1340),a=r(2165),s=function(t){function e(e,r,n){return t.call(this,e,"label",r,n)||this}return o(e,t),e.fromJson=function(t,e,r){return new this(r,e.content,e.id)},e.prototype.generateHtml=function(){t.prototype.generateHtml.call(this),this.html.classList.add(a.HtmlClasses.MENULABEL)},e.prototype.toJson=function(){return{type:""}},e}(i.AbstractItem);e.Label=s},385:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},n(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Radio=void 0;var i=r(6765),a=r(2556),s=r(2165),l=function(t){function e(e,r,n,o){var i=t.call(this,e,"radio",r,o)||this;return i.role="menuitemradio",i.variable=e.pool.lookup(n),i.register(),i}return o(e,t),e.fromJson=function(t,e,r){return new this(r,e.content,e.variable,e.id)},e.prototype.executeAction=function(){this.variable.setValue(this.id),a.MenuUtil.close(this)},e.prototype.generateSpan=function(){this.span=document.createElement("span"),this.span.textContent="\u2713",this.span.classList.add(s.HtmlClasses.MENURADIOCHECK)},e.prototype.updateAria=function(){this.html.setAttribute("aria-checked",this.variable.getValue()===this.id?"true":"false")},e.prototype.updateSpan=function(){this.span.style.display=this.variable.getValue()===this.id?"":"none"},e.prototype.toJson=function(){return{type:""}},e}(i.AbstractVariableItem);e.Radio=l},3463:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},n(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Rule=void 0;var i=r(9329),a=r(2165),s=function(t){function e(e){var r=t.call(this,e,"rule")||this;return r.className=a.HtmlClasses.MENUITEM,r.role="separator",r}return o(e,t),e.fromJson=function(t,e,r){return new this(r)},e.prototype.generateHtml=function(){t.prototype.generateHtml.call(this);var e=this.html;e.classList.add(a.HtmlClasses.MENURULE),e.setAttribute("aria-orientation","vertical")},e.prototype.addEvents=function(t){},e.prototype.toJson=function(){return{type:"rule"}},e}(i.AbstractEntry);e.Rule=s},7625:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},n(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Slider=void 0;var i=r(6765),a=r(2556),s=r(2165),l=r(3205),c=function(t){function e(e,r,n,o){var i=t.call(this,e,"slider",r,o)||this;return i.role="slider",i.labelId="ctx_slideLabel"+a.MenuUtil.counter(),i.valueId="ctx_slideValue"+a.MenuUtil.counter(),i.inputEvent=!1,i.variable=e.pool.lookup(n),i.register(),i}return o(e,t),e.fromJson=function(t,e,r){return new this(r,e.content,e.variable,e.id)},e.prototype.executeAction=function(){this.variable.setValue(this.input.value,a.MenuUtil.getActiveElement(this)),this.update()},e.prototype.space=function(e){t.prototype.space.call(this,e),a.MenuUtil.close(this)},e.prototype.focus=function(){t.prototype.focus.call(this),this.input.focus()},e.prototype.unfocus=function(){t.prototype.unfocus.call(this),this.updateSpan()},e.prototype.generateHtml=function(){t.prototype.generateHtml.call(this),this.html.classList.add(s.HtmlClasses.MENUSLIDER),this.valueSpan=document.createElement("span"),this.valueSpan.setAttribute("id",this.valueId),this.valueSpan.classList.add(s.HtmlClasses.SLIDERVALUE),this.html.appendChild(this.valueSpan)},e.prototype.generateSpan=function(){this.span=document.createElement("span"),this.labelSpan=document.createElement("span"),this.labelSpan.setAttribute("id",this.labelId),this.labelSpan.appendChild(this.html.childNodes[0]),this.html.appendChild(this.labelSpan),this.input=document.createElement("input"),this.input.setAttribute("type","range"),this.input.setAttribute("min","0"),this.input.setAttribute("max","100"),this.input.setAttribute("aria-valuemin","0"),this.input.setAttribute("aria-valuemax","100"),this.input.setAttribute("aria-labelledby",this.labelId),this.input.addEventListener("keydown",this.inputKey.bind(this)),this.input.addEventListener("input",this.executeAction.bind(this)),this.input.classList.add(s.HtmlClasses.SLIDERBAR),this.span.appendChild(this.input)},e.prototype.inputKey=function(t){this.inputEvent=!0},e.prototype.mousedown=function(t){t.stopPropagation()},e.prototype.mouseup=function(t){event.stopPropagation()},e.prototype.keydown=function(e){var r=e.keyCode;return r===l.KEY.UP||r===l.KEY.DOWN?(e.preventDefault(),void t.prototype.keydown.call(this,e)):this.inputEvent&&r!==l.KEY.ESCAPE&&r!==l.KEY.RETURN?(this.inputEvent=!1,void e.stopPropagation()):(t.prototype.keydown.call(this,e),void e.stopPropagation())},e.prototype.updateAria=function(){var t=this.variable.getValue();t&&this.input&&(this.input.setAttribute("aria-valuenow",t),this.input.setAttribute("aria-valuetext",t+"%"))},e.prototype.updateSpan=function(){var t;try{t=this.variable.getValue(a.MenuUtil.getActiveElement(this)),this.valueSpan.innerHTML=t+"%"}catch(e){t=""}this.input.value=t},e.prototype.toJson=function(){return{type:""}},e}(i.AbstractVariableItem);e.Slider=c},6186:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},n(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.Submenu=void 0;var i=r(1340),a=r(2165),s=function(t){function e(e,r,n){var o=t.call(this,e,"submenu",r,n)||this;return o._submenu=null,o}return o(e,t),e.fromJson=function(t,e,r){var n=e.content,o=e.menu,i=new this(r,n,e.id),a=t.get("subMenu")(t,o,i);return i.submenu=a,i},Object.defineProperty(e.prototype,"submenu",{get:function(){return this._submenu},set:function(t){this._submenu=t},enumerable:!1,configurable:!0}),e.prototype.mouseover=function(t){this.focus(),this.stop(t)},e.prototype.mouseout=function(t){this.stop(t)},e.prototype.unfocus=function(){if(this.submenu.isPosted()){if(this.menu.focused!==this)return t.prototype.unfocus.call(this),void this.menu.unpostSubmenus();this.html.setAttribute("tabindex","-1"),this.html.blur()}else t.prototype.unfocus.call(this)},e.prototype.focus=function(){t.prototype.focus.call(this),this.submenu.isPosted()||this.disabled||this.submenu.post()},e.prototype.executeAction=function(){this.submenu.isPosted()?this.submenu.unpost():this.submenu.post()},e.prototype.generateHtml=function(){t.prototype.generateHtml.call(this);var e=this.html;this.span=document.createElement("span"),this.span.textContent="\u25ba",this.span.classList.add(a.HtmlClasses.MENUARROW),e.appendChild(this.span),e.setAttribute("aria-haspopup","true")},e.prototype.left=function(e){this.submenu.isPosted()?this.submenu.unpost():t.prototype.left.call(this,e)},e.prototype.right=function(t){this.submenu.isPosted()?this.submenu.down(t):this.submenu.post()},e.prototype.toJson=function(){return{type:""}},e}(i.AbstractItem);e.Submenu=s},3205:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.KEY=void 0,function(t){t[t.RETURN=13]="RETURN",t[t.ESCAPE=27]="ESCAPE",t[t.SPACE=32]="SPACE",t[t.LEFT=37]="LEFT",t[t.UP=38]="UP",t[t.RIGHT=39]="RIGHT",t[t.DOWN=40]="DOWN"}(e.KEY||(e.KEY={}))},9328:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},n(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.MenuElement=void 0;var i=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.addAttributes=function(t){for(var e in t)this.html.setAttribute(e,t[e])},Object.defineProperty(e.prototype,"html",{get:function(){return this._html||this.generateHtml(),this._html},set:function(t){this._html=t,this.addEvents(t)},enumerable:!1,configurable:!0}),e.prototype.generateHtml=function(){var t=document.createElement("div");t.classList.add(this.className),t.setAttribute("role",this.role),this.html=t},e.prototype.focus=function(){var t=this.html;t.setAttribute("tabindex","0"),t.focus()},e.prototype.unfocus=function(){var t=this.html;t.hasAttribute("tabindex")&&t.setAttribute("tabindex","-1");try{t.blur()}catch(t){}t.blur()},e}(r(2868).AbstractNavigatable);e.MenuElement=i},1932:function(t,e,r){var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.MenuStore=void 0;var o=r(2556),i=r(2165),a=r(3205),s=function(){function t(t){this.menu=t,this.store=[],this._active=null,this.counter=0,this.attachedClass=i.HtmlClasses.ATTACHED+"_"+o.MenuUtil.counter(),this.taborder=!0,this.attrMap={}}return Object.defineProperty(t.prototype,"active",{get:function(){return this._active},set:function(t){do{if(-1!==this.store.indexOf(t)){this._active=t;break}t=t.parentNode}while(t)},enumerable:!1,configurable:!0}),t.prototype.next=function(){var t=this.store.length;if(0===t)return this.active=null,null;var e=this.store.indexOf(this.active);return e=-1===e?0:e<t-1?e+1:0,this.active=this.store[e],this.active},t.prototype.previous=function(){var t=this.store.length;if(0===t)return this.active=null,null;var e=t-1,r=this.store.indexOf(this.active);return r=-1===r||0===r?e:r-1,this.active=this.store[r],this.active},t.prototype.clear=function(){this.remove(this.store)},t.prototype.insert=function(t){var e,r,o=t instanceof HTMLElement?[t]:t;try{for(var i=n(o),a=i.next();!a.done;a=i.next()){var s=a.value;this.insertElement(s)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}this.sort()},t.prototype.remove=function(t){var e,r,o=t instanceof HTMLElement?[t]:t;try{for(var i=n(o),a=i.next();!a.done;a=i.next()){var s=a.value;this.removeElement(s)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}this.sort()},t.prototype.inTaborder=function(t){this.taborder&&!t&&this.removeTaborder(),!this.taborder&&t&&this.insertTaborder(),this.taborder=t},t.prototype.insertTaborder=function(){this.taborder&&this.insertTaborder_()},t.prototype.removeTaborder=function(){this.taborder&&this.removeTaborder_()},t.prototype.insertElement=function(t){t.classList.contains(this.attachedClass)||(t.classList.add(this.attachedClass),this.taborder&&this.addTabindex(t),this.addEvents(t))},t.prototype.removeElement=function(t){t.classList.contains(this.attachedClass)&&(t.classList.remove(this.attachedClass),this.taborder&&this.removeTabindex(t),this.removeEvents(t))},t.prototype.sort=function(){var t=document.getElementsByClassName(this.attachedClass);this.store=[].slice.call(t)},t.prototype.insertTaborder_=function(){this.store.forEach((function(t){return t.setAttribute("tabindex","0")}))},t.prototype.removeTaborder_=function(){this.store.forEach((function(t){return t.setAttribute("tabindex","-1")}))},t.prototype.addTabindex=function(t){t.hasAttribute("tabindex")&&t.setAttribute(i.HtmlAttrs.OLDTAB,t.getAttribute("tabindex")),t.setAttribute("tabindex","0")},t.prototype.removeTabindex=function(t){t.hasAttribute(i.HtmlAttrs.OLDTAB)?(t.setAttribute("tabindex",t.getAttribute(i.HtmlAttrs.OLDTAB)),t.removeAttribute(i.HtmlAttrs.OLDTAB)):t.removeAttribute("tabindex")},t.prototype.addEvents=function(t){t.hasAttribute(i.HtmlAttrs.COUNTER)||(this.addEvent(t,"contextmenu",this.menu.post.bind(this.menu)),this.addEvent(t,"keydown",this.keydown.bind(this)),t.setAttribute(i.HtmlAttrs.COUNTER,this.counter.toString()),this.counter++)},t.prototype.addEvent=function(t,e,r){var n=i.HtmlAttrs[e.toUpperCase()+"FUNC"];this.attrMap[n+this.counter]=r,t.addEventListener(e,r)},t.prototype.removeEvents=function(t){if(t.hasAttribute(i.HtmlAttrs.COUNTER)){var e=t.getAttribute(i.HtmlAttrs.COUNTER);this.removeEvent(t,"contextmenu",e),this.removeEvent(t,"keydown",e),t.removeAttribute(i.HtmlAttrs.COUNTER)}},t.prototype.removeEvent=function(t,e,r){var n=i.HtmlAttrs[e.toUpperCase()+"FUNC"],o=this.attrMap[n+r];t.removeEventListener(e,o)},t.prototype.keydown=function(t){t.keyCode===a.KEY.SPACE&&(this.menu.post(t),t.preventDefault(),t.stopImmediatePropagation())},t}();e.MenuStore=s},2556:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MenuUtil=void 0,function(t){t.close=function(t){var e=t.menu;e.baseMenu?e.baseMenu.unpost():e.unpost()},t.getActiveElement=function(t){var e=t.menu;return(e.baseMenu?e.baseMenu:e).store.active},t.error=function(t,e){console.error("ContextMenu Error: "+e)},t.counter=function(){return e++};var e=0}(e.MenuUtil||(e.MenuUtil={}))},8853:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.MOUSE=void 0,e.MOUSE={CLICK:"click",DBLCLICK:"dblclick",DOWN:"mousedown",UP:"mouseup",OVER:"mouseover",OUT:"mouseout",MOVE:"mousemove",SELECTEND:"selectend",SELECTSTART:"selectstart"}},6914:function(t,e,r){var n=this&&this.__rest||function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r},o=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a},i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(o(arguments[e]));return t};Object.defineProperty(e,"__esModule",{value:!0}),e.Parser=void 0;var s=r(3467),l=r(5073),c=r(3737),u=r(1409),p=r(9886),h=r(2965),d=r(385),f=r(6186),m=r(3463),y=r(7625),g=r(4834),b=r(2100),v=r(2308),_=function(){function t(t){var e=this;void 0===t&&(t=[]),this._initList=[["command",s.Command.fromJson.bind(s.Command)],["checkbox",u.Checkbox.fromJson.bind(u.Checkbox)],["combo",p.Combo.fromJson.bind(p.Combo)],["slider",y.Slider.fromJson.bind(y.Slider)],["label",h.Label.fromJson.bind(h.Label)],["radio",d.Radio.fromJson.bind(d.Radio)],["rule",m.Rule.fromJson.bind(m.Rule)],["submenu",f.Submenu.fromJson.bind(f.Submenu)],["contextMenu",l.ContextMenu.fromJson.bind(l.ContextMenu)],["subMenu",g.SubMenu.fromJson.bind(g.SubMenu)],["variable",c.Variable.fromJson.bind(c.Variable)],["items",this.items.bind(this)],["selectionMenu",b.SelectionMenu.fromJson.bind(b.SelectionMenu)],["selectionBox",b.SelectionBox.fromJson.bind(b.SelectionBox)]],this._factory=new v.ParserFactory(this._initList),t.forEach((function(t){var r=o(t,2),n=r[0],i=r[1];return e.factory.add(n,i)}))}return Object.defineProperty(t.prototype,"factory",{get:function(){return this._factory},enumerable:!1,configurable:!0}),t.prototype.items=function(t,e,r){var n,o,a=[];try{for(var s=i(e),l=s.next();!l.done;l=s.next()){var c=l.value,u=this.parse(c,r);u&&(r.items.push(u),c.disabled&&u.disable(),c.hidden&&a.push(u))}}catch(t){n={error:t}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(n)throw n.error}}return a.forEach((function(t){return t.hide()})),r.items},t.prototype.parse=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var o=t.type,i=n(t,["type"]),s=this.factory.get(o);return s?s.apply(void 0,a([this.factory,i],e)):null},t}();e.Parser=_},2308:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ParserFactory=void 0;var r=function(){function t(t){this._parser=new Map(t)}return t.prototype.get=function(t){return this._parser.get(t)},t.prototype.add=function(t,e){this._parser.set(t,e)},t}();e.ParserFactory=r},2100:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},n(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a};Object.defineProperty(e,"__esModule",{value:!0}),e.SelectionBox=e.SelectionMenu=void 0;var a=r(2556),s=r(2165),l=r(1484),c=r(4922),u=function(t){function e(e){var r=t.call(this)||this;return r.anchor=e,r.className=s.HtmlClasses.SELECTIONMENU,r.variablePool=r.anchor.menu.pool,r.baseMenu=r.anchor.menu,r}return o(e,t),e.fromJson=function(t,e,r){var n=e.title,o=e.values,i=e.variable,a=new this(r),s=t.get("label")(t,{content:n||"",id:n||"id"},a),l=t.get("rule")(t,{},a),c=o.map((function(e){return t.get("radio")(t,{content:e,variable:i,id:e},a)})),u=[s,l].concat(c);return a.items=u,a},e.prototype.generateHtml=function(){t.prototype.generateHtml.call(this),this.items.forEach((function(t){return t.html.classList.add(s.HtmlClasses.SELECTIONITEM)}))},e.prototype.display=function(){},e.prototype.right=function(t){this.anchor.right(t)},e.prototype.left=function(t){this.anchor.left(t)},e}(l.AbstractMenu);e.SelectionMenu=u;var p=function(t){function e(e,r,n,o){void 0===n&&(n="none"),void 0===o&&(o="vertical");var i=t.call(this,e,null,r)||this;return i.style=n,i.grid=o,i._selections=[],i.prefix="ctxt-selection",i._balanced=!0,i}return o(e,t),e.fromJson=function(t,e,r){var n=e.title,o=e.signature,i=e.selections,a=new this(n,o,e.order,e.grid);a.attachMenu(r);var s=i.map((function(e){return t.get("selectionMenu")(t,e,a)}));return a.selections=s,a},e.prototype.attachMenu=function(t){this.menu=t},Object.defineProperty(e.prototype,"selections",{get:function(){return this._selections},set:function(t){var e=this;this._selections=[],t.forEach((function(t){return e.addSelection(t)}))},enumerable:!1,configurable:!0}),e.prototype.addSelection=function(t){t.anchor=this,this._selections.push(t)},e.prototype.rowDiv=function(t){var e=this,r=document.createElement("div");this.contentDiv.appendChild(r);var n=t.map((function(t){return r.appendChild(t.html),t.html.id||(t.html.id=e.prefix+a.MenuUtil.counter()),t.html.getBoundingClientRect()})),o=n.map((function(t){return t.width})),i=o.reduce((function(t,e){return t+e}),0),l=n.reduce((function(t,e){return Math.max(t,e.height)}),0);return r.classList.add(s.HtmlClasses.SELECTIONDIVIDER),r.setAttribute("style","height: "+l+"px;"),[r,i,l,o]},e.prototype.display=function(){if(t.prototype.display.call(this),this.order(),this.selections.length){for(var e=[],r=0,n=[],o=this.getChunkSize(this.selections.length),a=function(t){var a=s.selections.slice(t,t+o),l=i(s.rowDiv(a),4),c=l[0],u=l[1],p=l[2],h=l[3];e.push(c),r=Math.max(r,u),a.forEach((function(t){return t.html.style.height=p+"px"})),n=s.combineColumn(n,h)},s=this,l=0;l<this.selections.length;l+=o)a(l);this._balanced&&(this.balanceColumn(e,n),r=n.reduce((function(t,e){return t+e}),20)),e.forEach((function(t){return t.style.width=r+"px"}))}},e.prototype.getChunkSize=function(t){switch(this.grid){case"square":return Math.floor(Math.sqrt(t));case"horizontal":return Math.floor(t/e.chunkSize);default:return e.chunkSize}},e.prototype.balanceColumn=function(t,e){t.forEach((function(t){for(var r=Array.from(t.children),n=0,o=void 0;o=r[n];n++)o.style.width=e[n]+"px"}))},e.prototype.combineColumn=function(t,e){for(var r=[],n=0;t[n]||e[n];){if(!t[n]){r=r.concat(e.slice(n));break}if(!e[n]){r=r.concat(t.slice(n));break}r.push(Math.max(t[n],e[n])),n++}return r},e.prototype.left=function(t){var e=this;this.move(t,(function(t){return(0===t?e.selections.length:t)-1}))},e.prototype.right=function(t){var e=this;this.move(t,(function(t){return t===e.selections.length-1?0:t+1}))},e.prototype.generateHtml=function(){t.prototype.generateHtml.call(this),this.html.classList.add(s.HtmlClasses.SELECTION)},e.prototype.generateContent=function(){var e=t.prototype.generateContent.call(this);return e.classList.add(s.HtmlClasses.SELECTIONBOX),e.removeAttribute("tabindex"),e},e.prototype.findSelection=function(t){var e=t.target,r=null;if(e.id&&(r=this.selections.find((function(t){return t.html.id===e.id}))),!r){var n=e.parentElement.id;r=this.selections.find((function(t){return t.html.id===n}))}return r},e.prototype.move=function(t,e){var r=this.findSelection(t);r.focused&&r.focused.unfocus();var n=e(this.selections.indexOf(r));this.selections[n].focus()},e.prototype.order=function(){this.selections.sort(e.orderMethod.get(this.style))},e.prototype.toJson=function(){return{type:""}},e.chunkSize=4,e.orderMethod=new Map([["alphabetical",function(t,e){return t.items[0].content.localeCompare(e.items[0].content)}],["none",function(t,e){return 1}],["decreasing",function(t,e){var r=t.items.length,n=e.items.length;return r<n?1:n<r?-1:0}],["increasing",function(t,e){var r=t.items.length,n=e.items.length;return r<n?-1:n<r?1:0}]]),e}(c.Info);e.SelectionBox=p},4834:function(t,e,r){var n,o=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},n(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.SubMenu=void 0;var i=function(t){function e(e){var r=t.call(this)||this;return r._anchor=e,r.variablePool=r.anchor.menu.pool,r.setBaseMenu(),r}return o(e,t),e.fromJson=function(t,e,r){var n=e.items,o=new this(r),i=t.get("items")(t,n,o);return o.items=i,o},Object.defineProperty(e.prototype,"anchor",{get:function(){return this._anchor},enumerable:!1,configurable:!0}),e.prototype.post=function(){if(this.anchor.menu.isPosted()){for(var e=this.anchor.html,r=this.html,n=this.baseMenu.frame,o=e.offsetWidth,i=o-2,a=0;e&&e!==n;)i+=e.offsetLeft,a+=e.offsetTop,e=e.parentNode;i+r.offsetWidth>document.body.offsetWidth-5&&(i=Math.max(5,i-o-r.offsetWidth+6)),t.prototype.post.call(this,i,a)}},e.prototype.display=function(){this.baseMenu.frame.appendChild(this.html)},e.prototype.setBaseMenu=function(){var t=this;do{t=t.anchor.menu}while(t instanceof e);this.baseMenu=t},e.prototype.left=function(t){this.focused=null,this.anchor.focus()},e.prototype.toJson=function(){return{type:""}},e}(r(1484).AbstractMenu);e.SubMenu=i},3737:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Variable=void 0;var n=r(2556),o=function(){function t(t,e,r){this._name=t,this.getter=e,this.setter=r,this.items=[]}return t.fromJson=function(t,e,r){var n=new this(e.name,e.getter,e.setter);r.insert(n)},Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),t.prototype.getValue=function(t){try{return this.getter(t)}catch(t){return n.MenuUtil.error(t,"Command of variable "+this.name+" failed."),null}},t.prototype.setValue=function(t,e){try{this.setter(t,e)}catch(t){n.MenuUtil.error(t,"Command of variable "+this.name+" failed.")}this.update()},t.prototype.register=function(t){-1===this.items.indexOf(t)&&this.items.push(t)},t.prototype.unregister=function(t){var e=this.items.indexOf(t);-1!==e&&this.items.splice(e,1)},t.prototype.update=function(){this.items.forEach((function(t){return t.update()}))},t.prototype.registerCallback=function(t){this.items.forEach((function(e){return e.registerCallback(t)}))},t.prototype.unregisterCallback=function(t){this.items.forEach((function(e){return e.unregisterCallback(t)}))},t.prototype.toJson=function(){return{type:"variable",name:this.name,getter:this.getter.toString(),setter:this.setter.toString()}},t}();e.Variable=o},2358:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.VariablePool=void 0;var r=function(){function t(){this.pool={}}return t.prototype.insert=function(t){this.pool[t.name]=t},t.prototype.lookup=function(t){return this.pool[t]},t.prototype.remove=function(t){delete this.pool[t]},t.prototype.update=function(){for(var t in this.pool)this.pool[t].update()},t}();e.VariablePool=r},3921:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractAudioRenderer=void 0;const n=r(5897);e.AbstractAudioRenderer=class{constructor(){this.separator_=" "}setSeparator(t){this.separator_=t}getSeparator(){return"braille"===n.default.getInstance().modality?"":this.separator_}error(t){return null}merge(t){let e="";const r=t.length-1;for(let n,o=0;n=t[o];o++)if(e+=n.speech,o<r){const t=n.attributes.separator;e+=void 0!==t?t:this.getSeparator()}return e}finalize(t){return t}pauseValue(t){let e;switch(t){case"long":e=750;break;case"medium":e=500;break;case"short":e=250;break;default:e=parseInt(t,10)}return Math.floor(e*n.default.getInstance().getRate()/100)}}},4196:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.AcssRenderer=void 0;const n=r(4440),o=r(8496),i=r(3706),a=r(182);class s extends a.MarkupRenderer{markup(t){this.setScaleFunction(-2,2,0,10,0);const e=i.personalityMarkup(t),r=[],n={open:[]};let o=null,a=!1;for(let t,s=0;t=e[s];s++){if(i.isMarkupElement(t)){i.mergeMarkup(n,t);continue}if(i.isPauseElement(t)){a&&(o=i.mergePause(o,t,Math.max));continue}const e='"'+this.merge(t.span)+'"';a=!0,o&&(r.push(this.pause(o)),o=null);const s=this.prosody_(n);r.push(s?"(text ("+s+") "+e+")":e)}return"(exp "+r.join(" ")+")"}error(t){return'(error "'+o.Move.get(t)+'")'}prosodyElement(t,e){switch(e=this.applyScaleFunction(e),t){case n.personalityProps.RATE:return"(richness . "+e+")";case n.personalityProps.PITCH:return"(average-pitch . "+e+")";case n.personalityProps.VOLUME:return"(stress . "+e+")"}return"(value . "+e+")"}pause(t){return"(pause . "+this.pauseValue(t[n.personalityProps.PAUSE])+")"}prosody_(t){const e=t.open,r=[];for(let n,o=0;n=e[o];o++)r.push(this.prosodyElement(n,t[n]));return r.join(" ")}}e.AcssRenderer=s},3706:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.isSpanElement=e.isPauseElement=e.isMarkupElement=e.personalityMarkup=e.sortClose=e.mergeMarkup=e.mergePause=void 0;const n=r(707),o=r(4440),i=r(9536);function a(t,e,r){return(r||function(r,n){return"number"==typeof r&&"number"==typeof n?r+n:"number"==typeof r?n:"number"==typeof n?r:[t,e].sort()[0]}).call(null,t,e)}e.mergePause=function(t,e,r){return t?{pause:a(t.pause,e.pause,r)}:e},e.mergeMarkup=function(t,e){delete t.open,e.close.forEach((e=>delete t[e])),e.open.forEach((r=>t[r]=e[r]));const r=Object.keys(t);t.open=r},e.sortClose=function(t,e){if(t.length<=1)return t;const r=[];for(let n,o=0;n=e[o],t.length;o++)n.close&&n.close.length&&n.close.forEach((function(e){const n=t.indexOf(e);-1!==n&&(r.unshift(e),t.splice(n,1))}));return r};let s={},l=[];function c(t,e){const r=t[t.length-1];if(r){if(d(e)&&d(r)){if(void 0===r.join)return void(r.span=r.span.concat(e.span));const t=r.span.pop(),n=e.span.shift();return r.span.push(t+r.join+n),r.span=r.span.concat(e.span),void(r.join=e.join)}h(e)&&h(r)?r.pause=a(r.pause,e.pause):t.push(e)}else t.push(e)}function u(t,e){t.rate&&(e.rate=t.rate),t.pitch&&(e.pitch=t.pitch),t.volume&&(e.volume=t.volume)}function p(t){return"object"==typeof t&&t.open}function h(t){return"object"==typeof t&&1===Object.keys(t).length&&Object.keys(t)[0]===o.personalityProps.PAUSE}function d(t){const e=Object.keys(t);return"object"==typeof t&&(1===e.length&&"span"===e[0]||2===e.length&&("span"===e[0]&&"join"===e[1]||"span"===e[1]&&"join"===e[0]))}function f(t,e,r,n,s,l=!1){if(l){const l=t[t.length-1];let c;if(l&&(c=l[o.personalityProps.JOIN]),l&&!e.speech&&s&&h(l)){const t=o.personalityProps.PAUSE;l[t]=a(l[t],s[t]),s=null}if(l&&e.speech&&0===Object.keys(r).length&&d(l)){if(void 0!==c){const t=l.span.pop();e=new i.Span(t.speech+c+e.speech,t.attributes)}l.span.push(e),e=new i.Span("",{}),l[o.personalityProps.JOIN]=n}}0!==Object.keys(r).length&&t.push(r),e.speech&&t.push({span:[e],join:n}),s&&t.push(s)}function m(t,e){if(!e)return t;const r={};for(const n of o.personalityPropList){const o=t[n],i=e[n];if(!o&&!i||o&&i&&o===i)continue;const a=o||0;p(r)||(r.open=[],r.close=[]),o||r.close.push(n),i||r.open.push(n),i&&o&&(r.close.push(n),r.open.push(n)),e[n]=a,r[n]=a,s[n]?s[n].push(a):s[n]=[a]}if(p(r)){let t=r.close.slice();for(;t.length>0;){let o=l.pop();const i=(0,n.setdifference)(o,t);if(t=(0,n.setdifference)(t,o),o=i,0!==t.length){if(0!==o.length){r.close=r.close.concat(o),r.open=r.open.concat(o);for(let t,n=0;t=o[n];n++)r[t]=e[t]}}else 0!==o.length&&l.push(o)}l.push(r.open)}return r}e.personalityMarkup=function(t){s={},l=[];let e=[];const r={};for(let n,i=0;n=t[i];i++){let t=null;const i=n.descriptionSpan(),a=n.personality,s=a[o.personalityProps.JOIN];delete a[o.personalityProps.JOIN],void 0!==a[o.personalityProps.PAUSE]&&(t={[o.personalityProps.PAUSE]:a[o.personalityProps.PAUSE]},delete a[o.personalityProps.PAUSE]);f(e,i,m(a,r),s,t,!0)}return e=e.concat(function(){const t=[];for(let e=l.length-1;e>=0;e--){const r=l[e];if(r.length){const e={open:[],close:[]};for(let t=0;t<r.length;t++){const n=r[t];e.close.push(n),e[n]=0}t.push(e)}}return t}()),e=function(t){const e={},r=[];for(let n,o=0;n=t[o];o++){if(!p(n)){c(r,n);continue}if(!n.close||1!==n.close.length||n.open.length){u(n,e),r.push(n);continue}let i=t[o+1];if(!i||d(i)){u(n,e),r.push(n);continue}const a=h(i)?i:null;a&&(i=t[o+2]),i&&p(i)&&i.open[0]===n.close[0]&&!i.close.length&&i[i.open[0]]===e[i.open[0]]?a?(c(r,a),o+=2):o+=1:(u(n,e),r.push(n))}return r}(e),e},e.isMarkupElement=p,e.isPauseElement=h,e.isSpanElement=d},7052:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.AuditoryDescription=void 0;const n=r(2105),o=r(9536);class i{constructor({context:t,text:e,userValue:r,annotation:n,attributes:o,personality:i,layout:a}){this.context=t||"",this.text=e||"",this.userValue=r||"",this.annotation=n||"",this.attributes=o||{},this.personality=i||{},this.layout=a||""}static create(t,e={}){return t.text=n.Grammar.getInstance().apply(t.text,e),new i(t)}isEmpty(){return 0===this.context.length&&0===this.text.length&&0===this.userValue.length&&0===this.annotation.length}clone(){let t,e;if(this.personality){t={};for(const e in this.personality)t[e]=this.personality[e]}if(this.attributes){e={};for(const t in this.attributes)e[t]=this.attributes[t]}return new i({context:this.context,text:this.text,userValue:this.userValue,annotation:this.annotation,personality:t,attributes:e,layout:this.layout})}toString(){return'AuditoryDescription(context="'+this.context+'"  text="'+this.text+'"  userValue="'+this.userValue+'"  annotation="'+this.annotation+'")'}descriptionString(){return this.context&&this.text?this.context+" "+this.text:this.context||this.text}descriptionSpan(){return new o.Span(this.descriptionString(),this.attributes)}equals(t){return this.context===t.context&&this.text===t.text&&this.userValue===t.userValue&&this.annotation===t.annotation}}e.AuditoryDescription=i},8290:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.isXml=e.registerRenderer=e.error=e.finalize=e.merge=e.markup=e.getSeparator=e.setSeparator=void 0;const n=r(5897),o=r(4440),i=r(4196),a=r(8639),s=r(8990),l=r(6660),c=r(9536),u=r(7504),p=r(3757),h=r(4032),d=r(2456),f=new u.SsmlRenderer,m=new Map([[o.Markup.NONE,new h.StringRenderer],[o.Markup.PUNCTUATION,new s.PunctuationRenderer],[o.Markup.LAYOUT,new a.LayoutRenderer],[o.Markup.ACSS,new i.AcssRenderer],[o.Markup.SABLE,new l.SableRenderer],[o.Markup.VOICEXML,f],[o.Markup.SSML,f],[o.Markup.SSML_STEP,new p.SsmlStepRenderer]]);e.setSeparator=function(t){const e=m.get(n.default.getInstance().markup);e&&e.setSeparator(t)},e.getSeparator=function(){const t=m.get(n.default.getInstance().markup);return t?t.getSeparator():""},e.markup=function(t){const e=m.get(n.default.getInstance().markup);return e?e.markup(t):""},e.merge=function(t){const e=t.map((t=>"string"==typeof t?new c.Span(t,{}):t)),r=m.get(n.default.getInstance().markup);return r?r.merge(e):t.join()},e.finalize=function(t){const e=m.get(n.default.getInstance().markup);return e?e.finalize(t):t},e.error=function(t){const e=m.get(n.default.getInstance().markup);return e?e.error(t):""},e.registerRenderer=function(t,e){m.set(t,e)},e.isXml=function(){return m.get(n.default.getInstance().markup)instanceof d.XmlRenderer}},8639:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.LayoutRenderer=void 0;const n=r(2057),o=r(5740),i=r(4440),a=r(3706),s=r(2456);class l extends s.XmlRenderer{finalize(t){return function(t){c="";const e=o.parseInput(`<all>${t}</all>`);return n.Debugger.getInstance().output(o.formatXml(e.toString())),c=d(e),c}(t)}pause(t){return""}prosodyElement(t,e){return t===i.personalityProps.LAYOUT?`<${e}>`:""}closeTag(t){return`</${t}>`}markup(t){const e=[];let r=[];for(const n of t){if(!n.layout){r.push(n);continue}e.push(this.processContent(r)),r=[];const t=n.layout;t.match(/^begin/)?e.push("<"+t.replace(/^begin/,"")+">"):t.match(/^end/)?e.push("</"+t.replace(/^end/,"")+">"):console.warn("Something went wrong with layout markup: "+t)}return e.push(this.processContent(r)),e.join("")}processContent(t){const e=[],r=a.personalityMarkup(t);for(let t,n=0;t=r[n];n++)t.span?e.push(this.merge(t.span)):a.isPauseElement(t);return e.join("")}}e.LayoutRenderer=l;let c="";const u={TABLE:function(t){let e=g(t);e.forEach((t=>{t.cells=t.cells.slice(1).slice(0,-1),t.width=t.width.slice(1).slice(0,-1)}));const[r,n]=b(e);return e=v(e,n),_(e,r)},CASES:function(t){let e=g(t);e.forEach((t=>{t.cells=t.cells.slice(0,-1),t.width=t.width.slice(0,-1)}));const[r,n]=b(e);return e=v(e,n),_(e,r)},CAYLEY:function(t){let e=g(t);e.forEach((t=>{t.cells=t.cells.slice(1).slice(0,-1),t.width=t.width.slice(1).slice(0,-1),t.sep=t.sep+t.sep}));const[r,n]=b(e),o={lfence:"",rfence:"",cells:n.map((t=>"\u2810"+new Array(t).join("\u2812"))),width:n,height:1,sep:e[0].sep};return e.splice(1,0,o),e=v(e,n),_(e,r)},MATRIX:function(t){let e=g(t);const[r,n]=b(e);return e=v(e,n),_(e,r)},CELL:d,FENCE:d,ROW:d,FRACTION:function(t){const[e,r,,n,o]=Array.from(t.childNodes),i=p(r),a=p(n),s=m(i),l=m(a);let c=Math.max(s,l);const u=e+new Array(c+1).join("\u2812")+o;return c=u.length,`${O(i,c)}\n${u}\n${O(a,c)}`},NUMERATOR:E,DENOMINATOR:E};function p(t){const e=o.tagName(t),r=u[e];return r?r(t):t.textContent}function h(t,e){if(!t||!e)return t+e;const r=f(t),n=f(e),o=r-n;t=o<0?y(t,n,m(t)):t,e=o>0?y(e,r,m(e)):e;const i=t.split(/\r\n|\r|\n/),a=e.split(/\r\n|\r|\n/),s=[];for(let t=0;t<i.length;t++)s.push(i[t]+a[t]);return s.join("\n")}function d(t){let e="";for(const r of Array.from(t.childNodes))e=r.nodeType!==o.NodeType.TEXT_NODE?h(e,p(r)):h(e,r.textContent);return e}function f(t){return t.split(/\r\n|\r|\n/).length}function m(t){return t.split(/\r\n|\r|\n/).reduce(((t,e)=>Math.max(e.length,t)),0)}function y(t,e,r){return t=function(t,e){const r=e-f(t);return t+(r>0?new Array(r+1).join("\n"):"")}(t,e),function(t,e){const r=t.split(/\r\n|\r|\n/),n=[];for(const t of r){const r=e-t.length;n.push(t+(r>0?new Array(r+1).join("\u2800"):""))}return n.join("\n")}(t,r)}function g(t){const e=Array.from(t.childNodes),r=[];for(const t of e)t.nodeType===o.NodeType.ELEMENT_NODE&&r.push(M(t));return r}function b(t){const e=t.reduce(((t,e)=>Math.max(e.height,t)),0),r=[];for(let e=0;e<t[0].width.length;e++)r.push(t.map((t=>t.width[e])).reduce(((t,e)=>Math.max(t,e)),0));return[e,r]}function v(t,e){const r=[];for(const n of t){if(0===n.height)continue;const t=[];for(let r=0;r<n.cells.length;r++)t.push(y(n.cells[r],n.height,e[r]));n.cells=t,r.push(n)}return r}function _(t,e){if(1===e)return t.map((t=>t.lfence+t.cells.join(t.sep)+t.rfence)).join("\n");const r=[];for(const e of t){const t=S(e.sep,e.height);let n=e.cells.shift();for(;e.cells.length;)n=h(n,t),n=h(n,e.cells.shift());n=h(S(e.lfence,e.height),n),n=h(n,S(e.rfence,e.height)),r.push(n),r.push(e.lfence+new Array(m(n)-3).join(e.sep)+e.rfence)}return r.slice(0,-1).join("\n")}function S(t,e){let r="";for(;e;)r+=t+"\n",e--;return r.slice(0,-1)}function x(t){return t.nodeType===o.NodeType.ELEMENT_NODE&&"FENCE"===o.tagName(t)?p(t):""}function M(t){const e=Array.from(t.childNodes),r=x(e[0]),n=x(e[e.length-1]);r&&e.shift(),n&&e.pop();let i="";const a=[];for(const t of e){if(t.nodeType===o.NodeType.TEXT_NODE){i=t.textContent;continue}const e=p(t);a.push(e)}return{lfence:r,rfence:n,sep:i,cells:a,height:a.reduce(((t,e)=>Math.max(f(e),t)),0),width:a.map(m)}}function O(t,e){const r=(e-m(t))/2,[n,o]=Math.floor(r)===r?[r,r]:[Math.floor(r),Math.ceil(r)],i=t.split(/\r\n|\r|\n/),a=[],[s,l]=[new Array(n+1).join("\u2800"),new Array(o+1).join("\u2800")];for(const t of i)a.push(s+t+l);return a.join("\n")}function E(t){const e=t.firstChild,r=d(t);if(e&&e.nodeType===o.NodeType.ELEMENT_NODE){if("ENGLISH"===o.tagName(e))return"\u2830"+r;if("NUMBER"===o.tagName(e))return"\u283c"+r}return r}},182:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.MarkupRenderer=void 0;const n=r(4440),o=r(3921);class i extends o.AbstractAudioRenderer{constructor(){super(...arguments),this.ignoreElements=[n.personalityProps.LAYOUT],this.scaleFunction=null}setScaleFunction(t,e,r,n,o=0){this.scaleFunction=i=>{const a=(i-t)/(e-t),s=r*(1-a)+n*a;return+(Math.round(s+"e+"+o)+"e-"+o)}}applyScaleFunction(t){return this.scaleFunction?this.scaleFunction(t):t}ignoreElement(t){return-1!==this.ignoreElements.indexOf(t)}}e.MarkupRenderer=i},8990:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.PunctuationRenderer=void 0;const n=r(4440),o=r(3921),i=r(3706);class a extends o.AbstractAudioRenderer{markup(t){const e=i.personalityMarkup(t);let r="",o=null,a=!1;for(let t,s=0;t=e[s];s++)i.isMarkupElement(t)||(i.isPauseElement(t)?a&&(o=i.mergePause(o,t,Math.max)):(o&&(r+=this.pause(o[n.personalityProps.PAUSE]),o=null),r+=(a?this.getSeparator():"")+this.merge(t.span),a=!0));return r}pause(t){let e;return e="number"==typeof t?t<=250?"short":t<=500?"medium":"long":t,a.PAUSE_PUNCTUATION.get(e)||""}}e.PunctuationRenderer=a,a.PAUSE_PUNCTUATION=new Map([["short",","],["medium",";"],["long","."]])},6660:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SableRenderer=void 0;const n=r(4440),o=r(2456);class i extends o.XmlRenderer{finalize(t){return'<?xml version="1.0"?><!DOCTYPE SABLE PUBLIC "-//SABLE//DTD SABLE speech mark up//EN" "Sable.v0_2.dtd" []><SABLE>'+this.getSeparator()+t+this.getSeparator()+"</SABLE>"}pause(t){return'<BREAK MSEC="'+this.pauseValue(t[n.personalityProps.PAUSE])+'"/>'}prosodyElement(t,e){switch(e=this.applyScaleFunction(e),t){case n.personalityProps.PITCH:return'<PITCH RANGE="'+e+'%">';case n.personalityProps.RATE:return'<RATE SPEED="'+e+'%">';case n.personalityProps.VOLUME:return'<VOLUME LEVEL="'+e+'%">';default:return"<"+t.toUpperCase()+' VALUE="'+e+'">'}}closeTag(t){return"</"+t.toUpperCase()+">"}}e.SableRenderer=i},9536:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Span=void 0;e.Span=class{constructor(t,e){this.speech=t,this.attributes=e}}},7504:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SsmlRenderer=void 0;const n=r(5897),o=r(4440),i=r(2456);class a extends i.XmlRenderer{finalize(t){return'<?xml version="1.0"?><speak version="1.1" xmlns="http://www.w3.org/2001/10/synthesis"><prosody rate="'+n.default.getInstance().getRate()+'%">'+this.getSeparator()+t+this.getSeparator()+"</prosody></speak>"}pause(t){return'<break time="'+this.pauseValue(t[o.personalityProps.PAUSE])+'ms"/>'}prosodyElement(t,e){const r=(e=Math.floor(this.applyScaleFunction(e)))<0?e.toString():"+"+e.toString();return"<prosody "+t.toLowerCase()+'="'+r+(t===o.personalityProps.VOLUME?">":'%">')}closeTag(t){return"</prosody>"}}e.SsmlRenderer=a},3757:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SsmlStepRenderer=void 0;const n=r(7504);class o extends n.SsmlRenderer{markup(t){return o.MARKS={},super.markup(t)}merge(t){const e=[];for(let r=0;r<t.length;r++){const n=t[r],i=n.attributes.extid;i&&!o.MARKS[i]&&(e.push('<mark name="'+i+'"/>'),o.MARKS[i]=!0),1===n.speech.length&&n.speech.match(/[a-zA-Z]/)?e.push('<say-as interpret-as="'+o.CHARACTER_ATTR+'">'+n.speech+"</say-as>"):e.push(n.speech)}return e.join(this.getSeparator())}}e.SsmlStepRenderer=o,o.CHARACTER_ATTR="character",o.MARKS={}},4032:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.StringRenderer=void 0;const n=r(3921),o=r(3706);class i extends n.AbstractAudioRenderer{markup(t){let e="";const r=(0,o.personalityMarkup)(t).filter((t=>t.span));if(!r.length)return e;const n=r.length-1;for(let t,o=0;t=r[o];o++){if(t.span&&(e+=this.merge(t.span)),o>=n)continue;const r=t.join;e+=void 0===r?this.getSeparator():r}return e}}e.StringRenderer=i},2456:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.XmlRenderer=void 0;const n=r(5897),o=r(3706),i=r(182);class a extends i.MarkupRenderer{markup(t){this.setScaleFunction(-2,2,-100,100,2);const e=o.personalityMarkup(t),r=[],i=[];for(let t,a=0;t=e[a];a++)if(t.span)r.push(this.merge(t.span));else if(o.isPauseElement(t))r.push(this.pause(t));else{if(t.close.length)for(let e=0;e<t.close.length;e++){const e=i.pop();if(-1===t.close.indexOf(e))throw new n.SREError("Unknown closing markup element: "+e);r.push(this.closeTag(e))}if(t.open.length){o.sortClose(t.open.slice(),e.slice(a+1)).forEach((e=>{r.push(this.prosodyElement(e,t[e])),i.push(e)}))}}return r.join(" ")}}e.XmlRenderer=a},707:function(t,e){function r(t,e){return t?e?t.filter((t=>e.indexOf(t)<0)):t:[]}Object.defineProperty(e,"__esModule",{value:!0}),e.union=e.setdifference=e.interleaveLists=e.removeEmpty=void 0,e.removeEmpty=function(t){return t.filter((t=>t))},e.interleaveLists=function(t,e){const r=[];for(;t.length||e.length;)t.length&&r.push(t.shift()),e.length&&r.push(e.shift());return r},e.setdifference=r,e.union=function(t,e){return t&&e?t.concat(r(e,t)):t||e||[]}},2139:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.loadScript=e.loadMapsForIE_=e.installWGXpath_=e.loadWGXpath_=e.mapsForIE=e.detectEdge=e.detectIE=void 0;const n=r(2315),o=r(5274);function i(t){l(n.default.WGXpath),a(t)}function a(t,e){let r=e||1;"undefined"==typeof wgxpath&&r<10?setTimeout((function(){a(t,r++)}),200):r>=10||(n.default.wgxpath=wgxpath,t?n.default.wgxpath.install({document:document}):n.default.wgxpath.install(),o.xpath.evaluate=document.evaluate,o.xpath.result=XPathResult,o.xpath.createNSResolver=document.createNSResolver)}function s(){l(n.default.mathmapsIePath)}function l(t){const e=n.default.document.createElement("script");e.type="text/javascript",e.src=t,n.default.document.head?n.default.document.head.appendChild(e):n.default.document.body.appendChild(e)}e.detectIE=function(){return"undefined"!=typeof window&&"ActiveXObject"in window&&"clipboardData"in window&&(s(),i(),!0)},e.detectEdge=function(){var t;return"undefined"!=typeof window&&"MSGestureEvent"in window&&null===(null===(t=window.chrome)||void 0===t?void 0:t.loadTimes)&&(document.evaluate=null,i(!0),!0)},e.mapsForIE=null,e.loadWGXpath_=i,e.installWGXpath_=a,e.loadMapsForIE_=s,e.loadScript=l},2057:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Debugger=void 0;const n=r(2315);class o{constructor(){this.isActive_=!1,this.outputFunction_=console.info,this.stream_=null}static getInstance(){return o.instance=o.instance||new o,o.instance}init(t){t&&this.startDebugFile_(t),this.isActive_=!0}output(...t){this.isActive_&&this.output_(t)}generateOutput(t){this.isActive_&&this.output_(t.apply(t,[]))}exit(t=(()=>{})){this.isActive_&&this.stream_&&this.stream_.end("","",t)}startDebugFile_(t){this.stream_=n.default.fs.createWriteStream(t),this.outputFunction_=function(...t){this.stream_.write(t.join(" ")),this.stream_.write("\n")}.bind(this),this.stream_.on("error",function(t){console.info("Invalid log file. Debug information sent to console."),this.outputFunction_=console.info}.bind(this)),this.stream_.on("finish",(function(){console.info("Finalizing debug file.")}))}output_(t){this.outputFunction_.apply(console.info===this.outputFunction_?console:this.outputFunction_,["Speech Rule Engine Debugger:"].concat(t))}}e.Debugger=o},5740:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeXml=e.cloneNode=e.tagName=e.querySelectorAll=e.querySelectorAllByAttrValue=e.querySelectorAllByAttr=e.formatXml=e.createTextNode=e.createElementNS=e.createElement=e.replaceNode=e.NodeType=e.parseInput=e.XML_ENTITIES=e.trimInput_=e.toArray=void 0;const n=r(5897),o=r(4440),i=r(2315),a=r(5274);function s(t){const e=[];for(let r=0,n=t.length;r<n;r++)e.push(t[r]);return e}function l(t){return(t=t.replace(/&nbsp;/g,"\xa0")).replace(/>[ \f\n\r\t\v\u200b]+</g,"><").trim()}function c(t,e){if(!e)return[!1,""];const r=t.match(/^<([^> ]+).*>/),n=e.match(/^<\/([^>]+)>(.*)/);return r&&n&&r[1]===n[1]?[!0,n[2]]:[!1,""]}e.toArray=s,e.trimInput_=l,e.XML_ENTITIES={"&lt;":!0,"&gt;":!0,"&amp;":!0,"&quot;":!0,"&apos;":!0},e.parseInput=function(t){const e=new i.default.xmldom.DOMParser,r=l(t),s=!!r.match(/&(?!lt|gt|amp|quot|apos)\w+;/g);if(!r)throw new Error("Empty input!");try{const t=e.parseFromString(r,s?"text/html":"text/xml");return n.default.getInstance().mode===o.Mode.HTTP?(a.xpath.currentDocument=t,s?t.body.childNodes[0]:t.documentElement):t.documentElement}catch(t){throw new n.SREError("Illegal input: "+t.message)}},function(t){t[t.ELEMENT_NODE=1]="ELEMENT_NODE",t[t.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",t[t.TEXT_NODE=3]="TEXT_NODE",t[t.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",t[t.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",t[t.ENTITY_NODE=6]="ENTITY_NODE",t[t.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",t[t.COMMENT_NODE=8]="COMMENT_NODE",t[t.DOCUMENT_NODE=9]="DOCUMENT_NODE",t[t.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",t[t.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE",t[t.NOTATION_NODE=12]="NOTATION_NODE"}(e.NodeType||(e.NodeType={})),e.replaceNode=function(t,e){t.parentNode&&(t.parentNode.insertBefore(e,t),t.parentNode.removeChild(t))},e.createElement=function(t){return i.default.document.createElement(t)},e.createElementNS=function(t,e){return i.default.document.createElementNS(t,e)},e.createTextNode=function(t){return i.default.document.createTextNode(t)},e.formatXml=function(t){let e="",r=/(>)(<)(\/*)/g,n=0,o=(t=t.replace(r,"$1\r\n$2$3")).split("\r\n");for(r=/(\.)*(<)(\/*)/g,o=o.map((t=>t.replace(r,"$1\r\n$2$3").split("\r\n"))).reduce(((t,e)=>t.concat(e)),[]);o.length;){let t=o.shift();if(!t)continue;let r=0;if(t.match(/^<\w[^>/]*>[^>]+$/)){const e=c(t,o[0]);e[0]?e[1]?(t+=o.shift().slice(0,-e[1].length),e[1].trim()&&o.unshift(e[1])):t+=o.shift():r=1}else if(t.match(/^<\/\w/))0!==n&&(n-=1);else if(t.match(/^<\w[^>]*[^/]>.*$/))r=1;else if(t.match(/^<\w[^>]*\/>.+$/)){const e=t.indexOf(">")+1;t.slice(e).trim()&&o.unshift(),t=t.slice(0,e)}else r=0;e+=new Array(n+1).join("  ")+t+"\r\n",n+=r}return e},e.querySelectorAllByAttr=function(t,e){return t.querySelectorAll?s(t.querySelectorAll(`[${e}]`)):a.evalXPath(`.//*[@${e}]`,t)},e.querySelectorAllByAttrValue=function(t,e,r){return t.querySelectorAll?s(t.querySelectorAll(`[${e}="${r}"]`)):a.evalXPath(`.//*[@${e}="${r}"]`,t)},e.querySelectorAll=function(t,e){return t.querySelectorAll?s(t.querySelectorAll(e)):a.evalXPath(`.//${e}`,t)},e.tagName=function(t){return t.tagName.toUpperCase()},e.cloneNode=function(t){return t.cloneNode(!0)},e.serializeXml=function(t){return(new i.default.xmldom.XMLSerializer).serializeToString(t)}},5897:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.EnginePromise=e.SREError=void 0;const n=r(1676),o=r(4440),i=r(2057),a=r(1377);class s extends Error{constructor(t=""){super(),this.message=t,this.name="SRE Error"}}e.SREError=s;class l{constructor(){this.customLoader=null,this.parsers={},this.comparator=null,this.mode=o.Mode.SYNC,this.init=!0,this.delay=!1,this.comparators={},this.domain="mathspeak",this.style=n.DynamicCstr.DEFAULT_VALUES[n.Axis.STYLE],this._defaultLocale=n.DynamicCstr.DEFAULT_VALUES[n.Axis.LOCALE],this.locale=this.defaultLocale,this.subiso="",this.modality=n.DynamicCstr.DEFAULT_VALUES[n.Axis.MODALITY],this.speech=o.Speech.NONE,this.markup=o.Markup.NONE,this.walker="Table",this.structure=!1,this.ruleSets=[],this.strict=!1,this.isIE=!1,this.isEdge=!1,this.rate="100",this.pprint=!1,this.config=!1,this.rules="",this.prune="",this.evaluator=l.defaultEvaluator,this.defaultParser=new n.DynamicCstrParser(n.DynamicCstr.DEFAULT_ORDER),this.parser=this.defaultParser,this.dynamicCstr=n.DynamicCstr.defaultCstr()}set defaultLocale(t){this._defaultLocale=a.Variables.ensureLocale(t,this._defaultLocale)}get defaultLocale(){return this._defaultLocale}static getInstance(){return l.instance=l.instance||new l,l.instance}static defaultEvaluator(t,e){return t}static evaluateNode(t){return l.nodeEvaluator(t)}getRate(){const t=parseInt(this.rate,10);return isNaN(t)?100:t}setDynamicCstr(t){if(this.defaultLocale&&(n.DynamicCstr.DEFAULT_VALUES[n.Axis.LOCALE]=this.defaultLocale),t){const e=Object.keys(t);for(let r=0;r<e.length;r++){const o=e[r];if(-1!==n.DynamicCstr.DEFAULT_ORDER.indexOf(o)){const e=t[o];this[o]=e}}}o.DOMAIN_TO_STYLES[this.domain]=this.style;const e=[this.locale,this.modality,this.domain,this.style].join("."),r=n.DynamicProperties.createProp([n.DynamicCstr.DEFAULT_VALUES[n.Axis.LOCALE]],[n.DynamicCstr.DEFAULT_VALUES[n.Axis.MODALITY]],[n.DynamicCstr.DEFAULT_VALUES[n.Axis.DOMAIN]],[n.DynamicCstr.DEFAULT_VALUES[n.Axis.STYLE]]),i=this.comparators[this.domain],a=this.parsers[this.domain];this.parser=a||this.defaultParser,this.dynamicCstr=this.parser.parse(e),this.dynamicCstr.updateProperties(r.getProperties()),this.comparator=i?i():new n.DefaultComparator(this.dynamicCstr)}configurate(t){this.mode!==o.Mode.HTTP||this.config||(!function(t){const e=document.documentElement.querySelectorAll('script[type="text/x-sre-config"]');for(let r=0,n=e.length;r<n;r++){let n;try{n=e[r].innerHTML;const o=JSON.parse(n);for(const e in o)t[e]=o[e]}catch(t){i.Debugger.getInstance().output("Illegal configuration ",n)}}}(t),this.config=!0),function(t){if("undefined"!=typeof SREfeature)for(const[e,r]of Object.entries(SREfeature))t[e]=r}(t)}setCustomLoader(t){t&&(this.customLoader=t)}}e.default=l,l.BINARY_FEATURES=["strict","structure","pprint"],l.STRING_FEATURES=["markup","style","domain","speech","walker","defaultLocale","locale","delay","modality","rate","rules","subiso","prune"],l.nodeEvaluator=function(t){return[]};class c{static get(t=l.getInstance().locale){return c.promises[t]||Promise.resolve("")}static getall(){return Promise.all(Object.values(c.promises))}}e.EnginePromise=c,c.loaded={},c.promises={}},4440:function(t,e){var r;Object.defineProperty(e,"__esModule",{value:!0}),e.DOMAIN_TO_STYLES=e.Markup=e.Speech=e.personalityPropList=e.personalityProps=e.Mode=void 0,function(t){t.SYNC="sync",t.ASYNC="async",t.HTTP="http"}(e.Mode||(e.Mode={})),function(t){t.PITCH="pitch",t.RATE="rate",t.VOLUME="volume",t.PAUSE="pause",t.JOIN="join",t.LAYOUT="layout"}(r=e.personalityProps||(e.personalityProps={})),e.personalityPropList=[r.PITCH,r.RATE,r.VOLUME,r.PAUSE,r.JOIN],function(t){t.NONE="none",t.SHALLOW="shallow",t.DEEP="deep"}(e.Speech||(e.Speech={})),function(t){t.NONE="none",t.LAYOUT="layout",t.PUNCTUATION="punctuation",t.SSML="ssml",t.SSML_STEP="ssml_step",t.ACSS="acss",t.SABLE="sable",t.VOICEXML="voicexml"}(e.Markup||(e.Markup={})),e.DOMAIN_TO_STYLES={mathspeak:"default",clearspeak:"default"}},6828:function(t,e,r){var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{l(n.next(t))}catch(t){i(t)}}function s(t){try{l(n.throw(t))}catch(t){i(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}l((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.setup=void 0;const o=r(7491),i=r(6141),a=r(2139),s=r(5897),l=r(7248),c=r(2315);e.setup=function(t){return n(this,void 0,void 0,(function*(){const e=s.default.getInstance();"default"!==t.domain||"speech"!==t.modality&&t.modality&&"speech"!==e.modality||(t.domain="mathspeak");const r=r=>{void 0!==t[r]&&(e[r]=t[r])};return r("mode"),e.configurate(t),s.default.BINARY_FEATURES.forEach((r=>{void 0!==t[r]&&(e[r]=!!t[r])})),s.default.STRING_FEATURES.forEach(r),t.json&&(c.default.jsonPath=l.makePath(t.json)),t.xpath&&(c.default.WGXpath=t.xpath),e.setCustomLoader(t.custom),function(t){t.isIE=a.detectIE(),t.isEdge=a.detectEdge()}(e),o.setLocale(),e.setDynamicCstr(),e.init?(s.EnginePromise.promises.init=new Promise(((t,e)=>{setTimeout((()=>{t("init")}),10)})),e.init=!1,s.EnginePromise.get()):e.delay?(e.delay=!1,s.EnginePromise.get()):i.loadLocale()}))}},8496:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Event=e.EventType=e.Move=e.KeyCode=void 0,function(t){t[t.ENTER=13]="ENTER",t[t.ESC=27]="ESC",t[t.SPACE=32]="SPACE",t[t.PAGE_UP=33]="PAGE_UP",t[t.PAGE_DOWN=34]="PAGE_DOWN",t[t.END=35]="END",t[t.HOME=36]="HOME",t[t.LEFT=37]="LEFT",t[t.UP=38]="UP",t[t.RIGHT=39]="RIGHT",t[t.DOWN=40]="DOWN",t[t.TAB=9]="TAB",t[t.LESS=188]="LESS",t[t.GREATER=190]="GREATER",t[t.DASH=189]="DASH",t[t.ZERO=48]="ZERO",t[t.ONE=49]="ONE",t[t.TWO=50]="TWO",t[t.THREE=51]="THREE",t[t.FOUR=52]="FOUR",t[t.FIVE=53]="FIVE",t[t.SIX=54]="SIX",t[t.SEVEN=55]="SEVEN",t[t.EIGHT=56]="EIGHT",t[t.NINE=57]="NINE",t[t.A=65]="A",t[t.B=66]="B",t[t.C=67]="C",t[t.D=68]="D",t[t.E=69]="E",t[t.F=70]="F",t[t.G=71]="G",t[t.H=72]="H",t[t.I=73]="I",t[t.J=74]="J",t[t.K=75]="K",t[t.L=76]="L",t[t.M=77]="M",t[t.N=78]="N",t[t.O=79]="O",t[t.P=80]="P",t[t.Q=81]="Q",t[t.R=82]="R",t[t.S=83]="S",t[t.T=84]="T",t[t.U=85]="U",t[t.V=86]="V",t[t.W=87]="W",t[t.X=88]="X",t[t.Y=89]="Y",t[t.Z=90]="Z"}(e.KeyCode||(e.KeyCode={})),e.Move=new Map([[13,"ENTER"],[27,"ESC"],[32,"SPACE"],[33,"PAGE_UP"],[34,"PAGE_DOWN"],[35,"END"],[36,"HOME"],[37,"LEFT"],[38,"UP"],[39,"RIGHT"],[40,"DOWN"],[9,"TAB"],[188,"LESS"],[190,"GREATER"],[189,"DASH"],[48,"ZERO"],[49,"ONE"],[50,"TWO"],[51,"THREE"],[52,"FOUR"],[53,"FIVE"],[54,"SIX"],[55,"SEVEN"],[56,"EIGHT"],[57,"NINE"],[65,"A"],[66,"B"],[67,"C"],[68,"D"],[69,"E"],[70,"F"],[71,"G"],[72,"H"],[73,"I"],[74,"J"],[75,"K"],[76,"L"],[77,"M"],[78,"N"],[79,"O"],[80,"P"],[81,"Q"],[82,"R"],[83,"S"],[84,"T"],[85,"U"],[86,"V"],[87,"W"],[88,"X"],[89,"Y"],[90,"Z"]]),function(t){t.CLICK="click",t.DBLCLICK="dblclick",t.MOUSEDOWN="mousedown",t.MOUSEUP="mouseup",t.MOUSEOVER="mouseover",t.MOUSEOUT="mouseout",t.MOUSEMOVE="mousemove",t.SELECTSTART="selectstart",t.KEYPRESS="keypress",t.KEYDOWN="keydown",t.KEYUP="keyup",t.TOUCHSTART="touchstart",t.TOUCHMOVE="touchmove",t.TOUCHEND="touchend",t.TOUCHCANCEL="touchcancel"}(e.EventType||(e.EventType={}));e.Event=class{constructor(t,e,r){this.src=t,this.type=e,this.callback=r}add(){this.src.addEventListener(this.type,this.callback)}remove(){this.src.removeEventListener(this.type,this.callback)}}},7248:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.localePath=e.makePath=void 0;const n=r(2315);function o(t){return t.match("/$")?t:t+"/"}e.makePath=o,e.localePath=function(t,e="json"){return o(n.default.jsonPath)+t+(e.match(/^\./)?e:"."+e)}},3769:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.KeyProcessor=e.Processor=void 0;const n=r(8496);class o{constructor(t,e){this.name=t,this.process=e.processor,this.postprocess=e.postprocessor||((t,e)=>t),this.processor=this.postprocess?function(t){return this.postprocess(this.process(t),t)}:this.process,this.print=e.print||o.stringify_,this.pprint=e.pprint||this.print}static stringify_(t){return t?t.toString():t}}e.Processor=o,o.LocalState={walker:null,speechGenerator:null,highlighter:null};class i extends o{constructor(t,e){super(t,e),this.key=e.key||i.getKey_}static getKey_(t){return"string"==typeof t?n.KeyCode[t.toUpperCase()]:t}}e.KeyProcessor=i},6499:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.keypress=e.output=e.print=e.process=e.set=void 0;const n=r(8290),o=r(5714),i=r(3090),a=r(4356),s=r(1414),l=r(9552),c=r(9543),u=r(3362),p=r(1204),h=r(5740),d=r(5897),f=r(4440),m=r(3769),y=r(5274),g=new Map;function b(t){g.set(t.name,t)}function v(t){const e=g.get(t);if(!e)throw new d.SREError("Unknown processor "+t);return e}function _(t,e){const r=v(t);try{return r.processor(e)}catch(t){throw new d.SREError("Processing error for expression "+e)}}function S(t,e){const r=v(t);return d.default.getInstance().pprint?r.pprint(e):r.print(e)}e.set=b,e.process=_,e.print=S,e.output=function(t,e){const r=v(t);try{const t=r.processor(e);return d.default.getInstance().pprint?r.pprint(t):r.print(t)}catch(t){throw new d.SREError("Processing error for expression "+e)}},e.keypress=function(t,e){const r=v(t),n=r instanceof m.KeyProcessor?r.key(e):e,o=r.processor(n);return d.default.getInstance().pprint?r.pprint(o):r.print(o)},b(new m.Processor("semantic",{processor:function(t){const e=h.parseInput(t);return s.xmlTree(e)},postprocessor:function(t,e){const r=d.default.getInstance().speech;if(r===f.Speech.NONE)return t;const o=h.cloneNode(t);let i=c.computeMarkup(o);if(r===f.Speech.SHALLOW)return t.setAttribute("speech",n.finalize(i)),t;const a=y.evalXPath(".//*[@id]",t),s=y.evalXPath(".//*[@id]",o);for(let t,e,r=0;t=a[r],e=s[r];r++)i=c.computeMarkup(e),t.setAttribute("speech",n.finalize(i));return t},pprint:function(t){return h.formatXml(t.toString())}})),b(new m.Processor("speech",{processor:function(t){const e=h.parseInput(t),r=s.xmlTree(e),o=c.computeSpeech(r);return n.finalize(n.markup(o))},pprint:function(t){const e=t.toString();return n.isXml()?h.formatXml(e):e}})),b(new m.Processor("json",{processor:function(t){const e=h.parseInput(t);return s.getTree(e).toJson()},postprocessor:function(t,e){const r=d.default.getInstance().speech;if(r===f.Speech.NONE)return t;const o=h.parseInput(e),i=s.xmlTree(o),a=c.computeMarkup(i);if(r===f.Speech.SHALLOW)return t.stree.speech=n.finalize(a),t;const l=t=>{const e=y.evalXPath(`.//*[@id=${t.id}]`,i)[0],r=c.computeMarkup(e);t.speech=n.finalize(r),t.children&&t.children.forEach(l)};return l(t.stree),t},print:function(t){return JSON.stringify(t)},pprint:function(t){return JSON.stringify(t,null,2)}})),b(new m.Processor("description",{processor:function(t){const e=h.parseInput(t),r=s.xmlTree(e);return c.computeSpeech(r)},print:function(t){return JSON.stringify(t)},pprint:function(t){return JSON.stringify(t,null,2)}})),b(new m.Processor("enriched",{processor:function(t){return o.semanticMathmlSync(t)},postprocessor:function(t,e){const r=p.getSemanticRoot(t);let n;switch(d.default.getInstance().speech){case f.Speech.NONE:break;case f.Speech.SHALLOW:n=l.generator("Adhoc"),n.getSpeech(r,t);break;case f.Speech.DEEP:n=l.generator("Tree"),n.getSpeech(t,t)}return t},pprint:function(t){return h.formatXml(t.toString())}})),b(new m.Processor("walker",{processor:function(t){const e=l.generator("Node");m.Processor.LocalState.speechGenerator=e,e.setOptions({modality:d.default.getInstance().modality,locale:d.default.getInstance().locale,domain:d.default.getInstance().domain,style:d.default.getInstance().style}),m.Processor.LocalState.highlighter=i.highlighter({color:"black"},{color:"white"},{renderer:"NativeMML"});const r=_("enriched",t),n=S("enriched",r);return m.Processor.LocalState.walker=u.walker(d.default.getInstance().walker,r,e,m.Processor.LocalState.highlighter,n),m.Processor.LocalState.walker},print:function(t){return m.Processor.LocalState.walker.speech()}})),b(new m.KeyProcessor("move",{processor:function(t){if(!m.Processor.LocalState.walker)return null;return!1===m.Processor.LocalState.walker.move(t)?n.error(t):m.Processor.LocalState.walker.speech()}})),b(new m.Processor("number",{processor:function(t){const e=parseInt(t,10);return isNaN(e)?"":a.LOCALE.NUMBERS.numberToWords(e)}})),b(new m.Processor("ordinal",{processor:function(t){const e=parseInt(t,10);return isNaN(e)?"":a.LOCALE.NUMBERS.wordOrdinal(e)}})),b(new m.Processor("numericOrdinal",{processor:function(t){const e=parseInt(t,10);return isNaN(e)?"":a.LOCALE.NUMBERS.numericOrdinal(e)}})),b(new m.Processor("vulgar",{processor:function(t){const[e,r]=t.split("/").map((t=>parseInt(t,10)));return isNaN(e)||isNaN(r)?"":_("speech",`<mfrac><mn>${e}</mn><mn>${r}</mn></mfrac>`)}}))},2998:function(t,e,r){var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{l(n.next(t))}catch(t){i(t)}}function s(t){try{l(n.throw(t))}catch(t){i(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}l((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.localePath=e.exit=e.move=e.walk=e.processFile=e.file=e.vulgar=e.numericOrdinal=e.ordinal=e.number=e.toEnriched=e.toDescription=e.toJson=e.toSemantic=e.toSpeech=e.localeLoader=e.engineReady=e.engineSetup=e.setupEngine=e.version=void 0;const o=r(5897),i=r(6828),a=r(4440),s=r(7248),l=r(6499),c=r(2315),u=r(1377),p=r(6141);function h(t){return n(this,void 0,void 0,(function*(){return(0,i.setup)(t)}))}function d(t,e){return l.process(t,e)}function f(t,e,r){switch(o.default.getInstance().mode){case a.Mode.ASYNC:return function(t,e,r){return n(this,void 0,void 0,(function*(){const n=yield c.default.fs.promises.readFile(e,{encoding:"utf8"}),i=l.output(t,n);if(r)try{c.default.fs.promises.writeFile(r,i)}catch(t){throw new o.SREError("Can not write to file: "+r)}return i}))}(t,e,r);case a.Mode.SYNC:return function(t,e,r){const n=function(t){let e;try{e=c.default.fs.readFileSync(t,{encoding:"utf8"})}catch(e){throw new o.SREError("Can not open file: "+t)}return e}(e),i=l.output(t,n);if(r)try{c.default.fs.writeFileSync(r,i)}catch(t){throw new o.SREError("Can not write to file: "+r)}return i}(t,e,r);default:throw new o.SREError(`Can process files in ${o.default.getInstance().mode} mode`)}}e.version=u.Variables.VERSION,e.setupEngine=h,e.engineSetup=function(){const t=["mode"].concat(o.default.STRING_FEATURES,o.default.BINARY_FEATURES),e=o.default.getInstance(),r={};return t.forEach((function(t){r[t]=e[t]})),r.json=c.default.jsonPath,r.xpath=c.default.WGXpath,r.rules=e.ruleSets.slice(),r},e.engineReady=function(){return n(this,void 0,void 0,(function*(){return h({}).then((()=>o.EnginePromise.getall()))}))},e.localeLoader=p.standardLoader,e.toSpeech=function(t){return d("speech",t)},e.toSemantic=function(t){return d("semantic",t)},e.toJson=function(t){return d("json",t)},e.toDescription=function(t){return d("description",t)},e.toEnriched=function(t){return d("enriched",t)},e.number=function(t){return d("number",t)},e.ordinal=function(t){return d("ordinal",t)},e.numericOrdinal=function(t){return d("numericOrdinal",t)},e.vulgar=function(t){return d("vulgar",t)},e.file={},e.file.toSpeech=function(t,e){return f("speech",t,e)},e.file.toSemantic=function(t,e){return f("semantic",t,e)},e.file.toJson=function(t,e){return f("json",t,e)},e.file.toDescription=function(t,e){return f("description",t,e)},e.file.toEnriched=function(t,e){return f("enriched",t,e)},e.processFile=f,e.walk=function(t){return l.output("walker",t)},e.move=function(t){return l.keypress("move",t)},e.exit=function(t){const e=t||0;o.EnginePromise.getall().then((()=>process.exit(e)))},e.localePath=s.localePath,c.default.documentSupported?h({mode:a.Mode.HTTP}).then((()=>h({}))):h({mode:a.Mode.SYNC}).then((()=>h({mode:a.Mode.ASYNC})))},2315:function(__unused_webpack_module,exports,__webpack_require__){var __dirname="/";Object.defineProperty(exports,"__esModule",{value:!0});const variables_1=__webpack_require__(1377);class SystemExternal{static extRequire(library){if("undefined"!=typeof process){const nodeRequire=eval("require");return nodeRequire(library)}return null}}exports.default=SystemExternal,SystemExternal.windowSupported=!("undefined"==typeof window),SystemExternal.documentSupported=SystemExternal.windowSupported&&!(void 0===window.document),SystemExternal.xmldom=SystemExternal.documentSupported?window:SystemExternal.extRequire("xmldom-sre"),SystemExternal.document=SystemExternal.documentSupported?window.document:(new SystemExternal.xmldom.DOMImplementation).createDocument("","",0),SystemExternal.xpath=SystemExternal.documentSupported?document:function(){const t={document:{},XPathResult:{}};return SystemExternal.extRequire("wicked-good-xpath").install(t),t.document.XPathResult=t.XPathResult,t.document}(),SystemExternal.mathmapsIePath="https://cdn.jsdelivr.net/npm/sre-mathmaps-ie@"+variables_1.Variables.VERSION+"mathmaps_ie.js",SystemExternal.commander=SystemExternal.documentSupported?null:SystemExternal.extRequire("commander"),SystemExternal.fs=SystemExternal.documentSupported?null:SystemExternal.extRequire("fs"),SystemExternal.url=variables_1.Variables.url,SystemExternal.jsonPath=(SystemExternal.documentSupported?SystemExternal.url:process.env.SRE_JSON_PATH||__webpack_require__.g.SRE_JSON_PATH||__dirname+"/mathmaps")+"/",SystemExternal.WGXpath=variables_1.Variables.WGXpath,SystemExternal.wgxpath=null},1377:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Variables=void 0;class r{static ensureLocale(t,e){return r.LOCALES.get(t)?t:(console.error(`Locale ${t} does not exist! Using ${r.LOCALES.get(e)} instead.`),e)}}e.Variables=r,r.VERSION="4.0.6",r.LOCALES=new Map([["ca","Catalan"],["da","Danish"],["de","German"],["en","English"],["es","Spanish"],["fr","French"],["hi","Hindi"],["it","Italian"],["nb","Bokm\xe5l"],["nn","Nynorsk"],["sv","Swedish"],["nemeth","Nemeth"]]),r.mathjaxVersion="3.2.1",r.url="https://cdn.jsdelivr.net/npm/speech-rule-engine@"+r.VERSION+"/lib/mathmaps",r.WGXpath="https://cdn.jsdelivr.net/npm/wicked-good-xpath@1.3.0/dist/wgxpath.install.js"},5274:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.updateEvaluator=e.evaluateString=e.evaluateBoolean=e.getLeafNodes=e.evalXPath=e.resolveNameSpace=e.xpath=void 0;const n=r(5897),o=r(4440),i=r(2315);function a(){return"undefined"!=typeof XPathResult}e.xpath={currentDocument:null,evaluate:a()?document.evaluate:i.default.xpath.evaluate,result:a()?XPathResult:i.default.xpath.XPathResult,createNSResolver:a()?document.createNSResolver:i.default.xpath.createNSResolver};const s={xhtml:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",mml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function l(t){return s[t]||null}e.resolveNameSpace=l;class c{constructor(){this.lookupNamespaceURI=l}}function u(t,r,i){return n.default.getInstance().mode!==o.Mode.HTTP||n.default.getInstance().isIE||n.default.getInstance().isEdge?e.xpath.evaluate(t,r,new c,i,null):e.xpath.currentDocument.evaluate(t,r,l,i,null)}function p(t,r){let n;try{n=u(t,r,e.xpath.result.ORDERED_NODE_ITERATOR_TYPE)}catch(t){return[]}const o=[];for(let t=n.iterateNext();t;t=n.iterateNext())o.push(t);return o}e.evalXPath=p,e.getLeafNodes=function(t){return p(".//*[count(*)=0]",t)},e.evaluateBoolean=function(t,r){let n;try{n=u(t,r,e.xpath.result.BOOLEAN_TYPE)}catch(t){return!1}return n.booleanValue},e.evaluateString=function(t,r){let n;try{n=u(t,r,e.xpath.result.STRING_TYPE)}catch(t){return""}return n.stringValue},e.updateEvaluator=function(t){if(n.default.getInstance().mode!==o.Mode.HTTP)return;let r=t;for(;r&&!r.evaluate;)r=r.parentNode;r&&r.evaluate?e.xpath.currentDocument=r:t.ownerDocument&&(e.xpath.currentDocument=t.ownerDocument)}},9268:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractEnrichCase=void 0;e.AbstractEnrichCase=class{constructor(t){this.semantic=t}}},6061:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.CaseBinomial=void 0;const n=r(5740),o=r(9268),i=r(5452),a=r(2298);class s extends o.AbstractEnrichCase{constructor(t){super(t),this.mml=t.mathmlTree}static test(t){return!t.mathmlTree&&"line"===t.type&&"binomial"===t.role}getMathml(){if(!this.semantic.childNodes.length)return this.mml;const t=this.semantic.childNodes[0];if(this.mml=(0,i.walkTree)(t),this.mml.hasAttribute(a.Attribute.TYPE)){const t=n.createElement("mrow");t.setAttribute(a.Attribute.ADDED,"true"),n.replaceNode(this.mml,t),t.appendChild(this.mml),this.mml=t}return(0,a.setAttributes)(this.mml,this.semantic),this.mml}}e.CaseBinomial=s},5765:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.CaseDoubleScript=void 0;const n=r(5740),o=r(9268),i=r(5452),a=r(2298);class s extends o.AbstractEnrichCase{constructor(t){super(t),this.mml=t.mathmlTree}static test(t){if(!t.mathmlTree||!t.childNodes.length)return!1;const e=n.tagName(t.mathmlTree),r=t.childNodes[0].role;return"MSUBSUP"===e&&"subsup"===r||"MUNDEROVER"===e&&"underover"===r}getMathml(){const t=this.semantic.childNodes[0],e=t.childNodes[0],r=this.semantic.childNodes[1],n=t.childNodes[1],o=i.walkTree(r),s=i.walkTree(e),l=i.walkTree(n);return(0,a.setAttributes)(this.mml,this.semantic),this.mml.setAttribute(a.Attribute.CHILDREN,(0,a.makeIdList)([e,n,r])),[s,l,o].forEach((t=>i.getInnerNode(t).setAttribute(a.Attribute.PARENT,this.mml.getAttribute(a.Attribute.ID)))),this.mml.setAttribute(a.Attribute.TYPE,t.role),i.addCollapsedAttribute(this.mml,[this.semantic.id,[t.id,e.id,n.id],r.id]),this.mml}}e.CaseDoubleScript=s},7251:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.CaseEmbellished=void 0;const n=r(5740),o=r(5952),i=r(9268),a=r(5765),s=r(7014),l=r(6887),c=r(5452),u=r(2298);class p extends i.AbstractEnrichCase{constructor(t){super(t),this.fenced=null,this.fencedMml=null,this.fencedMmlNodes=[],this.ofence=null,this.ofenceMml=null,this.ofenceMap={},this.cfence=null,this.cfenceMml=null,this.cfenceMap={},this.parentCleanup=[]}static test(t){return!(!t.mathmlTree||!t.fencePointer||t.mathmlTree.getAttribute("data-semantic-type"))}static makeEmptyNode_(t){const e=n.createElement("mrow"),r=new o.SemanticNode(t);return r.type="empty",r.mathmlTree=e,r}static fencedMap_(t,e){e[t.id]=t.mathmlTree,t.embellished&&p.fencedMap_(t.childNodes[0],e)}getMathml(){this.getFenced_(),this.fencedMml=c.walkTree(this.fenced),this.getFencesMml_(),"empty"!==this.fenced.type||this.fencedMml.parentNode||(this.fencedMml.setAttribute(u.Attribute.ADDED,"true"),this.cfenceMml.parentNode.insertBefore(this.fencedMml,this.cfenceMml)),this.getFencedMml_();return this.rewrite_()}fencedElement(t){return"fenced"===t.type||"matrix"===t.type||"vector"===t.type}getFenced_(){let t=this.semantic;for(;!this.fencedElement(t);)t=t.childNodes[0];this.fenced=t.childNodes[0],this.ofence=t.contentNodes[0],this.cfence=t.contentNodes[1],p.fencedMap_(this.ofence,this.ofenceMap),p.fencedMap_(this.cfence,this.cfenceMap)}getFencedMml_(){let t=this.ofenceMml.nextSibling;for(t=t===this.fencedMml?t:this.fencedMml;t&&t!==this.cfenceMml;)this.fencedMmlNodes.push(t),t=t.nextSibling}getFencesMml_(){let t=this.semantic;const e=Object.keys(this.ofenceMap),r=Object.keys(this.cfenceMap);for(;!(this.ofenceMml&&this.cfenceMml||t===this.fenced);)-1===e.indexOf(t.fencePointer)||this.ofenceMml||(this.ofenceMml=t.mathmlTree),-1===r.indexOf(t.fencePointer)||this.cfenceMml||(this.cfenceMml=t.mathmlTree),t=t.childNodes[0];this.ofenceMml||(this.ofenceMml=this.ofence.mathmlTree),this.cfenceMml||(this.cfenceMml=this.cfence.mathmlTree),this.ofenceMml&&(this.ofenceMml=c.ascendNewNode(this.ofenceMml)),this.cfenceMml&&(this.cfenceMml=c.ascendNewNode(this.cfenceMml))}rewrite_(){let t=this.semantic,e=null;const r=this.introduceNewLayer_();for((0,u.setAttributes)(r,this.fenced.parent);!this.fencedElement(t);){const o=t.mathmlTree,i=this.specialCase_(t,o);if(i)t=i;else{(0,u.setAttributes)(o,t);const e=[];for(let r,n=1;r=t.childNodes[n];n++)e.push(c.walkTree(r));t=t.childNodes[0]}const a=n.createElement("dummy"),s=o.childNodes[0];n.replaceNode(o,a),n.replaceNode(r,o),n.replaceNode(o.childNodes[0],r),n.replaceNode(a,s),e||(e=o)}return c.walkTree(this.ofence),c.walkTree(this.cfence),this.cleanupParents_(),e||r}specialCase_(t,e){const r=n.tagName(e);let o,i=null;if("MSUBSUP"===r?(i=t.childNodes[0],o=a.CaseDoubleScript):"MMULTISCRIPTS"===r&&("superscript"===t.type||"subscript"===t.type?o=s.CaseMultiscripts:"tensor"===t.type&&(o=l.CaseTensor),i=o&&t.childNodes[0]&&"subsup"===t.childNodes[0].role?t.childNodes[0]:t),!i)return null;const c=i.childNodes[0],u=p.makeEmptyNode_(c.id);return i.childNodes[0]=u,e=new o(t).getMathml(),i.childNodes[0]=c,this.parentCleanup.push(e),i.childNodes[0]}introduceNewLayer_(){const t=this.fullFence(this.ofenceMml),e=this.fullFence(this.cfenceMml);let r=n.createElement("mrow");if(n.replaceNode(this.fencedMml,r),this.fencedMmlNodes.forEach((t=>r.appendChild(t))),r.insertBefore(t,this.fencedMml),r.appendChild(e),!r.parentNode){const t=n.createElement("mrow");for(;r.childNodes.length>0;)t.appendChild(r.childNodes[0]);r.appendChild(t),r=t}return r}fullFence(t){const e=this.fencedMml.parentNode;let r=t;for(;r.parentNode&&r.parentNode!==e;)r=r.parentNode;return r}cleanupParents_(){this.parentCleanup.forEach((function(t){const e=t.childNodes[1].getAttribute(u.Attribute.PARENT);t.childNodes[0].setAttribute(u.Attribute.PARENT,e)}))}}e.CaseEmbellished=p},6265:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.CaseLimit=void 0;const n=r(5740),o=r(9268),i=r(5452),a=r(2298);class s extends o.AbstractEnrichCase{constructor(t){super(t),this.mml=t.mathmlTree}static test(t){if(!t.mathmlTree||!t.childNodes.length)return!1;const e=n.tagName(t.mathmlTree),r=t.type;return("limupper"===r||"limlower"===r)&&("MSUBSUP"===e||"MUNDEROVER"===e)||"limboth"===r&&("MSUB"===e||"MUNDER"===e||"MSUP"===e||"MOVER"===e)}static walkTree_(t){t&&i.walkTree(t)}getMathml(){const t=this.semantic.childNodes;return"limboth"!==this.semantic.type&&this.mml.childNodes.length>=3&&(this.mml=i.introduceNewLayer([this.mml],this.semantic)),(0,a.setAttributes)(this.mml,this.semantic),t[0].mathmlTree||(t[0].mathmlTree=this.semantic.mathmlTree),t.forEach(s.walkTree_),this.mml}}e.CaseLimit=s},6514:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.CaseLine=void 0;const n=r(9268),o=r(5452),i=r(2298);class a extends n.AbstractEnrichCase{constructor(t){super(t),this.mml=t.mathmlTree}static test(t){return!!t.mathmlTree&&"line"===t.type}getMathml(){return this.semantic.contentNodes.length&&o.walkTree(this.semantic.contentNodes[0]),this.semantic.childNodes.length&&o.walkTree(this.semantic.childNodes[0]),(0,i.setAttributes)(this.mml,this.semantic),this.mml}}e.CaseLine=a},6839:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.CaseMultiindex=void 0;const n=r(5740),o=r(9268),i=r(5452),a=r(2298);class s extends o.AbstractEnrichCase{constructor(t){super(t),this.mml=t.mathmlTree}static multiscriptIndex(t){return"punctuated"===t.type&&"dummy"===t.contentNodes[0].role?i.collapsePunctuated(t):(i.walkTree(t),t.id)}static createNone_(t){const e=n.createElement("none");return t&&(0,a.setAttributes)(e,t),e.setAttribute(a.Attribute.ADDED,"true"),e}completeMultiscript(t,e){const r=n.toArray(this.mml.childNodes).slice(1);let o=0;const l=t=>{for(let e,n=0;e=t[n];n++){const t=r[o];if(t&&e===parseInt(i.getInnerNode(t).getAttribute(a.Attribute.ID)))i.getInnerNode(t).setAttribute(a.Attribute.PARENT,this.semantic.id.toString()),o++;else{const r=this.semantic.querySelectorAll((t=>t.id===e));this.mml.insertBefore(s.createNone_(r[0]),t||null)}}};l(t),r[o]&&"MPRESCRIPTS"!==n.tagName(r[o])?this.mml.insertBefore(r[o],n.createElement("mprescripts")):o++,l(e)}}e.CaseMultiindex=s},7014:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.CaseMultiscripts=void 0;const n=r(5740),o=r(5656),i=r(6839),a=r(5452),s=r(2298);class l extends i.CaseMultiindex{static test(t){if(!t.mathmlTree)return!1;return"MMULTISCRIPTS"===n.tagName(t.mathmlTree)&&("superscript"===t.type||"subscript"===t.type)}constructor(t){super(t)}getMathml(){let t,e,r;if((0,s.setAttributes)(this.mml,this.semantic),this.semantic.childNodes[0]&&"subsup"===this.semantic.childNodes[0].role){const n=this.semantic.childNodes[0];t=n.childNodes[0],e=i.CaseMultiindex.multiscriptIndex(this.semantic.childNodes[1]),r=i.CaseMultiindex.multiscriptIndex(n.childNodes[1]);const l=[this.semantic.id,[n.id,t.id,r],e];a.addCollapsedAttribute(this.mml,l),this.mml.setAttribute(s.Attribute.TYPE,n.role),this.completeMultiscript(o.SemanticSkeleton.interleaveIds(r,e),[])}else{t=this.semantic.childNodes[0],e=i.CaseMultiindex.multiscriptIndex(this.semantic.childNodes[1]);const r=[this.semantic.id,t.id,e];a.addCollapsedAttribute(this.mml,r)}const n=o.SemanticSkeleton.collapsedLeafs(r||[],e),l=a.walkTree(t);return a.getInnerNode(l).setAttribute(s.Attribute.PARENT,this.semantic.id.toString()),n.unshift(t.id),this.mml.setAttribute(s.Attribute.CHILDREN,n.join(",")),this.mml}}e.CaseMultiscripts=l},3416:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.CaseProof=void 0;const n=r(9268),o=r(5452),i=r(2298);class a extends n.AbstractEnrichCase{constructor(t){super(t),this.mml=t.mathmlTree}static test(t){return!!t.mathmlTree&&("inference"===t.type||"premises"===t.type)}getMathml(){return this.semantic.childNodes.length?(this.semantic.contentNodes.forEach((function(t){o.walkTree(t),(0,i.setAttributes)(t.mathmlTree,t)})),this.semantic.childNodes.forEach((function(t){o.walkTree(t)})),(0,i.setAttributes)(this.mml,this.semantic),this.mml.getAttribute("data-semantic-id")===this.mml.getAttribute("data-semantic-parent")&&this.mml.removeAttribute("data-semantic-parent"),this.mml):this.mml}}e.CaseProof=a},5699:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.CaseTable=void 0;const n=r(5740),o=r(9268),i=r(5452),a=r(2298);class s extends o.AbstractEnrichCase{constructor(t){super(t),this.inner=[],this.mml=t.mathmlTree}static test(t){return"matrix"===t.type||"vector"===t.type||"cases"===t.type}getMathml(){const t=i.cloneContentNode(this.semantic.contentNodes[0]),e=this.semantic.contentNodes[1]?i.cloneContentNode(this.semantic.contentNodes[1]):null;if(this.inner=this.semantic.childNodes.map(i.walkTree),this.mml)if("MFENCED"===n.tagName(this.mml)){const r=this.mml.childNodes;this.mml.insertBefore(t,r[0]||null),e&&this.mml.appendChild(e),this.mml=i.rewriteMfenced(this.mml)}else{const r=[t,this.mml];e&&r.push(e),this.mml=i.introduceNewLayer(r,this.semantic)}else this.mml=i.introduceNewLayer([t].concat(this.inner,[e]),this.semantic);return(0,a.setAttributes)(this.mml,this.semantic),this.mml}}e.CaseTable=s},6887:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.CaseTensor=void 0;const n=r(5656),o=r(6839),i=r(5452),a=r(2298);class s extends o.CaseMultiindex{static test(t){return!!t.mathmlTree&&"tensor"===t.type}constructor(t){super(t)}getMathml(){i.walkTree(this.semantic.childNodes[0]);const t=o.CaseMultiindex.multiscriptIndex(this.semantic.childNodes[1]),e=o.CaseMultiindex.multiscriptIndex(this.semantic.childNodes[2]),r=o.CaseMultiindex.multiscriptIndex(this.semantic.childNodes[3]),s=o.CaseMultiindex.multiscriptIndex(this.semantic.childNodes[4]);(0,a.setAttributes)(this.mml,this.semantic);const l=[this.semantic.id,this.semantic.childNodes[0].id,t,e,r,s];i.addCollapsedAttribute(this.mml,l);const c=n.SemanticSkeleton.collapsedLeafs(t,e,r,s);return c.unshift(this.semantic.childNodes[0].id),this.mml.setAttribute(a.Attribute.CHILDREN,c.join(",")),this.completeMultiscript(n.SemanticSkeleton.interleaveIds(r,s),n.SemanticSkeleton.interleaveIds(t,e)),this.mml}}e.CaseTensor=s},9236:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.CaseText=void 0;const n=r(9268),o=r(5452),i=r(2298);class a extends n.AbstractEnrichCase{constructor(t){super(t),this.mml=t.mathmlTree}static test(t){return"punctuated"===t.type&&("text"===t.role||t.contentNodes.every((t=>"dummy"===t.role)))}getMathml(){const t=[],e=o.collapsePunctuated(this.semantic,t);return this.mml=o.introduceNewLayer(t,this.semantic),(0,i.setAttributes)(this.mml,this.semantic),this.mml.removeAttribute(i.Attribute.CONTENT),o.addCollapsedAttribute(this.mml,e),this.mml}}e.CaseText=a},5714:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.prepareMmlString=e.testTranslation__=e.semanticMathml=e.semanticMathmlSync=e.semanticMathmlNode=void 0;const n=r(2057),o=r(5740),i=r(5897),a=r(1414),s=r(5452),l=r(2298);function c(t){const e=o.cloneNode(t),r=a.getTree(e);return s.enrich(e,r)}function u(t){return c(o.parseInput(t))}function p(t){return t.match(/^<math/)||(t="<math>"+t),t.match(/\/math>$/)||(t+="</math>"),t}r(1513),e.semanticMathmlNode=c,e.semanticMathmlSync=u,e.semanticMathml=function(t,e){i.EnginePromise.getall().then((()=>{const r=o.parseInput(t);e(c(r))}))},e.testTranslation__=function(t){n.Debugger.getInstance().init();const e=u(p(t)).toString();return(0,l.removeAttributePrefix)(e),n.Debugger.getInstance().exit(),e},e.prepareMmlString=p},2298:function(t,e){var r;function n(t){return t.map((function(t){return t.id})).join(",")}function o(t,e){const n=[];"mglyph"===e.role&&n.push("image"),e.attributes.href&&n.push("link"),n.length&&t.setAttribute(r.POSTFIX,n.join(" "))}Object.defineProperty(e,"__esModule",{value:!0}),e.addPrefix=e.removeAttributePrefix=e.setPostfix=e.setAttributes=e.makeIdList=e.EnrichAttributes=e.Attribute=e.Prefix=void 0,e.Prefix="data-semantic-",function(t){t.ADDED="data-semantic-added",t.ALTERNATIVE="data-semantic-alternative",t.CHILDREN="data-semantic-children",t.COLLAPSED="data-semantic-collapsed",t.CONTENT="data-semantic-content",t.EMBELLISHED="data-semantic-embellished",t.FENCEPOINTER="data-semantic-fencepointer",t.FONT="data-semantic-font",t.ID="data-semantic-id",t.ANNOTATION="data-semantic-annotation",t.OPERATOR="data-semantic-operator",t.OWNS="data-semantic-owns",t.PARENT="data-semantic-parent",t.POSTFIX="data-semantic-postfix",t.PREFIX="data-semantic-prefix",t.ROLE="data-semantic-role",t.SPEECH="data-semantic-speech",t.STRUCTURE="data-semantic-structure",t.TYPE="data-semantic-type"}(r=e.Attribute||(e.Attribute={})),e.EnrichAttributes=[r.ADDED,r.ALTERNATIVE,r.CHILDREN,r.COLLAPSED,r.CONTENT,r.EMBELLISHED,r.FENCEPOINTER,r.FONT,r.ID,r.ANNOTATION,r.OPERATOR,r.OWNS,r.PARENT,r.POSTFIX,r.PREFIX,r.ROLE,r.SPEECH,r.STRUCTURE,r.TYPE],e.makeIdList=n,e.setAttributes=function(t,i){t.setAttribute(r.TYPE,i.type);const a=i.allAttributes();for(let r,n=0;r=a[n];n++)t.setAttribute(e.Prefix+r[0].toLowerCase(),r[1]);i.childNodes.length&&t.setAttribute(r.CHILDREN,n(i.childNodes)),i.contentNodes.length&&t.setAttribute(r.CONTENT,n(i.contentNodes)),i.parent&&t.setAttribute(r.PARENT,i.parent.id.toString()),o(t,i)},e.setPostfix=o,e.removeAttributePrefix=function(t){return t.toString().replace(new RegExp(e.Prefix,"g"),"")},e.addPrefix=function(t){return e.Prefix+t}},3532:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.factory=e.getCase=void 0,e.getCase=function(t){for(let r,n=0;r=e.factory[n];n++)if(r.test(t))return r.constr(t);return null},e.factory=[]},1513:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0});const n=r(6061),o=r(5765),i=r(7251),a=r(6265),s=r(6514),l=r(7014),c=r(3416),u=r(5699),p=r(6887),h=r(9236);r(3532).factory.push({test:a.CaseLimit.test,constr:t=>new a.CaseLimit(t)},{test:i.CaseEmbellished.test,constr:t=>new i.CaseEmbellished(t)},{test:o.CaseDoubleScript.test,constr:t=>new o.CaseDoubleScript(t)},{test:p.CaseTensor.test,constr:t=>new p.CaseTensor(t)},{test:l.CaseMultiscripts.test,constr:t=>new l.CaseMultiscripts(t)},{test:s.CaseLine.test,constr:t=>new s.CaseLine(t)},{test:n.CaseBinomial.test,constr:t=>new n.CaseBinomial(t)},{test:c.CaseProof.test,constr:t=>new c.CaseProof(t)},{test:u.CaseTable.test,constr:t=>new u.CaseTable(t)},{test:h.CaseText.test,constr:t=>new h.CaseText(t)})},5452:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.printNodeList__=e.collapsePunctuated=e.formattedOutput_=e.formattedOutput=e.getInnerNode=e.setOperatorAttribute_=e.createInvisibleOperator_=e.rewriteMfenced=e.cloneContentNode=e.addCollapsedAttribute=e.parentNode_=e.isIgnorable_=e.unitChild_=e.descendNode_=e.ascendNewNode=e.validLca_=e.pathToRoot_=e.attachedElement_=e.prunePath_=e.mathmlLca_=e.lcaType=e.functionApplication_=e.isDescendant_=e.insertNewChild_=e.mergeChildren_=e.collectChildNodes_=e.collateChildNodes_=e.childrenSubset_=e.moveSemanticAttributes_=e.introduceLayerAboveLca=e.introduceNewLayer=e.walkTree=e.enrich=e.SETTINGS=void 0;const n=r(2057),o=r(5740),i=r(5897),a=r(3588),s=r(7516),l=r(5656),c=r(4795),u=r(2298),p=r(3532);function h(t){const e=(0,p.getCase)(t);let r;if(e)return r=e.getMathml(),T(r);if(1===t.mathml.length)return n.Debugger.getInstance().output("Walktree Case 0"),r=t.mathml[0],u.setAttributes(r,t),t.childNodes.length&&(n.Debugger.getInstance().output("Walktree Case 0.1"),t.childNodes.forEach((function(t){"empty"===t.type&&r.appendChild(h(t))}))),T(r);const o=t.contentNodes.map(k);B(t,o);const i=t.childNodes.map(h),a=l.SemanticSkeleton.combineContentChildren(t,o,i);if(r=t.mathmlTree,null===r)n.Debugger.getInstance().output("Walktree Case 1"),r=d(a,t);else{const t=A(a);n.Debugger.getInstance().output("Walktree Case 2"),t?(n.Debugger.getInstance().output("Walktree Case 2.1"),r=t.parentNode):(n.Debugger.getInstance().output("Walktree Case 2.2"),r=D(r))}return r=R(r),v(r,a,t),u.setAttributes(r,t),T(r)}function d(t,e){const r=O(t);let i=r.node;const a=r.type;if(a!==M.VALID||!c.hasEmptyTag(i))if(n.Debugger.getInstance().output("Walktree Case 1.1"),i=o.createElement("mrow"),a===M.PRUNED)n.Debugger.getInstance().output("Walktree Case 1.1.0"),i=f(i,r.node,t);else if(t[0]){n.Debugger.getInstance().output("Walktree Case 1.1.1");const e=A(t),r=y(e.parentNode,t);o.replaceNode(e,i),r.forEach((function(t){i.appendChild(t)}))}return e.mathmlTree||(e.mathmlTree=i),i}function f(t,e,r){let i=N(e);if(c.hasMathTag(i)){n.Debugger.getInstance().output("Walktree Case 1.1.0.0"),m(i,t),o.toArray(i.childNodes).forEach((function(e){t.appendChild(e)}));const e=t;t=i,i=e}const a=r.indexOf(e);return r[a]=i,o.replaceNode(i,t),t.appendChild(i),r.forEach((function(e){t.appendChild(e)})),t}function m(t,e){for(const r of u.EnrichAttributes)t.hasAttribute(r)&&(e.setAttribute(r,t.getAttribute(r)),t.removeAttribute(r))}function y(t,e){const r=o.toArray(t.childNodes);let n=1/0,i=-1/0;return e.forEach((function(t){const e=r.indexOf(t);-1!==e&&(n=Math.min(n,e),i=Math.max(i,e))})),r.slice(n,i+1)}function g(t,e,r){const n=[];let i=o.toArray(t.childNodes),a=!1;for(;i.length;){const t=i.shift();if(t.hasAttribute(u.Attribute.TYPE)){n.push(t);continue}const e=b(t);0!==e.length&&(1!==e.length?(a?t.setAttribute("AuxiliaryImplicit",!0):a=!0,i=e.concat(i)):n.push(t))}const s=[],l=r.childNodes.map((function(t){return t.mathmlTree}));for(;l.length;){const t=l.pop();if(t){if(-1!==n.indexOf(t))break;-1!==e.indexOf(t)&&s.unshift(t)}}return n.concat(s)}function b(t){const e=[];let r=o.toArray(t.childNodes);for(;r.length;){const t=r.shift();t.nodeType===o.NodeType.ELEMENT_NODE&&(t.hasAttribute(u.Attribute.TYPE)?e.push(t):r=o.toArray(t.childNodes).concat(r))}return e}function v(t,e,r){const n="implicit"===r.role&&s.flags.combine_juxtaposition?g(t,e,r):o.toArray(t.childNodes);if(!n.length)return void e.forEach((function(e){t.appendChild(e)}));let i=0;for(;e.length;){const r=e[0];n[i]===r||x(n[i],r)?(e.shift(),i++):n[i]&&-1===e.indexOf(n[i])?i++:(S(r,t)||_(t,n[i],r),e.shift())}}function _(t,e,r){if(!e)return void t.insertBefore(r,null);let n=e,o=I(n);for(;o&&o.firstChild===n&&!n.hasAttribute("AuxiliaryImplicit")&&o!==t;)n=o,o=I(n);o&&(o.insertBefore(r,n),n.removeAttribute("AuxiliaryImplicit"))}function S(t,e){if(!t)return!1;do{if((t=t.parentNode)===e)return!0}while(t);return!1}function x(t,e){const r=a.functionApplication();if(t&&e&&t.textContent&&e.textContent&&t.textContent===r&&e.textContent===r&&"true"===e.getAttribute(u.Attribute.ADDED)){for(let r,n=0;r=t.attributes[n];n++)e.hasAttribute(r.nodeName)||e.setAttribute(r.nodeName,r.nodeValue);return o.replaceNode(t,e),!0}return!1}var M;function O(t){const e=A(t);if(!e)return{type:M.INVALID,node:null};const r=A(t.slice().reverse());if(e===r)return{type:M.VALID,node:e};const n=C(e),o=E(n,t),i=C(r,(function(t){return-1!==o.indexOf(t)})),a=i[0],s=o.indexOf(a);return-1===s?{type:M.INVALID,node:null}:{type:o.length!==n.length?M.PRUNED:w(o[s+1],i[1])?M.VALID:M.INVALID,node:a}}function E(t,e){let r=0;for(;t[r]&&-1===e.indexOf(t[r]);)r++;return t.slice(0,r+1)}function A(t){let e=0,r=null;for(;!r&&e<t.length;)t[e].parentNode&&(r=t[e]),e++;return r}function C(t,e){const r=e||(t=>!1),n=[t];for(;!r(t)&&!c.hasMathTag(t)&&t.parentNode;)t=I(t),n.unshift(t);return n}function w(t,e){return!(!t||!e||t.previousSibling||e.nextSibling)}function T(t){for(;!c.hasMathTag(t)&&L(t);)t=I(t);return t}function N(t){const e=o.toArray(t.childNodes);if(!e)return t;const r=e.filter((function(t){return t.nodeType===o.NodeType.ELEMENT_NODE&&!c.hasIgnoreTag(t)}));return 1===r.length&&c.hasEmptyTag(r[0])&&!r[0].hasAttribute(u.Attribute.TYPE)?N(r[0]):t}function L(t){const e=I(t);return!(!e||!c.hasEmptyTag(e))&&o.toArray(e.childNodes).every((function(e){return e===t||P(e)}))}function P(t){if(t.nodeType!==o.NodeType.ELEMENT_NODE)return!0;if(!t||c.hasIgnoreTag(t))return!0;const e=o.toArray(t.childNodes);return!(!c.hasEmptyTag(t)&&e.length||c.hasDisplayTag(t)||t.hasAttribute(u.Attribute.TYPE)||c.isOrphanedGlyph(t))&&o.toArray(t.childNodes).every(P)}function I(t){return t.parentNode}function k(t){if(t.mathml.length)return h(t);const r=e.SETTINGS.implicit?j(t):o.createElement("mrow");return t.mathml=[r],r}function R(t){if("MFENCED"!==o.tagName(t))return t;const e=o.createElement("mrow");for(let r,n=0;r=t.attributes[n];n++)-1===["open","close","separators"].indexOf(r.name)&&e.setAttribute(r.name,r.value);return o.toArray(t.childNodes).forEach((function(t){e.appendChild(t)})),o.replaceNode(t,e),e}function j(t){const e=o.createElement("mo"),r=o.createTextNode(t.textContent);return e.appendChild(r),u.setAttributes(e,t),e.setAttribute(u.Attribute.ADDED,"true"),e}function B(t,e){const r=t.type+(t.textContent?","+t.textContent:"");e.forEach((function(t){D(t).setAttribute(u.Attribute.OPERATOR,r)}))}function D(t){const e=o.toArray(t.childNodes);if(!e)return t;const r=e.filter((function(t){return!P(t)})),n=[];for(let t,e=0;t=r[e];e++)if(c.hasEmptyTag(t)){const e=D(t);e&&e!==t&&n.push(e)}else n.push(t);return 1===n.length?n[0]:t}function F(t,e,r,n){const o=n||!1;H(t,"Original MathML",o),H(r,"Semantic Tree",o),H(e,"Semantically enriched MathML",o)}function H(t,e,r){const n=o.formatXml(t.toString());r?console.info(e+":\n```html\n"+u.removeAttributePrefix(n)+"\n```\n"):console.info(n)}e.SETTINGS={collapsed:!0,implicit:!0},e.enrich=function(t,e){const r=o.cloneNode(t);return h(e.root),i.default.getInstance().structure&&t.setAttribute(u.Attribute.STRUCTURE,l.SemanticSkeleton.fromStructure(t,e).toString()),n.Debugger.getInstance().generateOutput((function(){return F(r,t,e,!0),[]})),t},e.walkTree=h,e.introduceNewLayer=d,e.introduceLayerAboveLca=f,e.moveSemanticAttributes_=m,e.childrenSubset_=y,e.collateChildNodes_=g,e.collectChildNodes_=b,e.mergeChildren_=v,e.insertNewChild_=_,e.isDescendant_=S,e.functionApplication_=x,function(t){t.VALID="valid",t.INVALID="invalid",t.PRUNED="pruned"}(M=e.lcaType||(e.lcaType={})),e.mathmlLca_=O,e.prunePath_=E,e.attachedElement_=A,e.pathToRoot_=C,e.validLca_=w,e.ascendNewNode=T,e.descendNode_=N,e.unitChild_=L,e.isIgnorable_=P,e.parentNode_=I,e.addCollapsedAttribute=function(t,e){const r=new l.SemanticSkeleton(e);t.setAttribute(u.Attribute.COLLAPSED,r.toString())},e.cloneContentNode=k,e.rewriteMfenced=R,e.createInvisibleOperator_=j,e.setOperatorAttribute_=B,e.getInnerNode=D,e.formattedOutput=F,e.formattedOutput_=H,e.collapsePunctuated=function(t,e){const r=!!e,n=e||[],o=t.parent,i=t.contentNodes.map((function(t){return t.id}));i.unshift("c");const a=[t.id,i];for(let e,i=0;e=t.childNodes[i];i++){const t=h(e);n.push(t);const i=D(t);o&&!r&&i.setAttribute(u.Attribute.PARENT,o.id.toString()),a.push(e.id)}return a},e.printNodeList__=function(t,e){console.info(t),o.toArray(e).forEach((function(t){console.info(t.toString())})),console.info("<<<<<<<<<<<<<<<<<")}},5105:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractHighlighter=void 0;const n=r(5274),o=r(2298);class i{constructor(){this.color=null,this.mactionName="",this.currentHighlights=[]}highlight(t){this.currentHighlights.push(t.map((t=>{const e=this.highlightNode(t);return this.setHighlighted(t),e})))}highlightAll(t){const e=this.getMactionNodes(t);for(let t,r=0;t=e[r];r++)this.highlight([t])}unhighlight(){const t=this.currentHighlights.pop();t&&t.forEach((t=>{this.isHighlighted(t.node)&&(this.unhighlightNode(t),this.unsetHighlighted(t.node))}))}unhighlightAll(){for(;this.currentHighlights.length>0;)this.unhighlight()}setColor(t){this.color=t}colorString(){return this.color.rgba()}addEvents(t,e){const r=this.getMactionNodes(t);for(let t,n=0;t=r[n];n++)for(const r in e)t.addEventListener(r,e[r])}getMactionNodes(t){return Array.from(t.getElementsByClassName(this.mactionName))}isMactionNode(t){const e=t.className||t.getAttribute("class");return!!e&&!!e.match(new RegExp(this.mactionName))}isHighlighted(t){return t.hasAttribute(i.ATTR)}setHighlighted(t){t.setAttribute(i.ATTR,"true")}unsetHighlighted(t){t.removeAttribute(i.ATTR)}colorizeAll(t){n.evalXPath(`.//*[@${o.Attribute.ID}]`,t).forEach((t=>this.colorize(t)))}uncolorizeAll(t){n.evalXPath(`.//*[@${o.Attribute.ID}]`,t).forEach((t=>this.uncolorize(t)))}colorize(t){const e=(0,o.addPrefix)("foreground");t.hasAttribute(e)&&(t.setAttribute(e+"-old",t.style.color),t.style.color=t.getAttribute(e))}uncolorize(t){const e=(0,o.addPrefix)("foreground")+"-old";t.hasAttribute(e)&&(t.style.color=t.getAttribute(e))}}e.AbstractHighlighter=i,i.ATTR="sre-highlight"},6937:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.ChtmlHighlighter=void 0;const n=r(933);class o extends n.CssHighlighter{constructor(){super()}isMactionNode(t){return t.tagName.toUpperCase()===this.mactionName.toUpperCase()}getMactionNodes(t){return Array.from(t.getElementsByTagName(this.mactionName))}}e.ChtmlHighlighter=o},8396:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.ContrastPicker=e.ColorPicker=void 0;const r={red:{red:255,green:0,blue:0},green:{red:0,green:255,blue:0},blue:{red:0,green:0,blue:255},yellow:{red:255,green:255,blue:0},cyan:{red:0,green:255,blue:255},magenta:{red:255,green:0,blue:255},white:{red:255,green:255,blue:255},black:{red:0,green:0,blue:0}};function n(t,e){const n=t||{color:e};let o=Object.prototype.hasOwnProperty.call(n,"color")?r[n.color]:n;return o||(o=r[e]),o.alpha=Object.prototype.hasOwnProperty.call(n,"alpha")?n.alpha:1,function(t){const e=t=>(t=Math.max(t,0),t=Math.min(255,t),Math.round(t));return t.red=e(t.red),t.green=e(t.green),t.blue=e(t.blue),t.alpha=Math.max(t.alpha,0),t.alpha=Math.min(1,t.alpha),t}(o)}class o{constructor(t,e){this.foreground=n(e,o.DEFAULT_FOREGROUND_),this.background=n(t,o.DEFAULT_BACKGROUND_)}static toHex(t){const e=t.toString(16);return 1===e.length?"0"+e:e}rgba(){const t=function(t){return"rgba("+t.red+","+t.green+","+t.blue+","+t.alpha+")"};return{background:t(this.background),foreground:t(this.foreground)}}rgb(){const t=function(t){return"rgb("+t.red+","+t.green+","+t.blue+")"};return{background:t(this.background),alphaback:this.background.alpha.toString(),foreground:t(this.foreground),alphafore:this.foreground.alpha.toString()}}hex(){const t=function(t){return"#"+o.toHex(t.red)+o.toHex(t.green)+o.toHex(t.blue)};return{background:t(this.background),alphaback:this.background.alpha.toString(),foreground:t(this.foreground),alphafore:this.foreground.alpha.toString()}}}e.ColorPicker=o,o.DEFAULT_BACKGROUND_="blue",o.DEFAULT_FOREGROUND_="black";e.ContrastPicker=class{constructor(){this.hue=10,this.sat=100,this.light=50,this.incr=50}generate(){return e=function(t,e,r){e=e>1?e/100:e,r=r>1?r/100:r;const n=(1-Math.abs(2*r-1))*e,o=n*(1-Math.abs(t/60%2-1)),i=r-n/2;let a=0,s=0,l=0;return 0<=t&&t<60?[a,s,l]=[n,o,0]:60<=t&&t<120?[a,s,l]=[o,n,0]:120<=t&&t<180?[a,s,l]=[0,n,o]:180<=t&&t<240?[a,s,l]=[0,o,n]:240<=t&&t<300?[a,s,l]=[o,0,n]:300<=t&&t<360&&([a,s,l]=[n,0,o]),{red:a+i,green:s+i,blue:l+i}}(this.hue,this.sat,this.light),"rgb("+(t={red:Math.round(255*e.red),green:Math.round(255*e.green),blue:Math.round(255*e.blue)}).red+","+t.green+","+t.blue+")";var t,e}increment(){this.hue=(this.hue+this.incr)%360}}},933:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.CssHighlighter=void 0;const n=r(5105);class o extends n.AbstractHighlighter{constructor(){super(),this.mactionName="mjx-maction"}highlightNode(t){const e={node:t,background:t.style.backgroundColor,foreground:t.style.color},r=this.colorString();return t.style.backgroundColor=r.background,t.style.color=r.foreground,e}unhighlightNode(t){t.node.style.backgroundColor=t.background,t.node.style.color=t.foreground}}e.CssHighlighter=o},3090:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.highlighterMapping_=e.addEvents=e.highlighter=void 0;const n=r(6937),o=r(8396),i=r(933),a=r(2598),s=r(4500),l=r(7071),c=r(4346),u=r(2222);e.highlighter=function(t,r,n){const i=new o.ColorPicker(t,r),a="NativeMML"===n.renderer&&"Safari"===n.browser?"MML-CSS":"SVG"===n.renderer&&"v3"===n.browser?"SVG-V3":n.renderer,s=new(e.highlighterMapping_[a]||e.highlighterMapping_.NativeMML);return s.setColor(i),s},e.addEvents=function(t,r,n){const o=e.highlighterMapping_[n.renderer];o&&(new o).addEvents(t,r)},e.highlighterMapping_={SVG:c.SvgHighlighter,"SVG-V3":u.SvgV3Highlighter,NativeMML:l.MmlHighlighter,"HTML-CSS":a.HtmlHighlighter,"MML-CSS":s.MmlCssHighlighter,CommonHTML:i.CssHighlighter,CHTML:n.ChtmlHighlighter}},2598:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.HtmlHighlighter=void 0;const n=r(5740),o=r(5105);class i extends o.AbstractHighlighter{constructor(){super(),this.mactionName="maction"}highlightNode(t){const e={node:t,foreground:t.style.color,position:t.style.position},r=this.color.rgb();t.style.color=r.foreground,t.style.position="relative";const o=t.bbox;if(o&&o.w){const i=.05,a=0,s=n.createElement("span"),l=parseFloat(t.style.paddingLeft||"0");s.style.backgroundColor=r.background,s.style.opacity=r.alphaback.toString(),s.style.display="inline-block",s.style.height=o.h+o.d+2*i+"em",s.style.verticalAlign=-o.d+"em",s.style.marginTop=s.style.marginBottom=-i+"em",s.style.width=o.w+2*a+"em",s.style.marginLeft=l-a+"em",s.style.marginRight=-o.w-a-l+"em",t.parentNode.insertBefore(s,t),e.box=s}return e}unhighlightNode(t){const e=t.node;e.style.color=t.foreground,e.style.position=t.position,t.box&&t.box.parentNode.removeChild(t.box)}}e.HtmlHighlighter=i},4500:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.MmlCssHighlighter=void 0;const n=r(933);class o extends n.CssHighlighter{constructor(){super(),this.mactionName="maction"}getMactionNodes(t){return Array.from(t.getElementsByTagName(this.mactionName))}isMactionNode(t){return t.tagName===this.mactionName}}e.MmlCssHighlighter=o},7071:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.MmlHighlighter=void 0;const n=r(5105);class o extends n.AbstractHighlighter{constructor(){super(),this.mactionName="maction"}highlightNode(t){let e=t.getAttribute("style");return e+=";background-color: "+this.colorString().background,e+=";color: "+this.colorString().foreground,t.setAttribute("style",e),{node:t}}unhighlightNode(t){let e=t.node.getAttribute("style");e=e.replace(";background-color: "+this.colorString().background,""),e=e.replace(";color: "+this.colorString().foreground,""),t.node.setAttribute("style",e)}colorString(){return this.color.rgba()}getMactionNodes(t){return Array.from(t.getElementsByTagName(this.mactionName))}isMactionNode(t){return t.tagName===this.mactionName}}e.MmlHighlighter=o},4346:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SvgHighlighter=void 0;const n=r(5740),o=r(5105);class i extends o.AbstractHighlighter{constructor(){super(),this.mactionName="mjx-svg-maction"}highlightNode(t){let e;if(this.isHighlighted(t))return e={node:t.previousSibling||t,background:t.style.backgroundColor,foreground:t.style.color},e;if("svg"===t.tagName){const e={node:t,background:t.style.backgroundColor,foreground:t.style.color};return t.style.backgroundColor=this.colorString().background,t.style.color=this.colorString().foreground,e}const r=n.createElementNS("http://www.w3.org/2000/svg","rect");let i;if("use"===t.nodeName){const e=n.createElementNS("http://www.w3.org/2000/svg","g");t.parentNode.insertBefore(e,t),e.appendChild(t),i=e.getBBox(),e.parentNode.replaceChild(t,e)}else i=t.getBBox();r.setAttribute("x",(i.x-40).toString()),r.setAttribute("y",(i.y-40).toString()),r.setAttribute("width",(i.width+80).toString()),r.setAttribute("height",(i.height+80).toString());const a=t.getAttribute("transform");return a&&r.setAttribute("transform",a),r.setAttribute("fill",this.colorString().background),r.setAttribute(o.AbstractHighlighter.ATTR,"true"),t.parentNode.insertBefore(r,t),e={node:r,foreground:t.getAttribute("fill")},t.setAttribute("fill",this.colorString().foreground),e}setHighlighted(t){"svg"===t.tagName&&super.setHighlighted(t)}unhighlightNode(t){if("background"in t)return t.node.style.backgroundColor=t.background,void(t.node.style.color=t.foreground);t.foreground?t.node.nextSibling.setAttribute("fill",t.foreground):t.node.nextSibling.removeAttribute("fill"),t.node.parentNode.removeChild(t.node)}isMactionNode(t){let e=t.className||t.getAttribute("class");return e=void 0!==e.baseVal?e.baseVal:e,!!e&&!!e.match(new RegExp(this.mactionName))}}e.SvgHighlighter=i},2222:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SvgV3Highlighter=void 0;const n=r(5740),o=r(5274),i=r(5105),a=r(8396),s=r(4346);class l extends s.SvgHighlighter{constructor(){super(),this.mactionName="maction"}highlightNode(t){let e;if(this.isHighlighted(t))return e={node:t,background:this.colorString().background,foreground:this.colorString().foreground},e;if("svg"===t.tagName||"MJX-CONTAINER"===t.tagName)return e={node:t,background:t.style.backgroundColor,foreground:t.style.color},t.style.backgroundColor=this.colorString().background,t.style.color=this.colorString().foreground,e;const r=n.createElementNS("http://www.w3.org/2000/svg","rect");r.setAttribute("sre-highlighter-added","true");const o=t.getBBox();r.setAttribute("x",(o.x-40).toString()),r.setAttribute("y",(o.y-40).toString()),r.setAttribute("width",(o.width+80).toString()),r.setAttribute("height",(o.height+80).toString());const s=t.getAttribute("transform");if(s&&r.setAttribute("transform",s),r.setAttribute("fill",this.colorString().background),t.setAttribute(i.AbstractHighlighter.ATTR,"true"),t.parentNode.insertBefore(r,t),e={node:t,foreground:t.getAttribute("fill")},"rect"===t.nodeName){const e=new a.ColorPicker({alpha:0,color:"black"});t.setAttribute("fill",e.rgba().foreground)}else t.setAttribute("fill",this.colorString().foreground);return e}unhighlightNode(t){const e=t.node.previousSibling;if(e&&e.hasAttribute("sre-highlighter-added"))return t.foreground?t.node.setAttribute("fill",t.foreground):t.node.removeAttribute("fill"),void t.node.parentNode.removeChild(e);t.node.style.backgroundColor=t.background,t.node.style.color=t.foreground}isMactionNode(t){return t.getAttribute("data-mml-node")===this.mactionName}getMactionNodes(t){return Array.from(o.evalXPath(`.//*[@data-mml-node="${this.mactionName}"]`,t))}}e.SvgV3Highlighter=l},7222:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.StaticTrieNode=e.AbstractTrieNode=void 0;const n=r(2057),o=r(4391);class i{constructor(t,e){this.constraint=t,this.test=e,this.children_={},this.kind=o.TrieNodeKind.ROOT}getConstraint(){return this.constraint}getKind(){return this.kind}applyTest(t){return this.test(t)}addChild(t){const e=t.getConstraint(),r=this.children_[e];return this.children_[e]=t,r}getChild(t){return this.children_[t]}getChildren(){const t=[];for(const e in this.children_)t.push(this.children_[e]);return t}findChildren(t){const e=[];for(const r in this.children_){const n=this.children_[r];n.applyTest(t)&&e.push(n)}return e}removeChild(t){delete this.children_[t]}toString(){return this.constraint}}e.AbstractTrieNode=i;e.StaticTrieNode=class extends i{constructor(t,e){super(t,e),this.rule_=null,this.kind=o.TrieNodeKind.STATIC}getRule(){return this.rule_}setRule(t){this.rule_&&n.Debugger.getInstance().output("Replacing rule "+this.rule_+" with "+t),this.rule_=t}toString(){return this.getRule()?this.constraint+"\n==> "+this.getRule().action:this.constraint}}},4508:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Trie=void 0;const n=r(4391),o=r(9701);class i{constructor(){this.root=(0,o.getNode)(n.TrieNodeKind.ROOT,"",null)}static collectRules_(t){const e=[];let r=[t];for(;r.length;){const t=r.shift();if(t.getKind()===n.TrieNodeKind.QUERY||t.getKind()===n.TrieNodeKind.BOOLEAN){const r=t.getRule();r&&e.unshift(r)}r=r.concat(t.getChildren())}return e}static printWithDepth_(t,e,r){r+=new Array(e+2).join(e.toString())+": "+t.toString()+"\n";const n=t.getChildren();for(let t,o=0;t=n[o];o++)r=i.printWithDepth_(t,e+1,r);return r}static order_(t){const e=t.getChildren();if(!e.length)return 0;const r=Math.max.apply(null,e.map(i.order_));return Math.max(e.length,r)}addRule(t){let e=this.root;const r=t.context,o=t.dynamicCstr.getValues();for(let t=0,i=o.length;t<i;t++)e=this.addNode_(e,o[t],n.TrieNodeKind.DYNAMIC,r);e=this.addNode_(e,t.precondition.query,n.TrieNodeKind.QUERY,r);const i=t.precondition.constraints;for(let t=0,o=i.length;t<o;t++)e=this.addNode_(e,i[t],n.TrieNodeKind.BOOLEAN,r);e.setRule(t)}lookupRules(t,e){let r=[this.root];const o=[];for(;e.length;){const t=e.shift(),o=[];for(;r.length;){r.shift().getChildren().forEach((e=>{e.getKind()===n.TrieNodeKind.DYNAMIC&&-1===t.indexOf(e.getConstraint())||o.push(e)}))}r=o.slice()}for(;r.length;){const e=r.shift();if(e.getRule){const t=e.getRule();t&&o.push(t)}const n=e.findChildren(t);r=r.concat(n)}return o}hasSubtrie(t){let e=this.root;for(let r=0,n=t.length;r<n;r++){const n=t[r];if(e=e.getChild(n),!e)return!1}return!0}toString(){return i.printWithDepth_(this.root,0,"")}collectRules(){return i.collectRules_(this.root)}order(){return i.order_(this.root)}enumerate(t){return this.enumerate_(this.root,t)}byConstraint(t){let e=this.root;for(;t.length&&e;){const r=t.shift();e=e.getChild(r)}return e||null}enumerate_(t,e){e=e||{};const r=t.getChildren();for(let t,o=0;t=r[o];o++)t.kind===n.TrieNodeKind.DYNAMIC&&(e[t.getConstraint()]=this.enumerate_(t,e[t.getConstraint()]));return e}addNode_(t,e,r,n){let i=t.getChild(e);return i||(i=(0,o.getNode)(r,e,n),t.addChild(i)),i}}e.Trie=i},4391:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.TrieNodeKind=void 0,function(t){t.ROOT="root",t.DYNAMIC="dynamic",t.QUERY="query",t.BOOLEAN="boolean",t.STATIC="static"}(e.TrieNodeKind||(e.TrieNodeKind={}))},9701:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.BooleanTrieNode=e.QueryTrieNode=e.constraintTest_=e.DynamicTrieNode=e.RootTrieNode=e.getNode=void 0;const n=r(5740),o=r(5274),i=r(2105),a=r(2780),s=r(7222),l=r(7222),c=r(4391);e.getNode=function(t,e,r){switch(t){case c.TrieNodeKind.ROOT:return new u;case c.TrieNodeKind.DYNAMIC:return new p(e);case c.TrieNodeKind.QUERY:return new f(e,r);case c.TrieNodeKind.BOOLEAN:return new m(e,r);default:return null}};class u extends s.AbstractTrieNode{constructor(){super("",(()=>!0)),this.kind=c.TrieNodeKind.ROOT}}e.RootTrieNode=u;class p extends s.AbstractTrieNode{constructor(t){super(t,(e=>e===t)),this.kind=c.TrieNodeKind.DYNAMIC}}e.DynamicTrieNode=p;const h={"=":(t,e)=>t===e,"!=":(t,e)=>t!==e,"<":(t,e)=>t<e,">":(t,e)=>t>e,"<=":(t,e)=>t<=e,">=":(t,e)=>t>=e};function d(t){if(t.match(/^self::\*$/))return t=>!0;if(t.match(/^self::\w+$/)){const e=t.slice(6).toUpperCase();return t=>t.tagName&&n.tagName(t)===e}if(t.match(/^self::\w+:\w+$/)){const e=t.split(":"),r=o.resolveNameSpace(e[2]);if(!r)return null;const n=e[3].toUpperCase();return t=>t.localName&&t.localName.toUpperCase()===n&&t.namespaceURI===r}if(t.match(/^@\w+$/)){const e=t.slice(1);return t=>t.hasAttribute&&t.hasAttribute(e)}if(t.match(/^@\w+="[\w\d ]+"$/)){const e=t.split("="),r=e[0].slice(1),n=e[1].slice(1,-1);return t=>t.hasAttribute&&t.hasAttribute(r)&&t.getAttribute(r)===n}if(t.match(/^@\w+!="[\w\d ]+"$/)){const e=t.split("!="),r=e[0].slice(1),n=e[1].slice(1,-1);return t=>!t.hasAttribute||!t.hasAttribute(r)||t.getAttribute(r)!==n}if(t.match(/^contains\(\s*@grammar\s*,\s*"[\w\d ]+"\s*\)$/)){const e=t.split('"')[1];return t=>!!i.Grammar.getInstance().getParameter(e)}if(t.match(/^not\(\s*contains\(\s*@grammar\s*,\s*"[\w\d ]+"\s*\)\s*\)$/)){const e=t.split('"')[1];return t=>!i.Grammar.getInstance().getParameter(e)}if(t.match(/^name\(\.\.\/\.\.\)="\w+"$/)){const e=t.split('"')[1].toUpperCase();return t=>{var r,o;return(null===(o=null===(r=t.parentNode)||void 0===r?void 0:r.parentNode)||void 0===o?void 0:o.tagName)&&n.tagName(t.parentNode.parentNode)===e}}if(t.match(/^count\(preceding-sibling::\*\)=\d+$/)){const e=t.split("="),r=parseInt(e[1],10);return t=>{var e;return(null===(e=t.parentNode)||void 0===e?void 0:e.childNodes[r])===t}}if(t.match(/^.+\[@category!?=".+"\]$/)){let[,e,r,n]=t.match(/^(.+)\[@category(!?=)"(.+)"\]$/);const i=n.match(/^unit:(.+)$/);let s="";return i&&(n=i[1],s=":unit"),t=>{const i=o.evalXPath(e,t)[0];if(i){const t=a.lookupCategory(i.textContent+s);return"="===r?t===n:t!==n}return!1}}if(t.match(/^string-length\(.+\)\W+\d+/)){const[,e,r,n]=t.match(/^string-length\((.+)\)(\W+)(\d+)/),i=h[r]||h["="],a=parseInt(n,10);return t=>{const r=o.evalXPath(e,t)[0];return!!r&&i(Array.from(r.textContent).length,a)}}return null}e.constraintTest_=d;class f extends l.StaticTrieNode{constructor(t,e){super(t,d(t)),this.context=e,this.kind=c.TrieNodeKind.QUERY}applyTest(t){return this.test?this.test(t):this.context.applyQuery(t,this.constraint)===t}}e.QueryTrieNode=f;class m extends l.StaticTrieNode{constructor(t,e){super(t,d(t)),this.context=e,this.kind=c.TrieNodeKind.BOOLEAN}applyTest(t){return this.test?this.test(t):this.context.applyConstraint(t,this.constraint)}}e.BooleanTrieNode=m},7491:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.completeLocale=e.getLocale=e.setLocale=e.locales=void 0;const n=r(5897),o=r(1377),i=r(2105),a=r(4249),s=r(8657),l=r(173),c=r(9393),u=r(7978),p=r(5540),h=r(5218),d=r(3887),f=r(8384),m=r(7206),y=r(7734),g=r(7264),b=r(4356);function v(){const t=o.Variables.ensureLocale(n.default.getInstance().locale,n.default.getInstance().defaultLocale);return n.default.getInstance().locale=t,e.locales[t]()}e.locales={ca:a.ca,da:s.da,de:l.de,en:c.en,es:u.es,fr:p.fr,hi:h.hi,it:d.it,nb:f.nb,nn:y.nn,sv:g.sv,nemeth:m.nemeth},e.setLocale=function(){const t=v();if(function(t){const e=n.default.getInstance().subiso;-1===t.SUBISO.all.indexOf(e)&&(n.default.getInstance().subiso=t.SUBISO.default);t.SUBISO.current=n.default.getInstance().subiso}(t),t){for(const e of Object.getOwnPropertyNames(t))b.LOCALE[e]=t[e];for(const[e,r]of Object.entries(t.CORRECTIONS))i.Grammar.getInstance().setCorrection(e,r)}},e.getLocale=v,e.completeLocale=function(t){const r=e.locales[t.locale];if(!r)return void console.error("Locale "+t.locale+" does not exist!");const n=t.kind.toUpperCase(),o=t.messages;if(!o)return;const i=r();for(const[t,e]of Object.entries(o))i[n][t]=e}},4356:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.createLocale=e.LOCALE=void 0;const n=r(7549);function o(){return{FUNCTIONS:(0,n.FUNCTIONS)(),MESSAGES:(0,n.MESSAGES)(),ALPHABETS:(0,n.ALPHABETS)(),NUMBERS:(0,n.NUMBERS)(),COMBINERS:{},CORRECTIONS:{},SUBISO:(0,n.SUBISO)()}}e.LOCALE=o(),e.createLocale=o},2536:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.localeFontCombiner=e.extractString=e.localEnclose=e.localRole=e.localFont=e.combinePostfixIndex=e.nestingToString=void 0;const n=r(4356),o=r(4977);function i(t,e){return void 0===t?e:"string"==typeof t?t:t[0]}e.nestingToString=function(t){switch(t){case 1:return n.LOCALE.MESSAGES.MS.ONCE||"";case 2:return n.LOCALE.MESSAGES.MS.TWICE;default:return t.toString()}},e.combinePostfixIndex=function(t,e){return t===n.LOCALE.MESSAGES.MS.ROOTINDEX||t===n.LOCALE.MESSAGES.MS.INDEX?t:t+" "+e},e.localFont=function(t){return i(n.LOCALE.MESSAGES.font[t],t)},e.localRole=function(t){return i(n.LOCALE.MESSAGES.role[t],t)},e.localEnclose=function(t){return i(n.LOCALE.MESSAGES.enclose[t],t)},e.extractString=i,e.localeFontCombiner=function(t){return"string"==typeof t?{font:t,combiner:n.LOCALE.ALPHABETS.combiner}:{font:t[0],combiner:n.LOCALE.COMBINERS[t[1]]||o.Combiners[t[1]]||n.LOCALE.ALPHABETS.combiner}}},4249:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.ca=void 0;const n=r(4356),o=r(2536),i=r(614),a=r(4977),s=function(t,e,r){return t="sans serif "+(r?r+" "+t:t),e?t+" "+e:t};let l=null;e.ca=function(){return l||(l=function(){const t=(0,n.createLocale)();return t.NUMBERS=i.default,t.COMBINERS.sansserif=s,t.FUNCTIONS.fracNestDepth=t=>!1,t.FUNCTIONS.combineRootIndex=o.combinePostfixIndex,t.FUNCTIONS.combineNestedRadical=(t,e,r)=>t+r,t.FUNCTIONS.fontRegexp=t=>RegExp("^"+t+" "),t.FUNCTIONS.plural=t=>/.*os$/.test(t)?t+"sos":/.*s$/.test(t)?t+"os":/.*ga$/.test(t)?t.slice(0,-2)+"gues":/.*\xe7a$/.test(t)?t.slice(0,-2)+"ces":/.*ca$/.test(t)?t.slice(0,-2)+"ques":/.*ja$/.test(t)?t.slice(0,-2)+"ges":/.*qua$/.test(t)?t.slice(0,-3)+"q\xfces":/.*a$/.test(t)?t.slice(0,-1)+"es":/.*(e|i)$/.test(t)?t+"ns":/.*\xed$/.test(t)?t.slice(0,-1)+"ins":t+"s",t.FUNCTIONS.si=(t,e)=>(e.match(/^metre/)&&(t=t.replace(/a$/,"\xe0").replace(/o$/,"\xf2").replace(/i$/,"\xed")),t+e),t.ALPHABETS.combiner=a.Combiners.prefixCombiner,t}()),l}},8657:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.da=void 0;const n=r(4356),o=r(2536),i=r(3866),a=r(4977);let s=null;e.da=function(){return s||(s=function(){const t=(0,n.createLocale)();return t.NUMBERS=i.default,t.FUNCTIONS.radicalNestDepth=o.nestingToString,t.FUNCTIONS.fontRegexp=e=>e===t.ALPHABETS.capPrefix.default?RegExp("^"+e+" "):RegExp(" "+e+"$"),t.ALPHABETS.combiner=a.Combiners.postfixCombiner,t.ALPHABETS.digitTrans.default=i.default.numberToWords,t}()),s}},173:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.de=void 0;const n=r(2105),o=r(2536),i=r(4356),a=r(1435),s=function(t,e,r){return"s"===r&&(e=e.split(" ").map((function(t){return t.replace(/s$/,"")})).join(" "),r=""),t=r?r+" "+t:t,e?e+" "+t:t},l=function(t,e,r){return t=r&&"s"!==r?r+" "+t:t,e?t+" "+e:t};let c=null;e.de=function(){return c||(c=function(){const t=(0,i.createLocale)();return t.NUMBERS=a.default,t.COMBINERS.germanPostfix=l,t.ALPHABETS.combiner=s,t.FUNCTIONS.radicalNestDepth=e=>e>1?t.NUMBERS.numberToWords(e)+"fach":"",t.FUNCTIONS.combineRootIndex=(t,e)=>{const r=e?e+"wurzel":"";return t.replace("Wurzel",r)},t.FUNCTIONS.combineNestedRadical=(t,e,r)=>{const n=(e?e+" ":"")+(t=r.match(/exponent$/)?t+"r":t);return r.match(/ /)?r.replace(/ /," "+n+" "):n+" "+r},t.FUNCTIONS.fontRegexp=function(t){return t=t.split(" ").map((function(t){return t.replace(/s$/,"(|s)")})).join(" "),new RegExp("((^"+t+" )|( "+t+"$))")},t.CORRECTIONS.correctOne=t=>t.replace(/^eins$/,"ein"),t.CORRECTIONS.localFontNumber=t=>(0,o.localFont)(t).split(" ").map((function(t){return t.replace(/s$/,"")})).join(" "),t.CORRECTIONS.lowercase=t=>t.toLowerCase(),t.CORRECTIONS.article=t=>{const e=n.Grammar.getInstance().getParameter("case"),r=n.Grammar.getInstance().getParameter("plural");return"dative"===e?{der:"dem",die:r?"den":"der",das:"dem"}[t]:t},t.CORRECTIONS.masculine=t=>"dative"===n.Grammar.getInstance().getParameter("case")?t+"n":t,t}()),c}},9393:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.en=void 0;const n=r(2105),o=r(4356),i=r(2536),a=r(310),s=r(4977);let l=null;e.en=function(){return l||(l=function(){const t=(0,o.createLocale)();return t.NUMBERS=a.default,t.FUNCTIONS.radicalNestDepth=i.nestingToString,t.FUNCTIONS.plural=t=>/.*s$/.test(t)?t:t+"s",t.ALPHABETS.combiner=s.Combiners.prefixCombiner,t.ALPHABETS.digitTrans.default=a.default.numberToWords,t.CORRECTIONS.article=t=>n.Grammar.getInstance().getParameter("noArticle")?"":t,t}()),l}},7978:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.es=void 0;const n=r(4356),o=r(2536),i=r(4634),a=r(4977),s=function(t,e,r){return t="sans serif "+(r?r+" "+t:t),e?t+" "+e:t};let l=null;e.es=function(){return l||(l=function(){const t=(0,n.createLocale)();return t.NUMBERS=i.default,t.COMBINERS.sansserif=s,t.FUNCTIONS.fracNestDepth=t=>!1,t.FUNCTIONS.combineRootIndex=o.combinePostfixIndex,t.FUNCTIONS.combineNestedRadical=(t,e,r)=>t+r,t.FUNCTIONS.fontRegexp=t=>RegExp("^"+t+" "),t.FUNCTIONS.plural=t=>/.*(a|e|i|o|u)$/.test(t)?t+"s":/.*z$/.test(t)?t.slice(0,-1)+"ces":/.*c$/.test(t)?t.slice(0,-1)+"ques":/.*g$/.test(t)?t+"ues":/.*\u00f3n$/.test(t)?t.slice(0,-2)+"ones":t+"es",t.FUNCTIONS.si=(t,e)=>(e.match(/^metro/)&&(t=t.replace(/a$/,"\xe1").replace(/o$/,"\xf3").replace(/i$/,"\xed")),t+e),t.ALPHABETS.combiner=a.Combiners.prefixCombiner,t}()),l}},5540:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.fr=void 0;const n=r(2105),o=r(4356),i=r(2536),a=r(2350),s=r(4977);let l=null;e.fr=function(){return l||(l=function(){const t=(0,o.createLocale)();return t.NUMBERS=a.default,t.FUNCTIONS.radicalNestDepth=i.nestingToString,t.FUNCTIONS.combineRootIndex=i.combinePostfixIndex,t.FUNCTIONS.combineNestedFraction=(t,e,r)=>r.replace(/ $/g,"")+e+t,t.FUNCTIONS.combineNestedRadical=(t,e,r)=>r+" "+t,t.FUNCTIONS.fontRegexp=t=>RegExp(" (en |)"+t+"$"),t.FUNCTIONS.plural=t=>/.*s$/.test(t)?t:t+"s",t.CORRECTIONS.article=t=>n.Grammar.getInstance().getParameter("noArticle")?"":t,t.ALPHABETS.combiner=s.Combiners.romanceCombiner,t.SUBISO={default:"fr",current:"fr",all:["fr","be","ch"]},t}()),l}},5218:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.hi=void 0;const n=r(4356),o=r(4438),i=r(4977),a=r(2536);let s=null;e.hi=function(){return s||(s=function(){const t=(0,n.createLocale)();return t.NUMBERS=o.default,t.ALPHABETS.combiner=i.Combiners.prefixCombiner,t.FUNCTIONS.radicalNestDepth=a.nestingToString,t}()),s}},3887:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.it=void 0;const n=r(2536),o=r(4356),i=r(8825),a=r(4977),s=function(t,e,r){return t.match(/^[a-zA-Z]$/)&&(e=e.replace("cerchiato","cerchiata")),t=r?t+" "+r:t,e?t+" "+e:t};let l=null;e.it=function(){return l||(l=function(){const t=(0,o.createLocale)();return t.NUMBERS=i.default,t.COMBINERS.italianPostfix=s,t.FUNCTIONS.radicalNestDepth=n.nestingToString,t.FUNCTIONS.combineRootIndex=n.combinePostfixIndex,t.FUNCTIONS.combineNestedFraction=(t,e,r)=>r.replace(/ $/g,"")+e+t,t.FUNCTIONS.combineNestedRadical=(t,e,r)=>r+" "+t,t.FUNCTIONS.fontRegexp=t=>RegExp(" (en |)"+t+"$"),t.ALPHABETS.combiner=a.Combiners.romanceCombiner,t}()),l}},8384:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.nb=void 0;const n=r(4356),o=r(2536),i=r(8274),a=r(4977);let s=null;e.nb=function(){return s||(s=function(){const t=(0,n.createLocale)();return t.NUMBERS=i.default,t.ALPHABETS.combiner=a.Combiners.prefixCombiner,t.ALPHABETS.digitTrans.default=i.default.numberToWords,t.FUNCTIONS.radicalNestDepth=o.nestingToString,t}()),s}},7206:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.nemeth=void 0;const n=r(4356),o=r(3720),i=r(4977),a=function(t){return t.match(RegExp("^"+h.ALPHABETS.languagePrefix.english))?t.slice(1):t},s=function(t,e,r){return t=a(t),e?t+e:t},l=function(t,e,r){return e+a(t)},c=function(t,e,r){return e+(r||"")+(t=a(t))+"\u283b"},u=function(t,e,r){return e+(r||"")+(t=a(t))+"\u283b\u283b"},p=function(t,e,r){return e+(t=a(t))+"\u283e"};let h=null;e.nemeth=function(){return h||(h=function(){const t=(0,n.createLocale)();return t.NUMBERS=o.default,t.COMBINERS={postfixCombiner:s,germanCombiner:l,embellishCombiner:c,doubleEmbellishCombiner:u,parensCombiner:p},t.FUNCTIONS.fracNestDepth=t=>!1,t.FUNCTIONS.fontRegexp=t=>RegExp("^"+t),t.FUNCTIONS.si=i.identityTransformer,t.ALPHABETS.combiner=(t,e,r)=>e?e+r+t:a(t),t.ALPHABETS.digitTrans={default:o.default.numberToWords},t}()),h}},7734:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.nn=void 0;const n=r(4356),o=r(2536),i=r(8274),a=r(4977);let s=null;e.nn=function(){return s||(s=function(){const t=(0,n.createLocale)();return t.NUMBERS=i.default,t.ALPHABETS.combiner=a.Combiners.prefixCombiner,t.ALPHABETS.digitTrans.default=i.default.numberToWords,t.FUNCTIONS.radicalNestDepth=o.nestingToString,t.SUBISO={default:"",current:"",all:["","alt"]},t}()),s}},7264:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.sv=void 0;const n=r(4356),o=r(2536),i=r(3898),a=r(4977);let s=null;e.sv=function(){return s||(s=function(){const t=(0,n.createLocale)();return t.NUMBERS=i.default,t.FUNCTIONS.radicalNestDepth=o.nestingToString,t.FUNCTIONS.fontRegexp=function(t){return new RegExp("((^"+t+" )|( "+t+"$))")},t.ALPHABETS.combiner=a.Combiners.prefixCombiner,t.ALPHABETS.digitTrans.default=i.default.numberToWords,t.CORRECTIONS.correctOne=t=>t.replace(/^ett$/,"en"),t}()),s}},7549:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SUBISO=e.FUNCTIONS=e.ALPHABETS=e.NUMBERS=e.MESSAGES=void 0;const n=r(4977);e.MESSAGES=function(){return{MS:{},MSroots:{},font:{},embellish:{},role:{},enclose:{},navigate:{},regexp:{},unitTimes:""}},e.NUMBERS=function(){return{zero:"zero",ones:[],tens:[],large:[],special:{},wordOrdinal:n.identityTransformer,numericOrdinal:n.identityTransformer,numberToWords:n.identityTransformer,numberToOrdinal:n.pluralCase,vulgarSep:" ",numSep:" "}},e.ALPHABETS=function(){return{latinSmall:[],latinCap:[],greekSmall:[],greekCap:[],capPrefix:{default:""},smallPrefix:{default:""},digitPrefix:{default:""},languagePrefix:{},digitTrans:{default:n.identityTransformer,mathspeak:n.identityTransformer,clearspeak:n.identityTransformer},letterTrans:{default:n.identityTransformer},combiner:(t,e,r)=>t}},e.FUNCTIONS=function(){return{fracNestDepth:t=>n.vulgarFractionSmall(t,10,100),radicalNestDepth:t=>"",combineRootIndex:function(t,e){return t},combineNestedFraction:n.Combiners.identityCombiner,combineNestedRadical:n.Combiners.identityCombiner,fontRegexp:function(t){return new RegExp("^"+t.split(/ |-/).join("( |-)")+"( |-)")},si:n.siCombiner,plural:n.identityTransformer}},e.SUBISO=function(){return{default:"",current:"",all:[]}}},614:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0});const n=r(2105);function o(t){const e=t%1e3,r=Math.floor(e/100),n=r?1===r?"cent":s.ones[r]+"-cents":"",o=function(t){const e=t%100;if(e<20)return s.ones[e];const r=Math.floor(e/10),n=s.tens[r],o=s.ones[e%10];return n&&o?n+(2===r?"-i-":"-")+o:n||o}(e%100);return n&&o?n+s.numSep+o:n||o}function i(t){if(0===t)return s.zero;if(t>=Math.pow(10,36))return t.toString();let e=0,r="";for(;t>0;){const n=t%(e>1?1e6:1e3);if(n){let t=s.large[e];if(e)if(1===e)r=(1===n?"":o(n)+s.numSep)+t+(r?s.numSep+r:"");else{const e=i(n);t=1===n?t:t.replace(/\u00f3$/,"ons"),r=e+s.numSep+t+(r?s.numSep+r:"")}else r=o(n)}t=Math.floor(t/(e>1?1e6:1e3)),e++}return r}function a(t){const e=n.Grammar.getInstance().getParameter("gender");return t.toString()+("f"===e?"a":"n")}const s=(0,r(7549).NUMBERS)();s.numericOrdinal=a,s.numberToWords=i,s.numberToOrdinal=function(t,e){if(t>1999)return a(t);if(t<=10)return s.special.onesOrdinals[t-1];const r=i(t);return r.match(/mil$/)?r.replace(/mil$/,"mil\xb7l\xe8sima"):r.match(/u$/)?r.replace(/u$/,"vena"):r.match(/a$/)?r.replace(/a$/,"ena"):r+(r.match(/e$/)?"na":"ena")},e.default=s},3866:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0});function n(t,e=!1){return t===s.ones[1]?e?"et":"en":t}function o(t,e=!1){let r=t%1e3,o="",i=s.ones[Math.floor(r/100)];if(o+=i?n(i,!0)+" hundrede":"",r%=100,r)if(o+=o?" og ":"",i=e?s.special.smallOrdinals[r]:s.ones[r],i)o+=i;else{const t=e?s.special.tensOrdinals[Math.floor(r/10)]:s.tens[Math.floor(r/10)];i=s.ones[r%10],o+=i?n(i)+"og"+t:t}return o}function i(t,e=!1){if(0===t)return s.zero;if(t>=Math.pow(10,36))return t.toString();let r=0,i="";for(;t>0;){const a=t%1e3;if(a){const t=o(a,e&&!r);if(r){const e=s.large[r],o=a>1?"er":"";i=n(t,r<=1)+" "+e+o+(i?" og ":"")+i}else i=n(t)+i}t=Math.floor(t/1e3),r++}return i}function a(t){if(t%100)return i(t,!0);const e=i(t);return e.match(/e$/)?e:e+"e"}const s=(0,r(7549).NUMBERS)();s.wordOrdinal=a,s.numericOrdinal=function(t){return t.toString()+"."},s.numberToWords=i,s.numberToOrdinal=function(t,e){return 1===t?e?"hel":"hele":2===t?e?"halv":"halve":a(t)+(e?"dele":"del")},e.default=s},1435:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0});function n(t,e=!1){return t===s.ones[1]?e?"eine":"ein":t}function o(t){let e=t%1e3,r="",o=s.ones[Math.floor(e/100)];if(r+=o?n(o)+"hundert":"",e%=100,e)if(r+=r?s.numSep:"",o=s.ones[e],o)r+=o;else{const t=s.tens[Math.floor(e/10)];o=s.ones[e%10],r+=o?n(o)+"und"+t:t}return r}function i(t){if(0===t)return s.zero;if(t>=Math.pow(10,36))return t.toString();let e=0,r="";for(;t>0;){const i=t%1e3;if(i){const a=o(t%1e3);if(e){const t=s.large[e],o=e>1&&i>1?t.match(/e$/)?"n":"en":"";r=n(a,e>1)+t+o+r}else r=n(a,e>1)+r}t=Math.floor(t/1e3),e++}return r.replace(/ein$/,"eins")}function a(t){if(1===t)return"erste";if(3===t)return"dritte";if(7===t)return"siebte";if(8===t)return"achte";return i(t)+(t<19?"te":"ste")}const s=(0,r(7549).NUMBERS)();s.wordOrdinal=a,s.numericOrdinal=function(t){return t.toString()+"."},s.numberToWords=i,s.numberToOrdinal=function(t,e){return 1===t?"eintel":2===t?e?"halbe":"halb":a(t)+"l"},e.default=s},310:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0});function n(t){let e=t%1e3,r="";return r+=a.ones[Math.floor(e/100)]?a.ones[Math.floor(e/100)]+a.numSep+"hundred":"",e%=100,e&&(r+=r?a.numSep:"",r+=a.ones[e]||a.tens[Math.floor(e/10)]+(e%10?a.numSep+a.ones[e%10]:"")),r}function o(t){if(0===t)return a.zero;if(t>=Math.pow(10,36))return t.toString();let e=0,r="";for(;t>0;){t%1e3&&(r=n(t%1e3)+(e?"-"+a.large[e]+"-":"")+r),t=Math.floor(t/1e3),e++}return r.replace(/-$/,"")}function i(t){let e=o(t);return e.match(/one$/)?e=e.slice(0,-3)+"first":e.match(/two$/)?e=e.slice(0,-3)+"second":e.match(/three$/)?e=e.slice(0,-5)+"third":e.match(/five$/)?e=e.slice(0,-4)+"fifth":e.match(/eight$/)?e=e.slice(0,-5)+"eighth":e.match(/nine$/)?e=e.slice(0,-4)+"ninth":e.match(/twelve$/)?e=e.slice(0,-6)+"twelfth":e.match(/ty$/)?e=e.slice(0,-2)+"tieth":e+="th",e}const a=(0,r(7549).NUMBERS)();a.wordOrdinal=i,a.numericOrdinal=function(t){const e=t%100,r=t.toString();if(e>10&&e<20)return r+"th";switch(t%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd";default:return r+"th"}},a.numberToWords=o,a.numberToOrdinal=function(t,e){if(1===t)return e?"oneths":"oneth";if(2===t)return e?"halves":"half";const r=i(t);return e?r+"s":r},e.default=a},4634:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0});const n=r(2105);function o(t){const e=t%1e3,r=Math.floor(e/100),n=i.special.hundreds[r],o=function(t){const e=t%100;if(e<30)return i.ones[e];const r=i.tens[Math.floor(e/10)],n=i.ones[e%10];return r&&n?r+" y "+n:r||n}(e%100);return 1===r?o?n+"to "+o:n:n&&o?n+" "+o:n||o}const i=(0,r(7549).NUMBERS)();i.numericOrdinal=function(t){const e=n.Grammar.getInstance().getParameter("gender");return t.toString()+("f"===e?"a":"o")},i.numberToWords=function(t){if(0===t)return i.zero;if(t>=Math.pow(10,36))return t.toString();let e=0,r="";for(;t>0;){const n=t%1e3;if(n){let t=i.large[e];const a=o(n);e?1===n?(t=t.match("/^mil( |$)/")?t:"un "+t,r=t+(r?" "+r:"")):(t=t.replace(/\u00f3n$/,"ones"),r=o(n)+" "+t+(r?" "+r:"")):r=a}t=Math.floor(t/1e3),e++}return r},i.numberToOrdinal=function(t,e){if(t>1999)return t.toString()+"a";if(t<=12)return i.special.onesOrdinals[t-1];const r=[];if(t>=1e3&&(t-=1e3,r.push("mil\xe9sima")),!t)return r.join(" ");let n=0;return n=Math.floor(t/100),n>0&&(r.push(i.special.hundredsOrdinals[n-1]),t%=100),t<=12?r.push(i.special.onesOrdinals[t-1]):(n=Math.floor(t/10),n>0&&(r.push(i.special.tensOrdinals[n-1]),t%=10),t>0&&r.push(i.special.onesOrdinals[t-1])),r.join(" ")},e.default=i},2350:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0});const n=r(5897),o=r(2105),i=r(7549);function a(t){let e=t%1e3,r="";if(r+=u.ones[Math.floor(e/100)]?u.ones[Math.floor(e/100)]+"-cent":"",e%=100,e){r+=r?"-":"";let t=u.ones[e];if(t)r+=t;else{const n=u.tens[Math.floor(e/10)];n.match(/-dix$/)?(t=u.ones[e%10+10],r+=n.replace(/-dix$/,"")+"-"+t):r+=n+(e%10?"-"+u.ones[e%10]:"")}}const n=r.match(/s-\w+$/);return n?r.replace(/s-\w+$/,n[0].slice(1)):r.replace(/-un$/,"-et-un")}function s(t){if(0===t)return u.zero;if(t>=Math.pow(10,36))return t.toString();u.special["tens-"+n.default.getInstance().subiso]&&(u.tens=u.special["tens-"+n.default.getInstance().subiso]);let e=0,r="";for(;t>0;){const n=t%1e3;if(n){let t=u.large[e];const o=a(n);if(t&&t.match(/^mille /)){const n=t.replace(/^mille /,"");r=r.match(RegExp(n))?o+(e?"-mille-":"")+r:r.match(RegExp(n.replace(/s$/,"")))?o+(e?"-mille-":"")+r.replace(n.replace(/s$/,""),n):o+(e?"-"+t+"-":"")+r}else t=1===n&&t?t.replace(/s$/,""):t,r=o+(e?"-"+t+"-":"")+r}t=Math.floor(t/1e3),e++}return r.replace(/-$/,"")}const l={1:"uni\xe8me",2:"demi",3:"tiers",4:"quart"};function c(t){if(1===t)return"premi\xe8re";let e=s(t);return e.match(/^neuf$/)?e=e.slice(0,-1)+"v":e.match(/cinq$/)?e+="u":e.match(/trois$/)?e+="":(e.match(/e$/)||e.match(/s$/))&&(e=e.slice(0,-1)),e+="i\xe8me",e}const u=(0,i.NUMBERS)();u.wordOrdinal=c,u.numericOrdinal=function(t){const e=o.Grammar.getInstance().getParameter("gender");return 1===t?t.toString()+("m"===e?"er":"re"):t.toString()+"e"},u.numberToWords=s,u.numberToOrdinal=function(t,e){const r=l[t]||c(t);return 3===t?r:e?r+"s":r},e.default=u},4438:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0});const n=r(2105);function o(t){if(0===t)return a.zero;if(t>=Math.pow(10,32))return t.toString();let e=0,r="";const n=function(t){let e=t%1e3,r="";return r+=a.ones[Math.floor(e/100)]?a.ones[Math.floor(e/100)]+a.numSep+a.special.hundred:"",e%=100,e&&(r+=r?a.numSep:"",r+=a.ones[e]),r}(t%1e3);if(!(t=Math.floor(t/1e3)))return n;for(;t>0;){const n=t%100;n&&(r=a.ones[n]+a.numSep+a.large[e]+(r?a.numSep+r:"")),t=Math.floor(t/100),e++}return n?r+a.numSep+n:r}function i(t){const e=n.Grammar.getInstance().getParameter("gender");if(t<=0)return t.toString();if(t<10)return"f"===e?a.special.ordinalsFeminine[t]:a.special.ordinalsMasculine[t];return o(t)+("f"===e?"\u0935\u0940\u0902":"\u0935\u093e\u0901")}const a=(0,r(7549).NUMBERS)();a.wordOrdinal=i,a.numericOrdinal=function(t){const e=n.Grammar.getInstance().getParameter("gender");return t>0&&t<10?"f"===e?a.special.simpleSmallOrdinalsFeminine[t]:a.special.simpleSmallOrdinalsMasculine[t]:t.toString().split("").map((function(t){const e=parseInt(t,10);return isNaN(e)?"":a.special.simpleNumbers[e]})).join("")+("f"===e?"\u0935\u0940\u0902":"\u0935\u093e\u0901")},a.numberToWords=o,a.numberToOrdinal=function(t,e){return t<=10?a.special.smallDenominators[t]:i(t)+" \u0905\u0902\u0936"},e.default=a},8825:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0});const n=r(2105);function o(t){let e=t%1e3,r="";if(r+=s.ones[Math.floor(e/100)]?s.ones[Math.floor(e/100)]+s.numSep+"cento":"",e%=100,e){r+=r?s.numSep:"";const t=s.ones[e];if(t)r+=t;else{let t=s.tens[Math.floor(e/10)];const n=e%10;1!==n&&8!==n||(t=t.slice(0,-1)),r+=t,r+=n?s.numSep+s.ones[e%10]:""}}return r}function i(t){if(0===t)return s.zero;if(t>=Math.pow(10,36))return t.toString();if(1===t&&n.Grammar.getInstance().getParameter("fraction"))return"un";let e=0,r="";for(;t>0;){t%1e3&&(r=o(t%1e3)+(e?"-"+s.large[e]+"-":"")+r),t=Math.floor(t/1e3),e++}return r.replace(/-$/,"")}function a(t){const e="m"===n.Grammar.getInstance().getParameter("gender")?"o":"a";let r=s.special.onesOrdinals[t];return r?r.slice(0,-1)+e:(r=i(t),r.slice(0,-1)+"esim"+e)}const s=(0,r(7549).NUMBERS)();s.wordOrdinal=a,s.numericOrdinal=function(t){const e=n.Grammar.getInstance().getParameter("gender");return t.toString()+("m"===e?"o":"a")},s.numberToWords=i,s.numberToOrdinal=function(t,e){if(2===t)return e?"mezzi":"mezzo";const r=a(t);if(!e)return r;const n=r.match(/o$/)?"i":"e";return r.slice(0,-1)+n},e.default=s},3720:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0});function n(t){return t.toString().split("").map((function(t){return o.ones[parseInt(t,10)]})).join("")}const o=(0,r(7549).NUMBERS)();o.numberToWords=n,o.numberToOrdinal=n,e.default=o},8274:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0});const n=r(5897);function o(t,e=!1){let r=t%1e3,n="";const o=Math.floor(r/100),a=s.ones[o];if(n+=a?(1===o?"":a)+"hundre":"",r%=100,r){if(n+=n?"og":"",e){const t=s.special.smallOrdinals[r];if(t)return n+t;if(r%10)return n+s.tens[Math.floor(r/10)]+s.special.smallOrdinals[r%10]}n+=s.ones[r]||s.tens[Math.floor(r/10)]+(r%10?s.ones[r%10]:"")}return e?i(n):n}function i(t){const e=s.special.endOrdinal[0];return"a"===e&&t.match(/en$/)?t.slice(0,-2)+s.special.endOrdinal:t.match(/(d|n)$/)||t.match(/hundre$/)?t+"de":t.match(/i$/)?t+s.special.endOrdinal:"a"===e&&t.match(/e$/)?t.slice(0,-1)+s.special.endOrdinal:(t.match(/e$/),t+"nde")}function a(t){return u(t,!0)}const s=(0,r(7549).NUMBERS)();function l(t,e=!1){return t===s.ones[1]?"ein"===t?"eitt ":e?"et":"ett":t}function c(t,e=!1){let r=t%1e3,n="",o=s.ones[Math.floor(r/100)];if(n+=o?l(o)+"hundre":"",r%=100,r){if(n+=n?"og":"",e){const t=s.special.smallOrdinals[r];if(t)return n+t}if(o=s.ones[r],o)n+=o;else{const t=s.tens[Math.floor(r/10)];o=s.ones[r%10],n+=o?o+"og"+t:t}}return e?i(n):n}function u(t,e=!1){const r="alt"===n.default.getInstance().subiso?function(t,e=!1){if(0===t)return e?s.special.smallOrdinals[0]:s.zero;if(t>=Math.pow(10,36))return t.toString();let r=0,n="";for(;t>0;){const o=t%1e3;if(o){const i=c(t%1e3,!r&&e);!r&&e&&(e=!e),n=(1===r?l(i,!0):i)+(r>1?s.numSep:"")+(r?s.large[r]+(r>1&&o>1?"er":""):"")+(r>1&&n?s.numSep:"")+n}t=Math.floor(t/1e3),r++}return e?n+(n.match(/tusen$/)?"de":"te"):n}(t,e):function(t,e=!1){if(0===t)return e?s.special.smallOrdinals[0]:s.zero;if(t>=Math.pow(10,36))return t.toString();let r=0,n="";for(;t>0;){const i=t%1e3;if(i){const a=o(t%1e3,!r&&e);!r&&e&&(e=!e),n=a+(r?" "+s.large[r]+(r>1&&i>1?"er":"")+(n?" ":""):"")+n}t=Math.floor(t/1e3),r++}return e?n+(n.match(/tusen$/)?"de":"te"):n}(t,e);return r}s.wordOrdinal=a,s.numericOrdinal=function(t){return t.toString()+"."},s.numberToWords=u,s.numberToOrdinal=function(t,e){return a(t)},e.default=s},3898:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0});function n(t){let e=t%1e3,r="";const n=Math.floor(e/100);return r+=a.ones[n]?(1===n?"":a.ones[n]+a.numSep)+"hundra":"",e%=100,e&&(r+=r?a.numSep:"",r+=a.ones[e]||a.tens[Math.floor(e/10)]+(e%10?a.numSep+a.ones[e%10]:"")),r}function o(t,e=!1){if(0===t)return a.zero;if(t>=Math.pow(10,36))return t.toString();let r=0,o="";for(;t>0;){const i=t%1e3;if(i){const s=a.large[r],l=i>1&&r>1&&!e?"er":"";o=(1===r&&1===i?"":(r>1&&1===i?"en":n(t%1e3))+(r>1?" ":""))+(r?s+l+(r>1?" ":""):"")+o}t=Math.floor(t/1e3),r++}return o.replace(/ $/,"")}function i(t){let e=o(t,!0);return e.match(/^noll$/)?e="nollte":e.match(/ett$/)?e=e.replace(/ett$/,"f\xf6rsta"):e.match(/tv\xe5$/)?e=e.replace(/tv\xe5$/,"andra"):e.match(/tre$/)?e=e.replace(/tre$/,"tredje"):e.match(/fyra$/)?e=e.replace(/fyra$/,"fj\xe4rde"):e.match(/fem$/)?e=e.replace(/fem$/,"femte"):e.match(/sex$/)?e=e.replace(/sex$/,"sj\xe4tte"):e.match(/sju$/)?e=e.replace(/sju$/,"sjunde"):e.match(/\xe5tta$/)?e=e.replace(/\xe5tta$/,"\xe5ttonde"):e.match(/nio$/)?e=e.replace(/nio$/,"nionde"):e.match(/tio$/)?e=e.replace(/tio$/,"tionde"):e.match(/elva$/)?e=e.replace(/elva$/,"elfte"):e.match(/tolv$/)?e=e.replace(/tolv$/,"tolfte"):e.match(/tusen$/)?e=e.replace(/tusen$/,"tusonde"):e.match(/jard$/)||e.match(/jon$/)?e+="te":e+="de",e}const a=(0,r(7549).NUMBERS)();a.wordOrdinal=i,a.numericOrdinal=function(t){const e=t.toString();return e.match(/11$|12$/)?e+":e":e+(e.match(/1$|2$/)?":a":":e")},a.numberToWords=o,a.numberToOrdinal=function(t,e){if(1===t)return"hel";if(2===t)return e?"halva":"halv";let r=i(t);return r=r.match(/de$/)?r.replace(/de$/,""):r,r+(e?"delar":"del")},e.default=a},4977:function(t,e){function r(t,e=""){if(!t.childNodes||!t.childNodes[0]||!t.childNodes[0].childNodes||t.childNodes[0].childNodes.length<2||"number"!==t.childNodes[0].childNodes[0].tagName||"integer"!==t.childNodes[0].childNodes[0].getAttribute("role")||"number"!==t.childNodes[0].childNodes[1].tagName||"integer"!==t.childNodes[0].childNodes[1].getAttribute("role"))return{convertible:!1,content:t.textContent};const r=t.childNodes[0].childNodes[1].textContent,n=t.childNodes[0].childNodes[0].textContent,o=Number(r),i=Number(n);return isNaN(o)||isNaN(i)?{convertible:!1,content:`${n} ${e} ${r}`}:{convertible:!0,enumerator:i,denominator:o}}Object.defineProperty(e,"__esModule",{value:!0}),e.vulgarFractionSmall=e.convertVulgarFraction=e.Combiners=e.siCombiner=e.identityTransformer=e.pluralCase=void 0,e.pluralCase=function(t,e){return t.toString()},e.identityTransformer=function(t){return t.toString()},e.siCombiner=function(t,e){return t+e.toLowerCase()},e.Combiners={},e.Combiners.identityCombiner=function(t,e,r){return t+e+r},e.Combiners.prefixCombiner=function(t,e,r){return t=r?r+" "+t:t,e?e+" "+t:t},e.Combiners.postfixCombiner=function(t,e,r){return t=r?r+" "+t:t,e?t+" "+e:t},e.Combiners.romanceCombiner=function(t,e,r){return t=r?t+" "+r:t,e?t+" "+e:t},e.convertVulgarFraction=r,e.vulgarFractionSmall=function(t,e,n){const o=r(t);if(o.convertible){const t=o.enumerator,r=o.denominator;return t>0&&t<e&&r>0&&r<n}return!1}},4504:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Condition=e.BaseRuleStore=void 0;const n=r(7052),o=r(1676),i=r(4650),a=r(4106);class s{constructor(){this.context=new a.SpeechRuleContext,this.parseOrder=o.DynamicCstr.DEFAULT_ORDER,this.parser=new o.DynamicCstrParser(this.parseOrder),this.locale=o.DynamicCstr.DEFAULT_VALUES[o.Axis.LOCALE],this.modality=o.DynamicCstr.DEFAULT_VALUES[o.Axis.MODALITY],this.domain="",this.initialized=!1,this.inherits=null,this.kind="standard",this.customTranscriptions={},this.preconditions=new Map,this.speechRules_=[],this.rank=0,this.parseMethods={Rule:this.defineRule,Generator:this.generateRules,Action:this.defineAction,Precondition:this.definePrecondition,Ignore:this.ignoreRules}}static compareStaticConstraints_(t,e){if(t.length!==e.length)return!1;for(let r,n=0;r=t[n];n++)if(-1===e.indexOf(r))return!1;return!0}static comparePreconditions_(t,e){const r=t.precondition,n=e.precondition;return r.query===n.query&&s.compareStaticConstraints_(r.constraints,n.constraints)}defineRule(t,e,r,n,...o){const a=this.parseAction(r),s=this.parsePrecondition(n,o),l=this.parseCstr(e);if(!(a&&s&&l))return console.error(`Rule Error: ${n}, (${e}): ${r}`),null;const c=new i.SpeechRule(t,l,s,a);return c.precondition.rank=this.rank++,this.addRule(c),c}addRule(t){t.context=this.context,this.speechRules_.unshift(t)}deleteRule(t){const e=this.speechRules_.indexOf(t);-1!==e&&this.speechRules_.splice(e,1)}findRule(t){for(let e,r=0;e=this.speechRules_[r];r++)if(t(e))return e;return null}findAllRules(t){return this.speechRules_.filter(t)}evaluateDefault(t){const e=t.textContent.slice(0);return e.match(/^\s+$/)?this.evaluateWhitespace(e):this.evaluateString(e)}evaluateWhitespace(t){return[]}evaluateCustom(t){const e=this.customTranscriptions[t];return void 0!==e?n.AuditoryDescription.create({text:e},{adjust:!0,translate:!1}):null}evaluateCharacter(t){return this.evaluateCustom(t)||n.AuditoryDescription.create({text:t},{adjust:!0,translate:!0})}removeDuplicates(t){for(let e,r=this.speechRules_.length-1;e=this.speechRules_[r];r--)e!==t&&t.dynamicCstr.equal(e.dynamicCstr)&&s.comparePreconditions_(e,t)&&this.speechRules_.splice(r,1)}getSpeechRules(){return this.speechRules_}setSpeechRules(t){this.speechRules_=t}getPreconditions(){return this.preconditions}parseCstr(t){try{return this.parser.parse(this.locale+"."+this.modality+(this.domain?"."+this.domain:"")+"."+t)}catch(e){if("RuleError"===e.name)return console.error("Rule Error ",`Illegal Dynamic Constraint: ${t}.`,e.message),null;throw e}}parsePrecondition(t,e){try{const r=this.parsePrecondition_(t);t=r[0];let n=r.slice(1);for(const t of e)n=n.concat(this.parsePrecondition_(t));return new i.Precondition(t,...n)}catch(r){if("RuleError"===r.name)return console.error("Rule Error ",`Illegal preconditions: ${t}, ${e}.`,r.message),null;throw r}}parseAction(t){try{return i.Action.fromString(t)}catch(e){if("RuleError"===e.name)return console.error("Rule Error ",`Illegal action: ${t}.`,e.message),null;throw e}}parse(t){this.modality=t.modality||this.modality,this.locale=t.locale||this.locale,this.domain=t.domain||this.domain,this.context.parse(t.functions||[]),"actions"!==t.kind&&(this.kind=t.kind||this.kind,this.inheritRules()),this.parseRules(t.rules||[])}parseRules(t){for(let e,r=0;e=t[r];r++){const t=e[0],r=this.parseMethods[t];t&&r&&r.apply(this,e.slice(1))}}generateRules(t){const e=this.context.customGenerators.lookup(t);e&&e(this)}defineAction(t,e){let r;try{r=i.Action.fromString(e)}catch(t){if("RuleError"===t.name)return void console.error("Action Error ",e,t.message);throw t}const n=this.getFullPreconditions(t);if(!n)return void console.error(`Action Error: No precondition for action ${t}`);this.ignoreRules(t);const o=new RegExp("^\\w+\\.\\w+\\."+(this.domain?"\\w+\\.":""));n.conditions.forEach((([e,n])=>{const a=this.parseCstr(e.toString().replace(o,""));this.addRule(new i.SpeechRule(t,a,n,r))}))}getFullPreconditions(t){const e=this.preconditions.get(t);return e||!this.inherits?e:this.inherits.getFullPreconditions(t)}definePrecondition(t,e,r,...n){const o=this.parsePrecondition(r,n),i=this.parseCstr(e);o&&i?(o.rank=this.rank++,this.preconditions.set(t,new l(i,o))):console.error(`Precondition Error: ${r}, (${e})`)}inheritRules(){if(!this.inherits||!this.inherits.getSpeechRules().length)return;const t=new RegExp("^\\w+\\.\\w+\\."+(this.domain?"\\w+\\.":""));this.inherits.getSpeechRules().forEach((e=>{const r=this.parseCstr(e.dynamicCstr.toString().replace(t,""));this.addRule(new i.SpeechRule(e.name,r,e.precondition,e.action))}))}ignoreRules(t,...e){let r=this.findAllRules((e=>e.name===t));if(!e.length)return void r.forEach(this.deleteRule.bind(this));let n=[];for(const t of e){const e=this.parseCstr(t);for(const t of r)e.equal(t.dynamicCstr)?this.deleteRule(t):n.push(t);r=n,n=[]}}parsePrecondition_(t){const e=this.context.customGenerators.lookup(t);return e?e():[t]}}e.BaseRuleStore=s;class l{constructor(t,e){this.base=t,this._conditions=[],this.constraints=[],this.allCstr={},this.constraints.push(t),this.addCondition(t,e)}get conditions(){return this._conditions}addConstraint(t){if(this.constraints.filter((e=>e.equal(t))).length)return;this.constraints.push(t);const e=[];for(const[r,n]of this.conditions)this.base.equal(r)&&e.push([t,n]);this._conditions=this._conditions.concat(e)}addBaseCondition(t){this.addCondition(this.base,t)}addFullCondition(t){this.constraints.forEach((e=>this.addCondition(e,t)))}addCondition(t,e){const r=t.toString()+" "+e.toString();this.allCstr.condStr||(this.allCstr[r]=!0,this._conditions.push([t,e]))}}e.Condition=l},2469:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.BrailleStore=void 0;const n=r(7630),o=r(9935);class i extends o.MathStore{constructor(){super(...arguments),this.modality="braille",this.customTranscriptions={"\u22ca":"\u2808\u2821\u2833"}}evaluateString(t){const e=[],r=Array.from(t);for(let t=0;t<r.length;t++)e.push(this.evaluateCharacter(r[t]));return e}annotations(){for(let t,e=0;t=this.annotators[e];e++)(0,n.activate)(this.locale,t)}}e.BrailleStore=i},1676:function(t,e){var r;Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultComparator=e.DynamicCstrParser=e.DynamicCstr=e.DynamicProperties=e.Axis=void 0,function(t){t.DOMAIN="domain",t.STYLE="style",t.LOCALE="locale",t.TOPIC="topic",t.MODALITY="modality"}(r=e.Axis||(e.Axis={}));class n{constructor(t,e=Object.keys(t)){this.properties=t,this.order=e}static createProp(...t){const e=o.DEFAULT_ORDER,r={};for(let n=0,o=t.length,i=e.length;n<o&&n<i;n++)r[e[n]]=t[n];return new n(r)}getProperties(){return this.properties}getOrder(){return this.order}getAxes(){return this.order}getProperty(t){return this.properties[t]}updateProperties(t){this.properties=t}allProperties(){const t=[];return this.order.forEach((e=>t.push(this.getProperty(e).slice()))),t}toString(){const t=[];return this.order.forEach((e=>t.push(e+": "+this.getProperty(e).toString()))),t.join("\n")}}e.DynamicProperties=n;class o extends n{constructor(t,e){const r={};for(const[e,n]of Object.entries(t))r[e]=[n];super(r,e),this.components=t}static createCstr(...t){const e=o.DEFAULT_ORDER,r={};for(let n=0,o=t.length,i=e.length;n<o&&n<i;n++)r[e[n]]=t[n];return new o(r)}static defaultCstr(){return o.createCstr.apply(null,o.DEFAULT_ORDER.map((function(t){return o.DEFAULT_VALUES[t]})))}static validOrder(t){const e=o.DEFAULT_ORDER.slice();return t.every((t=>{const r=e.indexOf(t);return-1!==r&&e.splice(r,1)}))}getComponents(){return this.components}getValue(t){return this.components[t]}getValues(){return this.order.map((t=>this.getValue(t)))}allProperties(){const t=super.allProperties();for(let e,r,n=0;e=t[n],r=this.order[n];n++){const t=this.getValue(r);-1===e.indexOf(t)&&e.unshift(t)}return t}toString(){return this.getValues().join(".")}equal(t){const e=t.getAxes();if(this.order.length!==e.length)return!1;for(let r,n=0;r=e[n];n++){const e=this.getValue(r);if(!e||t.getValue(r)!==e)return!1}return!0}}e.DynamicCstr=o,o.DEFAULT_ORDER=[r.LOCALE,r.MODALITY,r.DOMAIN,r.STYLE,r.TOPIC],o.BASE_LOCALE="base",o.DEFAULT_VALUE="default",o.DEFAULT_VALUES={[r.LOCALE]:"en",[r.DOMAIN]:o.DEFAULT_VALUE,[r.STYLE]:o.DEFAULT_VALUE,[r.TOPIC]:o.DEFAULT_VALUE,[r.MODALITY]:"speech"};e.DynamicCstrParser=class{constructor(t){this.order=t}parse(t){const e=t.split("."),r={};if(e.length>this.order.length)throw new Error("Invalid dynamic constraint: "+r);let n=0;for(let t,o=0;t=this.order[o],e.length;o++,n++){const n=e.shift();r[t]=n}return new o(r,this.order.slice(0,n))}};e.DefaultComparator=class{constructor(t,e=new n(t.getProperties(),t.getOrder())){this.reference=t,this.fallback=e,this.order=this.reference.getOrder()}getReference(){return this.reference}setReference(t,e){this.reference=t,this.fallback=e||new n(t.getProperties(),t.getOrder()),this.order=this.reference.getOrder()}match(t){const e=t.getAxes();return e.length===this.reference.getAxes().length&&e.every((e=>{const r=t.getValue(e);return r===this.reference.getValue(e)||-1!==this.fallback.getProperty(e).indexOf(r)}))}compare(t,e){let r=!1;for(let n,o=0;n=this.order[o];o++){const o=t.getValue(n),i=e.getValue(n);if(!r){const t=this.reference.getValue(n);if(t===o&&t!==i)return-1;if(t===i&&t!==o)return 1;if(t===o&&t===i)continue;t!==o&&t!==i&&(r=!0)}const a=this.fallback.getProperty(n),s=a.indexOf(o),l=a.indexOf(i);if(s<l)return-1;if(l<s)return 1}return 0}toString(){return this.reference.toString()+"\n"+this.fallback.toString()}}},2105:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.numbersToAlpha=e.Grammar=e.ATTRIBUTE=void 0;const n=r(5740),o=r(5897),i=r(2536),a=r(4356);e.ATTRIBUTE="grammar";class s{constructor(){this.currentFlags={},this.parameters_={},this.corrections_={},this.preprocessors_={},this.stateStack_=[]}static getInstance(){return s.instance=s.instance||new s,s.instance}static parseInput(t){const e={},r=t.split(":");for(let t=0,n=r.length;t<n;t++){const n=r[t].split("="),o=n[0].trim();n[1]?e[o]=n[1].trim():o.match(/^!/)?e[o.slice(1)]=!1:e[o]=!0}return e}static parseState(t){const e={},r=t.split(" ");for(let t=0,n=r.length;t<n;t++){const n=r[t].split(":"),o=n[0],i=n[1];e[o]=i||!0}return e}static translateString_(t){if(t.match(/:unit$/))return s.translateUnit_(t);const e=o.default.getInstance();let r=e.evaluator(t,e.dynamicCstr);return r=null===r?t:r,s.getInstance().getParameter("plural")&&(r=a.LOCALE.FUNCTIONS.plural(r)),r}static translateUnit_(t){t=s.prepareUnit_(t);const e=o.default.getInstance(),r=s.getInstance().getParameter("plural"),n=e.strict,i=`${e.locale}.${e.modality}.default`;let l,c;return e.strict=!0,r&&(l=e.defaultParser.parse(i+".plural"),c=e.evaluator(t,l)),c?(e.strict=n,c):(l=e.defaultParser.parse(i+".default"),c=e.evaluator(t,l),e.strict=n,c?(r&&(c=a.LOCALE.FUNCTIONS.plural(c)),c):s.cleanUnit_(t))}static prepareUnit_(t){const e=t.match(/:unit$/);return e?t.slice(0,e.index).replace(/\s+/g," ")+t.slice(e.index):t}static cleanUnit_(t){return t.match(/:unit$/)?t.replace(/:unit$/,""):t}clear(){this.parameters_={},this.stateStack_=[]}setParameter(t,e){const r=this.parameters_[t];return e?this.parameters_[t]=e:delete this.parameters_[t],r}getParameter(t){return this.parameters_[t]}setCorrection(t,e){this.corrections_[t]=e}setPreprocessor(t,e){this.preprocessors_[t]=e}getCorrection(t){return this.corrections_[t]}getState(){const t=[];for(const e in this.parameters_){const r=this.parameters_[e];t.push("string"==typeof r?e+":"+r:e)}return t.join(" ")}pushState(t){for(const e in t)t[e]=this.setParameter(e,t[e]);this.stateStack_.push(t)}popState(){const t=this.stateStack_.pop();for(const e in t)this.setParameter(e,t[e])}setAttribute(t){if(t&&t.nodeType===n.NodeType.ELEMENT_NODE){const r=this.getState();r&&t.setAttribute(e.ATTRIBUTE,r)}}preprocess(t){return this.runProcessors_(t,this.preprocessors_)}correct(t){return this.runProcessors_(t,this.corrections_)}apply(t,e){return this.currentFlags=e||{},t=this.currentFlags.adjust||this.currentFlags.preprocess?s.getInstance().preprocess(t):t,(this.parameters_.translate||this.currentFlags.translate)&&(t=s.translateString_(t)),t=this.currentFlags.adjust||this.currentFlags.correct?s.getInstance().correct(t):t,this.currentFlags={},t}runProcessors_(t,e){for(const r in this.parameters_){const n=e[r];if(!n)continue;const o=this.parameters_[r];t=!0===o?n(t):n(t,o)}return t}}function l(t,e){if(!e||!t)return t;const r=a.LOCALE.FUNCTIONS.fontRegexp(i.localFont(e));return t.replace(r,"")}function c(t){return t.match(/\d+/)?a.LOCALE.NUMBERS.numberToWords(parseInt(t,10)):t}e.Grammar=s,e.numbersToAlpha=c,s.getInstance().setCorrection("localFont",i.localFont),s.getInstance().setCorrection("localRole",i.localRole),s.getInstance().setCorrection("localEnclose",i.localEnclose),s.getInstance().setCorrection("ignoreFont",l),s.getInstance().setPreprocessor("annotation",(function(t,e){return t+":"+e})),s.getInstance().setPreprocessor("noTranslateText",(function(t){return t.match(new RegExp("^["+a.LOCALE.MESSAGES.regexp.TEXT+"]+$"))&&(s.getInstance().currentFlags.translate=!1),t})),s.getInstance().setCorrection("ignoreCaps",(function(t){let e=a.LOCALE.ALPHABETS.capPrefix[o.default.getInstance().domain];return void 0===e&&(e=a.LOCALE.ALPHABETS.capPrefix.default),l(t,e)})),s.getInstance().setPreprocessor("numbers2alpha",c)},2780:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.enumerate=e.lookupString=e.lookupCategory=e.lookupRule=e.addSiUnitRules=e.addUnitRules=e.addFunctionRules=e.addSymbolRules=e.defineRule=e.defineRules=e.setSiPrefixes=void 0;const n=r(2057),o=r(5897),i=r(7491),a=r(4658),s=r(1676);let l=s.DynamicCstr.DEFAULT_VALUES[s.Axis.LOCALE],c=s.DynamicCstr.DEFAULT_VALUES[s.Axis.MODALITY],u={};e.setSiPrefixes=function(t){u=t};const p={};function h(t,e,r,n){const o=_(e);S(o,r),o.defineRulesFromMappings(t,l,c,e,n)}function d(t){if(v(t))return;const e=t.names,r=t.mappings,n=t.category;for(let t,o=0;t=e[o];o++)h(t,t,n,r)}function f(t){for(const e of Object.keys(u)){const r=Object.assign({},t);r.mappings={};const n=u[e];r.key=e+r.key,r.names=r.names.map((function(t){return e+t}));for(const e of Object.keys(t.mappings)){r.mappings[e]={};for(const o of Object.keys(t.mappings[e]))r.mappings[e][o]=i.locales[l]().FUNCTIONS.si(n,t.mappings[e][o])}b(r)}b(t)}function m(t,e){const r=p[t];return r?r.lookupRule(null,e):null}function y(t,e){const r=m(t,e);return r?r.action:null}function g(t,e){return e=e||{},t.length?(e[t[0]]=g(t.slice(1),e[t[0]]),e):e}function b(t){const e=t.names;e&&(t.names=e.map((function(t){return t+":unit"}))),d(t)}function v(t){return!(!t.locale&&!t.modality)&&(l=t.locale||l,c=t.modality||c,!0)}function _(t){let e=p[t];return e?(n.Debugger.getInstance().output("Store exists! "+t),e):(e=new a.MathSimpleStore,p[t]=e,e)}function S(t,e){e&&(t.category=e)}e.defineRules=h,e.defineRule=function(t,e,r,n,o,i){const a=_(o);S(a,n),a.defineRuleFromStrings(t,l,c,e,r,o,i)},e.addSymbolRules=function(t){if(v(t))return;const e=a.MathSimpleStore.parseUnicode(t.key);h(t.key,e,t.category,t.mappings)},e.addFunctionRules=d,e.addUnitRules=function(t){v(t)||(t.si?f(t):b(t))},e.addSiUnitRules=f,e.lookupRule=m,e.lookupCategory=function(t){const e=p[t];return e?e.category:""},e.lookupString=y,o.default.getInstance().evaluator=y,e.enumerate=function(t={}){for(const e of Object.values(p))for(const[,r]of e.rules.entries())for(const{cstr:e}of r)t=g(e.getValues(),t);return t}},4658:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.MathSimpleStore=void 0;const n=r(5897),o=r(1676);class i{constructor(){this.category="",this.rules=new Map}static parseUnicode(t){const e=parseInt(t,16);return String.fromCodePoint(e)}static testDynamicConstraints_(t,e){return n.default.getInstance().strict?e.cstr.equal(t):n.default.getInstance().comparator.match(e.cstr)}defineRulesFromMappings(t,e,r,n,o){for(const i in o)for(const a in o[i]){const s=o[i][a];this.defineRuleFromStrings(t,e,r,i,a,n,s)}}getRules(t){let e=this.rules.get(t);return e||(e=[],this.rules.set(t,e)),e}defineRuleFromStrings(t,e,r,o,i,a,s){let l=this.getRules(e);const c=n.default.getInstance().parsers[o]||n.default.getInstance().defaultParser,u=n.default.getInstance().comparators[o],p=`${e}.${r}.${o}.${i}`,h=c.parse(p),d=u?u():n.default.getInstance().comparator,f=d.getReference();d.setReference(h);const m={cstr:h,action:s};l=l.filter((t=>!h.equal(t.cstr))),l.push(m),this.rules.set(e,l),d.setReference(f)}lookupRule(t,e){let r=this.getRules(e.getValue(o.Axis.LOCALE));return r=r.filter((function(t){return i.testDynamicConstraints_(e,t)})),1===r.length?r[0]:r.length?r.sort(((t,e)=>n.default.getInstance().comparator.compare(t.cstr,e.cstr)))[0]:null}}e.MathSimpleStore=i},9935:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.MathStore=void 0;const n=r(707),o=r(4356),i=r(7630),a=r(4504),s=r(4650);class l extends a.BaseRuleStore{constructor(){super(),this.annotators=[],this.parseMethods.Alias=this.defineAlias,this.parseMethods.SpecializedRule=this.defineSpecializedRule,this.parseMethods.Specialized=this.defineSpecialized}initialize(){this.initialized||(this.annotations(),this.initialized=!0)}annotations(){for(let t,e=0;t=this.annotators[e];e++)(0,i.activate)(this.domain,t)}defineAlias(t,e,...r){const n=this.parsePrecondition(e,r);if(!n)return void console.error(`Precondition Error: ${e} ${r}`);const o=this.preconditions.get(t);o?o.addFullCondition(n):console.error(`Alias Error: No precondition by the name of ${t}`)}defineRulesAlias(t,e,...r){const n=this.findAllRules((function(e){return e.name===t}));if(0===n.length)throw new s.OutputError("Rule with name "+t+" does not exist.");const o=[];n.forEach((t=>{(t=>{const e=t.dynamicCstr.toString(),r=t.action.toString();for(let t,n=0;t=o[n];n++)if(t.action===r&&t.cstr===e)return!1;return o.push({cstr:e,action:r}),!0})(t)&&this.addAlias_(t,e,r)}))}defineSpecializedRule(t,e,r,n){const o=this.parseCstr(e),i=this.findRule((e=>e.name===t&&o.equal(e.dynamicCstr))),a=this.parseCstr(r);if(!i&&n)throw new s.OutputError("Rule named "+t+" with style "+e+" does not exist.");const l=n?s.Action.fromString(n):i.action,c=new s.SpeechRule(i.name,a,i.precondition,l);this.addRule(c)}defineSpecialized(t,e,r){const n=this.parseCstr(r);if(!n)return void console.error(`Dynamic Constraint Error: ${r}`);const o=this.preconditions.get(t);o?o.addConstraint(n):console.error(`Alias Error: No precondition by the name of ${t}`)}evaluateString(t){const e=[];if(t.match(/^\s+$/))return e;let r=this.matchNumber_(t);if(r&&r.length===t.length)return e.push(this.evaluateCharacter(r.number)),e;const i=n.removeEmpty(t.replace(/\s/g," ").split(" "));for(let t,n=0;t=i[n];n++)if(1===t.length)e.push(this.evaluateCharacter(t));else if(t.match(new RegExp("^["+o.LOCALE.MESSAGES.regexp.TEXT+"]+$")))e.push(this.evaluateCharacter(t));else{let n=t;for(;n;){r=this.matchNumber_(n);const t=n.match(new RegExp("^["+o.LOCALE.MESSAGES.regexp.TEXT+"]+"));if(r)e.push(this.evaluateCharacter(r.number)),n=n.substring(r.length);else if(t)e.push(this.evaluateCharacter(t[0])),n=n.substring(t[0].length);else{const t=Array.from(n),r=t[0];e.push(this.evaluateCharacter(r)),n=t.slice(1).join("")}}}return e}parse(t){super.parse(t),this.annotators=t.annotators||[]}addAlias_(t,e,r){const n=this.parsePrecondition(e,r),o=new s.SpeechRule(t.name,t.dynamicCstr,n,t.action);o.name=t.name,this.addRule(o)}matchNumber_(t){const e=t.match(new RegExp("^"+o.LOCALE.MESSAGES.regexp.NUMBER)),r=t.match(new RegExp("^"+l.regexp.NUMBER));if(!e&&!r)return null;const n=r&&r[0]===t;if(e&&e[0]===t||!n)return e?{number:e[0],length:e[0].length}:null;return{number:r[0].replace(new RegExp(l.regexp.DIGIT_GROUP,"g"),"X").replace(new RegExp(l.regexp.DECIMAL_MARK,"g"),o.LOCALE.MESSAGES.regexp.DECIMAL_MARK).replace(/X/g,o.LOCALE.MESSAGES.regexp.DIGIT_GROUP.replace(/\\/g,"")),length:r[0].length}}}e.MathStore=l,l.regexp={NUMBER:"((\\d{1,3})(?=(,| ))((,| )\\d{3})*(\\.\\d+)?)|^\\d*\\.\\d+|^\\d+",DECIMAL_MARK:"\\.",DIGIT_GROUP:","}},4650:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.OutputError=e.Precondition=e.Action=e.Component=e.ActionType=e.SpeechRule=void 0;const n=r(5897),o=r(2105);var i;function a(t){switch(t){case"[n]":return i.NODE;case"[m]":return i.MULTI;case"[t]":return i.TEXT;case"[p]":return i.PERSONALITY;default:throw"Parse error: "+t}}e.SpeechRule=class{constructor(t,e,r,n){this.name=t,this.dynamicCstr=e,this.precondition=r,this.action=n,this.context=null}toString(){return this.name+" | "+this.dynamicCstr.toString()+" | "+this.precondition.toString()+" ==> "+this.action.toString()}},function(t){t.NODE="NODE",t.MULTI="MULTI",t.TEXT="TEXT",t.PERSONALITY="PERSONALITY"}(i=e.ActionType||(e.ActionType={}));class s{constructor({type:t,content:e,attributes:r,grammar:n}){this.type=t,this.content=e,this.attributes=r,this.grammar=n}static grammarFromString(t){return o.Grammar.parseInput(t)}static fromString(t){const e={type:a(t.substring(0,3))};let r=t.slice(3).trim();if(!r)throw new u("Missing content.");switch(e.type){case i.TEXT:if('"'===r[0]){const t=p(r,"\\(")[0].trim();if('"'!==t.slice(-1))throw new u("Invalid string syntax.");e.content=t,r=r.slice(t.length).trim(),-1===r.indexOf("(")&&(r="");break}case i.NODE:case i.MULTI:{const t=r.indexOf(" (");if(-1===t){e.content=r.trim(),r="";break}e.content=r.substring(0,t).trim(),r=r.slice(t).trim()}}if(r){const t=s.attributesFromString(r);t.grammar&&(e.grammar=t.grammar,delete t.grammar),Object.keys(t).length&&(e.attributes=t)}return new s(e)}static attributesFromString(t){if("("!==t[0]||")"!==t.slice(-1))throw new u("Invalid attribute expression: "+t);const e={},r=p(t.slice(1,-1),",");for(let t=0,n=r.length;t<n;t++){const n=r[t],i=n.indexOf(":");if(-1===i)e[n.trim()]="true";else{const t=n.substring(0,i).trim(),r=n.slice(i+1).trim();e[t]=t===o.ATTRIBUTE?s.grammarFromString(r):r}}return e}toString(){let t="";t+=function(t){switch(t){case i.NODE:return"[n]";case i.MULTI:return"[m]";case i.TEXT:return"[t]";case i.PERSONALITY:return"[p]";default:throw"Unknown type error: "+t}}(this.type),t+=this.content?" "+this.content:"";const e=this.attributesToString();return t+=e?" "+e:"",t}grammarToString(){return this.getGrammar().join(":")}getGrammar(){const t=[];for(const e in this.grammar)!0===this.grammar[e]?t.push(e):!1===this.grammar[e]?t.push("!"+e):t.push(e+"="+this.grammar[e]);return t}attributesToString(){const t=this.getAttributes(),e=this.grammarToString();return e&&t.push("grammar:"+e),t.length>0?"("+t.join(", ")+")":""}getAttributes(){const t=[];for(const e in this.attributes){const r=this.attributes[e];"true"===r?t.push(e):t.push(e+":"+r)}return t}}e.Component=s;class l{constructor(t){this.components=t}static fromString(t){const e=p(t,";").filter((function(t){return t.match(/\S/)})).map((function(t){return t.trim()})),r=[];for(let t=0,n=e.length;t<n;t++){const n=s.fromString(e[t]);n&&r.push(n)}return new l(r)}toString(){return this.components.map((function(t){return t.toString()})).join("; ")}}e.Action=l;class c{constructor(t,...e){this.query=t,this.constraints=e;const[r,n]=this.presetPriority();this.priority=r?n:this.calculatePriority()}static constraintValue(t,e){for(let r,n=0;r=e[n];n++)if(t.match(r))return++n;return 0}toString(){const t=this.constraints.join(", ");return`${this.query}, ${t} (${this.priority}, ${this.rank})`}calculatePriority(){const t=c.constraintValue(this.query,c.queryPriorities);if(!t)return 0;const e=this.query.match(/^self::.+\[(.+)\]/)[1];return 100*t+10*c.constraintValue(e,c.attributePriorities)}presetPriority(){if(!this.constraints.length)return[!1,0];const t=this.constraints[this.constraints.length-1].match(/^priority=(.*$)/);if(!t)return[!1,0];this.constraints.pop();const e=parseFloat(t[1]);return[!0,isNaN(e)?0:e]}}e.Precondition=c,c.queryPriorities=[/^self::\*\[.+\]$/,/^self::[\w-]+\[.+\]$/],c.attributePriorities=[/^@[\w-]+$/,/^@[\w-]+!=".+"$/,/^not\(contains\(@[\w-]+,\s*".+"\)\)$/,/^contains\(@[\w-]+,".+"\)$/,/^@[\w-]+=".+"$/];class u extends n.SREError{constructor(t){super(t),this.name="RuleError"}}function p(t,e){const r=[];let n="";for(;""!==t;){const o=t.search(e);if(-1===o){if((t.match(/"/g)||[]).length%2!=0)throw new u("Invalid string in expression: "+t);r.push(n+t),n="",t=""}else if((t.substring(0,o).match(/"/g)||[]).length%2==0)r.push(n+t.substring(0,o)),n="",t=t.substring(o+1);else{const e=t.substring(o).search('"');if(-1===e)throw new u("Invalid string in expression: "+t);n+=t.substring(0,o+e+1),t=t.substring(o+e+1)}}return n&&r.push(n),r}e.OutputError=u},4106:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SpeechRuleContext=void 0;const n=r(5274),o=r(5662);e.SpeechRuleContext=class{constructor(){this.customQueries=new o.CustomQueries,this.customStrings=new o.CustomStrings,this.contextFunctions=new o.ContextFunctions,this.customGenerators=new o.CustomGenerators}applyCustomQuery(t,e){const r=this.customQueries.lookup(e);return r?r(t):null}applySelector(t,e){return this.applyCustomQuery(t,e)||n.evalXPath(e,t)}applyQuery(t,e){const r=this.applySelector(t,e);return r.length>0?r[0]:null}applyConstraint(t,e){return!!this.applyQuery(t,e)||n.evaluateBoolean(e,t)}constructString(t,e){if(!e)return"";if('"'===e.charAt(0))return e.slice(1,-1);const r=this.customStrings.lookup(e);return r?r(t):n.evaluateString(e,t)}parse(t){const e=Array.isArray(t)?t:Object.entries(t);for(let t,r=0;t=e[r];r++){switch(t[0].slice(0,3)){case"CQF":this.customQueries.add(t[0],t[1]);break;case"CSF":this.customStrings.add(t[0],t[1]);break;case"CTF":this.contextFunctions.add(t[0],t[1]);break;case"CGF":this.customGenerators.add(t[0],t[1]);break;default:console.error("FunctionError: Invalid function name "+t[0])}}}}},2362:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.storeFactory=e.SpeechRuleEngine=void 0;const n=r(7052),o=r(2057),i=r(5740),a=r(5897),s=r(4440),l=r(5274),c=r(7283),u=r(7599),p=r(2469),h=r(1676),d=r(2105),f=r(9935),m=r(4650),y=r(4508);class g{constructor(){this.trie=null,this.evaluators_={},this.trie=new y.Trie}static getInstance(){return g.instance=g.instance||new g,g.instance}static debugSpeechRule(t,e){const r=t.precondition,n=t.context.applyQuery(e,r.query);o.Debugger.getInstance().output(r.query,n?n.toString():n),r.constraints.forEach((r=>o.Debugger.getInstance().output(r,t.context.applyConstraint(e,r))))}static debugNamedSpeechRule(t,e){const r=g.getInstance().trie.collectRules().filter((e=>e.name==t));for(let n,i=0;n=r[i];i++)o.Debugger.getInstance().output("Rule",t,"DynamicCstr:",n.dynamicCstr.toString(),"number",i),g.debugSpeechRule(n,e)}evaluateNode(t){(0,l.updateEvaluator)(t);const e=(new Date).getTime();let r=[];try{r=this.evaluateNode_(t)}catch(t){console.error("Something went wrong computing speech."),o.Debugger.getInstance().output(t)}const n=(new Date).getTime();return o.Debugger.getInstance().output("Time:",n-e),r}toString(){return this.trie.collectRules().map((t=>t.toString())).join("\n")}runInSetting(t,e){const r=a.default.getInstance(),n={};for(const e in t)n[e]=r[e],r[e]=t[e];r.setDynamicCstr();const o=e();for(const t in n)r[t]=n[t];return r.setDynamicCstr(),o}addStore(t){const e=v(t);"abstract"!==e.kind&&e.getSpeechRules().forEach((t=>this.trie.addRule(t))),this.addEvaluator(e)}processGrammar(t,e,r){const n={};for(const o in r){const i=r[o];n[o]="string"==typeof i?t.constructString(e,i):i}d.Grammar.getInstance().pushState(n)}addEvaluator(t){const e=t.evaluateDefault.bind(t),r=this.evaluators_[t.locale];if(r)return void(r[t.modality]=e);const n={};n[t.modality]=e,this.evaluators_[t.locale]=n}getEvaluator(t,e){const r=this.evaluators_[t]||this.evaluators_[h.DynamicCstr.DEFAULT_VALUES[h.Axis.LOCALE]];return r[e]||r[h.DynamicCstr.DEFAULT_VALUES[h.Axis.MODALITY]]}enumerate(t){return this.trie.enumerate(t)}evaluateNode_(t){return t?(this.updateConstraint_(),this.evaluateTree_(t)):[]}evaluateTree_(t){const e=a.default.getInstance();let r;o.Debugger.getInstance().output(e.mode!==s.Mode.HTTP?t.toString():t),d.Grammar.getInstance().setAttribute(t);const i=this.lookupRule(t,e.dynamicCstr);if(!i)return e.strict?[]:(r=this.getEvaluator(e.locale,e.modality)(t),t.attributes&&this.addPersonality_(r,{},!1,t),r);o.Debugger.getInstance().generateOutput((()=>["Apply Rule:",i.name,i.dynamicCstr.toString(),(e.mode,s.Mode.HTTP,t).toString()]));const c=i.context,u=i.action.components;r=[];for(let e,o=0;e=u[o];o++){let o=[];const i=e.content||"",s=e.attributes||{};let u=!1;e.grammar&&this.processGrammar(c,t,e.grammar);let p=null;if(s.engine){p=a.default.getInstance().dynamicCstr.getComponents();const t=d.Grammar.parseInput(s.engine);a.default.getInstance().setDynamicCstr(t)}switch(e.type){case m.ActionType.NODE:{const e=c.applyQuery(t,i);e&&(o=this.evaluateTree_(e))}break;case m.ActionType.MULTI:{u=!0;const e=c.applySelector(t,i);e.length>0&&(o=this.evaluateNodeList_(c,e,s.sepFunc,c.constructString(t,s.separator),s.ctxtFunc,c.constructString(t,s.context)))}break;case m.ActionType.TEXT:{const e=s.span,r={};if(e){const n=(0,l.evalXPath)(e,t);n.length&&(r.extid=n[0].getAttribute("extid"))}const a=c.constructString(t,i);(a||""===a)&&(o=Array.isArray(a)?a.map((function(t){return n.AuditoryDescription.create({text:t.speech,attributes:t.attributes},{adjust:!0})})):[n.AuditoryDescription.create({text:a,attributes:r},{adjust:!0})])}break;case m.ActionType.PERSONALITY:default:o=[n.AuditoryDescription.create({text:i})]}o[0]&&!u&&(s.context&&(o[0].context=c.constructString(t,s.context)+(o[0].context||"")),s.annotation&&(o[0].annotation=s.annotation)),this.addLayout(o,s,u),e.grammar&&d.Grammar.getInstance().popState(),r=r.concat(this.addPersonality_(o,s,u,t)),p&&a.default.getInstance().setDynamicCstr(p)}return r}evaluateNodeList_(t,e,r,o,i,a){if(!e.length)return[];const s=o||"",l=a||"",c=t.contextFunctions.lookup(i),u=c?c(e,l):function(){return l},p=t.contextFunctions.lookup(r),h=p?p(e,s):function(){return[n.AuditoryDescription.create({text:s},{translate:!0})]};let d=[];for(let t,r=0;t=e[r];r++){const n=this.evaluateTree_(t);if(n.length>0&&(n[0].context=u()+(n[0].context||""),d=d.concat(n),r<e.length-1)){const t=h();d=d.concat(t)}}return d}addLayout(t,e,r){const o=e.layout;o&&(o.match(/^begin/)?t.unshift(new n.AuditoryDescription({text:"",layout:o})):o.match(/^end/)?t.push(new n.AuditoryDescription({text:"",layout:o})):(t.unshift(new n.AuditoryDescription({text:"",layout:`begin${o}`})),t.push(new n.AuditoryDescription({text:"",layout:`end${o}`}))))}addPersonality_(t,e,r,o){const i={};let a=null;for(const t of s.personalityPropList){const r=e[t];if(void 0===r)continue;const n=parseFloat(r),o=isNaN(n)?'"'===r.charAt(0)?r.slice(1,-1):r:n;t===s.personalityProps.PAUSE?a=o:i[t]=o}for(let e,r=0;e=t[r];r++)this.addRelativePersonality_(e,i),this.addExternalAttributes_(e,o);if(r&&t.length&&delete t[t.length-1].personality[s.personalityProps.JOIN],a&&t.length){const e=t[t.length-1];e.text||Object.keys(e.personality).length?t.push(n.AuditoryDescription.create({text:"",personality:{pause:a}})):e.personality[s.personalityProps.PAUSE]=a}return t}addExternalAttributes_(t,e){if(e.hasAttributes()){const r=e.attributes;for(let e=r.length-1;e>=0;e--){const n=r[e].name;!t.attributes[n]&&n.match(/^ext/)&&(t.attributes[n]=r[e].value)}}}addRelativePersonality_(t,e){if(!t.personality)return t.personality=e,t;const r=t.personality;for(const t in e)r[t]&&"number"==typeof r[t]&&"number"==typeof e[t]?r[t]=r[t]+e[t]:r[t]||(r[t]=e[t]);return t}updateConstraint_(){const t=a.default.getInstance().dynamicCstr,e=a.default.getInstance().strict,r=this.trie,n={};let o=t.getValue(h.Axis.LOCALE),i=t.getValue(h.Axis.MODALITY),s=t.getValue(h.Axis.DOMAIN);r.hasSubtrie([o,i,s])||(s=h.DynamicCstr.DEFAULT_VALUES[h.Axis.DOMAIN],r.hasSubtrie([o,i,s])||(i=h.DynamicCstr.DEFAULT_VALUES[h.Axis.MODALITY],r.hasSubtrie([o,i,s])||(o=h.DynamicCstr.DEFAULT_VALUES[h.Axis.LOCALE]))),n[h.Axis.LOCALE]=[o],n[h.Axis.MODALITY]=["summary"!==i?i:h.DynamicCstr.DEFAULT_VALUES[h.Axis.MODALITY]],n[h.Axis.DOMAIN]=["speech"!==i?h.DynamicCstr.DEFAULT_VALUES[h.Axis.DOMAIN]:s];const l=t.getOrder();for(let r,o=0;r=l[o];o++)if(!n[r]){const o=t.getValue(r),i=this.makeSet_(o,t.preference),a=h.DynamicCstr.DEFAULT_VALUES[r];e||o===a||i.push(a),n[r]=i}t.updateProperties(n)}makeSet_(t,e){return e&&Object.keys(e).length?t.split(":"):[t]}lookupRule(t,e){if(!t||t.nodeType!==i.NodeType.ELEMENT_NODE&&t.nodeType!==i.NodeType.TEXT_NODE)return null;const r=this.lookupRules(t,e);return r.length>0?this.pickMostConstraint_(e,r):null}lookupRules(t,e){return this.trie.lookupRules(t,e.allProperties())}pickMostConstraint_(t,e){const r=a.default.getInstance().comparator;return e.sort((function(t,e){return r.compare(t.dynamicCstr,e.dynamicCstr)||e.precondition.priority-t.precondition.priority||e.precondition.constraints.length-t.precondition.constraints.length||e.precondition.rank-t.precondition.rank})),o.Debugger.getInstance().generateOutput((()=>e.map((t=>t.name+"("+t.dynamicCstr.toString()+")"))).bind(this)),e[0]}}e.SpeechRuleEngine=g;const b=new Map;function v(t){const e=`${t.locale}.${t.modality}.${t.domain}`;if("actions"===t.kind){const r=b.get(e);return r.parse(t),r}u.init(),t&&!t.functions&&(t.functions=c.getStore(t.locale,t.modality,t.domain));const r="braille"===t.modality?new p.BrailleStore:new f.MathStore;return b.set(e,r),t.inherits&&(r.inherits=b.get(`${t.inherits}.${t.modality}.${t.domain}`)),r.parse(t),r.initialize(),r}e.storeFactory=v,a.default.nodeEvaluator=g.getInstance().evaluateNode.bind(g.getInstance())},5662:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.CustomGenerators=e.ContextFunctions=e.CustomStrings=e.CustomQueries=void 0;class r{constructor(t,e){this.prefix=t,this.store=e}add(t,e){this.checkCustomFunctionSyntax_(t)&&(this.store[t]=e)}addStore(t){const e=Object.keys(t.store);for(let r,n=0;r=e[n];n++)this.add(r,t.store[r])}lookup(t){return this.store[t]}checkCustomFunctionSyntax_(t){const e=new RegExp("^"+this.prefix);return!!t.match(e)||(console.error("FunctionError: Invalid function name. Expected prefix "+this.prefix),!1)}}e.CustomQueries=class extends r{constructor(){super("CQF",{})}};e.CustomStrings=class extends r{constructor(){super("CSF",{})}};e.ContextFunctions=class extends r{constructor(){super("CTF",{})}};e.CustomGenerators=class extends r{constructor(){super("CGF",{})}}},365:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.contentIterator=e.pauseSeparator=e.nodeCounter=void 0;const n=r(7052),o=r(5274),i=r(5897);e.nodeCounter=function(t,e){const r=t.length;let n=0,o=e;return e||(o=""),function(){return n<r&&(n+=1),o+" "+n}},e.pauseSeparator=function(t,e){const r=parseFloat(e),o=isNaN(r)?e:r;return function(){return[n.AuditoryDescription.create({text:"",personality:{pause:o}})]}},e.contentIterator=function(t,e){let r;return r=t.length>0?o.evalXPath("../../content/*",t[0]):[],function(){const t=r.shift(),o=e?[n.AuditoryDescription.create({text:e},{translate:!0})]:[];if(!t)return o;const a=i.default.evaluateNode(t);return o.concat(a)}}},1414:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.getTreeFromString=e.getTree=e.xmlTree=void 0;const n=r(5740),o=r(7075);function i(t){return new o.SemanticTree(t)}e.xmlTree=function(t){return i(t).xml()},e.getTree=i,e.getTreeFromString=function(t){return i(n.parseInput(t))}},7630:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.annotate=e.activate=e.register=e.visitors=e.annotators=void 0;const n=r(9265);e.annotators=new Map,e.visitors=new Map,e.register=function(t){const r=t.domain+":"+t.name;t instanceof n.SemanticAnnotator?e.annotators.set(r,t):e.visitors.set(r,t)},e.activate=function(t,r){const n=t+":"+r,o=e.annotators.get(n)||e.visitors.get(n);o&&(o.active=!0)},e.annotate=function(t){for(const r of e.annotators.values())r.active&&r.annotate(t);for(const r of e.visitors.values())r.active&&r.visit(t,Object.assign({},r.def))}},9265:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.SemanticVisitor=e.SemanticAnnotator=void 0;e.SemanticAnnotator=class{constructor(t,e,r){this.domain=t,this.name=e,this.func=r,this.active=!1}annotate(t){t.childNodes.forEach(this.annotate.bind(this)),t.addAnnotation(this.domain,this.func(t))}};e.SemanticVisitor=class{constructor(t,e,r,n={}){this.domain=t,this.name=e,this.func=r,this.def=n,this.active=!1}visit(t,e){let r=this.func(t,e);t.addAnnotation(this.domain,r[0]);for(let e,n=0;e=t.childNodes[n];n++)r=this.visit(e,r[1]);return r}}},3588:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.lookupSecondary=e.isEmbellishedType=e.isMatchingFence=e.functionApplication=e.invisibleComma=e.invisiblePlus=e.invisibleTimes=e.lookupMeaning=e.lookupRole=e.lookupType=e.equal=e.allLettersRegExp=void 0;const r=String.fromCodePoint(8291),n=["\uff0c","\ufe50",",",r],o=["\xaf","\u2012","\u2013","\u2014","\u2015","\ufe58","-","\u207b","\u208b","\u2212","\u2796","\ufe63","\uff0d","\u2010","\u2011","\u203e","_"],i=["~","\u0303","\u223c","\u02dc","\u223d","\u02f7","\u0334","\u0330"],a={"(":")","[":"]","{":"}","\u2045":"\u2046","\u2329":"\u232a","\u2768":"\u2769","\u276a":"\u276b","\u276c":"\u276d","\u276e":"\u276f","\u2770":"\u2771","\u2772":"\u2773","\u2774":"\u2775","\u27c5":"\u27c6","\u27e6":"\u27e7","\u27e8":"\u27e9","\u27ea":"\u27eb","\u27ec":"\u27ed","\u27ee":"\u27ef","\u2983":"\u2984","\u2985":"\u2986","\u2987":"\u2988","\u2989":"\u298a","\u298b":"\u298c","\u298d":"\u298e","\u298f":"\u2990","\u2991":"\u2992","\u2993":"\u2994","\u2995":"\u2996","\u2997":"\u2998","\u29d8":"\u29d9","\u29da":"\u29db","\u29fc":"\u29fd","\u2e22":"\u2e23","\u2e24":"\u2e25","\u2e26":"\u2e27","\u2e28":"\u2e29","\u3008":"\u3009","\u300a":"\u300b","\u300c":"\u300d","\u300e":"\u300f","\u3010":"\u3011","\u3014":"\u3015","\u3016":"\u3017","\u3018":"\u3019","\u301a":"\u301b","\u301d":"\u301e","\ufd3e":"\ufd3f","\ufe17":"\ufe18","\ufe59":"\ufe5a","\ufe5b":"\ufe5c","\ufe5d":"\ufe5e","\uff08":"\uff09","\uff3b":"\uff3d","\uff5b":"\uff5d","\uff5f":"\uff60","\uff62":"\uff63","\u2308":"\u2309","\u230a":"\u230b","\u230c":"\u230d","\u230e":"\u230f","\u231c":"\u231d","\u231e":"\u231f","\u239b":"\u239e","\u239c":"\u239f","\u239d":"\u23a0","\u23a1":"\u23a4","\u23a2":"\u23a5","\u23a3":"\u23a6","\u23a7":"\u23ab","\u23a8":"\u23ac","\u23a9":"\u23ad","\u23b0":"\u23b1","\u23b8":"\u23b9"},s={"\u23b4":"\u23b5","\u23dc":"\u23dd","\u23de":"\u23df","\u23e0":"\u23e1","\ufe35":"\ufe36","\ufe37":"\ufe38","\ufe39":"\ufe3a","\ufe3b":"\ufe3c","\ufe3d":"\ufe3e","\ufe3f":"\ufe40","\ufe41":"\ufe42","\ufe43":"\ufe44","\ufe47":"\ufe48"},l=Object.keys(a),c=Object.values(a);c.push("\u301f");const u=Object.keys(s),p=Object.values(s),h=["|","\xa6","\u2223","\u23d0","\u23b8","\u23b9","\u2758","\uff5c","\uffe4","\ufe31","\ufe32"],d=["\u2016","\u2225","\u2980","\u2af4"],f=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],m=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","\u0131","\u0237"],y=["\uff21","\uff22","\uff23","\uff24","\uff25","\uff26","\uff27","\uff28","\uff29","\uff2a","\uff2b","\uff2c","\uff2d","\uff2e","\uff2f","\uff30","\uff31","\uff32","\uff33","\uff34","\uff35","\uff36","\uff37","\uff38","\uff39","\uff3a"],g=["\uff41","\uff42","\uff43","\uff44","\uff45","\uff46","\uff47","\uff48","\uff49","\uff4a","\uff4b","\uff4c","\uff4d","\uff4e","\uff4f","\uff50","\uff51","\uff52","\uff53","\uff54","\uff55","\uff56","\uff57","\uff58","\uff59","\uff5a"],b=["\ud835\udc00","\ud835\udc01","\ud835\udc02","\ud835\udc03","\ud835\udc04","\ud835\udc05","\ud835\udc06","\ud835\udc07","\ud835\udc08","\ud835\udc09","\ud835\udc0a","\ud835\udc0b","\ud835\udc0c","\ud835\udc0d","\ud835\udc0e","\ud835\udc0f","\ud835\udc10","\ud835\udc11","\ud835\udc12","\ud835\udc13","\ud835\udc14","\ud835\udc15","\ud835\udc16","\ud835\udc17","\ud835\udc18","\ud835\udc19"],v=["\ud835\udc1a","\ud835\udc1b","\ud835\udc1c","\ud835\udc1d","\ud835\udc1e","\ud835\udc1f","\ud835\udc20","\ud835\udc21","\ud835\udc22","\ud835\udc23","\ud835\udc24","\ud835\udc25","\ud835\udc26","\ud835\udc27","\ud835\udc28","\ud835\udc29","\ud835\udc2a","\ud835\udc2b","\ud835\udc2c","\ud835\udc2d","\ud835\udc2e","\ud835\udc2f","\ud835\udc30","\ud835\udc31","\ud835\udc32","\ud835\udc33"],_=["\ud835\udc34","\ud835\udc35","\ud835\udc36","\ud835\udc37","\ud835\udc38","\ud835\udc39","\ud835\udc3a","\ud835\udc3b","\ud835\udc3c","\ud835\udc3d","\ud835\udc3e","\ud835\udc3f","\ud835\udc40","\ud835\udc41","\ud835\udc42","\ud835\udc43","\ud835\udc44","\ud835\udc45","\ud835\udc46","\ud835\udc47","\ud835\udc48","\ud835\udc49","\ud835\udc4a","\ud835\udc4b","\ud835\udc4c","\ud835\udc4d"],S=["\ud835\udc4e","\ud835\udc4f","\ud835\udc50","\ud835\udc51","\ud835\udc52","\ud835\udc53","\ud835\udc54","\u210e","\ud835\udc56","\ud835\udc57","\ud835\udc58","\ud835\udc59","\ud835\udc5a","\ud835\udc5b","\ud835\udc5c","\ud835\udc5d","\ud835\udc5e","\ud835\udc5f","\ud835\udc60","\ud835\udc61","\ud835\udc62","\ud835\udc63","\ud835\udc64","\ud835\udc65","\ud835\udc66","\ud835\udc67","\ud835\udea4","\ud835\udea5"],x=["\ud835\udc68","\ud835\udc69","\ud835\udc6a","\ud835\udc6b","\ud835\udc6c","\ud835\udc6d","\ud835\udc6e","\ud835\udc6f","\ud835\udc70","\ud835\udc71","\ud835\udc72","\ud835\udc73","\ud835\udc74","\ud835\udc75","\ud835\udc76","\ud835\udc77","\ud835\udc78","\ud835\udc79","\ud835\udc7a","\ud835\udc7b","\ud835\udc7c","\ud835\udc7d","\ud835\udc7e","\ud835\udc7f","\ud835\udc80","\ud835\udc81"],M=["\ud835\udc82","\ud835\udc83","\ud835\udc84","\ud835\udc85","\ud835\udc86","\ud835\udc87","\ud835\udc88","\ud835\udc89","\ud835\udc8a","\ud835\udc8b","\ud835\udc8c","\ud835\udc8d","\ud835\udc8e","\ud835\udc8f","\ud835\udc90","\ud835\udc91","\ud835\udc92","\ud835\udc93","\ud835\udc94","\ud835\udc95","\ud835\udc96","\ud835\udc97","\ud835\udc98","\ud835\udc99","\ud835\udc9a","\ud835\udc9b"],O=["\ud835\udc9c","\u212c","\ud835\udc9e","\ud835\udc9f","\u2130","\u2131","\ud835\udca2","\u210b","\u2110","\ud835\udca5","\ud835\udca6","\u2112","\u2133","\ud835\udca9","\ud835\udcaa","\ud835\udcab","\ud835\udcac","\u211b","\ud835\udcae","\ud835\udcaf","\ud835\udcb0","\ud835\udcb1","\ud835\udcb2","\ud835\udcb3","\ud835\udcb4","\ud835\udcb5","\u2118"],E=["\ud835\udcb6","\ud835\udcb7","\ud835\udcb8","\ud835\udcb9","\u212f","\ud835\udcbb","\u210a","\ud835\udcbd","\ud835\udcbe","\ud835\udcbf","\ud835\udcc0","\ud835\udcc1","\ud835\udcc2","\ud835\udcc3","\u2134","\ud835\udcc5","\ud835\udcc6","\ud835\udcc7","\ud835\udcc8","\ud835\udcc9","\ud835\udcca","\ud835\udccb","\ud835\udccc","\ud835\udccd","\ud835\udcce","\ud835\udccf","\u2113"],A=["\ud835\udcd0","\ud835\udcd1","\ud835\udcd2","\ud835\udcd3","\ud835\udcd4","\ud835\udcd5","\ud835\udcd6","\ud835\udcd7","\ud835\udcd8","\ud835\udcd9","\ud835\udcda","\ud835\udcdb","\ud835\udcdc","\ud835\udcdd","\ud835\udcde","\ud835\udcdf","\ud835\udce0","\ud835\udce1","\ud835\udce2","\ud835\udce3","\ud835\udce4","\ud835\udce5","\ud835\udce6","\ud835\udce7","\ud835\udce8","\ud835\udce9"],C=["\ud835\udcea","\ud835\udceb","\ud835\udcec","\ud835\udced","\ud835\udcee","\ud835\udcef","\ud835\udcf0","\ud835\udcf1","\ud835\udcf2","\ud835\udcf3","\ud835\udcf4","\ud835\udcf5","\ud835\udcf6","\ud835\udcf7","\ud835\udcf8","\ud835\udcf9","\ud835\udcfa","\ud835\udcfb","\ud835\udcfc","\ud835\udcfd","\ud835\udcfe","\ud835\udcff","\ud835\udd00","\ud835\udd01","\ud835\udd02","\ud835\udd03"],w=["\ud835\udd04","\ud835\udd05","\u212d","\ud835\udd07","\ud835\udd08","\ud835\udd09","\ud835\udd0a","\u210c","\u2111","\ud835\udd0d","\ud835\udd0e","\ud835\udd0f","\ud835\udd10","\ud835\udd11","\ud835\udd12","\ud835\udd13","\ud835\udd14","\u211c","\ud835\udd16","\ud835\udd17","\ud835\udd18","\ud835\udd19","\ud835\udd1a","\ud835\udd1b","\ud835\udd1c","\u2128"],T=["\ud835\udd1e","\ud835\udd1f","\ud835\udd20","\ud835\udd21","\ud835\udd22","\ud835\udd23","\ud835\udd24","\ud835\udd25","\ud835\udd26","\ud835\udd27","\ud835\udd28","\ud835\udd29","\ud835\udd2a","\ud835\udd2b","\ud835\udd2c","\ud835\udd2d","\ud835\udd2e","\ud835\udd2f","\ud835\udd30","\ud835\udd31","\ud835\udd32","\ud835\udd33","\ud835\udd34","\ud835\udd35","\ud835\udd36","\ud835\udd37"],N=["\ud835\udd38","\ud835\udd39","\u2102","\ud835\udd3b","\ud835\udd3c","\ud835\udd3d","\ud835\udd3e","\u210d","\ud835\udd40","\ud835\udd41","\ud835\udd42","\ud835\udd43","\ud835\udd44","\u2115","\ud835\udd46","\u2119","\u211a","\u211d","\ud835\udd4a","\ud835\udd4b","\ud835\udd4c","\ud835\udd4d","\ud835\udd4e","\ud835\udd4f","\ud835\udd50","\u2124"],L=["\ud835\udd52","\ud835\udd53","\ud835\udd54","\ud835\udd55","\ud835\udd56","\ud835\udd57","\ud835\udd58","\ud835\udd59","\ud835\udd5a","\ud835\udd5b","\ud835\udd5c","\ud835\udd5d","\ud835\udd5e","\ud835\udd5f","\ud835\udd60","\ud835\udd61","\ud835\udd62","\ud835\udd63","\ud835\udd64","\ud835\udd65","\ud835\udd66","\ud835\udd67","\ud835\udd68","\ud835\udd69","\ud835\udd6a","\ud835\udd6b"],P=["\ud835\udd6c","\ud835\udd6d","\ud835\udd6e","\ud835\udd6f","\ud835\udd70","\ud835\udd71","\ud835\udd72","\ud835\udd73","\ud835\udd74","\ud835\udd75","\ud835\udd76","\ud835\udd77","\ud835\udd78","\ud835\udd79","\ud835\udd7a","\ud835\udd7b","\ud835\udd7c","\ud835\udd7d","\ud835\udd7e","\ud835\udd7f","\ud835\udd80","\ud835\udd81","\ud835\udd82","\ud835\udd83","\ud835\udd84","\ud835\udd85"],I=["\ud835\udd86","\ud835\udd87","\ud835\udd88","\ud835\udd89","\ud835\udd8a","\ud835\udd8b","\ud835\udd8c","\ud835\udd8d","\ud835\udd8e","\ud835\udd8f","\ud835\udd90","\ud835\udd91","\ud835\udd92","\ud835\udd93","\ud835\udd94","\ud835\udd95","\ud835\udd96","\ud835\udd97","\ud835\udd98","\ud835\udd99","\ud835\udd9a","\ud835\udd9b","\ud835\udd9c","\ud835\udd9d","\ud835\udd9e","\ud835\udd9f"],k=["\ud835\udda0","\ud835\udda1","\ud835\udda2","\ud835\udda3","\ud835\udda4","\ud835\udda5","\ud835\udda6","\ud835\udda7","\ud835\udda8","\ud835\udda9","\ud835\uddaa","\ud835\uddab","\ud835\uddac","\ud835\uddad","\ud835\uddae","\ud835\uddaf","\ud835\uddb0","\ud835\uddb1","\ud835\uddb2","\ud835\uddb3","\ud835\uddb4","\ud835\uddb5","\ud835\uddb6","\ud835\uddb7","\ud835\uddb8","\ud835\uddb9"],R=["\ud835\uddba","\ud835\uddbb","\ud835\uddbc","\ud835\uddbd","\ud835\uddbe","\ud835\uddbf","\ud835\uddc0","\ud835\uddc1","\ud835\uddc2","\ud835\uddc3","\ud835\uddc4","\ud835\uddc5","\ud835\uddc6","\ud835\uddc7","\ud835\uddc8","\ud835\uddc9","\ud835\uddca","\ud835\uddcb","\ud835\uddcc","\ud835\uddcd","\ud835\uddce","\ud835\uddcf","\ud835\uddd0","\ud835\uddd1","\ud835\uddd2","\ud835\uddd3"],j=["\ud835\uddd4","\ud835\uddd5","\ud835\uddd6","\ud835\uddd7","\ud835\uddd8","\ud835\uddd9","\ud835\uddda","\ud835\udddb","\ud835\udddc","\ud835\udddd","\ud835\uddde","\ud835\udddf","\ud835\udde0","\ud835\udde1","\ud835\udde2","\ud835\udde3","\ud835\udde4","\ud835\udde5","\ud835\udde6","\ud835\udde7","\ud835\udde8","\ud835\udde9","\ud835\uddea","\ud835\uddeb","\ud835\uddec","\ud835\udded"],B=["\ud835\uddee","\ud835\uddef","\ud835\uddf0","\ud835\uddf1","\ud835\uddf2","\ud835\uddf3","\ud835\uddf4","\ud835\uddf5","\ud835\uddf6","\ud835\uddf7","\ud835\uddf8","\ud835\uddf9","\ud835\uddfa","\ud835\uddfb","\ud835\uddfc","\ud835\uddfd","\ud835\uddfe","\ud835\uddff","\ud835\ude00","\ud835\ude01","\ud835\ude02","\ud835\ude03","\ud835\ude04","\ud835\ude05","\ud835\ude06","\ud835\ude07"],D=["\ud835\ude08","\ud835\ude09","\ud835\ude0a","\ud835\ude0b","\ud835\ude0c","\ud835\ude0d","\ud835\ude0e","\ud835\ude0f","\ud835\ude10","\ud835\ude11","\ud835\ude12","\ud835\ude13","\ud835\ude14","\ud835\ude15","\ud835\ude16","\ud835\ude17","\ud835\ude18","\ud835\ude19","\ud835\ude1a","\ud835\ude1b","\ud835\ude1c","\ud835\ude1d","\ud835\ude1e","\ud835\ude1f","\ud835\ude20","\ud835\ude21"],F=["\ud835\ude22","\ud835\ude23","\ud835\ude24","\ud835\ude25","\ud835\ude26","\ud835\ude27","\ud835\ude28","\ud835\ude29","\ud835\ude2a","\ud835\ude2b","\ud835\ude2c","\ud835\ude2d","\ud835\ude2e","\ud835\ude2f","\ud835\ude30","\ud835\ude31","\ud835\ude32","\ud835\ude33","\ud835\ude34","\ud835\ude35","\ud835\ude36","\ud835\ude37","\ud835\ude38","\ud835\ude39","\ud835\ude3a","\ud835\ude3b"],H=["\ud835\ude3c","\ud835\ude3d","\ud835\ude3e","\ud835\ude3f","\ud835\ude40","\ud835\ude41","\ud835\ude42","\ud835\ude43","\ud835\ude44","\ud835\ude45","\ud835\ude46","\ud835\ude47","\ud835\ude48","\ud835\ude49","\ud835\ude4a","\ud835\ude4b","\ud835\ude4c","\ud835\ude4d","\ud835\ude4e","\ud835\ude4f","\ud835\ude50","\ud835\ude51","\ud835\ude52","\ud835\ude53","\ud835\ude54","\ud835\ude55"],q=["\ud835\ude56","\ud835\ude57","\ud835\ude58","\ud835\ude59","\ud835\ude5a","\ud835\ude5b","\ud835\ude5c","\ud835\ude5d","\ud835\ude5e","\ud835\ude5f","\ud835\ude60","\ud835\ude61","\ud835\ude62","\ud835\ude63","\ud835\ude64","\ud835\ude65","\ud835\ude66","\ud835\ude67","\ud835\ude68","\ud835\ude69","\ud835\ude6a","\ud835\ude6b","\ud835\ude6c","\ud835\ude6d","\ud835\ude6e","\ud835\ude6f"],U=["\ud835\ude70","\ud835\ude71","\ud835\ude72","\ud835\ude73","\ud835\ude74","\ud835\ude75","\ud835\ude76","\ud835\ude77","\ud835\ude78","\ud835\ude79","\ud835\ude7a","\ud835\ude7b","\ud835\ude7c","\ud835\ude7d","\ud835\ude7e","\ud835\ude7f","\ud835\ude80","\ud835\ude81","\ud835\ude82","\ud835\ude83","\ud835\ude84","\ud835\ude85","\ud835\ude86","\ud835\ude87","\ud835\ude88","\ud835\ude89"],G=["\ud835\ude8a","\ud835\ude8b","\ud835\ude8c","\ud835\ude8d","\ud835\ude8e","\ud835\ude8f","\ud835\ude90","\ud835\ude91","\ud835\ude92","\ud835\ude93","\ud835\ude94","\ud835\ude95","\ud835\ude96","\ud835\ude97","\ud835\ude98","\ud835\ude99","\ud835\ude9a","\ud835\ude9b","\ud835\ude9c","\ud835\ude9d","\ud835\ude9e","\ud835\ude9f","\ud835\udea0","\ud835\udea1","\ud835\udea2","\ud835\udea3"],V=["\u2145","\u2146","\u2147","\u2148","\u2149"],X=["\u0391","\u0392","\u0393","\u0394","\u0395","\u0396","\u0397","\u0398","\u0399","\u039a","\u039b","\u039c","\u039d","\u039e","\u039f","\u03a0","\u03a1","\u03a3","\u03a4","\u03a5","\u03a6","\u03a7","\u03a8","\u03a9"],W=["\u03b1","\u03b2","\u03b3","\u03b4","\u03b5","\u03b6","\u03b7","\u03b8","\u03b9","\u03ba","\u03bb","\u03bc","\u03bd","\u03be","\u03bf","\u03c0","\u03c1","\u03c2","\u03c3","\u03c4","\u03c5","\u03c6","\u03c7","\u03c8","\u03c9"],z=["\ud835\udea8","\ud835\udea9","\ud835\udeaa","\ud835\udeab","\ud835\udeac","\ud835\udead","\ud835\udeae","\ud835\udeaf","\ud835\udeb0","\ud835\udeb1","\ud835\udeb2","\ud835\udeb3","\ud835\udeb4","\ud835\udeb5","\ud835\udeb6","\ud835\udeb7","\ud835\udeb8","\ud835\udeba","\ud835\udebb","\ud835\udebc","\ud835\udebd","\ud835\udebe","\ud835\udebf","\ud835\udec0"],$=["\ud835\udec2","\ud835\udec3","\ud835\udec4","\ud835\udec5","\ud835\udec6","\ud835\udec7","\ud835\udec8","\ud835\udec9","\ud835\udeca","\ud835\udecb","\ud835\udecc","\ud835\udecd","\ud835\udece","\ud835\udecf","\ud835\uded0","\ud835\uded1","\ud835\uded2","\ud835\uded3","\ud835\uded4","\ud835\uded5","\ud835\uded6","\ud835\uded7","\ud835\uded8","\ud835\uded9","\ud835\udeda"],J=["\ud835\udee2","\ud835\udee3","\ud835\udee4","\ud835\udee5","\ud835\udee6","\ud835\udee7","\ud835\udee8","\ud835\udee9","\ud835\udeea","\ud835\udeeb","\ud835\udeec","\ud835\udeed","\ud835\udeee","\ud835\udeef","\ud835\udef0","\ud835\udef1","\ud835\udef2","\ud835\udef4","\ud835\udef5","\ud835\udef6","\ud835\udef7","\ud835\udef8","\ud835\udef9","\ud835\udefa"],K=["\ud835\udefc","\ud835\udefd","\ud835\udefe","\ud835\udeff","\ud835\udf00","\ud835\udf01","\ud835\udf02","\ud835\udf03","\ud835\udf04","\ud835\udf05","\ud835\udf06","\ud835\udf07","\ud835\udf08","\ud835\udf09","\ud835\udf0a","\ud835\udf0b","\ud835\udf0c","\ud835\udf0d","\ud835\udf0e","\ud835\udf0f","\ud835\udf10","\ud835\udf11","\ud835\udf12","\ud835\udf13","\ud835\udf14"],Y=["\ud835\udf1c","\ud835\udf1d","\ud835\udf1e","\ud835\udf1f","\ud835\udf20","\ud835\udf21","\ud835\udf22","\ud835\udf23","\ud835\udf24","\ud835\udf25","\ud835\udf26","\ud835\udf27","\ud835\udf28","\ud835\udf29","\ud835\udf2a","\ud835\udf2b","\ud835\udf2c","\ud835\udf2e","\ud835\udf2f","\ud835\udf30","\ud835\udf31","\ud835\udf32","\ud835\udf33","\ud835\udf34"],Z=["\ud835\udf36","\ud835\udf37","\ud835\udf38","\ud835\udf39","\ud835\udf3a","\ud835\udf3b","\ud835\udf3c","\ud835\udf3d","\ud835\udf3e","\ud835\udf3f","\ud835\udf40","\ud835\udf41","\ud835\udf42","\ud835\udf43","\ud835\udf44","\ud835\udf45","\ud835\udf46","\ud835\udf47","\ud835\udf48","\ud835\udf49","\ud835\udf4a","\ud835\udf4b","\ud835\udf4c","\ud835\udf4d","\ud835\udf4e"],Q=["\ud835\udf56","\ud835\udf57","\ud835\udf58","\ud835\udf59","\ud835\udf5a","\ud835\udf5b","\ud835\udf5c","\ud835\udf5d","\ud835\udf5e","\ud835\udf5f","\ud835\udf60","\ud835\udf61","\ud835\udf62","\ud835\udf63","\ud835\udf64","\ud835\udf65","\ud835\udf66","\ud835\udf68","\ud835\udf69","\ud835\udf6a","\ud835\udf6b","\ud835\udf6c","\ud835\udf6d","\ud835\udf6e"],tt=["\ud835\udf70","\ud835\udf71","\ud835\udf72","\ud835\udf73","\ud835\udf74","\ud835\udf75","\ud835\udf76","\ud835\udf77","\ud835\udf78","\ud835\udf79","\ud835\udf7a","\ud835\udf7b","\ud835\udf7c","\ud835\udf7d","\ud835\udf7e","\ud835\udf7f","\ud835\udf80","\ud835\udf81","\ud835\udf82","\ud835\udf83","\ud835\udf84","\ud835\udf85","\ud835\udf86","\ud835\udf87","\ud835\udf88"],et=["\ud835\udf90","\ud835\udf91","\ud835\udf92","\ud835\udf93","\ud835\udf94","\ud835\udf95","\ud835\udf96","\ud835\udf97","\ud835\udf98","\ud835\udf99","\ud835\udf9a","\ud835\udf9b","\ud835\udf9c","\ud835\udf9d","\ud835\udf9e","\ud835\udf9f","\ud835\udfa0","\ud835\udfa2","\ud835\udfa3","\ud835\udfa4","\ud835\udfa5","\ud835\udfa6","\ud835\udfa7","\ud835\udfa8"],rt=["\ud835\udfaa","\ud835\udfab","\ud835\udfac","\ud835\udfad","\ud835\udfae","\ud835\udfaf","\ud835\udfb0","\ud835\udfb1","\ud835\udfb2","\ud835\udfb3","\ud835\udfb4","\ud835\udfb5","\ud835\udfb6","\ud835\udfb7","\ud835\udfb8","\ud835\udfb9","\ud835\udfba","\ud835\udfbb","\ud835\udfbc","\ud835\udfbd","\ud835\udfbe","\ud835\udfbf","\ud835\udfc0","\ud835\udfc1","\ud835\udfc2"],nt=["\u213c","\u213d","\u213e","\u213f"],ot=["\u03d0","\u03d1","\u03d5","\u03d6","\u03d7","\u03f0","\u03f1","\u03f5","\u03f6","\u03f4"],it=["\ud835\udedc","\ud835\udedd","\ud835\udede","\ud835\udedf","\ud835\udee0","\ud835\udee1"],at=["\ud835\udf16","\ud835\udf17","\ud835\udf18","\ud835\udf19","\ud835\udf1a","\ud835\udf1b"],st=["\ud835\udf8a","\ud835\udf8b","\ud835\udf8c","\ud835\udf8d","\ud835\udf8e","\ud835\udf8f"],lt=["\u2135","\u2136","\u2137","\u2138"],ct=f.concat(m,y,g,b,v,_,x,M,S,O,E,A,C,w,T,N,L,P,I,k,R,j,B,D,F,H,q,U,G,V,X,W,z,$,J,K,Y,Z,Q,tt,nt,ot,et,rt,it,at,st,lt);e.allLettersRegExp=new RegExp(ct.join("|"));const ut=["+","\xb1","\u2213","\u2214","\u2227","\u2228","\u2229","\u222a","\u228c","\u228d","\u228e","\u2293","\u2294","\u229d","\u229e","\u22a4","\u22a5","\u22ba","\u22bb","\u22bc","\u22c4","\u22ce","\u22cf","\u22d2","\u22d3","\u2a5e","\u2295","\u22d4"],pt=String.fromCodePoint(8292);ut.push(pt);const ht=["\u2020","\u2021","\u2210","\u2217","\u2218","\u2219","\u2240","\u229a","\u229b","\u22a0","\u22a1","\u22c5","\u22c6","\u22c7","\u22c8","\u22c9","\u22ca","\u22cb","\u22cc","\u25cb","\xb7","*","\u2297","\u2299"],dt=String.fromCodePoint(8290);ht.push(dt);const ft=String.fromCodePoint(8289),mt=["\xbc","\xbd","\xbe","\u2150","\u2151","\u2152","\u2153","\u2154","\u2155","\u2156","\u2157","\u2158","\u2159","\u215a","\u215b","\u215c","\u215d","\u215e","\u215f","\u2189"],yt=["\xb2","\xb3","\xb9","\u2070","\u2074","\u2075","\u2076","\u2077","\u2078","\u2079"].concat(["\u2080","\u2081","\u2082","\u2083","\u2084","\u2085","\u2086","\u2087","\u2088","\u2089"],["\u2460","\u2461","\u2462","\u2463","\u2464","\u2465","\u2466","\u2467","\u2468","\u2469","\u246a","\u246b","\u246c","\u246d","\u246e","\u246f","\u2470","\u2471","\u2472","\u2473","\u24ea","\u24eb","\u24ec","\u24ed","\u24ee","\u24ef","\u24f0","\u24f1","\u24f2","\u24f3","\u24f4","\u24f5","\u24f6","\u24f7","\u24f8","\u24f9","\u24fa","\u24fb","\u24fc","\u24fd","\u24fe","\u24ff","\u2776","\u2777","\u2778","\u2779","\u277a","\u277b","\u277c","\u277d","\u277e","\u277f","\u2780","\u2781","\u2782","\u2783","\u2784","\u2785","\u2786","\u2787","\u2788","\u2789","\u278a","\u278b","\u278c","\u278d","\u278e","\u278f","\u2790","\u2791","\u2792","\u2793","\u3248","\u3249","\u324a","\u324b","\u324c","\u324d","\u324e","\u324f","\u3251","\u3252","\u3253","\u3254","\u3255","\u3256","\u3257","\u3258","\u3259","\u325a","\u325b","\u325c","\u325d","\u325e","\u325f","\u32b1","\u32b2","\u32b3","\u32b4","\u32b5","\u32b6","\u32b7","\u32b8","\u32b9","\u32ba","\u32bb","\u32bc","\u32bd","\u32be","\u32bf"],["\u2474","\u2475","\u2476","\u2477","\u2478","\u2479","\u247a","\u247b","\u247c","\u247d","\u247e","\u247f","\u2480","\u2481","\u2482","\u2483","\u2484","\u2485","\u2486","\u2487"],["\u2488","\u2489","\u248a","\u248b","\u248c","\u248d","\u248e","\u248f","\u2490","\u2491","\u2492","\u2493","\u2494","\u2495","\u2496","\u2497","\u2498","\u2499","\u249a","\u249b","\ud83c\udd00","\ud83c\udd01","\ud83c\udd02","\ud83c\udd03","\ud83c\udd04","\ud83c\udd05","\ud83c\udd06","\ud83c\udd07","\ud83c\udd08","\ud83c\udd09","\ud83c\udd0a"]),gt=["cos","cot","csc","sec","sin","tan","arccos","arccot","arccsc","arcsec","arcsin","arctan","arc cos","arc cot","arc csc","arc sec","arc sin","arc tan"].concat(["cosh","coth","csch","sech","sinh","tanh","arcosh","arcoth","arcsch","arsech","arsinh","artanh","arccosh","arccoth","arccsch","arcsech","arcsinh","arctanh"],["deg","det","dim","hom","ker","Tr","tr"],["log","ln","lg","exp","expt","gcd","gcd","arg","im","re","Pr"]),bt=[{set:["!",'"',"#","%","&",";","?","@","\\","\xa1","\xa7","\xb6","\xbf","\u2017","\u2020","\u2021","\u2022","\u2023","\u2024","\u2025","\u2027","\u2030","\u2031","\u2038","\u203b","\u203c","\u203d","\u203e","\u2041","\u2042","\u2043","\u2047","\u2048","\u2049","\u204b","\u204c","\u204d","\u204e","\u204f","\u2050","\u2051","\u2053","\u2055","\u2056","\u2058","\u2059","\u205a","\u205b","\u205c","\u205d","\u205e","\ufe10","\ufe14","\ufe15","\ufe16","\ufe30","\ufe45","\ufe46","\ufe49","\ufe4a","\ufe4b","\ufe4c","\ufe54","\ufe56","\ufe57","\ufe5f","\ufe60","\ufe61","\ufe68","\ufe6a","\ufe6b","\uff01","\uff02","\uff03","\uff05","\uff06","\uff07","\uff0a","\uff0f","\uff1b","\uff1f","\uff20","\uff3c"],type:"punctuation",role:"unknown"},{set:["\ufe13",":","\uff1a","\ufe55"],type:"punctuation",role:"colon"},{set:n,type:"punctuation",role:"comma"},{set:["\u2026","\u22ee","\u22ef","\u22f0","\u22f1","\ufe19"],type:"punctuation",role:"ellipsis"},{set:[".","\ufe52","\uff0e"],type:"punctuation",role:"fullstop"},{set:o,type:"operator",role:"dash"},{set:i,type:"operator",role:"tilde"},{set:["'","\u2032","\u2033","\u2034","\u2035","\u2036","\u2037","\u2057","\u02b9","\u02ba"],type:"punctuation",role:"prime"},{set:["\xb0"],type:"punctuation",role:"degree"},{set:l,type:"fence",role:"open"},{set:c,type:"fence",role:"close"},{set:u,type:"fence",role:"top"},{set:p,type:"fence",role:"bottom"},{set:h,type:"fence",role:"neutral"},{set:d,type:"fence",role:"metric"},{set:m,type:"identifier",role:"latinletter",font:"normal"},{set:f,type:"identifier",role:"latinletter",font:"normal"},{set:g,type:"identifier",role:"latinletter",font:"normal"},{set:y,type:"identifier",role:"latinletter",font:"normal"},{set:v,type:"identifier",role:"latinletter",font:"bold"},{set:b,type:"identifier",role:"latinletter",font:"bold"},{set:S,type:"identifier",role:"latinletter",font:"italic"},{set:_,type:"identifier",role:"latinletter",font:"italic"},{set:M,type:"identifier",role:"latinletter",font:"bold-italic"},{set:x,type:"identifier",role:"latinletter",font:"bold-italic"},{set:E,type:"identifier",role:"latinletter",font:"script"},{set:O,type:"identifier",role:"latinletter",font:"script"},{set:C,type:"identifier",role:"latinletter",font:"bold-script"},{set:A,type:"identifier",role:"latinletter",font:"bold-script"},{set:T,type:"identifier",role:"latinletter",font:"fraktur"},{set:w,type:"identifier",role:"latinletter",font:"fraktur"},{set:L,type:"identifier",role:"latinletter",font:"double-struck"},{set:N,type:"identifier",role:"latinletter",font:"double-struck"},{set:I,type:"identifier",role:"latinletter",font:"bold-fraktur"},{set:P,type:"identifier",role:"latinletter",font:"bold-fraktur"},{set:R,type:"identifier",role:"latinletter",font:"sans-serif"},{set:k,type:"identifier",role:"latinletter",font:"sans-serif"},{set:B,type:"identifier",role:"latinletter",font:"sans-serif-bold"},{set:j,type:"identifier",role:"latinletter",font:"sans-serif-bold"},{set:F,type:"identifier",role:"latinletter",font:"sans-serif-italic"},{set:D,type:"identifier",role:"latinletter",font:"sans-serif-italic"},{set:q,type:"identifier",role:"latinletter",font:"sans-serif-bold-italic"},{set:H,type:"identifier",role:"latinletter",font:"sans-serif-bold-italic"},{set:G,type:"identifier",role:"latinletter",font:"monospace"},{set:U,type:"identifier",role:"latinletter",font:"monospace"},{set:V,type:"identifier",role:"latinletter",font:"double-struck-italic"},{set:W,type:"identifier",role:"greekletter",font:"normal"},{set:X,type:"identifier",role:"greekletter",font:"normal"},{set:$,type:"identifier",role:"greekletter",font:"bold"},{set:z,type:"identifier",role:"greekletter",font:"bold"},{set:K,type:"identifier",role:"greekletter",font:"italic"},{set:J,type:"identifier",role:"greekletter",font:"italic"},{set:Z,type:"identifier",role:"greekletter",font:"bold-italic"},{set:Y,type:"identifier",role:"greekletter",font:"bold-italic"},{set:tt,type:"identifier",role:"greekletter",font:"sans-serif-bold"},{set:Q,type:"identifier",role:"greekletter",font:"sans-serif-bold"},{set:et,type:"identifier",role:"greekletter",font:"sans-serif-bold-italic"},{set:rt,type:"identifier",role:"greekletter",font:"sans-serif-bold-italic"},{set:nt,type:"identifier",role:"greekletter",font:"double-struck"},{set:ot,type:"identifier",role:"greekletter",font:"normal"},{set:it,type:"identifier",role:"greekletter",font:"bold"},{set:at,type:"identifier",role:"greekletter",font:"italic"},{set:st,type:"identifier",role:"greekletter",font:"sans-serif-bold"},{set:lt,type:"identifier",role:"otherletter",font:"normal"},{set:["0","1","2","3","4","5","6","7","8","9"],type:"number",role:"integer",font:"normal"},{set:["\uff10","\uff11","\uff12","\uff13","\uff14","\uff15","\uff16","\uff17","\uff18","\uff19"],type:"number",role:"integer",font:"normal"},{set:["\ud835\udfce","\ud835\udfcf","\ud835\udfd0","\ud835\udfd1","\ud835\udfd2","\ud835\udfd3","\ud835\udfd4","\ud835\udfd5","\ud835\udfd6","\ud835\udfd7"],type:"number",role:"integer",font:"bold"},{set:["\ud835\udfd8","\ud835\udfd9","\ud835\udfda","\ud835\udfdb","\ud835\udfdc","\ud835\udfdd","\ud835\udfde","\ud835\udfdf","\ud835\udfe0","\ud835\udfe1"],type:"number",role:"integer",font:"double-struck"},{set:["\ud835\udfe2","\ud835\udfe3","\ud835\udfe4","\ud835\udfe5","\ud835\udfe6","\ud835\udfe7","\ud835\udfe8","\ud835\udfe9","\ud835\udfea","\ud835\udfeb"],type:"number",role:"integer",font:"sans-serif"},{set:["\ud835\udfec","\ud835\udfed","\ud835\udfee","\ud835\udfef","\ud835\udff0","\ud835\udff1","\ud835\udff2","\ud835\udff3","\ud835\udff4","\ud835\udff5"],type:"number",role:"integer",font:"sans-serif-bold"},{set:["\ud835\udff6","\ud835\udff7","\ud835\udff8","\ud835\udff9","\ud835\udffa","\ud835\udffb","\ud835\udffc","\ud835\udffd","\ud835\udffe","\ud835\udfff"],type:"number",role:"integer",font:"monospace"},{set:mt,type:"number",role:"float"},{set:yt,type:"number",role:"othernumber"},{set:ut,type:"operator",role:"addition"},{set:ht,type:"operator",role:"multiplication"},{set:["\xaf","-","\u2052","\u207b","\u208b","\u2212","\u2216","\u2238","\u2242","\u2296","\u229f","\u2796","\u2a29","\u2a2a","\u2a2b","\u2a2c","\u2a3a","\u2a41","\ufe63","\uff0d","\u2010","\u2011"],type:"operator",role:"subtraction"},{set:["/","\xf7","\u2044","\u2215","\u2298","\u27cc","\u29bc","\u2a38"],type:"operator",role:"division"},{set:["\u2200","\u2203","\u2206","\u2207","\u2202","\u2201","\u2204"],type:"operator",role:"prefix operator"},{set:["\ud835\udec1","\ud835\udedb","\ud835\udfca","\ud835\udfcb"],type:"operator",role:"prefix operator",font:"bold"},{set:["\ud835\udefb","\ud835\udf15"],type:"operator",role:"prefix operator",font:"italic"},{set:["\ud835\udf6f","\ud835\udf89"],type:"operator",role:"prefix operator",font:"sans-serif-bold"},{set:["=","~","\u207c","\u208c","\u223c","\u223d","\u2243","\u2245","\u2248","\u224a","\u224b","\u224c","\u224d","\u224e","\u2251","\u2252","\u2253","\u2254","\u2255","\u2256","\u2257","\u2258","\u2259","\u225a","\u225b","\u225c","\u225d","\u225e","\u225f","\u2261","\u2263","\u29e4","\u2a66","\u2a6e","\u2a6f","\u2a70","\u2a71","\u2a72","\u2a73","\u2a74","\u2a75","\u2a76","\u2a77","\u2a78","\u22d5","\u2a6d","\u2a6a","\u2a6b","\u2a6c","\ufe66","\uff1d","\u2a6c","\u229c","\u2237"],type:"relation",role:"equality"},{set:["<",">","\u2241","\u2242","\u2244","\u2246","\u2247","\u2249","\u224f","\u2250","\u2260","\u2262","\u2264","\u2265","\u2266","\u2267","\u2268","\u2269","\u226a","\u226b","\u226c","\u226d","\u226e","\u226f","\u2270","\u2271","\u2272","\u2273","\u2274","\u2275","\u2276","\u2277","\u2278","\u2279","\u227a","\u227b","\u227c","\u227d","\u227e","\u227f","\u2280","\u2281","\u22d6","\u22d7","\u22d8","\u22d9","\u22da","\u22db","\u22dc","\u22dd","\u22de","\u22df","\u22e0","\u22e1","\u22e6","\u22e7","\u22e8","\u22e9","\u2a79","\u2a7a","\u2a7b","\u2a7c","\u2a7d","\u2a7e","\u2a7f","\u2a80","\u2a81","\u2a82","\u2a83","\u2a84","\u2a85","\u2a86","\u2a87","\u2a88","\u2a89","\u2a8a","\u2a8b","\u2a8c","\u2a8d","\u2a8e","\u2a8f","\u2a90","\u2a91","\u2a92","\u2a93","\u2a94","\u2a95","\u2a96","\u2a97","\u2a98","\u2a99","\u2a9a","\u2a9b","\u2a9c","\u2a9d","\u2a9e","\u2a9f","\u2aa0","\u2aa1","\u2aa2","\u2aa3","\u2aa4","\u2aa5","\u2aa6","\u2aa7","\u2aa8","\u2aa9","\u2aaa","\u2aab","\u2aac","\u2aad","\u2aae","\u2aaf","\u2ab0","\u2ab1","\u2ab2","\u2ab3","\u2ab4","\u2ab5","\u2ab6","\u2ab7","\u2ab8","\u2ab9","\u2aba","\u2abb","\u2abc","\u2af7","\u2af8","\u2af9","\u2afa","\u29c0","\u29c1","\ufe64","\ufe65","\uff1c","\uff1e"],type:"relation",role:"inequality"},{set:["\u22e2","\u22e3","\u22e4","\u22e5","\u2282","\u2283","\u2284","\u2285","\u2286","\u2287","\u2288","\u2289","\u228a","\u228b","\u228f","\u2290","\u2291","\u2292","\u2abd","\u2abe","\u2abf","\u2ac0","\u2ac1","\u2ac2","\u2ac3","\u2ac4","\u2ac5","\u2ac6","\u2ac7","\u2ac8","\u2ac9","\u2aca","\u2acb","\u2acc","\u2acd","\u2ace","\u2acf","\u2ad0","\u2ad1","\u2ad2","\u2ad3","\u2ad4","\u2ad5","\u2ad6","\u2ad7","\u2ad8","\u22d0","\u22d1","\u22ea","\u22eb","\u22ec","\u22ed","\u22b2","\u22b3","\u22b4","\u22b5"],type:"relation",role:"set"},{set:["\u22a2","\u22a3","\u22a6","\u22a7","\u22a8","\u22a9","\u22aa","\u22ab","\u22ac","\u22ad","\u22ae","\u22af","\u2ade","\u2adf","\u2ae0","\u2ae1","\u2ae2","\u2ae3","\u2ae4","\u2ae5","\u2ae6","\u2ae7","\u2ae8","\u2ae9","\u2aea","\u2aeb","\u2aec","\u2aed"],type:"relation",role:"unknown"},{set:["\u2190","\u2191","\u2192","\u2193","\u2194","\u2195","\u2196","\u2197","\u2198","\u2199","\u219a","\u219b","\u219c","\u219d","\u219e","\u219f","\u21a0","\u21a1","\u21a2","\u21a3","\u21a4","\u21a5","\u21a6","\u21a7","\u21a8","\u21a9","\u21aa","\u21ab","\u21ac","\u21ad","\u21ae","\u21af","\u21b0","\u21b1","\u21b2","\u21b3","\u21b4","\u21b5","\u21b6","\u21b7","\u21b8","\u21b9","\u21ba","\u21bb","\u21c4","\u21c5","\u21c6","\u21c7","\u21c8","\u21c9","\u21ca","\u21cd","\u21ce","\u21cf","\u21d0","\u21d1","\u21d2","\u21d3","\u21d4","\u21d5","\u21d6","\u21d7","\u21d8","\u21d9","\u21da","\u21db","\u21dc","\u21dd","\u21de","\u21df","\u21e0","\u21e1","\u21e2","\u21e3","\u21e4","\u21e5","\u21e6","\u21e7","\u21e8","\u21e9","\u21ea","\u21eb","\u21ec","\u21ed","\u21ee","\u21ef","\u21f0","\u21f1","\u21f2","\u21f3","\u21f4","\u21f5","\u21f6","\u21f7","\u21f8","\u21f9","\u21fa","\u21fb","\u21fc","\u21fd","\u21fe","\u21ff","\u2301","\u2303","\u2304","\u2324","\u238b","\u2794","\u2798","\u2799","\u279a","\u279b","\u279c","\u279d","\u279e","\u279f","\u27a0","\u27a1","\u27a2","\u27a3","\u27a4","\u27a5","\u27a6","\u27a7","\u27a8","\u27a9","\u27aa","\u27ab","\u27ac","\u27ad","\u27ae","\u27af","\u27b1","\u27b2","\u27b3","\u27b4","\u27b5","\u27b6","\u27b7","\u27b8","\u27b9","\u27ba","\u27bb","\u27bc","\u27bd","\u27be","\u27f0","\u27f1","\u27f2","\u27f3","\u27f4","\u27f5","\u27f6","\u27f7","\u27f8","\u27f9","\u27fa","\u27fb","\u27fc","\u27fd","\u27fe","\u27ff","\u2900","\u2901","\u2902","\u2903","\u2904","\u2905","\u2906","\u2907","\u2908","\u2909","\u290a","\u290b","\u290c","\u290d","\u290e","\u290f","\u2910","\u2911","\u2912","\u2913","\u2914","\u2915","\u2916","\u2917","\u2918","\u2919","\u291a","\u291b","\u291c","\u291d","\u291e","\u291f","\u2920","\u2921","\u2922","\u2923","\u2924","\u2925","\u2926","\u2927","\u2928","\u2929","\u292a","\u292d","\u292e","\u292f","\u2930","\u2931","\u2932","\u2933","\u2934","\u2935","\u2936","\u2937","\u2938","\u2939","\u293a","\u293b","\u293c","\u293d","\u293e","\u293f","\u2940","\u2941","\u2942","\u2943","\u2944","\u2945","\u2946","\u2947","\u2948","\u2949","\u2970","\u2971","\u2972","\u2973","\u2974","\u2975","\u2976","\u2977","\u2978","\u2979","\u297a","\u297b","\u29b3","\u29b4","\u29bd","\u29ea","\u29ec","\u29ed","\u2a17","\u2b00","\u2b01","\u2b02","\u2b03","\u2b04","\u2b05","\u2b06","\u2b07","\u2b08","\u2b09","\u2b0a","\u2b0b","\u2b0c","\u2b0d","\u2b0e","\u2b0f","\u2b10","\u2b11","\u2b30","\u2b31","\u2b32","\u2b33","\u2b34","\u2b35","\u2b36","\u2b37","\u2b38","\u2b39","\u2b3a","\u2b3b","\u2b3c","\u2b3d","\u2b3e","\u2b3f","\u2b40","\u2b41","\u2b42","\u2b43","\u2b44","\u2b45","\u2b46","\u2b47","\u2b48","\u2b49","\u2b4a","\u2b4b","\u2b4c","\uffe9","\uffea","\uffeb","\uffec","\u21bc","\u21bd","\u21be","\u21bf","\u21c0","\u21c1","\u21c2","\u21c3","\u21cb","\u21cc","\u294a","\u294b","\u294c","\u294d","\u294e","\u294f","\u2950","\u2951","\u2952","\u2953","\u2954","\u2955","\u2956","\u2957","\u2958","\u2959","\u295a","\u295b","\u295c","\u295d","\u295e","\u295f","\u2960","\u2961","\u2962","\u2963","\u2964","\u2965","\u2966","\u2967","\u2968","\u2969","\u296a","\u296b","\u296c","\u296d","\u296e","\u296f","\u297c","\u297d","\u297e","\u297f"],type:"relation",role:"arrow"},{set:["\u2208","\u220a","\u22f2","\u22f3","\u22f4","\u22f5","\u22f6","\u22f7","\u22f8","\u22f9","\u22ff"],type:"operator",role:"element"},{set:["\u2209"],type:"operator",role:"nonelement"},{set:["\u220b","\u220d","\u22fa","\u22fb","\u22fc","\u22fd","\u22fe"],type:"operator",role:"reelement"},{set:["\u220c"],type:"operator",role:"renonelement"},{set:["\u2140","\u220f","\u2210","\u2211","\u22c0","\u22c1","\u22c2","\u22c3","\u2a00","\u2a01","\u2a02","\u2a03","\u2a04","\u2a05","\u2a06","\u2a07","\u2a08","\u2a09","\u2a0a","\u2a0b","\u2afc","\u2aff"],type:"largeop",role:"sum"},{set:["\u222b","\u222c","\u222d","\u222e","\u222f","\u2230","\u2231","\u2232","\u2233","\u2a0c","\u2a0d","\u2a0e","\u2a0f","\u2a10","\u2a11","\u2a12","\u2a13","\u2a14","\u2a15","\u2a16","\u2a17","\u2a18","\u2a19","\u2a1a","\u2a1b","\u2a1c"],type:"largeop",role:"integral"},{set:["\u221f","\u2220","\u2221","\u2222","\u22be","\u22bf","\u25b3","\u25b7","\u25bd","\u25c1"],type:"operator",role:"geometry"},{set:["inf","lim","liminf","limsup","max","min","sup","injlim","projlim","inj lim","proj lim"],type:"function",role:"limit function"},{set:gt,type:"function",role:"prefix function"},{set:["mod","rem"],type:"operator",role:"prefix function"}],vt=function(){const t={};for(let e,r=0;e=bt[r];r++)e.set.forEach((function(r){t[r]={role:e.role||"unknown",type:e.type||"unknown",font:e.font||"unknown"}}));return t}();e.equal=function(t,e){return t.type===e.type&&t.role===e.role&&t.font===e.font},e.lookupType=function(t){var e;return(null===(e=vt[t])||void 0===e?void 0:e.type)||"unknown"},e.lookupRole=function(t){var e;return(null===(e=vt[t])||void 0===e?void 0:e.role)||"unknown"},e.lookupMeaning=function(t){return vt[t]||{role:"unknown",type:"unknown",font:"unknown"}},e.invisibleTimes=function(){return dt},e.invisiblePlus=function(){return pt},e.invisibleComma=function(){return r},e.functionApplication=function(){return ft},e.isMatchingFence=function(t,e){return-1!==h.indexOf(t)||-1!==d.indexOf(t)?t===e:a[t]===e||s[t]===e},e.isEmbellishedType=function(t){return"operator"===t||"relation"===t||"fence"===t||"punctuation"===t};const _t=new Map;function St(t,e){return`${t} ${e}`}function xt(t,e,r=""){for(const n of e)_t.set(St(t,n),r||t)}xt("d",["d","\u2146","\uff44","\ud835\udc1d","\ud835\udc51","\ud835\udcb9","\ud835\udced","\ud835\udd21","\ud835\udd55","\ud835\udd89","\ud835\uddbd","\ud835\uddf1","\ud835\ude25","\ud835\ude8d"]),xt("bar",o),xt("tilde",i),e.lookupSecondary=function(t,e){return _t.get(St(t,e))}},8158:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SemanticMeaningCollator=e.SemanticNodeCollator=e.SemanticDefault=void 0;const n=r(3588),o=r(3882);class i{constructor(){this.map={}}static key(t,e){return e?t+":"+e:t}add(t,e){this.map[i.key(t,e.font)]=e}addNode(t){this.add(t.textContent,t.meaning())}retrieve(t,e){return this.map[i.key(t,e)]}retrieveNode(t){return this.retrieve(t.textContent,t.font)}size(){return Object.keys(this.map).length}}e.SemanticDefault=i;class a{constructor(){this.map={}}add(t,e){const r=this.map[t];r?r.push(e):this.map[t]=[e]}retrieve(t,e){return this.map[i.key(t,e)]}retrieveNode(t){return this.retrieve(t.textContent,t.font)}copy(){const t=this.copyCollator();for(const e in this.map)t.map[e]=this.map[e];return t}minimize(){for(const t in this.map)1===this.map[t].length&&delete this.map[t]}minimalCollator(){const t=this.copy();for(const e in t.map)1===t.map[e].length&&delete t.map[e];return t}isMultiValued(){for(const t in this.map)if(this.map[t].length>1)return!0;return!1}isEmpty(){return!Object.keys(this.map).length}}class s extends a{copyCollator(){return new s}add(t,e){const r=i.key(t,e.font);super.add(r,e)}addNode(t){this.add(t.textContent,t)}toString(){const t=[];for(const e in this.map){const r=Array(e.length+3).join(" "),n=this.map[e],o=[];for(let t,e=0;t=n[e];e++)o.push(t.toString());t.push(e+": "+o.join("\n"+r))}return t.join("\n")}collateMeaning(){const t=new l;for(const e in this.map)t.map[e]=this.map[e].map((function(t){return t.meaning()}));return t}}e.SemanticNodeCollator=s;class l extends a{copyCollator(){return new l}add(t,e){const r=this.retrieve(t,e.font);if(!r||!r.find((function(t){return n.equal(t,e)}))){const r=i.key(t,e.font);super.add(r,e)}}addNode(t){this.add(t.textContent,t.meaning())}toString(){const t=[];for(const e in this.map){const r=Array(e.length+3).join(" "),n=this.map[e],o=[];for(let t,e=0;t=n[e];e++)o.push("{type: "+t.type+", role: "+t.role+", font: "+t.font+"}");t.push(e+": "+o.join("\n"+r))}return t.join("\n")}reduce(){for(const t in this.map)1!==this.map[t].length&&(this.map[t]=(0,o.reduce)(this.map[t]))}default(){const t=new i;for(const e in this.map)1===this.map[e].length&&(t.map[e]=this.map[e][0]);return t}newDefault(){const t=this.default();this.reduce();const e=this.default();return t.size()!==e.size()?e:null}}e.SemanticMeaningCollator=l},9911:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.SemanticMultiHeuristic=e.SemanticTreeHeuristic=e.SemanticAbstractHeuristic=void 0;class r{constructor(t,e,r=(t=>!1)){this.name=t,this.apply=e,this.applicable=r}}e.SemanticAbstractHeuristic=r;e.SemanticTreeHeuristic=class extends r{};e.SemanticMultiHeuristic=class extends r{}},7516:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.lookup=e.run=e.add=e.blacklist=e.flags=e.updateFactory=e.factory=void 0,e.factory=null,e.updateFactory=function(t){e.factory=t};const r=new Map;function n(t){return r.get(t)}e.flags={combine_juxtaposition:!0,convert_juxtaposition:!0,multioperator:!0},e.blacklist={},e.add=function(t){const n=t.name;r.set(n,t),e.flags[n]||(e.flags[n]=!1)},e.run=function(t,r,o){const i=n(t);return i&&!e.blacklist[t]&&(e.flags[t]||i.applicable(r))?i.apply(r):o?o(r):r},e.lookup=n},94:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0});const n=r(2057),o=r(5897),i=r(3588),a=r(7516),s=r(9911),l=r(5609),c=r(3308),u=r(4795);function p(t,e,r){let n=null;if(!t.length)return n;const o=r[r.length-1],i=o&&o.length,a=e&&e.length,s=c.default.getInstance();if(i&&a){if("infixop"===e[0].type&&"implicit"===e[0].role)return n=t.pop(),o.push(s.postfixNode_(o.pop(),t)),n;n=t.shift();const r=s.prefixNode_(e.shift(),t);return e.unshift(r),n}return i?(o.push(s.postfixNode_(o.pop(),t)),n):(a&&e.unshift(s.prefixNode_(e.shift(),t)),n)}function h(t,e,r){if(!e.length)return t;const o=t.pop(),i=e.shift(),s=r.shift();if(l.isImplicitOp(i)){n.Debugger.getInstance().output("Juxta Heuristic Case 2");const a=(o?[o,i]:[i]).concat(s);return h(t.concat(a),e,r)}if(!o)return n.Debugger.getInstance().output("Juxta Heuristic Case 3"),h([i].concat(s),e,r);const c=s.shift();if(!c){n.Debugger.getInstance().output("Juxta Heuristic Case 9");const s=a.factory.makeBranchNode("infixop",[o,e.shift()],[i],i.textContent);return s.role="implicit",a.run("combine_juxtaposition",s),e.unshift(s),h(t,e,r)}if(l.isOperator(o)||l.isOperator(c))return n.Debugger.getInstance().output("Juxta Heuristic Case 4"),h(t.concat([o,i,c]).concat(s),e,r);let u=null;return l.isImplicitOp(o)&&l.isImplicitOp(c)?(n.Debugger.getInstance().output("Juxta Heuristic Case 5"),o.contentNodes.push(i),o.contentNodes=o.contentNodes.concat(c.contentNodes),o.childNodes.push(c),o.childNodes=o.childNodes.concat(c.childNodes),c.childNodes.forEach((t=>t.parent=o)),i.parent=o,o.addMathmlNodes(i.mathml),o.addMathmlNodes(c.mathml),u=o):l.isImplicitOp(o)?(n.Debugger.getInstance().output("Juxta Heuristic Case 6"),o.contentNodes.push(i),o.childNodes.push(c),c.parent=o,i.parent=o,o.addMathmlNodes(i.mathml),o.addMathmlNodes(c.mathml),u=o):l.isImplicitOp(c)?(n.Debugger.getInstance().output("Juxta Heuristic Case 7"),c.contentNodes.unshift(i),c.childNodes.unshift(o),o.parent=c,i.parent=c,c.addMathmlNodes(i.mathml),c.addMathmlNodes(o.mathml),u=c):(n.Debugger.getInstance().output("Juxta Heuristic Case 8"),u=a.factory.makeBranchNode("infixop",[o,c],[i],i.textContent),u.role="implicit"),t.push(u),h(t.concat(s),e,r)}a.add(new s.SemanticTreeHeuristic("combine_juxtaposition",(function(t){for(let e,r=t.childNodes.length-1;e=t.childNodes[r];r--)l.isImplicitOp(e)&&!e.nobreaking&&(t.childNodes.splice(r,1,...e.childNodes),t.contentNodes.splice(r,0,...e.contentNodes),e.childNodes.concat(e.contentNodes).forEach((function(e){e.parent=t})),t.addMathmlNodes(e.mathml));return t}))),a.add(new s.SemanticTreeHeuristic("propagateSimpleFunction",(t=>("infixop"!==t.type&&"fraction"!==t.type||!t.childNodes.every(l.isSimpleFunction)||(t.role="composed function"),t)),(t=>"clearspeak"===o.default.getInstance().domain))),a.add(new s.SemanticTreeHeuristic("simpleNamedFunction",(t=>("unit"!==t.role&&-1!==["f","g","h","F","G","H"].indexOf(t.textContent)&&(t.role="simple function"),t)),(t=>"clearspeak"===o.default.getInstance().domain))),a.add(new s.SemanticTreeHeuristic("propagateComposedFunction",(t=>("fenced"===t.type&&"composed function"===t.childNodes[0].role&&(t.role="composed function"),t)),(t=>"clearspeak"===o.default.getInstance().domain))),a.add(new s.SemanticTreeHeuristic("multioperator",(t=>{if("unknown"!==t.role||t.textContent.length<=1)return;const e=[...t.textContent].map(i.lookupMeaning).reduce((function(t,e){return t&&e.role&&"unknown"!==e.role&&e.role!==t?"unknown"===t?e.role:null:t}),"unknown");e&&(t.role=e)}))),a.add(new s.SemanticMultiHeuristic("convert_juxtaposition",(t=>{let e=u.partitionNodes(t,(function(t){return t.textContent===i.invisibleTimes()&&"operator"===t.type}));e=e.rel.length?function(t){const e=[],r=[];let n=t.comp.shift(),o=null,i=[];for(;t.comp.length;)if(i=[],n.length)o&&e.push(o),r.push(n),o=t.rel.shift(),n=t.comp.shift();else{for(o&&i.push(o);!n.length&&t.comp.length;)n=t.comp.shift(),i.push(t.rel.shift());o=p(i,n,r)}i.length||n.length?(e.push(o),r.push(n)):(i.push(o),p(i,n,r));return{rel:e,comp:r}}(e):e,t=e.comp[0];for(let r,n,o=1;r=e.comp[o],n=e.rel[o-1];o++)t.push(n),t=t.concat(r);return e=u.partitionNodes(t,(function(t){return t.textContent===i.invisibleTimes()&&("operator"===t.type||"infixop"===t.type)})),e.rel.length?h(e.comp.shift(),e.rel,e.comp):t}))),a.add(new s.SemanticTreeHeuristic("simple2prefix",(t=>(t.textContent.length>1&&!t.textContent[0].match(/[A-Z]/)&&(t.role="prefix function"),t)),(t=>"braille"===o.default.getInstance().modality&&"identifier"===t.type))),a.add(new s.SemanticTreeHeuristic("detect_cycle",(t=>{t.type="matrix",t.role="cycle";const e=t.childNodes[0];return e.type="row",e.role="cycle",e.textContent="",e.contentNodes=[],t}),(t=>"fenced"===t.type&&"infixop"===t.childNodes[0].type&&"implicit"===t.childNodes[0].role&&t.childNodes[0].childNodes.every((function(t){return"number"===t.type}))&&t.childNodes[0].contentNodes.every((function(t){return"space"===t.role})))))},7228:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SemanticMathml=void 0;const n=r(5740),o=r(5250),i=r(5609),a=r(3308),s=r(4795);class l extends o.SemanticAbstractParser{constructor(){super("MathML"),this.parseMap_={SEMANTICS:this.semantics_.bind(this),MATH:this.rows_.bind(this),MROW:this.rows_.bind(this),MPADDED:this.rows_.bind(this),MSTYLE:this.rows_.bind(this),MFRAC:this.fraction_.bind(this),MSUB:this.limits_.bind(this),MSUP:this.limits_.bind(this),MSUBSUP:this.limits_.bind(this),MOVER:this.limits_.bind(this),MUNDER:this.limits_.bind(this),MUNDEROVER:this.limits_.bind(this),MROOT:this.root_.bind(this),MSQRT:this.sqrt_.bind(this),MTABLE:this.table_.bind(this),MLABELEDTR:this.tableLabeledRow_.bind(this),MTR:this.tableRow_.bind(this),MTD:this.tableCell_.bind(this),MS:this.text_.bind(this),MTEXT:this.text_.bind(this),MSPACE:this.space_.bind(this),"ANNOTATION-XML":this.text_.bind(this),MI:this.identifier_.bind(this),MN:this.number_.bind(this),MO:this.operator_.bind(this),MFENCED:this.fenced_.bind(this),MENCLOSE:this.enclosed_.bind(this),MMULTISCRIPTS:this.multiscripts_.bind(this),ANNOTATION:this.empty_.bind(this),NONE:this.empty_.bind(this),MACTION:this.action_.bind(this)};const t={type:"identifier",role:"numbersetletter",font:"double-struck"};["C","H","N","P","Q","R","Z","\u2102","\u210d","\u2115","\u2119","\u211a","\u211d","\u2124"].forEach((e=>this.getFactory().defaultMap.add(e,t)).bind(this))}static getAttribute_(t,e,r){if(!t.hasAttribute(e))return r;const n=t.getAttribute(e);return n.match(/^\s*$/)?null:n}parse(t){a.default.getInstance().setNodeFactory(this.getFactory());const e=n.toArray(t.childNodes),r=n.tagName(t),o=this.parseMap_[r],i=(o||this.dummy_.bind(this))(t,e);return s.addAttributes(i,t),-1!==["MATH","MROW","MPADDED","MSTYLE","SEMANTICS"].indexOf(r)||(i.mathml.unshift(t),i.mathmlTree=t),i}semantics_(t,e){return e.length?this.parse(e[0]):this.getFactory().makeEmptyNode()}rows_(t,e){const r=t.getAttribute("semantics");if(r&&r.match("bspr_"))return a.default.proof(t,r,this.parseList.bind(this));let n;return 1===(e=s.purgeNodes(e)).length?(n=this.parse(e[0]),"empty"!==n.type||n.mathmlTree||(n.mathmlTree=t)):n=a.default.getInstance().row(this.parseList(e)),n.mathml.unshift(t),n}fraction_(t,e){if(!e.length)return this.getFactory().makeEmptyNode();const r=this.parse(e[0]),n=e[1]?this.parse(e[1]):this.getFactory().makeEmptyNode();return a.default.getInstance().fractionLikeNode(r,n,t.getAttribute("linethickness"),"true"===t.getAttribute("bevelled"))}limits_(t,e){return a.default.getInstance().limitNode(n.tagName(t),this.parseList(e))}root_(t,e){return e[1]?this.getFactory().makeBranchNode("root",[this.parse(e[1]),this.parse(e[0])],[]):this.sqrt_(t,e)}sqrt_(t,e){const r=this.parseList(s.purgeNodes(e));return this.getFactory().makeBranchNode("sqrt",[a.default.getInstance().row(r)],[])}table_(t,e){const r=t.getAttribute("semantics");if(r&&r.match("bspr_"))return a.default.proof(t,r,this.parseList.bind(this));const n=this.getFactory().makeBranchNode("table",this.parseList(e),[]);return n.mathmlTree=t,a.default.tableToMultiline(n),n}tableRow_(t,e){const r=this.getFactory().makeBranchNode("row",this.parseList(e),[]);return r.role="table",r}tableLabeledRow_(t,e){if(!e.length)return this.tableRow_(t,e);const r=this.parse(e[0]);r.role="label";const n=this.getFactory().makeBranchNode("row",this.parseList(e.slice(1)),[r]);return n.role="table",n}tableCell_(t,e){const r=this.parseList(s.purgeNodes(e));let n;n=r.length?1===r.length&&i.isType(r[0],"empty")?r:[a.default.getInstance().row(r)]:[];const o=this.getFactory().makeBranchNode("cell",n,[]);return o.role="table",o}space_(t,e){const r=t.getAttribute("width"),o=r&&r.match(/[a-z]*$/);if(!o)return this.empty_(t,e);const i=o[0],s=parseFloat(r.slice(0,o.index)),l={cm:.4,pc:.5,em:.5,ex:1,in:.15,pt:5,mm:5}[i];if(!l||isNaN(s)||s<l)return this.empty_(t,e);const c=this.getFactory().makeUnprocessed(t);return a.default.getInstance().text(c,n.tagName(t))}text_(t,e){const r=this.leaf_(t,e);return t.textContent?(r.updateContent(t.textContent,!0),a.default.getInstance().text(r,n.tagName(t))):r}identifier_(t,e){const r=this.leaf_(t,e);return a.default.getInstance().identifierNode(r,a.default.getInstance().font(t.getAttribute("mathvariant")),t.getAttribute("class"))}number_(t,e){const r=this.leaf_(t,e);return a.default.number(r),r}operator_(t,e){const r=this.leaf_(t,e);return a.default.getInstance().operatorNode(r),r}fenced_(t,e){const r=this.parseList(s.purgeNodes(e)),n=l.getAttribute_(t,"separators",","),o=l.getAttribute_(t,"open","("),i=l.getAttribute_(t,"close",")"),c=a.default.getInstance().mfenced(o,i,n,r);return a.default.getInstance().tablesInRow([c])[0]}enclosed_(t,e){const r=this.parseList(s.purgeNodes(e)),n=this.getFactory().makeBranchNode("enclose",[a.default.getInstance().row(r)],[]);return n.role=t.getAttribute("notation")||"unknown",n}multiscripts_(t,e){if(!e.length)return this.getFactory().makeEmptyNode();const r=this.parse(e.shift());if(!e.length)return r;const o=[],i=[],l=[],c=[];let u=!1,p=0;for(let t,r=0;t=e[r];r++)"MPRESCRIPTS"!==n.tagName(t)?(u?1&p?o.push(t):i.push(t):1&p?l.push(t):c.push(t),p++):(u=!0,p=0);return s.purgeNodes(o).length||s.purgeNodes(i).length?a.default.getInstance().tensor(r,this.parseList(i),this.parseList(o),this.parseList(c),this.parseList(l)):a.default.getInstance().pseudoTensor(r,this.parseList(c),this.parseList(l))}empty_(t,e){return this.getFactory().makeEmptyNode()}action_(t,e){return e.length>1?this.parse(e[1]):this.getFactory().makeUnprocessed(t)}dummy_(t,e){const r=this.getFactory().makeUnprocessed(t);return r.role=t.tagName,r.textContent=t.textContent,r}leaf_(t,e){if(1===e.length&&e[0].nodeType!==n.NodeType.TEXT_NODE){const r=this.getFactory().makeUnprocessed(t);return r.role=e[0].tagName,s.addAttributes(r,e[0]),r}return this.getFactory().makeLeafNode(t.textContent,a.default.getInstance().font(t.getAttribute("mathvariant")))}}e.SemanticMathml=l},5952:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SemanticNode=void 0;const n=r(5740),o=r(3588),i=r(4795);class a{constructor(t){this.id=t,this.mathml=[],this.parent=null,this.type="unknown",this.role="unknown",this.font="unknown",this.embellished=null,this.fencePointer="",this.childNodes=[],this.textContent="",this.mathmlTree=null,this.contentNodes=[],this.annotation={},this.attributes={},this.nobreaking=!1}static fromXml(t){const e=parseInt(t.getAttribute("id"),10),r=new a(e);return r.type=t.tagName,a.setAttribute(r,t,"role"),a.setAttribute(r,t,"font"),a.setAttribute(r,t,"embellished"),a.setAttribute(r,t,"fencepointer","fencePointer"),t.getAttribute("annotation")&&r.parseAnnotation(t.getAttribute("annotation")),i.addAttributes(r,t),a.processChildren(r,t),r}static setAttribute(t,e,r,n){n=n||r;const o=e.getAttribute(r);o&&(t[n]=o)}static processChildren(t,e){for(const r of n.toArray(e.childNodes)){if(r.nodeType===n.NodeType.TEXT_NODE){t.textContent=r.textContent;continue}const e=n.toArray(r.childNodes).map(a.fromXml);e.forEach((e=>e.parent=t)),"CONTENT"===n.tagName(r)?t.contentNodes=e:t.childNodes=e}}querySelectorAll(t){let e=[];for(let r,n=0;r=this.childNodes[n];n++)e=e.concat(r.querySelectorAll(t));for(let r,n=0;r=this.contentNodes[n];n++)e=e.concat(r.querySelectorAll(t));return t(this)&&e.unshift(this),e}xml(t,e){const r=function(r,n){const o=n.map((function(r){return r.xml(t,e)})),i=t.createElementNS("",r);for(let t,e=0;t=o[e];e++)i.appendChild(t);return i},n=t.createElementNS("",this.type);return e||this.xmlAttributes(n),n.textContent=this.textContent,this.contentNodes.length>0&&n.appendChild(r("content",this.contentNodes)),this.childNodes.length>0&&n.appendChild(r("children",this.childNodes)),n}toString(t=!1){const e=n.parseInput("<snode/>");return n.serializeXml(this.xml(e,t))}allAttributes(){const t=[];return t.push(["role",this.role]),"unknown"!==this.font&&t.push(["font",this.font]),Object.keys(this.annotation).length&&t.push(["annotation",this.xmlAnnotation()]),this.embellished&&t.push(["embellished",this.embellished]),this.fencePointer&&t.push(["fencepointer",this.fencePointer]),t.push(["id",this.id.toString()]),t}xmlAnnotation(){const t=[];for(const e in this.annotation)this.annotation[e].forEach((function(r){t.push(e+":"+r)}));return t.join(";")}toJson(){const t={};t.type=this.type;const e=this.allAttributes();for(let r,n=0;r=e[n];n++)t[r[0]]=r[1].toString();return this.textContent&&(t.$t=this.textContent),this.childNodes.length&&(t.children=this.childNodes.map((function(t){return t.toJson()}))),this.contentNodes.length&&(t.content=this.contentNodes.map((function(t){return t.toJson()}))),t}updateContent(t,e){const r=e?t.replace(/^[ \f\n\r\t\v\u200b]*/,"").replace(/[ \f\n\r\t\v\u200b]*$/,""):t.trim();if(t=t&&!r?t:r,this.textContent===t)return;const n=(0,o.lookupMeaning)(t);this.textContent=t,this.role=n.role,this.type=n.type,this.font=n.font}addMathmlNodes(t){for(let e,r=0;e=t[r];r++)-1===this.mathml.indexOf(e)&&this.mathml.push(e)}appendChild(t){this.childNodes.push(t),this.addMathmlNodes(t.mathml),t.parent=this}replaceChild(t,e){const r=this.childNodes.indexOf(t);if(-1===r)return;t.parent=null,e.parent=this,this.childNodes[r]=e;const n=t.mathml.filter((function(t){return-1===e.mathml.indexOf(t)})),o=e.mathml.filter((function(e){return-1===t.mathml.indexOf(e)}));this.removeMathmlNodes(n),this.addMathmlNodes(o)}appendContentNode(t){t&&(this.contentNodes.push(t),this.addMathmlNodes(t.mathml),t.parent=this)}removeContentNode(t){if(t){const e=this.contentNodes.indexOf(t);-1!==e&&this.contentNodes.slice(e,1)}}equals(t){if(!t)return!1;if(this.type!==t.type||this.role!==t.role||this.textContent!==t.textContent||this.childNodes.length!==t.childNodes.length||this.contentNodes.length!==t.contentNodes.length)return!1;for(let e,r,n=0;e=this.childNodes[n],r=t.childNodes[n];n++)if(!e.equals(r))return!1;for(let e,r,n=0;e=this.contentNodes[n],r=t.contentNodes[n];n++)if(!e.equals(r))return!1;return!0}displayTree(){console.info(this.displayTree_(0))}addAnnotation(t,e){e&&this.addAnnotation_(t,e)}getAnnotation(t){const e=this.annotation[t];return e||[]}hasAnnotation(t,e){const r=this.annotation[t];return!!r&&-1!==r.indexOf(e)}parseAnnotation(t){const e=t.split(";");for(let t=0,r=e.length;t<r;t++){const r=e[t].split(":");this.addAnnotation(r[0],r[1])}}meaning(){return{type:this.type,role:this.role,font:this.font}}xmlAttributes(t){const e=this.allAttributes();for(let r,n=0;r=e[n];n++)t.setAttribute(r[0],r[1]);this.addExternalAttributes(t)}addExternalAttributes(t){for(const e in this.attributes)t.setAttribute(e,this.attributes[e])}removeMathmlNodes(t){const e=this.mathml;for(let r,n=0;r=t[n];n++){const t=e.indexOf(r);-1!==t&&e.splice(t,1)}this.mathml=e}displayTree_(t){t++;const e=Array(t).join("  ");let r="";r+="\n"+e+this.toString(),r+="\n"+e+"MathmlTree:",r+="\n"+e+this.mathmlTreeString(),r+="\n"+e+"MathML:";for(let t,n=0;t=this.mathml[n];n++)r+="\n"+e+t.toString();return r+="\n"+e+"Begin Content",this.contentNodes.forEach((function(e){r+=e.displayTree_(t)})),r+="\n"+e+"End Content",r+="\n"+e+"Begin Children",this.childNodes.forEach((function(e){r+=e.displayTree_(t)})),r+="\n"+e+"End Children",r}mathmlTreeString(){return this.mathmlTree?this.mathmlTree.toString():"EMPTY"}addAnnotation_(t,e){const r=this.annotation[t];r?r.push(e):this.annotation[t]=[e]}}e.SemanticNode=a},6537:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SemanticNodeFactory=void 0;const n=r(8158),o=r(8158),i=r(5952);e.SemanticNodeFactory=class{constructor(){this.leafMap=new o.SemanticNodeCollator,this.defaultMap=new n.SemanticDefault,this.idCounter_=-1}makeNode(t){return this.createNode_(t)}makeUnprocessed(t){const e=this.createNode_();return e.mathml=[t],e.mathmlTree=t,e}makeEmptyNode(){const t=this.createNode_();return t.type="empty",t}makeContentNode(t){const e=this.createNode_();return e.updateContent(t),e}makeMultipleContentNodes(t,e){const r=[];for(let n=0;n<t;n++)r.push(this.makeContentNode(e));return r}makeLeafNode(t,e){if(!t)return this.makeEmptyNode();const r=this.makeContentNode(t);r.font=e||r.font;const n=this.defaultMap.retrieveNode(r);return n&&(r.type=n.type,r.role=n.role,r.font=n.font),this.leafMap.addNode(r),r}makeBranchNode(t,e,r,n){const o=this.createNode_();return n&&o.updateContent(n),o.type=t,o.childNodes=e,o.contentNodes=r,e.concat(r).forEach((function(t){t.parent=o,o.addMathmlNodes(t.mathml)})),o}createNode_(t){return void 0!==t?this.idCounter_=Math.max(this.idCounter_,t):t=++this.idCounter_,new i.SemanticNode(t)}}},3882:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.SemanticComparator=e.reduce=e.sort=e.apply=e.add=void 0;const r=[];function n(t){r.push(t)}function o(t,e){for(let n,o=0;n=r[o];o++){const r=n.compare(t,e);if(0!==r)return r}return 0}function i(t){t.sort(o)}e.add=n,e.apply=o,e.sort=i,e.reduce=function(t){if(t.length<=1)return t;const e=t.slice();i(e);const r=[];let n;do{n=e.pop(),r.push(n)}while(n&&e.length&&0===o(e[e.length-1],n));return r};class a{constructor(t,e=null){this.comparator=t,this.type=e,n(this)}compare(t,e){return this.type&&this.type===t.type&&this.type===e.type?this.comparator(t,e):0}}e.SemanticComparator=a,new a((function(t,e){return"simple function"===t.role?1:"simple function"===e.role?-1:0}),"identifier")},5250:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SemanticAbstractParser=void 0;const n=r(6537);e.SemanticAbstractParser=class{constructor(t){this.type=t,this.factory_=new n.SemanticNodeFactory}getFactory(){return this.factory_}setFactory(t){this.factory_=t}getType(){return this.type}parseList(t){const e=[];for(let r,n=0;r=t[n];n++)e.push(this.parse(r));return e}}},5609:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.isMembership=e.elligibleRightNeutral=e.elligibleLeftNeutral=e.compareNeutralFences=e.isNeutralFence=e.isImplicitOp=e.isImplicit=e.isPureUnit=e.isUnitCounter=e.isNumber=e.isSingletonSetContent=e.scriptedElement_=e.illegalSingleton_=e.isSetNode=e.isRightBrace=e.isLeftBrace=e.isSimpleFunction=e.singlePunctAtPosition=e.isSimpleFunctionHead=e.isLimitBase=e.isBinomial=e.lineIsLabelled=e.tableIsMultiline=e.tableIsCases=e.isFencedElement=e.tableIsMatrixOrVector=e.isTableOrMultiline=e.isElligibleEmbellishedFence=e.isFence=e.isPunctuation=e.isRelation=e.isOperator=e.isEmbellished=e.isGeneralFunctionBoundary=e.isIntegralDxBoundarySingle=e.isIntegralDxBoundary=e.isBigOpBoundary=e.isPrefixFunctionBoundary=e.isSimpleFunctionScope=e.isAccent=e.isRole=e.embellishedType=e.isType=void 0;const n=r(3588),o=r(4795);function i(t,e){return t.type===e}function a(t,e){return t.embellished===e}function s(t,e){return t.role===e}function l(t){return u(t)||p(t)}function c(t){return i(t,"operator")||a(t,"operator")}function u(t){return i(t,"relation")||a(t,"relation")}function p(t){return i(t,"punctuation")||a(t,"punctuation")}function h(t){return i(t,"fence")||a(t,"fence")}function d(t){return!t.embellished||!function(t){return i(t,"tensor")&&(!i(t.childNodes[1],"empty")||!i(t.childNodes[2],"empty"))&&(!i(t.childNodes[3],"empty")||!i(t.childNodes[4],"empty"))}(t)&&((!s(t,"close")||!i(t,"tensor"))&&((!s(t,"open")||!i(t,"subscript")&&!i(t,"superscript"))&&d(t.childNodes[0])))}function f(t){return!!t&&(i(t,"table")||i(t,"multiline"))}function m(t){return!!t&&i(t,"fenced")&&(s(t,"leftright")||v(t))&&1===t.childNodes.length}function y(t){return!!t&&-1!==["{","\ufe5b","\uff5b"].indexOf(t.textContent)}function g(t){return!!t&&-1!==["}","\ufe5c","\uff5d"].indexOf(t.textContent)}function b(t){return"number"===t.type&&("integer"===t.role||"float"===t.role)}function v(t){return"neutral"===t.role||"metric"===t.role}e.isType=i,e.embellishedType=a,e.isRole=s,e.isAccent=function(t){const e=new RegExp("\u221e|\u1ab2");return i(t,"fence")||i(t,"punctuation")||i(t,"operator")&&!t.textContent.match(e)||i(t,"relation")||i(t,"identifier")&&s(t,"unknown")&&!t.textContent.match(n.allLettersRegExp)&&!t.textContent.match(e)},e.isSimpleFunctionScope=function(t){const e=t.childNodes;if(0===e.length)return!0;if(e.length>1)return!1;const r=e[0];if("infixop"===r.type){if("implicit"!==r.role)return!1;if(r.childNodes.some((t=>i(t,"infixop"))))return!1}return!0},e.isPrefixFunctionBoundary=function(t){return c(t)&&!s(t,"division")||i(t,"appl")||l(t)},e.isBigOpBoundary=function(t){return c(t)||l(t)},e.isIntegralDxBoundary=function(t,e){return!!e&&i(e,"identifier")&&n.lookupSecondary("d",t.textContent)},e.isIntegralDxBoundarySingle=function(t){if(i(t,"identifier")){const e=t.textContent[0];return e&&t.textContent[1]&&n.lookupSecondary("d",e)}return!1},e.isGeneralFunctionBoundary=l,e.isEmbellished=function(t){return t.embellished?t.embellished:n.isEmbellishedType(t.type)?t.type:null},e.isOperator=c,e.isRelation=u,e.isPunctuation=p,e.isFence=h,e.isElligibleEmbellishedFence=function(t){return!(!t||!h(t))&&(!t.embellished||d(t))},e.isTableOrMultiline=f,e.tableIsMatrixOrVector=function(t){return!!t&&m(t)&&f(t.childNodes[0])},e.isFencedElement=m,e.tableIsCases=function(t,e){return e.length>0&&s(e[e.length-1],"openfence")},e.tableIsMultiline=function(t){return t.childNodes.every((function(t){return t.childNodes.length<=1}))},e.lineIsLabelled=function(t){return i(t,"line")&&t.contentNodes.length&&s(t.contentNodes[0],"label")},e.isBinomial=function(t){return 2===t.childNodes.length},e.isLimitBase=function t(e){return i(e,"largeop")||i(e,"limboth")||i(e,"limlower")||i(e,"limupper")||i(e,"function")&&s(e,"limit function")||(i(e,"overscore")||i(e,"underscore"))&&t(e.childNodes[0])},e.isSimpleFunctionHead=function(t){return"identifier"===t.type||"latinletter"===t.role||"greekletter"===t.role||"otherletter"===t.role},e.singlePunctAtPosition=function(t,e,r){return 1===e.length&&("punctuation"===t[r].type||"punctuation"===t[r].embellished)&&t[r]===e[0]},e.isSimpleFunction=function(t){return i(t,"identifier")&&s(t,"simple function")},e.isLeftBrace=y,e.isRightBrace=g,e.isSetNode=function(t){return y(t.contentNodes[0])&&g(t.contentNodes[1])},e.illegalSingleton_=["punctuation","punctuated","relseq","multirel","table","multiline","cases","inference"],e.scriptedElement_=["limupper","limlower","limboth","subscript","superscript","underscore","overscore","tensor"],e.isSingletonSetContent=function t(r){const n=r.type;return-1===e.illegalSingleton_.indexOf(n)&&("infixop"!==n||"implicit"===r.role)&&("fenced"===n?"leftright"!==r.role||t(r.childNodes[0]):-1===e.scriptedElement_.indexOf(n)||t(r.childNodes[0]))},e.isNumber=b,e.isUnitCounter=function(t){return b(t)||"vulgar"===t.role||"mixed"===t.role},e.isPureUnit=function(t){const e=t.childNodes;return"unit"===t.role&&(!e.length||"unit"===e[0].role)},e.isImplicit=function(t){return"implicit"===t.role||"unit"===t.role&&!!t.contentNodes.length&&t.contentNodes[0].textContent===n.invisibleTimes()},e.isImplicitOp=function(t){return"infixop"===t.type&&"implicit"===t.role},e.isNeutralFence=v,e.compareNeutralFences=function(t,e){return v(t)&&v(e)&&(0,o.getEmbellishedInner)(t).textContent===(0,o.getEmbellishedInner)(e).textContent},e.elligibleLeftNeutral=function(t){return!!v(t)&&(!t.embellished||"superscript"!==t.type&&"subscript"!==t.type&&("tensor"!==t.type||"empty"===t.childNodes[3].type&&"empty"===t.childNodes[4].type))},e.elligibleRightNeutral=function(t){return!!v(t)&&(!t.embellished||("tensor"!==t.type||"empty"===t.childNodes[1].type&&"empty"===t.childNodes[2].type))},e.isMembership=function(t){return["element","nonelement","reelement","renonelement"].includes(t.role)}},3308:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0});const n=r(5740),o=r(3588),i=r(7516),a=r(6537),s=r(5609),l=r(4795);class c{constructor(){this.funcAppls={},this.factory_=new a.SemanticNodeFactory,i.updateFactory(this.factory_)}static getInstance(){return c.instance=c.instance||new c,c.instance}static tableToMultiline(t){if(s.tableIsMultiline(t)){t.type="multiline";for(let e,r=0;e=t.childNodes[r];r++)c.rowToLine_(e,"multiline");1===t.childNodes.length&&!s.lineIsLabelled(t.childNodes[0])&&s.isFencedElement(t.childNodes[0].childNodes[0])&&c.tableToMatrixOrVector_(c.rewriteFencedLine_(t)),c.binomialForm_(t),c.classifyMultiline(t)}else c.classifyTable(t)}static number(t){"unknown"!==t.type&&"identifier"!==t.type||(t.type="number"),c.numberRole_(t),c.exprFont_(t)}static classifyMultiline(t){let e=0;const r=t.childNodes.length;let n;for(;e<r&&(!(n=t.childNodes[e])||!n.childNodes.length);)e++;if(e>=r)return;const o=n.childNodes[0].role;"unknown"!==o&&t.childNodes.every((function(t){const e=t.childNodes[0];return!e||e.role===o&&(s.isType(e,"relation")||s.isType(e,"relseq"))}))&&(t.role=o)}static classifyTable(t){const e=c.computeColumns_(t);c.classifyByColumns_(t,e,"equality")||c.classifyByColumns_(t,e,"inequality",["equality"])||c.classifyByColumns_(t,e,"arrow")||c.detectCaleyTable(t)}static detectCaleyTable(t){if(!t.mathmlTree)return!1;const e=t.mathmlTree,r=e.getAttribute("columnlines"),n=e.getAttribute("rowlines");return!(!r||!n)&&(!(!c.cayleySpacing(r)||!c.cayleySpacing(n))&&(t.role="cayley",!0))}static cayleySpacing(t){const e=t.split(" ");return("solid"===e[0]||"dashed"===e[0])&&e.slice(1).every((t=>"none"===t))}static proof(t,e,r){const n=c.separateSemantics(e);return c.getInstance().proof(t,n,r)}static findSemantics(t,e,r){const n=null==r?null:r,o=c.getSemantics(t);return!!o&&(!!o[e]&&(null==n||o[e]===n))}static getSemantics(t){const e=t.getAttribute("semantics");return e?c.separateSemantics(e):null}static removePrefix(t){const[,...e]=t.split("_");return e.join("_")}static separateSemantics(t){const e={};return t.split(";").forEach((function(t){const[r,n]=t.split(":");e[c.removePrefix(r)]=n})),e}static matchSpaces_(t,e){for(let r,n=0;r=e[n];n++){const e=t[n].mathmlTree,o=t[n+1].mathmlTree;if(!e||!o)continue;const i=e.nextSibling;if(!i||i===o)continue;const a=c.getSpacer_(i);a&&(r.mathml.push(a),r.mathmlTree=a,r.role="space")}}static getSpacer_(t){if("MSPACE"===n.tagName(t))return t;for(;l.hasEmptyTag(t)&&1===t.childNodes.length;)if(t=t.childNodes[0],"MSPACE"===n.tagName(t))return t;return null}static fenceToPunct_(t){const e=c.FENCE_TO_PUNCT_[t.role];if(e){for(;t.embellished;)t.embellished="punctuation",s.isRole(t,"subsup")||s.isRole(t,"underover")||(t.role=e),t=t.childNodes[0];t.type="punctuation",t.role=e}}static classifyFunction_(t,e){if("appl"===t.type||"bigop"===t.type||"integral"===t.type)return"";if(e[0]&&e[0].textContent===o.functionApplication()){c.getInstance().funcAppls[t.id]=e.shift();let r="simple function";return i.run("simple2prefix",t),"prefix function"!==t.role&&"limit function"!==t.role||(r=t.role),c.propagateFunctionRole_(t,r),"prefix"}const r=c.CLASSIFY_FUNCTION_[t.role];return r||(s.isSimpleFunctionHead(t)?"simple":"")}static propagateFunctionRole_(t,e){if(t){if("infixop"===t.type)return;s.isRole(t,"subsup")||s.isRole(t,"underover")||(t.role=e),c.propagateFunctionRole_(t.childNodes[0],e)}}static getFunctionOp_(t,e){if(e(t))return t;for(let r,n=0;r=t.childNodes[n];n++){const t=c.getFunctionOp_(r,e);if(t)return t}return null}static tableToMatrixOrVector_(t){const e=t.childNodes[0];s.isType(e,"multiline")?c.tableToVector_(t):c.tableToMatrix_(t),t.contentNodes.forEach(e.appendContentNode.bind(e));for(let t,r=0;t=e.childNodes[r];r++)c.assignRoleToRow_(t,c.getComponentRoles_(e));return e.parent=null,e}static tableToVector_(t){const e=t.childNodes[0];e.type="vector",1!==e.childNodes.length?c.binomialForm_(e):c.tableToSquare_(t)}static binomialForm_(t){s.isBinomial(t)&&(t.role="binomial",t.childNodes[0].role="binomial",t.childNodes[1].role="binomial")}static tableToMatrix_(t){const e=t.childNodes[0];e.type="matrix",e.childNodes&&e.childNodes.length>0&&e.childNodes[0].childNodes&&e.childNodes.length===e.childNodes[0].childNodes.length?c.tableToSquare_(t):e.childNodes&&1===e.childNodes.length&&(e.role="rowvector")}static tableToSquare_(t){const e=t.childNodes[0];s.isNeutralFence(t)?e.role="determinant":e.role="squarematrix"}static getComponentRoles_(t){const e=t.role;return e&&"unknown"!==e?e:t.type.toLowerCase()||"unknown"}static tableToCases_(t,e){for(let e,r=0;e=t.childNodes[r];r++)c.assignRoleToRow_(e,"cases");return t.type="cases",t.appendContentNode(e),s.tableIsMultiline(t)&&c.binomialForm_(t),t}static rewriteFencedLine_(t){const e=t.childNodes[0],r=t.childNodes[0].childNodes[0],n=t.childNodes[0].childNodes[0].childNodes[0];return r.parent=t.parent,t.parent=r,n.parent=e,r.childNodes=[t],e.childNodes=[n],r}static rowToLine_(t,e){const r=e||"unknown";s.isType(t,"row")&&(t.type="line",t.role=r,1===t.childNodes.length&&s.isType(t.childNodes[0],"cell")&&(t.childNodes=t.childNodes[0].childNodes,t.childNodes.forEach((function(e){e.parent=t}))))}static assignRoleToRow_(t,e){s.isType(t,"line")?t.role=e:s.isType(t,"row")&&(t.role=e,t.childNodes.forEach((function(t){s.isType(t,"cell")&&(t.role=e)})))}static nextSeparatorFunction_(t){let e;if(t){if(t.match(/^\s+$/))return null;e=t.replace(/\s/g,"").split("").filter((function(t){return t}))}else e=[","];return function(){return e.length>1?e.shift():e[0]}}static numberRole_(t){if("unknown"!==t.role)return;const e=[...t.textContent].filter((t=>t.match(/[^\s]/))),r=e.map(o.lookupMeaning);if(r.every((function(t){return"number"===t.type&&"integer"===t.role||"punctuation"===t.type&&"comma"===t.role})))return t.role="integer",void("0"===e[0]&&t.addAnnotation("general","basenumber"));r.every((function(t){return"number"===t.type&&"integer"===t.role||"punctuation"===t.type}))?t.role="float":t.role="othernumber"}static exprFont_(t){if("unknown"!==t.font)return;const e=[...t.textContent].map(o.lookupMeaning).reduce((function(t,e){return t&&e.font&&"unknown"!==e.font&&e.font!==t?"unknown"===t?e.font:null:t}),"unknown");e&&(t.font=e)}static purgeFences_(t){const e=t.rel,r=t.comp,n=[],o=[];for(;e.length>0;){const t=e.shift();let i=r.shift();s.isElligibleEmbellishedFence(t)?(n.push(t),o.push(i)):(c.fenceToPunct_(t),i.push(t),i=i.concat(r.shift()),r.unshift(i))}return o.push(r.shift()),{rel:n,comp:o}}static rewriteFencedNode_(t){const e=t.contentNodes[0],r=t.contentNodes[1];let n=c.rewriteFence_(t,e);return t.contentNodes[0]=n.fence,n=c.rewriteFence_(n.node,r),t.contentNodes[1]=n.fence,t.contentNodes[0].parent=t,t.contentNodes[1].parent=t,n.node.parent=null,n.node}static rewriteFence_(t,e){if(!e.embellished)return{node:t,fence:e};const r=e.childNodes[0],n=c.rewriteFence_(t,r);return s.isType(e,"superscript")||s.isType(e,"subscript")||s.isType(e,"tensor")?(s.isRole(e,"subsup")||(e.role=t.role),r!==n.node&&(e.replaceChild(r,n.node),r.parent=t),c.propagateFencePointer_(e,r),{node:e,fence:n.fence}):(e.replaceChild(r,n.fence),e.mathmlTree&&-1===e.mathml.indexOf(e.mathmlTree)&&e.mathml.push(e.mathmlTree),{node:n.node,fence:e})}static propagateFencePointer_(t,e){t.fencePointer=e.fencePointer||e.id.toString(),t.embellished=null}static classifyByColumns_(t,e,r,n){return!!(3===e.length&&c.testColumns_(e,1,(t=>c.isPureRelation_(t,r)))||2===e.length&&(c.testColumns_(e,1,(t=>c.isEndRelation_(t,r)||c.isPureRelation_(t,r)))||c.testColumns_(e,0,(t=>c.isEndRelation_(t,r,!0)||c.isPureRelation_(t,r)))))&&(t.role=r,!0)}static isEndRelation_(t,e,r){const n=r?t.childNodes.length-1:0;return s.isType(t,"relseq")&&s.isRole(t,e)&&s.isType(t.childNodes[n],"empty")}static isPureRelation_(t,e){return s.isType(t,"relation")&&s.isRole(t,e)}static computeColumns_(t){const e=[];for(let r,n=0;r=t.childNodes[n];n++)for(let t,n=0;t=r.childNodes[n];n++){e[n]?e[n].push(t):e[n]=[t]}return e}static testColumns_(t,e,r){const n=t[e];return!!n&&(n.some((function(t){return t.childNodes.length&&r(t.childNodes[0])}))&&n.every((function(t){return!t.childNodes.length||r(t.childNodes[0])})))}setNodeFactory(t){c.getInstance().factory_=t,i.updateFactory(c.getInstance().factory_)}getNodeFactory(){return c.getInstance().factory_}identifierNode(t,e,r){if("MathML-Unit"===r)t.type="identifier",t.role="unit";else if(!e&&1===t.textContent.length&&("integer"===t.role||"latinletter"===t.role||"greekletter"===t.role)&&"normal"===t.font)return t.font="italic",i.run("simpleNamedFunction",t);return"unknown"===t.type&&(t.type="identifier"),c.exprFont_(t),i.run("simpleNamedFunction",t)}implicitNode(t){if(t=c.getInstance().getMixedNumbers_(t),1===(t=c.getInstance().combineUnits_(t)).length)return t[0];const e=c.getInstance().implicitNode_(t);return i.run("combine_juxtaposition",e)}text(t,e){return c.exprFont_(t),t.type="text","MS"===e?(t.role="string",t):"MSPACE"===e||t.textContent.match(/^\s*$/)?(t.role="space",t):t}row(t){return 0===(t=t.filter((function(t){return!s.isType(t,"empty")}))).length?c.getInstance().factory_.makeEmptyNode():(t=c.getInstance().getFencesInRow_(t),t=c.getInstance().tablesInRow(t),t=c.getInstance().getPunctuationInRow_(t),t=c.getInstance().getTextInRow_(t),t=c.getInstance().getFunctionsInRow_(t),c.getInstance().relationsInRow_(t))}limitNode(t,e){if(!e.length)return c.getInstance().factory_.makeEmptyNode();let r,n=e[0],o="unknown";if(!e[1])return n;if(s.isLimitBase(n)){r=c.MML_TO_LIMIT_[t];const i=r.length;if(o=r.type,e=e.slice(0,r.length+1),1===i&&s.isAccent(e[1])||2===i&&s.isAccent(e[1])&&s.isAccent(e[2]))return r=c.MML_TO_BOUNDS_[t],c.getInstance().accentNode_(n,e,r.type,r.length,r.accent);if(2===i){if(s.isAccent(e[1]))return n=c.getInstance().accentNode_(n,[n,e[1]],{MSUBSUP:"subscript",MUNDEROVER:"underscore"}[t],1,!0),e[2]?c.getInstance().makeLimitNode_(n,[n,e[2]],null,"limupper"):n;if(e[2]&&s.isAccent(e[2]))return n=c.getInstance().accentNode_(n,[n,e[2]],{MSUBSUP:"superscript",MUNDEROVER:"overscore"}[t],1,!0),c.getInstance().makeLimitNode_(n,[n,e[1]],null,"limlower");e[i]||(o="limlower")}return c.getInstance().makeLimitNode_(n,e,null,o)}return r=c.MML_TO_BOUNDS_[t],c.getInstance().accentNode_(n,e,r.type,r.length,r.accent)}tablesInRow(t){let e=l.partitionNodes(t,s.tableIsMatrixOrVector),r=[];for(let t,n=0;t=e.rel[n];n++)r=r.concat(e.comp.shift()),r.push(c.tableToMatrixOrVector_(t));r=r.concat(e.comp.shift()),e=l.partitionNodes(r,s.isTableOrMultiline),r=[];for(let t,n=0;t=e.rel[n];n++){const n=e.comp.shift();s.tableIsCases(t,n)&&c.tableToCases_(t,n.pop()),r=r.concat(n),r.push(t)}return r.concat(e.comp.shift())}mfenced(t,e,r,n){if(r&&n.length>0){const t=c.nextSeparatorFunction_(r),e=[n.shift()];n.forEach((r=>{e.push(c.getInstance().factory_.makeContentNode(t())),e.push(r)})),n=e}return t&&e?c.getInstance().horizontalFencedNode_(c.getInstance().factory_.makeContentNode(t),c.getInstance().factory_.makeContentNode(e),n):(t&&n.unshift(c.getInstance().factory_.makeContentNode(t)),e&&n.push(c.getInstance().factory_.makeContentNode(e)),c.getInstance().row(n))}fractionLikeNode(t,e,r,n){let o;if(!n&&l.isZeroLength(r)){const r=c.getInstance().factory_.makeBranchNode("line",[t],[]),n=c.getInstance().factory_.makeBranchNode("line",[e],[]);return o=c.getInstance().factory_.makeBranchNode("multiline",[r,n],[]),c.binomialForm_(o),c.classifyMultiline(o),o}return o=c.getInstance().fractionNode_(t,e),n&&o.addAnnotation("general","bevelled"),o}tensor(t,e,r,n,o){const i=c.getInstance().factory_.makeBranchNode("tensor",[t,c.getInstance().scriptNode_(e,"leftsub"),c.getInstance().scriptNode_(r,"leftsuper"),c.getInstance().scriptNode_(n,"rightsub"),c.getInstance().scriptNode_(o,"rightsuper")],[]);return i.role=t.role,i.embellished=s.isEmbellished(t),i}pseudoTensor(t,e,r){const n=t=>!s.isType(t,"empty"),o=e.filter(n).length,i=r.filter(n).length;if(!o&&!i)return t;const a=o?i?"MSUBSUP":"MSUB":"MSUP",l=[t];return o&&l.push(c.getInstance().scriptNode_(e,"rightsub",!0)),i&&l.push(c.getInstance().scriptNode_(r,"rightsuper",!0)),c.getInstance().limitNode(a,l)}font(t){const e=c.MATHJAX_FONTS[t];return e||t}proof(t,e,r){if(e.inference||e.axiom||console.log("Noise"),e.axiom){const e=c.getInstance().cleanInference(t.childNodes),n=e.length?c.getInstance().factory_.makeBranchNode("inference",r(e),[]):c.getInstance().factory_.makeEmptyNode();return n.role="axiom",n.mathmlTree=t,n}const n=c.getInstance().inference(t,e,r);return e.proof&&(n.role="proof",n.childNodes[0].role="final"),n}inference(t,e,r){if(e.inferenceRule){const e=c.getInstance().getFormulas(t,[],r);return c.getInstance().factory_.makeBranchNode("inference",[e.conclusion,e.premises],[])}const o=e.labelledRule,i=n.toArray(t.childNodes),a=[];"left"!==o&&"both"!==o||a.push(c.getInstance().getLabel(t,i,r,"left")),"right"!==o&&"both"!==o||a.push(c.getInstance().getLabel(t,i,r,"right"));const s=c.getInstance().getFormulas(t,i,r),l=c.getInstance().factory_.makeBranchNode("inference",[s.conclusion,s.premises],a);return l.mathmlTree=t,l}getLabel(t,e,r,o){const i=c.getInstance().findNestedRow(e,"prooflabel",o),a=c.getInstance().factory_.makeBranchNode("rulelabel",r(n.toArray(i.childNodes)),[]);return a.role=o,a.mathmlTree=i,a}getFormulas(t,e,r){const o=e.length?c.getInstance().findNestedRow(e,"inferenceRule"):t,i="up"===c.getSemantics(o).inferenceRule,a=i?o.childNodes[1]:o.childNodes[0],s=i?o.childNodes[0]:o.childNodes[1],l=a.childNodes[0].childNodes[0],u=n.toArray(l.childNodes[0].childNodes),p=[];let h=1;for(const t of u)h%2&&p.push(t.childNodes[0]),h++;const d=r(p),f=r(n.toArray(s.childNodes[0].childNodes))[0],m=c.getInstance().factory_.makeBranchNode("premises",d,[]);m.mathmlTree=l;const y=c.getInstance().factory_.makeBranchNode("conclusion",[f],[]);return y.mathmlTree=s.childNodes[0].childNodes[0],{conclusion:y,premises:m}}findNestedRow(t,e,r){return c.getInstance().findNestedRow_(t,e,0,r)}cleanInference(t){return n.toArray(t).filter((function(t){return"MSPACE"!==n.tagName(t)}))}operatorNode(t){return"unknown"===t.type&&(t.type="operator"),i.run("multioperator",t)}implicitNode_(t){const e=c.getInstance().factory_.makeMultipleContentNodes(t.length-1,o.invisibleTimes());c.matchSpaces_(t,e);const r=c.getInstance().infixNode_(t,e[0]);return r.role="implicit",e.forEach((function(t){t.parent=r})),r.contentNodes=e,r}infixNode_(t,e){const r=c.getInstance().factory_.makeBranchNode("infixop",t,[e],l.getEmbellishedInner(e).textContent);return r.role=e.role,i.run("propagateSimpleFunction",r)}explicitMixed_(t){const e=l.partitionNodes(t,(function(t){return t.textContent===o.invisiblePlus()}));if(!e.rel.length)return t;let r=[];for(let t,n=0;t=e.rel[n];n++){const o=e.comp[n],i=e.comp[n+1],a=o.length-1;if(o[a]&&i[0]&&s.isType(o[a],"number")&&!s.isRole(o[a],"mixed")&&s.isType(i[0],"fraction")){const t=c.getInstance().factory_.makeBranchNode("number",[o[a],i[0]],[]);t.role="mixed",r=r.concat(o.slice(0,a)),r.push(t),i.shift()}else r=r.concat(o),r.push(t)}return r.concat(e.comp[e.comp.length-1])}concatNode_(t,e,r){if(0===e.length)return t;const n=e.map((function(t){return l.getEmbellishedInner(t).textContent})).join(" "),o=c.getInstance().factory_.makeBranchNode(r,[t],e,n);return e.length>1&&(o.role="multiop"),o}prefixNode_(t,e){const r=l.partitionNodes(e,(t=>s.isRole(t,"subtraction")));let n=c.getInstance().concatNode_(t,r.comp.pop(),"prefixop");for(1===n.contentNodes.length&&"addition"===n.contentNodes[0].role&&"+"===n.contentNodes[0].textContent&&(n.role="positive");r.rel.length>0;)n=c.getInstance().concatNode_(n,[r.rel.pop()],"prefixop"),n.role="negative",n=c.getInstance().concatNode_(n,r.comp.pop(),"prefixop");return n}postfixNode_(t,e){return e.length?c.getInstance().concatNode_(t,e,"postfixop"):t}combineUnits_(t){const e=l.partitionNodes(t,(function(t){return!s.isRole(t,"unit")}));if(t.length===e.rel.length)return e.rel;const r=[];let n,o;do{const t=e.comp.shift();n=e.rel.shift();let i=null;o=r.pop(),o&&(t.length&&s.isUnitCounter(o)?t.unshift(o):r.push(o)),1===t.length&&(i=t.pop()),t.length>1&&(i=c.getInstance().implicitNode_(t),i.role="unit"),i&&r.push(i),n&&r.push(n)}while(n);return r}getMixedNumbers_(t){const e=l.partitionNodes(t,(function(t){return s.isType(t,"fraction")&&s.isRole(t,"vulgar")}));if(!e.rel.length)return t;let r=[];for(let t,n=0;t=e.rel[n];n++){const o=e.comp[n],i=o.length-1;if(o[i]&&s.isType(o[i],"number")&&(s.isRole(o[i],"integer")||s.isRole(o[i],"float"))){const e=c.getInstance().factory_.makeBranchNode("number",[o[i],t],[]);e.role="mixed",r=r.concat(o.slice(0,i)),r.push(e)}else r=r.concat(o),r.push(t)}return r.concat(e.comp[e.comp.length-1])}getTextInRow_(t){if(t.length<=1)return t;const e=l.partitionNodes(t,(t=>s.isType(t,"text")));if(0===e.rel.length)return t;const r=[];let n=e.comp[0];n.length>0&&r.push(c.getInstance().row(n));for(let t,o=0;t=e.rel[o];o++)r.push(t),n=e.comp[o+1],n.length>0&&r.push(c.getInstance().row(n));return[c.getInstance().dummyNode_(r)]}relationsInRow_(t){const e=l.partitionNodes(t,s.isRelation),r=e.rel[0];if(!r)return c.getInstance().operationsInRow_(t);if(1===t.length)return t[0];const n=e.comp.map(c.getInstance().operationsInRow_);let o;return e.rel.some((function(t){return!t.equals(r)}))?(o=c.getInstance().factory_.makeBranchNode("multirel",n,e.rel),e.rel.every((function(t){return t.role===r.role}))&&(o.role=r.role),o):(o=c.getInstance().factory_.makeBranchNode("relseq",n,e.rel,l.getEmbellishedInner(r).textContent),o.role=r.role,o)}operationsInRow_(t){if(0===t.length)return c.getInstance().factory_.makeEmptyNode();if(1===(t=c.getInstance().explicitMixed_(t)).length)return t[0];const e=[];for(;t.length>0&&s.isOperator(t[0]);)e.push(t.shift());if(0===t.length)return c.getInstance().prefixNode_(e.pop(),e);if(1===t.length)return c.getInstance().prefixNode_(t[0],e);t=i.run("convert_juxtaposition",t);const r=l.sliceNodes(t,s.isOperator),n=c.getInstance().prefixNode_(c.getInstance().implicitNode(r.head),e);return r.div?c.getInstance().operationsTree_(r.tail,n,r.div):n}operationsTree_(t,e,r,n){const o=n||[];if(0===t.length){if(o.unshift(r),"infixop"===e.type){const t=c.getInstance().postfixNode_(e.childNodes.pop(),o);return e.appendChild(t),e}return c.getInstance().postfixNode_(e,o)}const i=l.sliceNodes(t,s.isOperator);if(0===i.head.length)return o.push(i.div),c.getInstance().operationsTree_(i.tail,e,r,o);const a=c.getInstance().prefixNode_(c.getInstance().implicitNode(i.head),o),u=c.getInstance().appendOperand_(e,r,a);return i.div?c.getInstance().operationsTree_(i.tail,u,i.div,[]):u}appendOperand_(t,e,r){if("infixop"!==t.type)return c.getInstance().infixNode_([t,r],e);const n=c.getInstance().appendDivisionOp_(t,e,r);return n||(c.getInstance().appendExistingOperator_(t,e,r)?t:"multiplication"===e.role?c.getInstance().appendMultiplicativeOp_(t,e,r):c.getInstance().appendAdditiveOp_(t,e,r))}appendDivisionOp_(t,e,r){return"division"===e.role?s.isImplicit(t)?c.getInstance().infixNode_([t,r],e):c.getInstance().appendLastOperand_(t,e,r):"division"===t.role?c.getInstance().infixNode_([t,r],e):null}appendLastOperand_(t,e,r){let n=t,o=t.childNodes[t.childNodes.length-1];for(;o&&"infixop"===o.type&&!s.isImplicit(o);)n=o,o=n.childNodes[t.childNodes.length-1];const i=c.getInstance().infixNode_([n.childNodes.pop(),r],e);return n.appendChild(i),t}appendMultiplicativeOp_(t,e,r){if(s.isImplicit(t))return c.getInstance().infixNode_([t,r],e);let n=t,o=t.childNodes[t.childNodes.length-1];for(;o&&"infixop"===o.type&&!s.isImplicit(o);)n=o,o=n.childNodes[t.childNodes.length-1];const i=c.getInstance().infixNode_([n.childNodes.pop(),r],e);return n.appendChild(i),t}appendAdditiveOp_(t,e,r){return c.getInstance().infixNode_([t,r],e)}appendExistingOperator_(t,e,r){return!(!t||"infixop"!==t.type||s.isImplicit(t))&&(t.contentNodes[0].equals(e)?(t.appendContentNode(e),t.appendChild(r),!0):c.getInstance().appendExistingOperator_(t.childNodes[t.childNodes.length-1],e,r))}getFencesInRow_(t){let e=l.partitionNodes(t,s.isFence);e=c.purgeFences_(e);const r=e.comp.shift();return c.getInstance().fences_(e.rel,e.comp,[],[r])}fences_(t,e,r,n){if(0===t.length&&0===r.length)return n[0];const o=t=>s.isRole(t,"open");if(0===t.length){const t=n.shift();for(;r.length>0;){if(o(r[0])){const e=r.shift();c.fenceToPunct_(e),t.push(e)}else{const e=l.sliceNodes(r,o),i=e.head.length-1,a=c.getInstance().neutralFences_(e.head,n.slice(0,i));n=n.slice(i),t.push(...a),e.div&&e.tail.unshift(e.div),r=e.tail}t.push(...n.shift())}return t}const i=r[r.length-1],a=t[0].role;if("open"===a||s.isNeutralFence(t[0])&&(!i||!s.compareNeutralFences(t[0],i))){r.push(t.shift());const o=e.shift();return o&&n.push(o),c.getInstance().fences_(t,e,r,n)}if(i&&"close"===a&&"open"===i.role){const o=c.getInstance().horizontalFencedNode_(r.pop(),t.shift(),n.pop());return n.push(n.pop().concat([o],e.shift())),c.getInstance().fences_(t,e,r,n)}if(i&&s.compareNeutralFences(t[0],i)){if(!s.elligibleLeftNeutral(i)||!s.elligibleRightNeutral(t[0])){r.push(t.shift());const o=e.shift();return o&&n.push(o),c.getInstance().fences_(t,e,r,n)}const o=c.getInstance().horizontalFencedNode_(r.pop(),t.shift(),n.pop());return n.push(n.pop().concat([o],e.shift())),c.getInstance().fences_(t,e,r,n)}if(i&&"close"===a&&s.isNeutralFence(i)&&r.some(o)){const i=l.sliceNodes(r,o,!0),a=n.pop(),s=n.length-i.tail.length+1,u=c.getInstance().neutralFences_(i.tail,n.slice(s));n=n.slice(0,s);const p=c.getInstance().horizontalFencedNode_(i.div,t.shift(),n.pop().concat(u,a));return n.push(n.pop().concat([p],e.shift())),c.getInstance().fences_(t,e,i.head,n)}const u=t.shift();return c.fenceToPunct_(u),n.push(n.pop().concat([u],e.shift())),c.getInstance().fences_(t,e,r,n)}neutralFences_(t,e){if(0===t.length)return t;if(1===t.length)return c.fenceToPunct_(t[0]),t;const r=t.shift();if(!s.elligibleLeftNeutral(r)){c.fenceToPunct_(r);const n=e.shift();return n.unshift(r),n.concat(c.getInstance().neutralFences_(t,e))}const n=l.sliceNodes(t,(function(t){return s.compareNeutralFences(t,r)}));if(!n.div){c.fenceToPunct_(r);const n=e.shift();return n.unshift(r),n.concat(c.getInstance().neutralFences_(t,e))}if(!s.elligibleRightNeutral(n.div))return c.fenceToPunct_(n.div),t.unshift(r),c.getInstance().neutralFences_(t,e);const o=c.getInstance().combineFencedContent_(r,n.div,n.head,e);if(n.tail.length>0){const t=o.shift(),e=c.getInstance().neutralFences_(n.tail,o);return t.concat(e)}return o[0]}combineFencedContent_(t,e,r,n){if(0===r.length){const r=c.getInstance().horizontalFencedNode_(t,e,n.shift());return n.length>0?n[0].unshift(r):n=[[r]],n}const o=n.shift(),i=r.length-1,a=n.slice(0,i),s=(n=n.slice(i)).shift(),l=c.getInstance().neutralFences_(r,a);o.push(...l),o.push(...s);const u=c.getInstance().horizontalFencedNode_(t,e,o);return n.length>0?n[0].unshift(u):n=[[u]],n}horizontalFencedNode_(t,e,r){const n=c.getInstance().row(r);let o=c.getInstance().factory_.makeBranchNode("fenced",[n],[t,e]);return"open"===t.role?(c.getInstance().classifyHorizontalFence_(o),o=i.run("propagateComposedFunction",o)):o.role=t.role,o=i.run("detect_cycle",o),c.rewriteFencedNode_(o)}classifyHorizontalFence_(t){t.role="leftright";const e=t.childNodes;if(!s.isSetNode(t)||e.length>1)return;if(0===e.length||"empty"===e[0].type)return void(t.role="set empty");const r=e[0].type;if(1===e.length&&s.isSingletonSetContent(e[0]))return void(t.role="set singleton");const n=e[0].role;if("punctuated"===r&&"sequence"===n){if("comma"!==e[0].contentNodes[0].role)return 1!==e[0].contentNodes.length||"vbar"!==e[0].contentNodes[0].role&&"colon"!==e[0].contentNodes[0].role?void 0:(t.role="set extended",void c.getInstance().setExtension_(t));t.role="set collection"}}setExtension_(t){const e=t.childNodes[0].childNodes[0];e&&"infixop"===e.type&&1===e.contentNodes.length&&s.isMembership(e.contentNodes[0])&&(e.addAnnotation("set","intensional"),e.contentNodes[0].addAnnotation("set","intensional"))}getPunctuationInRow_(t){if(t.length<=1)return t;const e=t=>{const e=t.type;return"punctuation"===e||"text"===e||"operator"===e||"relation"===e},r=l.partitionNodes(t,(function(r){if(!s.isPunctuation(r))return!1;if(s.isPunctuation(r)&&!s.isRole(r,"ellipsis"))return!0;const n=t.indexOf(r);if(0===n)return!t[1]||!e(t[1]);const o=t[n-1];if(n===t.length-1)return!e(o);const i=t[n+1];return!e(o)||!e(i)}));if(0===r.rel.length)return t;const n=[];let o=r.comp.shift();o.length>0&&n.push(c.getInstance().row(o));let i=0;for(;r.comp.length>0;)n.push(r.rel[i++]),o=r.comp.shift(),o.length>0&&n.push(c.getInstance().row(o));return[c.getInstance().punctuatedNode_(n,r.rel)]}punctuatedNode_(t,e){const r=c.getInstance().factory_.makeBranchNode("punctuated",t,e);if(e.length===t.length){const t=e[0].role;if("unknown"!==t&&e.every((function(e){return e.role===t})))return r.role=t,r}return s.singlePunctAtPosition(t,e,0)?r.role="startpunct":s.singlePunctAtPosition(t,e,t.length-1)?r.role="endpunct":e.every((t=>s.isRole(t,"dummy")))?r.role="text":e.every((t=>s.isRole(t,"space")))?r.role="space":r.role="sequence",r}dummyNode_(t){const e=c.getInstance().factory_.makeMultipleContentNodes(t.length-1,o.invisibleComma());return e.forEach((function(t){t.role="dummy"})),c.getInstance().punctuatedNode_(t,e)}accentRole_(t,e){if(!s.isAccent(t))return!1;const r=t.textContent,n=o.lookupSecondary("bar",r)||o.lookupSecondary("tilde",r)||t.role;return t.role="underscore"===e?"underaccent":"overaccent",t.addAnnotation("accent",n),!0}accentNode_(t,e,r,n,o){const i=(e=e.slice(0,n+1))[1],a=e[2];let s;if(!o&&a&&(s=c.getInstance().factory_.makeBranchNode("subscript",[t,i],[]),s.role="subsup",e=[s,a],r="superscript"),o){const n=c.getInstance().accentRole_(i,r);if(a){c.getInstance().accentRole_(a,"overscore")&&!n?(s=c.getInstance().factory_.makeBranchNode("overscore",[t,a],[]),e=[s,i],r="underscore"):(s=c.getInstance().factory_.makeBranchNode("underscore",[t,i],[]),e=[s,a],r="overscore"),s.role="underover"}}return c.getInstance().makeLimitNode_(t,e,s,r)}makeLimitNode_(t,e,r,n){if("limupper"===n&&"limlower"===t.type)return t.childNodes.push(e[1]),e[1].parent=t,t.type="limboth",t;if("limlower"===n&&"limupper"===t.type)return t.childNodes.splice(1,-1,e[1]),e[1].parent=t,t.type="limboth",t;const o=c.getInstance().factory_.makeBranchNode(n,e,[]),i=s.isEmbellished(t);return r&&(r.embellished=i),o.embellished=i,o.role=t.role,o}getFunctionsInRow_(t,e){const r=e||[];if(0===t.length)return r;const n=t.shift(),o=c.classifyFunction_(n,t);if(!o)return r.push(n),c.getInstance().getFunctionsInRow_(t,r);const i=c.getInstance().getFunctionsInRow_(t,[]),a=c.getInstance().getFunctionArgs_(n,i,o);return r.concat(a)}getFunctionArgs_(t,e,r){let n,o,i;switch(r){case"integral":{const r=c.getInstance().getIntegralArgs_(e);if(!r.intvar&&!r.integrand.length)return r.rest.unshift(t),r.rest;const n=c.getInstance().row(r.integrand);return i=c.getInstance().integralNode_(t,n,r.intvar),r.rest.unshift(i),r.rest}case"prefix":if(e[0]&&"fenced"===e[0].type){const r=e.shift();return s.isNeutralFence(r)||(r.role="leftright"),i=c.getInstance().functionNode_(t,r),e.unshift(i),e}if(n=l.sliceNodes(e,s.isPrefixFunctionBoundary),n.head.length)o=c.getInstance().row(n.head),n.div&&n.tail.unshift(n.div);else{if(!n.div||!s.isType(n.div,"appl"))return e.unshift(t),e;o=n.div}return i=c.getInstance().functionNode_(t,o),n.tail.unshift(i),n.tail;case"bigop":return n=l.sliceNodes(e,s.isBigOpBoundary),n.head.length?(o=c.getInstance().row(n.head),i=c.getInstance().bigOpNode_(t,o),n.div&&n.tail.unshift(n.div),n.tail.unshift(i),n.tail):(e.unshift(t),e);default:{if(0===e.length)return[t];const r=e[0];return"fenced"===r.type&&!s.isNeutralFence(r)&&s.isSimpleFunctionScope(r)?(r.role="leftright",c.propagateFunctionRole_(t,"simple function"),i=c.getInstance().functionNode_(t,e.shift()),e.unshift(i),e):(e.unshift(t),e)}}}getIntegralArgs_(t,e=[]){if(0===t.length)return{integrand:e,intvar:null,rest:t};const r=t[0];if(s.isGeneralFunctionBoundary(r))return{integrand:e,intvar:null,rest:t};if(s.isIntegralDxBoundarySingle(r))return r.role="integral",{integrand:e,intvar:r,rest:t.slice(1)};if(t[1]&&s.isIntegralDxBoundary(r,t[1])){const n=c.getInstance().prefixNode_(t[1],[r]);return n.role="integral",{integrand:e,intvar:n,rest:t.slice(2)}}return e.push(t.shift()),c.getInstance().getIntegralArgs_(t,e)}functionNode_(t,e){const r=c.getInstance().factory_.makeContentNode(o.functionApplication()),n=c.getInstance().funcAppls[t.id];n&&(r.mathmlTree=n.mathmlTree,r.mathml=n.mathml,r.annotation=n.annotation,r.attributes=n.attributes,delete c.getInstance().funcAppls[t.id]),r.type="punctuation",r.role="application";const i=c.getFunctionOp_(t,(function(t){return s.isType(t,"function")||s.isType(t,"identifier")&&s.isRole(t,"simple function")}));return c.getInstance().functionalNode_("appl",[t,e],i,[r])}bigOpNode_(t,e){const r=c.getFunctionOp_(t,(t=>s.isType(t,"largeop")));return c.getInstance().functionalNode_("bigop",[t,e],r,[])}integralNode_(t,e,r){e=e||c.getInstance().factory_.makeEmptyNode(),r=r||c.getInstance().factory_.makeEmptyNode();const n=c.getFunctionOp_(t,(t=>s.isType(t,"largeop")));return c.getInstance().functionalNode_("integral",[t,e,r],n,[])}functionalNode_(t,e,r,n){const o=e[0];let i;r&&(i=r.parent,n.push(r));const a=c.getInstance().factory_.makeBranchNode(t,e,n);return a.role=o.role,i&&(r.parent=i),a}fractionNode_(t,e){const r=c.getInstance().factory_.makeBranchNode("fraction",[t,e],[]);return r.role=r.childNodes.every((function(t){return s.isType(t,"number")&&s.isRole(t,"integer")}))?"vulgar":r.childNodes.every(s.isPureUnit)?"unit":"division",i.run("propagateSimpleFunction",r)}scriptNode_(t,e,r){let n;switch(t.length){case 0:n=c.getInstance().factory_.makeEmptyNode();break;case 1:if(n=t[0],r)return n;break;default:n=c.getInstance().dummyNode_(t)}return n.role=e,n}findNestedRow_(t,e,r,o){if(r>3)return null;for(let i,a=0;i=t[a];a++){const t=n.tagName(i);if("MSPACE"!==t){if("MROW"===t)return c.getInstance().findNestedRow_(n.toArray(i.childNodes),e,r+1,o);if(c.findSemantics(i,e,o))return i}}return null}}e.default=c,c.FENCE_TO_PUNCT_={metric:"metric",neutral:"vbar",open:"openfence",close:"closefence"},c.MML_TO_LIMIT_={MSUB:{type:"limlower",length:1},MUNDER:{type:"limlower",length:1},MSUP:{type:"limupper",length:1},MOVER:{type:"limupper",length:1},MSUBSUP:{type:"limboth",length:2},MUNDEROVER:{type:"limboth",length:2}},c.MML_TO_BOUNDS_={MSUB:{type:"subscript",length:1,accent:!1},MSUP:{type:"superscript",length:1,accent:!1},MSUBSUP:{type:"subscript",length:2,accent:!1},MUNDER:{type:"underscore",length:1,accent:!0},MOVER:{type:"overscore",length:1,accent:!0},MUNDEROVER:{type:"underscore",length:2,accent:!0}},c.CLASSIFY_FUNCTION_={integral:"integral",sum:"bigop","prefix function":"prefix","limit function":"prefix","simple function":"prefix","composed function":"prefix"},c.MATHJAX_FONTS={"-tex-caligraphic":"caligraphic","-tex-caligraphic-bold":"caligraphic-bold","-tex-calligraphic":"caligraphic","-tex-calligraphic-bold":"caligraphic-bold","-tex-oldstyle":"oldstyle","-tex-oldstyle-bold":"oldstyle-bold","-tex-mathit":"italic"}},5656:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SemanticSkeleton=void 0;const n=r(707),o=r(5274),i=r(2298);class a{constructor(t){this.parents=null,this.levelsMap=null,t=0===t?t:t||[],this.array=t}static fromTree(t){return a.fromNode(t.root)}static fromNode(t){return new a(a.fromNode_(t))}static fromString(t){return new a(a.fromString_(t))}static simpleCollapseStructure(t){return"number"==typeof t}static contentCollapseStructure(t){return!!t&&!a.simpleCollapseStructure(t)&&"c"===t[0]}static interleaveIds(t,e){return n.interleaveLists(a.collapsedLeafs(t),a.collapsedLeafs(e))}static collapsedLeafs(...t){return t.reduce(((t,e)=>{return t.concat((r=e,a.simpleCollapseStructure(r)?[r]:(r=r,a.contentCollapseStructure(r[1])?r.slice(2):r.slice(1))));var r}),[])}static fromStructure(t,e){return new a(a.tree_(t,e.root))}static combineContentChildren(t,e,r){switch(t.type){case"relseq":case"infixop":case"multirel":return n.interleaveLists(r,e);case"prefixop":return e.concat(r);case"postfixop":return r.concat(e);case"fenced":return r.unshift(e[0]),r.push(e[1]),r;case"appl":return[r[0],e[0],r[1]];case"root":return[r[1],r[0]];case"row":case"line":return e.length&&r.unshift(e[0]),r;default:return r}}static makeSexp_(t){return a.simpleCollapseStructure(t)?t.toString():a.contentCollapseStructure(t)?"(c "+t.slice(1).map(a.makeSexp_).join(" ")+")":"("+t.map(a.makeSexp_).join(" ")+")"}static fromString_(t){let e=t.replace(/\(/g,"[");return e=e.replace(/\)/g,"]"),e=e.replace(/ /g,","),e=e.replace(/c/g,'"c"'),JSON.parse(e)}static fromNode_(t){if(!t)return[];const e=t.contentNodes;let r;e.length&&(r=e.map(a.fromNode_),r.unshift("c"));const n=t.childNodes;if(!n.length)return e.length?[t.id,r]:t.id;const o=n.map(a.fromNode_);return e.length&&o.unshift(r),o.unshift(t.id),o}static tree_(t,e){if(!e)return[];if(!e.childNodes.length)return e.id;const r=e.id,n=[r],s=o.evalXPath(`.//self::*[@${i.Attribute.ID}=${r}]`,t)[0],l=a.combineContentChildren(e,e.contentNodes.map((function(t){return t})),e.childNodes.map((function(t){return t})));s&&a.addOwns_(s,l);for(let e,r=0;e=l[r];r++)n.push(a.tree_(t,e));return n}static addOwns_(t,e){const r=t.getAttribute(i.Attribute.COLLAPSED),n=r?a.realLeafs_(a.fromString(r).array):e.map((t=>t.id));t.setAttribute(i.Attribute.OWNS,n.join(" "))}static realLeafs_(t){if(a.simpleCollapseStructure(t))return[t];if(a.contentCollapseStructure(t))return[];t=t;let e=[];for(let r=1;r<t.length;r++)e=e.concat(a.realLeafs_(t[r]));return e}populate(){this.parents&&this.levelsMap||(this.parents={},this.levelsMap={},this.populate_(this.array,this.array,[]))}toString(){return a.makeSexp_(this.array)}populate_(t,e,r){if(a.simpleCollapseStructure(t))return t=t,this.levelsMap[t]=e,void(this.parents[t]=t===r[0]?r.slice(1):r);const n=a.contentCollapseStructure(t)?t.slice(1):t,o=[n[0]].concat(r);for(let e=0,r=n.length;e<r;e++){const r=n[e];this.populate_(r,t,o)}}isRoot(t){return t===this.levelsMap[t][0]}directChildren(t){if(!this.isRoot(t))return[];return this.levelsMap[t].slice(1).map((t=>a.simpleCollapseStructure(t)?t:a.contentCollapseStructure(t)?t[1]:t[0]))}subtreeNodes(t){if(!this.isRoot(t))return[];const e=(t,r)=>{a.simpleCollapseStructure(t)?r.push(t):(t=t,a.contentCollapseStructure(t)&&(t=t.slice(1)),t.forEach((t=>e(t,r))))},r=this.levelsMap[t],n=[];return e(r.slice(1),n),n}}e.SemanticSkeleton=a},7075:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SemanticTree=void 0;const n=r(5740),o=r(7630),i=r(9265),a=r(7228),s=r(5952),l=r(5609);r(94);class c{constructor(t){this.mathml=t,this.parser=new a.SemanticMathml,this.root=this.parser.parse(t),this.collator=this.parser.getFactory().leafMap.collateMeaning();const e=this.collator.newDefault();e&&(this.parser=new a.SemanticMathml,this.parser.getFactory().defaultMap=e,this.root=this.parser.parse(t)),u.visit(this.root,{}),(0,o.annotate)(this.root)}static empty(){const t=n.parseInput("<math/>"),e=new c(t);return e.mathml=t,e}static fromNode(t,e){const r=c.empty();return r.root=t,e&&(r.mathml=e),r}static fromRoot(t,e){let r=t;for(;r.parent;)r=r.parent;const n=c.fromNode(r);return e&&(n.mathml=e),n}static fromXml(t){const e=c.empty();return t.childNodes[0]&&(e.root=s.SemanticNode.fromXml(t.childNodes[0])),e}xml(t){const e=n.parseInput("<stree></stree>"),r=this.root.xml(e.ownerDocument,t);return e.appendChild(r),e}toString(t){return n.serializeXml(this.xml(t))}formatXml(t){const e=this.toString(t);return n.formatXml(e)}displayTree(){this.root.displayTree()}replaceNode(t,e){const r=t.parent;r?r.replaceChild(t,e):this.root=e}toJson(){const t={};return t.stree=this.root.toJson(),t}}e.SemanticTree=c;const u=new i.SemanticVisitor("general","unit",((t,e)=>{if("infixop"===t.type&&("multiplication"===t.role||"implicit"===t.role)){const e=t.childNodes;e.length&&(l.isPureUnit(e[0])||l.isUnitCounter(e[0]))&&t.childNodes.slice(1).every(l.isPureUnit)&&(t.role="unit")}return!1}))},4795:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.partitionNodes=e.sliceNodes=e.getEmbellishedInner=e.addAttributes=e.isZeroLength=e.purgeNodes=e.isOrphanedGlyph=e.hasDisplayTag=e.hasEmptyTag=e.hasIgnoreTag=e.hasLeafTag=e.hasMathTag=e.directSpeechKeys=e.DISPLAYTAGS=e.EMPTYTAGS=e.IGNORETAGS=e.LEAFTAGS=void 0;const n=r(5740);function o(t){return!!t&&-1!==e.LEAFTAGS.indexOf(n.tagName(t))}function i(t,e,r){r&&t.reverse();const n=[];for(let o,i=0;o=t[i];i++){if(e(o))return r?{head:t.slice(i+1).reverse(),div:o,tail:n.reverse()}:{head:n,div:o,tail:t.slice(i+1)};n.push(o)}return r?{head:[],div:null,tail:n.reverse()}:{head:n,div:null,tail:[]}}e.LEAFTAGS=["MO","MI","MN","MTEXT","MS","MSPACE"],e.IGNORETAGS=["MERROR","MPHANTOM","MALIGNGROUP","MALIGNMARK","MPRESCRIPTS","ANNOTATION","ANNOTATION-XML"],e.EMPTYTAGS=["MATH","MROW","MPADDED","MACTION","NONE","MSTYLE","SEMANTICS"],e.DISPLAYTAGS=["MROOT","MSQRT"],e.directSpeechKeys=["aria-label","exact-speech","alt"],e.hasMathTag=function(t){return!!t&&"MATH"===n.tagName(t)},e.hasLeafTag=o,e.hasIgnoreTag=function(t){return!!t&&-1!==e.IGNORETAGS.indexOf(n.tagName(t))},e.hasEmptyTag=function(t){return!!t&&-1!==e.EMPTYTAGS.indexOf(n.tagName(t))},e.hasDisplayTag=function(t){return!!t&&-1!==e.DISPLAYTAGS.indexOf(n.tagName(t))},e.isOrphanedGlyph=function(t){return!!t&&"MGLYPH"===n.tagName(t)&&!o(t.parentNode)},e.purgeNodes=function(t){const r=[];for(let o,i=0;o=t[i];i++){if(o.nodeType!==n.NodeType.ELEMENT_NODE)continue;const t=n.tagName(o);-1===e.IGNORETAGS.indexOf(t)&&(-1!==e.EMPTYTAGS.indexOf(t)&&0===o.childNodes.length||r.push(o))}return r},e.isZeroLength=function(t){if(!t)return!1;if(-1!==["negativeveryverythinmathspace","negativeverythinmathspace","negativethinmathspace","negativemediummathspace","negativethickmathspace","negativeverythickmathspace","negativeveryverythickmathspace"].indexOf(t))return!0;const e=t.match(/[0-9.]+/);return!!e&&0===parseFloat(e[0])},e.addAttributes=function(t,r){if(r.hasAttributes()){const n=r.attributes;for(let r=n.length-1;r>=0;r--){const o=n[r].name;o.match(/^ext/)&&(t.attributes[o]=n[r].value,t.nobreaking=!0),-1!==e.directSpeechKeys.indexOf(o)&&(t.attributes["ext-speech"]=n[r].value,t.nobreaking=!0),o.match(/texclass$/)&&(t.attributes.texclass=n[r].value),"href"===o&&(t.attributes.href=n[r].value,t.nobreaking=!0)}}},e.getEmbellishedInner=function t(e){return e&&e.embellished&&e.childNodes.length>0?t(e.childNodes[0]):e},e.sliceNodes=i,e.partitionNodes=function(t,e){let r=t;const n=[],o=[];let a=null;do{a=i(r,e),o.push(a.head),n.push(a.div),r=a.tail}while(a.div);return n.pop(),{rel:n,comp:o}}},6278:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractSpeechGenerator=void 0;const n=r(6828),o=r(2298),i=r(1214),a=r(9543);e.AbstractSpeechGenerator=class{constructor(){this.modality=o.addPrefix("speech"),this.rebuilt_=null,this.options_={}}getRebuilt(){return this.rebuilt_}setRebuilt(t){this.rebuilt_=t}setOptions(t){this.options_=t||{},this.modality=o.addPrefix(this.options_.modality||"speech")}getOptions(){return this.options_}start(){}end(){}generateSpeech(t,e){return this.rebuilt_||(this.rebuilt_=new i.RebuildStree(e)),(0,n.setup)(this.options_),a.computeMarkup(this.getRebuilt().xml)}}},1452:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.AdhocSpeechGenerator=void 0;const n=r(6278);class o extends n.AbstractSpeechGenerator{getSpeech(t,e){const r=this.generateSpeech(t,e);return t.setAttribute(this.modality,r),r}}e.AdhocSpeechGenerator=o},5152:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.ColorGenerator=void 0;const n=r(2298),o=r(8396),i=r(1214),a=r(1204),s=r(6278);class l extends s.AbstractSpeechGenerator{constructor(){super(...arguments),this.modality=(0,n.addPrefix)("foreground"),this.contrast=new o.ContrastPicker}static visitStree_(t,e,r){if(t.childNodes.length){if(t.contentNodes.length&&("punctuated"===t.type&&t.contentNodes.forEach((t=>r[t.id]=!0)),"implicit"!==t.role&&e.push(t.contentNodes.map((t=>t.id)))),t.childNodes.length){if("implicit"===t.role){const n=[];let o=[];for(const e of t.childNodes){const t=[];l.visitStree_(e,t,r),t.length<=2&&n.push(t.shift()),o=o.concat(t)}return e.push(n),void o.forEach((t=>e.push(t)))}t.childNodes.forEach((t=>l.visitStree_(t,e,r)))}}else r[t.id]||e.push(t.id)}getSpeech(t,e){return a.getAttribute(t,this.modality)}generateSpeech(t,e){return this.getRebuilt()||this.setRebuilt(new i.RebuildStree(t)),this.colorLeaves_(t),a.getAttribute(t,this.modality)}colorLeaves_(t){const e=[];l.visitStree_(this.getRebuilt().streeRoot,e,{});for(const r of e){const e=this.contrast.generate();let n=!1;n=Array.isArray(r)?r.map((r=>this.colorLeave_(t,r,e))).reduce(((t,e)=>t||e),!1):this.colorLeave_(t,r.toString(),e),n&&this.contrast.increment()}}colorLeave_(t,e,r){const n=a.getBySemanticId(t,e);return!!n&&(n.setAttribute(this.modality,r),!0)}}e.ColorGenerator=l},6604:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.DirectSpeechGenerator=void 0;const n=r(1204),o=r(6278);class i extends o.AbstractSpeechGenerator{getSpeech(t,e){return n.getAttribute(t,this.modality)}}e.DirectSpeechGenerator=i},3123:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.DummySpeechGenerator=void 0;const n=r(6278);class o extends n.AbstractSpeechGenerator{getSpeech(t,e){return""}}e.DummySpeechGenerator=o},5858:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.NodeSpeechGenerator=void 0;const n=r(1204),o=r(4598);class i extends o.TreeSpeechGenerator{getSpeech(t,e){return super.getSpeech(t,e),n.getAttribute(t,this.modality)}}e.NodeSpeechGenerator=i},9552:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.generatorMapping_=e.generator=void 0;const n=r(1452),o=r(5152),i=r(6604),a=r(3123),s=r(5858),l=r(597),c=r(4598);e.generator=function(t){return(e.generatorMapping_[t]||e.generatorMapping_.Direct)()},e.generatorMapping_={Adhoc:()=>new n.AdhocSpeechGenerator,Color:()=>new o.ColorGenerator,Direct:()=>new i.DirectSpeechGenerator,Dummy:()=>new a.DummySpeechGenerator,Node:()=>new s.NodeSpeechGenerator,Summary:()=>new l.SummarySpeechGenerator,Tree:()=>new c.TreeSpeechGenerator}},9543:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.computeSummary_=e.retrieveSummary=e.connectAllMactions=e.connectMactions=e.nodeAtPosition_=e.computePrefix_=e.retrievePrefix=e.addPrefix=e.addModality=e.addSpeech=e.recomputeMarkup=e.computeMarkup=e.recomputeSpeech=e.computeSpeech=void 0;const n=r(8290),o=r(5740),i=r(5274),a=r(2298),s=r(2362),l=r(7075),c=r(1204);function u(t){return s.SpeechRuleEngine.getInstance().evaluateNode(t)}function p(t){return u(l.SemanticTree.fromNode(t).xml())}function h(t){const e=p(t);return n.markup(e)}function d(t){const e=f(t);return n.markup(e)}function f(t){const e=l.SemanticTree.fromRoot(t),r=i.evalXPath('.//*[@id="'+t.id+'"]',e.xml());let n=r[0];return r.length>1&&(n=m(t,r)||n),n?s.SpeechRuleEngine.getInstance().runInSetting({modality:"prefix",domain:"default",style:"default",strict:!0,speech:!0},(function(){return s.SpeechRuleEngine.getInstance().evaluateNode(n)})):[]}function m(t,e){const r=e[0];if(!t.parent)return r;const n=[];for(;t;)n.push(t.id),t=t.parent;const o=function(t,e){for(;e.length&&e.shift().toString()===t.getAttribute("id")&&t.parentNode&&t.parentNode.parentNode;)t=t.parentNode.parentNode;return!e.length};for(let t,r=0;t=e[r];r++)if(o(t,n.slice()))return t;return r}function y(t){return t?s.SpeechRuleEngine.getInstance().runInSetting({modality:"summary",strict:!1,speech:!0},(function(){return s.SpeechRuleEngine.getInstance().evaluateNode(t)})):[]}e.computeSpeech=u,e.recomputeSpeech=p,e.computeMarkup=function(t){const e=u(t);return n.markup(e)},e.recomputeMarkup=h,e.addSpeech=function(t,e,r){const i=o.querySelectorAllByAttrValue(r,"id",e.id.toString())[0],s=i?n.markup(u(i)):h(e);t.setAttribute(a.Attribute.SPEECH,s)},e.addModality=function(t,e,r){const n=h(e);t.setAttribute(r,n)},e.addPrefix=function(t,e){const r=d(e);r&&t.setAttribute(a.Attribute.PREFIX,r)},e.retrievePrefix=d,e.computePrefix_=f,e.nodeAtPosition_=m,e.connectMactions=function(t,e,r){const n=o.querySelectorAll(e,"maction");for(let e,i=0;e=n[i];i++){const n=e.getAttribute("id"),i=o.querySelectorAllByAttrValue(t,"id",n)[0];if(!i)continue;const s=e.childNodes[1],l=s.getAttribute(a.Attribute.ID);let u=c.getBySemanticId(t,l);if(u&&"dummy"!==u.getAttribute(a.Attribute.TYPE))continue;if(u=i.childNodes[0],u.getAttribute("sre-highlighter-added"))continue;const p=s.getAttribute(a.Attribute.PARENT);p&&u.setAttribute(a.Attribute.PARENT,p),u.setAttribute(a.Attribute.TYPE,"dummy"),u.setAttribute(a.Attribute.ID,l);o.querySelectorAllByAttrValue(r,"id",l)[0].setAttribute("alternative",l)}},e.connectAllMactions=function(t,e){const r=o.querySelectorAll(t,"maction");for(let t,n=0;t=r[n];n++){const r=t.childNodes[1].getAttribute(a.Attribute.ID);o.querySelectorAllByAttrValue(e,"id",r)[0].setAttribute("alternative",r)}},e.retrieveSummary=function(t){const e=y(t);return n.markup(e)},e.computeSummary_=y},597:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SummarySpeechGenerator=void 0;const n=r(6278),o=r(9543);class i extends n.AbstractSpeechGenerator{getSpeech(t,e){return o.connectAllMactions(e,this.getRebuilt().xml),this.generateSpeech(t,e)}}e.SummarySpeechGenerator=i},4598:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.TreeSpeechGenerator=void 0;const n=r(2298),o=r(1204),i=r(6278),a=r(9543);class s extends i.AbstractSpeechGenerator{getSpeech(t,e){const r=this.generateSpeech(t,e),i=this.getRebuilt().nodeDict;for(const r in i){const s=i[r],l=o.getBySemanticId(e,r),c=o.getBySemanticId(t,r);l&&c&&(this.modality&&this.modality!==n.Attribute.SPEECH?a.addModality(c,s,this.modality):a.addSpeech(c,s,this.getRebuilt().xml),this.modality===n.Attribute.SPEECH&&a.addPrefix(c,s))}return r}}e.TreeSpeechGenerator=s},313:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.INTERVALS=e.makeLetter=e.numberRules=e.alphabetRules=e.getFont=e.makeInterval=e.generate=e.makeDomains_=e.Domains_=e.Base=e.Embellish=e.Font=void 0;const n=r(5897),o=r(7491),i=r(4356),a=r(2536),s=r(2780);var l,c,u;function p(){const t=i.LOCALE.ALPHABETS,r=(t,e)=>{const r={};return Object.keys(t).forEach((t=>r[t]=!0)),Object.keys(e).forEach((t=>r[t]=!0)),Object.keys(r)};e.Domains_.small=r(t.smallPrefix,t.letterTrans),e.Domains_.capital=r(t.capPrefix,t.letterTrans),e.Domains_.digit=r(t.digitPrefix,t.digitTrans)}function h(t){const e=t.toString(16).toUpperCase();return e.length>3?e:("000"+e).slice(-4)}function d([t,e],r){const n=parseInt(t,16),o=parseInt(e,16),i=[];for(let t=n;t<=o;t++){let e=h(t);!1!==r[e]&&(e=r[e]||e,i.push(e))}return i}function f(t){const e="normal"===t||"fullwidth"===t?"":i.LOCALE.MESSAGES.font[t]||i.LOCALE.MESSAGES.embellish[t]||"";return(0,a.localeFontCombiner)(e)}function m(t,r,n,o,a,s){const l=f(o);for(let o,c,u,p=0;o=t[p],c=r[p],u=n[p];p++){const t=s?i.LOCALE.ALPHABETS.capPrefix:i.LOCALE.ALPHABETS.smallPrefix,r=s?e.Domains_.capital:e.Domains_.small;g(l.combiner,o,c,u,l.font,t,a,i.LOCALE.ALPHABETS.letterTrans,r)}}function y(t,r,n,o,a){const s=f(n);for(let n,l,c=0;n=t[c],l=r[c];c++){const t=i.LOCALE.ALPHABETS.digitPrefix,r=c+a;g(s.combiner,n,l,r,s.font,t,o,i.LOCALE.ALPHABETS.digitTrans,e.Domains_.digit)}}function g(t,e,r,n,o,i,a,l,c){for(let u,p=0;u=c[p];p++){const c=u in l?l[u]:l.default,p=u in i?i[u]:i.default;s.defineRule(e.toString(),u,"default",a,r,t(c(n),o,p))}}!function(t){t.BOLD="bold",t.BOLDFRAKTUR="bold-fraktur",t.BOLDITALIC="bold-italic",t.BOLDSCRIPT="bold-script",t.DOUBLESTRUCK="double-struck",t.FULLWIDTH="fullwidth",t.FRAKTUR="fraktur",t.ITALIC="italic",t.MONOSPACE="monospace",t.NORMAL="normal",t.SCRIPT="script",t.SANSSERIF="sans-serif",t.SANSSERIFITALIC="sans-serif-italic",t.SANSSERIFBOLD="sans-serif-bold",t.SANSSERIFBOLDITALIC="sans-serif-bold-italic"}(l=e.Font||(e.Font={})),function(t){t.SUPER="super",t.SUB="sub",t.CIRCLED="circled",t.PARENTHESIZED="parenthesized",t.PERIOD="period",t.NEGATIVECIRCLED="negative-circled",t.DOUBLECIRCLED="double-circled",t.CIRCLEDSANSSERIF="circled-sans-serif",t.NEGATIVECIRCLEDSANSSERIF="negative-circled-sans-serif",t.COMMA="comma",t.SQUARED="squared",t.NEGATIVESQUARED="negative-squared"}(c=e.Embellish||(e.Embellish={})),function(t){t.LATINCAP="latinCap",t.LATINSMALL="latinSmall",t.GREEKCAP="greekCap",t.GREEKSMALL="greekSmall",t.DIGIT="digit"}(u=e.Base||(e.Base={})),e.Domains_={small:["default"],capital:["default"],digit:["default"]},e.makeDomains_=p,e.generate=function(t){const r=n.default.getInstance().locale;n.default.getInstance().locale=t,o.setLocale(),s.addSymbolRules({locale:t}),p();const a=e.INTERVALS;for(let t,e=0;t=a[e];e++){const e=d(t.interval,t.subst),r=e.map((function(t){return String.fromCodePoint(parseInt(t,16))}));if("offset"in t)y(e,r,t.font,t.category,t.offset||0);else{m(e,r,i.LOCALE.ALPHABETS[t.base],t.font,t.category,!!t.capital)}}n.default.getInstance().locale=r,o.setLocale()},e.makeInterval=d,e.getFont=f,e.alphabetRules=m,e.numberRules=y,e.makeLetter=g,e.INTERVALS=[{interval:["1D400","1D419"],base:u.LATINCAP,subst:{},capital:!0,category:"Lu",font:l.BOLD},{interval:["1D41A","1D433"],base:u.LATINSMALL,subst:{},capital:!1,category:"Ll",font:l.BOLD},{interval:["1D56C","1D585"],base:u.LATINCAP,subst:{},capital:!0,category:"Lu",font:l.BOLDFRAKTUR},{interval:["1D586","1D59F"],base:u.LATINSMALL,subst:{},capital:!1,category:"Ll",font:l.BOLDFRAKTUR},{interval:["1D468","1D481"],base:u.LATINCAP,subst:{},capital:!0,category:"Lu",font:l.BOLDITALIC},{interval:["1D482","1D49B"],base:u.LATINSMALL,subst:{},capital:!1,category:"Ll",font:l.BOLDITALIC},{interval:["1D4D0","1D4E9"],base:u.LATINCAP,subst:{},capital:!0,category:"Lu",font:l.BOLDSCRIPT},{interval:["1D4EA","1D503"],base:u.LATINSMALL,subst:{},capital:!1,category:"Ll",font:l.BOLDSCRIPT},{interval:["1D538","1D551"],base:u.LATINCAP,subst:{"1D53A":"2102","1D53F":"210D","1D545":"2115","1D547":"2119","1D548":"211A","1D549":"211D","1D551":"2124"},capital:!0,category:"Lu",font:l.DOUBLESTRUCK},{interval:["1D552","1D56B"],base:u.LATINSMALL,subst:{},capital:!1,category:"Ll",font:l.DOUBLESTRUCK},{interval:["1D504","1D51D"],base:u.LATINCAP,subst:{"1D506":"212D","1D50B":"210C","1D50C":"2111","1D515":"211C","1D51D":"2128"},capital:!0,category:"Lu",font:l.FRAKTUR},{interval:["1D51E","1D537"],base:u.LATINSMALL,subst:{},capital:!1,category:"Ll",font:l.FRAKTUR},{interval:["FF21","FF3A"],base:u.LATINCAP,subst:{},capital:!0,category:"Lu",font:l.FULLWIDTH},{interval:["FF41","FF5A"],base:u.LATINSMALL,subst:{},capital:!1,category:"Ll",font:l.FULLWIDTH},{interval:["1D434","1D44D"],base:u.LATINCAP,subst:{},capital:!0,category:"Lu",font:l.ITALIC},{interval:["1D44E","1D467"],base:u.LATINSMALL,subst:{"1D455":"210E"},capital:!1,category:"Ll",font:l.ITALIC},{interval:["1D670","1D689"],base:u.LATINCAP,subst:{},capital:!0,category:"Lu",font:l.MONOSPACE},{interval:["1D68A","1D6A3"],base:u.LATINSMALL,subst:{},capital:!1,category:"Ll",font:l.MONOSPACE},{interval:["0041","005A"],base:u.LATINCAP,subst:{},capital:!0,category:"Lu",font:l.NORMAL},{interval:["0061","007A"],base:u.LATINSMALL,subst:{},capital:!1,category:"Ll",font:l.NORMAL},{interval:["1D49C","1D4B5"],base:u.LATINCAP,subst:{"1D49D":"212C","1D4A0":"2130","1D4A1":"2131","1D4A3":"210B","1D4A4":"2110","1D4A7":"2112","1D4A8":"2133","1D4AD":"211B"},capital:!0,category:"Lu",font:l.SCRIPT},{interval:["1D4B6","1D4CF"],base:u.LATINSMALL,subst:{"1D4BA":"212F","1D4BC":"210A","1D4C4":"2134"},capital:!1,category:"Ll",font:l.SCRIPT},{interval:["1D5A0","1D5B9"],base:u.LATINCAP,subst:{},capital:!0,category:"Lu",font:l.SANSSERIF},{interval:["1D5BA","1D5D3"],base:u.LATINSMALL,subst:{},capital:!1,category:"Ll",font:l.SANSSERIF},{interval:["1D608","1D621"],base:u.LATINCAP,subst:{},capital:!0,category:"Lu",font:l.SANSSERIFITALIC},{interval:["1D622","1D63B"],base:u.LATINSMALL,subst:{},capital:!1,category:"Ll",font:l.SANSSERIFITALIC},{interval:["1D5D4","1D5ED"],base:u.LATINCAP,subst:{},capital:!0,category:"Lu",font:l.SANSSERIFBOLD},{interval:["1D5EE","1D607"],base:u.LATINSMALL,subst:{},capital:!1,category:"Ll",font:l.SANSSERIFBOLD},{interval:["1D63C","1D655"],base:u.LATINCAP,subst:{},capital:!0,category:"Lu",font:l.SANSSERIFBOLDITALIC},{interval:["1D656","1D66F"],base:u.LATINSMALL,subst:{},capital:!1,category:"Ll",font:l.SANSSERIFBOLDITALIC},{interval:["0391","03A9"],base:u.GREEKCAP,subst:{"03A2":"03F4"},capital:!0,category:"Lu",font:l.NORMAL},{interval:["03B0","03D0"],base:u.GREEKSMALL,subst:{"03B0":"2207","03CA":"2202","03CB":"03F5","03CC":"03D1","03CD":"03F0","03CE":"03D5","03CF":"03F1","03D0":"03D6"},capital:!1,category:"Ll",font:l.NORMAL},{interval:["1D6A8","1D6C0"],base:u.GREEKCAP,subst:{},capital:!0,category:"Lu",font:l.BOLD},{interval:["1D6C1","1D6E1"],base:u.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:l.BOLD},{interval:["1D6E2","1D6FA"],base:u.GREEKCAP,subst:{},capital:!0,category:"Lu",font:l.ITALIC},{interval:["1D6FB","1D71B"],base:u.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:l.ITALIC},{interval:["1D71C","1D734"],base:u.GREEKCAP,subst:{},capital:!0,category:"Lu",font:l.BOLDITALIC},{interval:["1D735","1D755"],base:u.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:l.BOLDITALIC},{interval:["1D756","1D76E"],base:u.GREEKCAP,subst:{},capital:!0,category:"Lu",font:l.SANSSERIFBOLD},{interval:["1D76F","1D78F"],base:u.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:l.SANSSERIFBOLD},{interval:["1D790","1D7A8"],base:u.GREEKCAP,subst:{},capital:!0,category:"Lu",font:l.SANSSERIFBOLDITALIC},{interval:["1D7A9","1D7C9"],base:u.GREEKSMALL,subst:{},capital:!1,category:"Ll",font:l.SANSSERIFBOLDITALIC},{interval:["0030","0039"],base:u.DIGIT,subst:{},offset:0,category:"Nd",font:l.NORMAL},{interval:["2070","2079"],base:u.DIGIT,subst:{2071:"00B9",2072:"00B2",2073:"00B3"},offset:0,category:"No",font:c.SUPER},{interval:["2080","2089"],base:u.DIGIT,subst:{},offset:0,category:"No",font:c.SUB},{interval:["245F","2473"],base:u.DIGIT,subst:{"245F":"24EA"},offset:0,category:"No",font:c.CIRCLED},{interval:["3251","325F"],base:u.DIGIT,subst:{},offset:21,category:"No",font:c.CIRCLED},{interval:["32B1","32BF"],base:u.DIGIT,subst:{},offset:36,category:"No",font:c.CIRCLED},{interval:["2474","2487"],base:u.DIGIT,subst:{},offset:1,category:"No",font:c.PARENTHESIZED},{interval:["2487","249B"],base:u.DIGIT,subst:{2487:"1F100"},offset:0,category:"No",font:c.PERIOD},{interval:["2775","277F"],base:u.DIGIT,subst:{2775:"24FF"},offset:0,category:"No",font:c.NEGATIVECIRCLED},{interval:["24EB","24F4"],base:u.DIGIT,subst:{},offset:11,category:"No",font:c.NEGATIVECIRCLED},{interval:["24F5","24FE"],base:u.DIGIT,subst:{},offset:1,category:"No",font:c.DOUBLECIRCLED},{interval:["277F","2789"],base:u.DIGIT,subst:{"277F":"1F10B"},offset:0,category:"No",font:c.CIRCLEDSANSSERIF},{interval:["2789","2793"],base:u.DIGIT,subst:{2789:"1F10C"},offset:0,category:"No",font:c.NEGATIVECIRCLEDSANSSERIF},{interval:["FF10","FF19"],base:u.DIGIT,subst:{},offset:0,category:"Nd",font:l.FULLWIDTH},{interval:["1D7CE","1D7D7"],base:u.DIGIT,subst:{},offset:0,category:"Nd",font:l.BOLD},{interval:["1D7D8","1D7E1"],base:u.DIGIT,subst:{},offset:0,category:"Nd",font:l.DOUBLESTRUCK},{interval:["1D7E2","1D7EB"],base:u.DIGIT,subst:{},offset:0,category:"Nd",font:l.SANSSERIF},{interval:["1D7EC","1D7F5"],base:u.DIGIT,subst:{},offset:0,category:"Nd",font:l.SANSSERIFBOLD},{interval:["1D7F6","1D7FF"],base:u.DIGIT,subst:{},offset:0,category:"Nd",font:l.MONOSPACE},{interval:["1F101","1F10A"],base:u.DIGIT,subst:{},offset:0,category:"No",font:c.COMMA},{interval:["24B6","24CF"],base:u.LATINCAP,subst:{},capital:!0,category:"So",font:c.CIRCLED},{interval:["24D0","24E9"],base:u.LATINSMALL,subst:{},capital:!1,category:"So",font:c.CIRCLED},{interval:["1F110","1F129"],base:u.LATINCAP,subst:{},capital:!0,category:"So",font:c.PARENTHESIZED},{interval:["249C","24B5"],base:u.LATINSMALL,subst:{},capital:!1,category:"So",font:c.PARENTHESIZED},{interval:["1F130","1F149"],base:u.LATINCAP,subst:{},capital:!0,category:"So",font:c.SQUARED},{interval:["1F170","1F189"],base:u.LATINCAP,subst:{},capital:!0,category:"So",font:c.NEGATIVESQUARED},{interval:["1F150","1F169"],base:u.LATINCAP,subst:{},capital:!0,category:"So",font:c.NEGATIVECIRCLED}]},8504:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Parser=e.Comparator=e.ClearspeakPreferences=void 0;const n=r(5897),o=r(4440),i=r(1676),a=r(1676),s=r(2780),l=r(2362);class c extends i.DynamicCstr{constructor(t,e){super(t),this.preference=e}static comparator(){return new p(n.default.getInstance().dynamicCstr,a.DynamicProperties.createProp([i.DynamicCstr.DEFAULT_VALUES[a.Axis.LOCALE]],[i.DynamicCstr.DEFAULT_VALUES[a.Axis.MODALITY]],[i.DynamicCstr.DEFAULT_VALUES[a.Axis.DOMAIN]],[i.DynamicCstr.DEFAULT_VALUES[a.Axis.STYLE]]))}static fromPreference(t){const e=t.split(":"),r={},n=u.getProperties(),o=Object.keys(n);for(let t,i=0;t=e[i];i++){const e=t.split("_");if(-1===o.indexOf(e[0]))continue;const i=e[1];i&&i!==c.AUTO&&-1!==n[e[0]].indexOf(i)&&(r[e[0]]=e[1])}return r}static toPreference(t){const e=Object.keys(t),r=[];for(let n=0;n<e.length;n++)r.push(e[n]+"_"+t[e[n]]);return r.length?r.join(":"):i.DynamicCstr.DEFAULT_VALUE}static getLocalePreferences(t){const e=t||s.enumerate(l.SpeechRuleEngine.getInstance().enumerate());return c.getLocalePreferences_(e)}static smartPreferences(t,e){const r=c.getLocalePreferences()[e];if(!r)return[];const n=t.explorers.speech,i=c.relevantPreferences(n.walker.getFocus().getSemanticPrimary()),a=o.DOMAIN_TO_STYLES.clearspeak;return[{type:"radio",content:"No Preferences",id:"clearspeak-default",variable:"speechRules"},{type:"radio",content:"Current Preferences",id:"clearspeak-"+a,variable:"speechRules"},{type:"rule"},{type:"label",content:"Preferences for "+i},{type:"rule"}].concat(r[i].map((function(t){const e=t.split("_");return{type:"radio",content:e[1],id:"clearspeak-"+c.addPreference(a,e[0],e[1]),variable:"speechRules"}})))}static relevantPreferences(t){const e=f[t.type];return e&&(e[t.role]||e[""])||"ImpliedTimes"}static findPreference(t,e){if("default"===t)return c.AUTO;return c.fromPreference(t)[e]||c.AUTO}static addPreference(t,e,r){if("default"===t)return e+"_"+r;const n=c.fromPreference(t);return n[e]=r,c.toPreference(n)}static getLocalePreferences_(t){const e={};for(const r in t){if(!t[r].speech||!t[r].speech.clearspeak)continue;const n=Object.keys(t[r].speech.clearspeak),o=e[r]={};for(const t in u.getProperties()){const e=u.getProperties()[t],r=[t+"_Auto"];if(e)for(const o of e)-1!==n.indexOf(t+"_"+o)&&r.push(t+"_"+o);o[t]=r}}return e}equal(t){if(!super.equal(t))return!1;const e=Object.keys(this.preference),r=t.preference;if(e.length!==Object.keys(r).length)return!1;for(let t,n=0;t=e[n];n++)if(this.preference[t]!==r[t])return!1;return!0}}e.ClearspeakPreferences=c,c.AUTO="Auto";const u=new a.DynamicProperties({AbsoluteValue:["Auto","AbsEnd","Cardinality","Determinant"],Bar:["Auto","Conjugate"],Caps:["Auto","SayCaps"],CombinationPermutation:["Auto","ChoosePermute"],Currency:["Auto","Position","Prefix"],Ellipses:["Auto","AndSoOn"],Enclosed:["Auto","EndEnclose"],Exponent:["Auto","AfterPower","Ordinal","OrdinalPower","Exponent"],Fraction:["Auto","EndFrac","FracOver","General","GeneralEndFrac","Ordinal","Over","OverEndFrac","Per"],Functions:["Auto","None","Reciprocal"],ImpliedTimes:["Auto","MoreImpliedTimes","None"],Log:["Auto","LnAsNaturalLog"],Matrix:["Auto","Combinatoric","EndMatrix","EndVector","SilentColNum","SpeakColNum","Vector"],MultiLineLabel:["Auto","Case","Constraint","Equation","Line","None","Row","Step"],MultiLineOverview:["Auto","None"],MultiLinePausesBetweenColumns:["Auto","Long","Short"],MultsymbolDot:["Auto","Dot"],MultsymbolX:["Auto","By","Cross"],Paren:["Auto","CoordPoint","Interval","Silent","Speak","SpeakNestingLevel"],Prime:["Auto","Angle","Length"],Roots:["Auto","PosNegSqRoot","PosNegSqRootEnd","RootEnd"],SetMemberSymbol:["Auto","Belongs","Element","Member","In"],Sets:["Auto","SilentBracket","woAll"],TriangleSymbol:["Auto","Delta"],Trig:["Auto","ArcTrig","TrigInverse","Reciprocal"],VerticalLine:["Auto","Divides","Given","SuchThat"]});class p extends a.DefaultComparator{constructor(t,e){super(t,e),this.preference=t instanceof c?t.preference:{}}match(t){if(!(t instanceof c))return super.match(t);if("default"===t.getComponents()[a.Axis.STYLE])return!0;const e=Object.keys(t.preference);for(let r,n=0;r=e[n];n++)if(this.preference[r]!==t.preference[r])return!1;return!0}compare(t,e){const r=super.compare(t,e);if(0!==r)return r;const n=t instanceof c,o=e instanceof c;if(!n&&o)return 1;if(n&&!o)return-1;if(!n&&!o)return 0;const i=Object.keys(t.preference).length,a=Object.keys(e.preference).length;return i>a?-1:i<a?1:0}}e.Comparator=p;class h extends a.DynamicCstrParser{constructor(){super([a.Axis.LOCALE,a.Axis.MODALITY,a.Axis.DOMAIN,a.Axis.STYLE])}parse(t){const e=super.parse(t);let r=e.getValue(a.Axis.STYLE);const n=e.getValue(a.Axis.LOCALE),o=e.getValue(a.Axis.MODALITY);let s={};return r!==i.DynamicCstr.DEFAULT_VALUE&&(s=this.fromPreference(r),r=this.toPreference(s)),new c({locale:n,modality:o,domain:"clearspeak",style:r},s)}fromPreference(t){return c.fromPreference(t)}toPreference(t){return c.toPreference(t)}}e.Parser=h;const d=[["AbsoluteValue","fenced","neutral","metric"],["Bar","overscore","overaccent"],["Caps","identifier","latinletter"],["CombinationPermutation","appl","unknown"],["Ellipses","punctuation","ellipsis"],["Exponent","superscript",""],["Fraction","fraction",""],["Functions","appl","simple function"],["ImpliedTimes","operator","implicit"],["Log","appl","prefix function"],["Matrix","matrix",""],["Matrix","vector",""],["MultiLineLabel","multiline","label"],["MultiLineOverview","multiline","table"],["MultiLinePausesBetweenColumns","multiline","table"],["MultiLineLabel","table","label"],["MultiLineOverview","table","table"],["MultiLinePausesBetweenColumns","table","table"],["MultiLineLabel","cases","label"],["MultiLineOverview","cases","table"],["MultiLinePausesBetweenColumns","cases","table"],["MultsymbolDot","operator","multiplication"],["MultsymbolX","operator","multiplication"],["Paren","fenced","leftright"],["Prime","superscript","prime"],["Roots","root",""],["Roots","sqrt",""],["SetMemberSymbol","relation","element"],["Sets","fenced","set extended"],["TriangleSymbol","identifier","greekletter"],["Trig","appl","prefix function"],["VerticalLine","punctuated","vbar"]],f=function(){const t={};for(let e,r=0;e=d[r];r++){const r=e[0];let n=t[e[1]];n||(n={},t[e[1]]=n),n[e[2]]=r}return t}();n.default.getInstance().comparators.clearspeak=c.comparator,n.default.getInstance().parsers.clearspeak=new h},5425:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.ClearspeakRules=void 0;const n=r(1676),o=r(365),i=r(9912),a=r(1378),s=r(8437),l=r(7283);e.ClearspeakRules=function(){l.addStore(n.DynamicCstr.BASE_LOCALE+".speech.clearspeak","",{CTFpauseSeparator:o.pauseSeparator,CTFnodeCounter:i.nodeCounter,CTFcontentIterator:o.contentIterator,CSFvulgarFraction:s.vulgarFraction,CQFvulgarFractionSmall:i.isSmallVulgarFraction,CQFcellsSimple:i.allCellsSimple,CSFordinalExponent:i.ordinalExponent,CSFwordOrdinal:i.wordOrdinal,CQFmatchingFences:i.matchingFences,CSFnestingDepth:i.nestingDepth,CQFfencedArguments:i.fencedArguments,CQFsimpleArguments:i.simpleArguments,CQFspaceoutNumber:a.spaceoutNumber})}},9912:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.wordOrdinal=e.layoutFactor_=e.fencedFactor_=e.simpleFactor_=e.simpleArguments=e.fencedArguments=e.insertNesting=e.matchingFences=e.nestingDepth=e.NESTING_DEPTH=e.ordinalExponent=e.allTextLastContent_=e.isUnitExpression=e.isSmallVulgarFraction=e.allCellsSimple=e.allIndices_=e.isInteger_=e.simpleCell_=e.simpleNode=e.hasPreference=e.isSimpleFraction_=e.isSimpleNumber_=e.isNumber_=e.isLetter_=e.isSimple_=e.isSimpleLetters_=e.isSimpleDegree_=e.isSimpleNegative_=e.isSimpleFunction_=e.isSimpleExpression=e.nodeCounter=void 0;const n=r(5740),o=r(5897),i=r(5274),a=r(4356),s=r(4977),l=r(2105),c=r(365),u=r(7630),p=r(9265),h=r(3588);function d(t){return S(t)||g(t)||y(t)||m(t)||f(t)}function f(t){return"appl"===t.type&&("prefix function"===t.childNodes[0].role||"simple function"===t.childNodes[0].role)&&(b(t.childNodes[1])||"fenced"===t.childNodes[1].type&&b(t.childNodes[1].childNodes[0]))}function m(t){return"prefixop"===t.type&&"negative"===t.role&&b(t.childNodes[0])&&"prefixop"!==t.childNodes[0].type&&"appl"!==t.childNodes[0].type&&"punctuated"!==t.childNodes[0].type}function y(t){return"punctuated"===t.type&&"endpunct"===t.role&&2===t.childNodes.length&&"degree"===t.childNodes[1].role&&(v(t.childNodes[0])||_(t.childNodes[0])||"prefixop"===t.childNodes[0].type&&"negative"===t.childNodes[0].role&&(v(t.childNodes[0].childNodes[0])||_(t.childNodes[0].childNodes[0])))}function g(t){return v(t)||"infixop"===t.type&&"implicit"===t.role&&(2===t.childNodes.length&&(v(t.childNodes[0])||S(t.childNodes[0]))&&v(t.childNodes[1])||3===t.childNodes.length&&S(t.childNodes[0])&&v(t.childNodes[1])&&v(t.childNodes[2]))}function b(t){return t.hasAnnotation("clearspeak","simple")}function v(t){return"identifier"===t.type&&("latinletter"===t.role||"greekletter"===t.role||"otherletter"===t.role||"simple function"===t.role)}function _(t){return"number"===t.type&&("integer"===t.role||"float"===t.role)}function S(t){return _(t)||x(t)}function x(t){if(M("Fraction_Over")||M("Fraction_FracOver"))return!1;if("fraction"!==t.type||"vulgar"!==t.role)return!1;if(M("Fraction_Ordinal"))return!0;const e=parseInt(t.childNodes[0].textContent,10),r=parseInt(t.childNodes[1].textContent,10);return e>0&&e<20&&r>0&&r<11}function M(t){return o.default.getInstance().style===t}function O(t){if(!t.hasAttribute("annotation"))return!1;const e=t.getAttribute("annotation");return!!/clearspeak:simple$|clearspeak:simple;/.exec(e)}function E(t){if(O(t))return!0;if("subscript"!==t.tagName)return!1;const e=t.childNodes[0].childNodes,r=e[1];return"identifier"===e[0].tagName&&(A(r)||"infixop"===r.tagName&&r.hasAttribute("role")&&"implicit"===r.getAttribute("role")&&C(r))}function A(t){return"number"===t.tagName&&t.hasAttribute("role")&&"integer"===t.getAttribute("role")}function C(t){return i.evalXPath("children/*",t).every((t=>A(t)||"identifier"===t.tagName))}function w(t){return"text"===t.type||"punctuated"===t.type&&"text"===t.role&&_(t.childNodes[0])&&T(t.childNodes.slice(1))||"identifier"===t.type&&"unit"===t.role||"infixop"===t.type&&("implicit"===t.role||"unit"===t.role)}function T(t){for(let e=0;e<t.length-1;e++)if("text"!==t[e].type||""!==t[e].textContent)return!1;return"text"===t[t.length-1].type}function N(t,e){if(!e||!t)return t;const r=t.match(/^(open|close) /);return r?r[0]+e+" "+t.substring(r[0].length):e+" "+t}function L(t){return!!t&&("number"===t.tagName||"identifier"===t.tagName||"function"===t.tagName||"appl"===t.tagName||"fraction"===t.tagName)}function P(t){return t&&("fenced"===t.tagName||t.hasAttribute("role")&&"leftright"===t.getAttribute("role")||I(t))}function I(t){return!!t&&("matrix"===t.tagName||"vector"===t.tagName)}e.nodeCounter=function(t,e){const r=e.split("-"),n=c.nodeCounter(t,r[0]||""),o=r[1]||"",i=r[2]||"";let a=!0;return function(){const t=n();return a?(a=!1,i+t+o):t+o}},e.isSimpleExpression=d,e.isSimpleFunction_=f,e.isSimpleNegative_=m,e.isSimpleDegree_=y,e.isSimpleLetters_=g,e.isSimple_=b,e.isLetter_=v,e.isNumber_=_,e.isSimpleNumber_=S,e.isSimpleFraction_=x,e.hasPreference=M,(0,u.register)(new p.SemanticAnnotator("clearspeak","simple",(function(t){return d(t)?"simple":""}))),e.simpleNode=O,e.simpleCell_=E,e.isInteger_=A,e.allIndices_=C,e.allCellsSimple=function(t){const e="matrix"===t.tagName?"children/row/children/cell/children/*":"children/line/children/*";return i.evalXPath(e,t).every(E)?[t]:[]},e.isSmallVulgarFraction=function(t){return(0,s.vulgarFractionSmall)(t,20,11)?[t]:[]},e.isUnitExpression=w,e.allTextLastContent_=T,(0,u.register)(new p.SemanticAnnotator("clearspeak","unit",(function(t){return w(t)?"unit":""}))),e.ordinalExponent=function(t){const e=parseInt(t.textContent,10);return isNaN(e)?t.textContent:e>10?a.LOCALE.NUMBERS.numericOrdinal(e):a.LOCALE.NUMBERS.wordOrdinal(e)},e.NESTING_DEPTH=null,e.nestingDepth=function(t){let r=0;const n=t.textContent,o="open"===t.getAttribute("role")?0:1;let i=t.parentNode;for(;i;)"fenced"===i.tagName&&i.childNodes[0].childNodes[o].textContent===n&&r++,i=i.parentNode;return e.NESTING_DEPTH=r>1?a.LOCALE.NUMBERS.wordOrdinal(r):"",e.NESTING_DEPTH},e.matchingFences=function(t){const e=t.previousSibling;let r,n;return e?(r=e,n=t):(r=t,n=t.nextSibling),n&&(0,h.isMatchingFence)(r.textContent,n.textContent)?[t]:[]},e.insertNesting=N,l.Grammar.getInstance().setCorrection("insertNesting",N),e.fencedArguments=function(t){const e=n.toArray(t.parentNode.childNodes),r=i.evalXPath("../../children/*",t),o=e.indexOf(t);return P(r[o])||P(r[o+1])?[t]:[]},e.simpleArguments=function(t){const e=n.toArray(t.parentNode.childNodes),r=i.evalXPath("../../children/*",t),o=e.indexOf(t);return L(r[o])&&r[o+1]&&(L(r[o+1])||"root"===r[o+1].tagName||"sqrt"===r[o+1].tagName||"superscript"===r[o+1].tagName&&r[o+1].childNodes[0].childNodes[0]&&("number"===r[o+1].childNodes[0].childNodes[0].tagName||"identifier"===r[o+1].childNodes[0].childNodes[0].tagName)&&("2"===r[o+1].childNodes[0].childNodes[1].textContent||"3"===r[o+1].childNodes[0].childNodes[1].textContent))?[t]:[]},e.simpleFactor_=L,e.fencedFactor_=P,e.layoutFactor_=I,e.wordOrdinal=function(t){return a.LOCALE.NUMBERS.wordOrdinal(parseInt(t.textContent,10))}},6141:function(t,e,r){var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{l(n.next(t))}catch(t){i(t)}}function s(t){try{l(n.throw(t))}catch(t){i(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}l((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.loadAjax=e.loadFileSync=e.loadFile=e.parseMaps=e.retrieveFiles=e.standardLoader=e.loadLocale=e.store=void 0;const o=r(2139),i=r(5897),a=r(4440),s=r(7248),l=r(2315),c=r(1676),u=r(2780),p=r(2362),h=r(7491),d=r(313);e.store=u;const f={functions:u.addFunctionRules,symbols:u.addSymbolRules,units:u.addUnitRules,si:u.setSiPrefixes};let m=!1;function y(t=i.default.getInstance().locale){i.EnginePromise.loaded[t]||(i.EnginePromise.loaded[t]=[!1,!1],function(t){if(i.default.getInstance().isIE&&i.default.getInstance().mode===a.Mode.HTTP)return void S(t);b(t)}(t))}function g(){switch(i.default.getInstance().mode){case a.Mode.ASYNC:return x;case a.Mode.HTTP:return O;case a.Mode.SYNC:default:return M}}function b(t){const e=i.default.getInstance().customLoader?i.default.getInstance().customLoader:g(),r=new Promise((r=>{e(t).then((e=>{v(e),i.EnginePromise.loaded[t]=[!0,!0],r(t)}),(e=>{i.EnginePromise.loaded[t]=[!0,!1],console.error(`Unable to load locale: ${t}`),i.default.getInstance().locale=i.default.getInstance().defaultLocale,r(t)}))}));i.EnginePromise.promises[t]=r}function v(t){_(JSON.parse(t))}function _(t,e){let r=!0;for(let n,o=0;n=Object.keys(t)[o];o++){const o=n.split("/");e&&e!==o[0]||("rules"===o[1]?p.SpeechRuleEngine.getInstance().addStore(t[n]):"messages"===o[1]?(0,h.completeLocale)(t[n]):(r&&(d.generate(o[0]),r=!1),t[n].forEach(f[o[1]])))}}function S(t,e){let r=e||1;o.mapsForIE?_(o.mapsForIE,t):r<=5&&setTimeout((()=>S(t,r++)).bind(this),300)}function x(t){const e=s.localePath(t);return new Promise(((t,r)=>{l.default.fs.readFile(e,"utf8",((e,n)=>{if(e)return r(e);t(n)}))}))}function M(t){const e=s.localePath(t);return new Promise(((t,r)=>{let n="{}";try{n=l.default.fs.readFileSync(e,"utf8")}catch(t){return r(t)}t(n)}))}function O(t){const e=s.localePath(t),r=new XMLHttpRequest;return new Promise(((t,n)=>{r.onreadystatechange=function(){if(4===r.readyState){const e=r.status;0===e||e>=200&&e<400?t(r.responseText):n(e)}},r.open("GET",e,!0),r.send()}))}e.loadLocale=function(t=i.default.getInstance().locale){return n(this,void 0,void 0,(function*(){return m||(y(c.DynamicCstr.BASE_LOCALE),m=!0),i.EnginePromise.promises[c.DynamicCstr.BASE_LOCALE].then((()=>n(this,void 0,void 0,(function*(){const e=i.default.getInstance().defaultLocale;return e?(y(e),i.EnginePromise.promises[e].then((()=>n(this,void 0,void 0,(function*(){return y(t),i.EnginePromise.promises[t]}))))):(y(t),i.EnginePromise.promises[t])}))))}))},e.standardLoader=g,e.retrieveFiles=b,e.parseMaps=v,e.loadFile=x,e.loadFileSync=M,e.loadAjax=O},7088:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.leftSubscriptBrief=e.leftSuperscriptBrief=e.leftSubscriptVerbose=e.leftSuperscriptVerbose=e.baselineBrief=e.baselineVerbose=void 0;const n=r(1378);e.baselineVerbose=function(t){return n.baselineVerbose(t).replace(/-$/,"")},e.baselineBrief=function(t){return n.baselineBrief(t).replace(/-$/,"")},e.leftSuperscriptVerbose=function(t){return n.superscriptVerbose(t).replace(/^exposant/,"exposant gauche")},e.leftSubscriptVerbose=function(t){return n.subscriptVerbose(t).replace(/^indice/,"indice gauche")},e.leftSuperscriptBrief=function(t){return n.superscriptBrief(t).replace(/^sup/,"sup gauche")},e.leftSubscriptBrief=function(t){return n.subscriptBrief(t).replace(/^sub/,"sub gauche")}},9577:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.MathspeakRules=void 0;const n=r(1676),o=r(365),i=r(7088),a=r(1378),s=r(8437),l=r(7283),c=r(7598);e.MathspeakRules=function(){l.addStore(n.DynamicCstr.BASE_LOCALE+".speech.mathspeak","",{CQFspaceoutNumber:a.spaceoutNumber,CQFspaceoutIdentifier:a.spaceoutIdentifier,CSFspaceoutText:a.spaceoutText,CSFopenFracVerbose:a.openingFractionVerbose,CSFcloseFracVerbose:a.closingFractionVerbose,CSFoverFracVerbose:a.overFractionVerbose,CSFopenFracBrief:a.openingFractionBrief,CSFcloseFracBrief:a.closingFractionBrief,CSFopenFracSbrief:a.openingFractionSbrief,CSFcloseFracSbrief:a.closingFractionSbrief,CSFoverFracSbrief:a.overFractionSbrief,CSFvulgarFraction:s.vulgarFraction,CQFvulgarFractionSmall:a.isSmallVulgarFraction,CSFopenRadicalVerbose:a.openingRadicalVerbose,CSFcloseRadicalVerbose:a.closingRadicalVerbose,CSFindexRadicalVerbose:a.indexRadicalVerbose,CSFopenRadicalBrief:a.openingRadicalBrief,CSFcloseRadicalBrief:a.closingRadicalBrief,CSFindexRadicalBrief:a.indexRadicalBrief,CSFopenRadicalSbrief:a.openingRadicalSbrief,CSFindexRadicalSbrief:a.indexRadicalSbrief,CQFisSmallRoot:a.smallRoot,CSFsuperscriptVerbose:a.superscriptVerbose,CSFsuperscriptBrief:a.superscriptBrief,CSFsubscriptVerbose:a.subscriptVerbose,CSFsubscriptBrief:a.subscriptBrief,CSFbaselineVerbose:a.baselineVerbose,CSFbaselineBrief:a.baselineBrief,CSFleftsuperscriptVerbose:a.superscriptVerbose,CSFleftsubscriptVerbose:a.subscriptVerbose,CSFrightsuperscriptVerbose:a.superscriptVerbose,CSFrightsubscriptVerbose:a.subscriptVerbose,CSFleftsuperscriptBrief:a.superscriptBrief,CSFleftsubscriptBrief:a.subscriptBrief,CSFrightsuperscriptBrief:a.superscriptBrief,CSFrightsubscriptBrief:a.subscriptBrief,CSFunderscript:a.nestedUnderscript,CSFoverscript:a.nestedOverscript,CSFendscripts:a.endscripts,CTFordinalCounter:s.ordinalCounter,CTFwordCounter:s.wordCounter,CTFcontentIterator:o.contentIterator,CQFdetIsSimple:a.determinantIsSimple,CSFRemoveParens:a.removeParens,CQFresetNesting:a.resetNestingDepth,CGFbaselineConstraint:a.generateBaselineConstraint,CGFtensorRules:a.generateTensorRules}),l.addStore("es.speech.mathspeak",n.DynamicCstr.BASE_LOCALE+".speech.mathspeak",{CTFunitMultipliers:c.unitMultipliers,CQFoneLeft:c.oneLeft}),l.addStore("fr.speech.mathspeak",n.DynamicCstr.BASE_LOCALE+".speech.mathspeak",{CSFbaselineVerbose:i.baselineVerbose,CSFbaselineBrief:i.baselineBrief,CSFleftsuperscriptVerbose:i.leftSuperscriptVerbose,CSFleftsubscriptVerbose:i.leftSubscriptVerbose,CSFleftsuperscriptBrief:i.leftSuperscriptBrief,CSFleftsubscriptBrief:i.leftSubscriptBrief})}},1378:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.smallRoot=e.generateTensorRules=e.removeParens=e.generateBaselineConstraint=e.determinantIsSimple=e.nestedOverscript=e.endscripts=e.overscoreNestingDepth=e.nestedUnderscript=e.underscoreNestingDepth=e.indexRadicalSbrief=e.openingRadicalSbrief=e.indexRadicalBrief=e.closingRadicalBrief=e.openingRadicalBrief=e.indexRadicalVerbose=e.closingRadicalVerbose=e.openingRadicalVerbose=e.getRootIndex=e.nestedRadical=e.radicalNestingDepth=e.baselineBrief=e.baselineVerbose=e.superscriptBrief=e.superscriptVerbose=e.subscriptBrief=e.subscriptVerbose=e.nestedSubSuper=e.isSmallVulgarFraction=e.overFractionSbrief=e.closingFractionSbrief=e.openingFractionSbrief=e.closingFractionBrief=e.openingFractionBrief=e.overFractionVerbose=e.closingFractionVerbose=e.openingFractionVerbose=e.nestedFraction=e.fractionNestingDepth=e.computeNestingDepth_=e.containsAttr=e.getNestingDepth=e.resetNestingDepth=e.nestingBarriers=e.spaceoutIdentifier=e.spaceoutNumber=e.spaceoutNodes=e.spaceoutText=void 0;const n=r(707),o=r(5740),i=r(5274),a=r(4356),s=r(3308);let l={};function c(t,e){const r=Array.from(t.textContent),n=[],o=s.default.getInstance(),i=t.ownerDocument;for(let t,a=0;t=r[a];a++){const r=o.getNodeFactory().makeLeafNode(t,"unknown"),a=o.identifierNode(r,"unknown","");e(a),n.push(a.xml(i))}return n}function u(t,r,i,a,s,c){a=a||e.nestingBarriers,s=s||{},c=c||function(t){return!1};const u=o.serializeXml(r);if(l[t]||(l[t]={}),l[t][u])return l[t][u];if(c(r)||i.indexOf(r.tagName)<0)return 0;const p=h(r,i,n.setdifference(a,i),s,c,0);return l[t][u]=p,p}function p(t,e){if(!t.attributes)return!1;const r=o.toArray(t.attributes);for(let t,n=0;t=r[n];n++)if(e[t.nodeName]===t.nodeValue)return!0;return!1}function h(t,e,r,n,i,a){if(i(t)||r.indexOf(t.tagName)>-1||p(t,n))return a;if(e.indexOf(t.tagName)>-1&&a++,!t.childNodes||0===t.childNodes.length)return a;const s=o.toArray(t.childNodes);return Math.max.apply(null,s.map((function(t){return h(t,e,r,n,i,a)})))}function d(t){return u("fraction",t,["fraction"],e.nestingBarriers,{},a.LOCALE.FUNCTIONS.fracNestDepth)}function f(t,e,r){const n=d(t),o=Array(n).fill(e);return r&&o.push(r),o.join(a.LOCALE.MESSAGES.regexp.JOINER_FRAC)}function m(t,e,r){for(;t.parentNode;){const n=t.parentNode,o=n.parentNode;if(!o)break;const i=t.getAttribute&&t.getAttribute("role");("subscript"===o.tagName&&t===n.childNodes[1]||"tensor"===o.tagName&&i&&("leftsub"===i||"rightsub"===i))&&(e=r.sub+a.LOCALE.MESSAGES.regexp.JOINER_SUBSUPER+e),("superscript"===o.tagName&&t===n.childNodes[1]||"tensor"===o.tagName&&i&&("leftsuper"===i||"rightsuper"===i))&&(e=r.sup+a.LOCALE.MESSAGES.regexp.JOINER_SUBSUPER+e),t=o}return e.trim()}function y(t){return u("radical",t,["sqrt","root"],e.nestingBarriers,{})}function g(t,e,r){const n=y(t),o=b(t);return r=o?a.LOCALE.FUNCTIONS.combineRootIndex(r,o):r,1===n?r:a.LOCALE.FUNCTIONS.combineNestedRadical(e,a.LOCALE.FUNCTIONS.radicalNestDepth(n-1),r)}function b(t){const e="sqrt"===t.tagName?"2":i.evalXPath("children/*[1]",t)[0].textContent.trim();return a.LOCALE.MESSAGES.MSroots[e]||""}function v(t){return u("underscore",t,["underscore"],e.nestingBarriers,{},(function(t){return t.tagName&&"underscore"===t.tagName&&"underaccent"===t.childNodes[0].childNodes[1].getAttribute("role")}))}function _(t){return u("overscore",t,["overscore"],e.nestingBarriers,{},(function(t){return t.tagName&&"overscore"===t.tagName&&"overaccent"===t.childNodes[0].childNodes[1].getAttribute("role")}))}e.spaceoutText=function(t){return Array.from(t.textContent).join(" ")},e.spaceoutNodes=c,e.spaceoutNumber=function(t){return c(t,(function(t){t.textContent.match(/\W/)||(t.type="number")}))},e.spaceoutIdentifier=function(t){return c(t,(function(t){t.font="unknown",t.type="identifier"}))},e.nestingBarriers=["cases","cell","integral","line","matrix","multiline","overscore","root","row","sqrt","subscript","superscript","table","underscore","vector"],e.resetNestingDepth=function(t){return l={},[t]},e.getNestingDepth=u,e.containsAttr=p,e.computeNestingDepth_=h,e.fractionNestingDepth=d,e.nestedFraction=f,e.openingFractionVerbose=function(t){return f(t,a.LOCALE.MESSAGES.MS.START,a.LOCALE.MESSAGES.MS.FRAC_V)},e.closingFractionVerbose=function(t){return f(t,a.LOCALE.MESSAGES.MS.END,a.LOCALE.MESSAGES.MS.FRAC_V)},e.overFractionVerbose=function(t){return f(t,a.LOCALE.MESSAGES.MS.FRAC_OVER)},e.openingFractionBrief=function(t){return f(t,a.LOCALE.MESSAGES.MS.START,a.LOCALE.MESSAGES.MS.FRAC_B)},e.closingFractionBrief=function(t){return f(t,a.LOCALE.MESSAGES.MS.END,a.LOCALE.MESSAGES.MS.FRAC_B)},e.openingFractionSbrief=function(t){const e=d(t);return 1===e?a.LOCALE.MESSAGES.MS.FRAC_S:a.LOCALE.FUNCTIONS.combineNestedFraction(a.LOCALE.MESSAGES.MS.NEST_FRAC,a.LOCALE.FUNCTIONS.radicalNestDepth(e-1),a.LOCALE.MESSAGES.MS.FRAC_S)},e.closingFractionSbrief=function(t){const e=d(t);return 1===e?a.LOCALE.MESSAGES.MS.ENDFRAC:a.LOCALE.FUNCTIONS.combineNestedFraction(a.LOCALE.MESSAGES.MS.NEST_FRAC,a.LOCALE.FUNCTIONS.radicalNestDepth(e-1),a.LOCALE.MESSAGES.MS.ENDFRAC)},e.overFractionSbrief=function(t){const e=d(t);return 1===e?a.LOCALE.MESSAGES.MS.FRAC_OVER:a.LOCALE.FUNCTIONS.combineNestedFraction(a.LOCALE.MESSAGES.MS.NEST_FRAC,a.LOCALE.FUNCTIONS.radicalNestDepth(e-1),a.LOCALE.MESSAGES.MS.FRAC_OVER)},e.isSmallVulgarFraction=function(t){return a.LOCALE.FUNCTIONS.fracNestDepth(t)?[t]:[]},e.nestedSubSuper=m,e.subscriptVerbose=function(t){return m(t,a.LOCALE.MESSAGES.MS.SUBSCRIPT,{sup:a.LOCALE.MESSAGES.MS.SUPER,sub:a.LOCALE.MESSAGES.MS.SUB})},e.subscriptBrief=function(t){return m(t,a.LOCALE.MESSAGES.MS.SUB,{sup:a.LOCALE.MESSAGES.MS.SUP,sub:a.LOCALE.MESSAGES.MS.SUB})},e.superscriptVerbose=function(t){return m(t,a.LOCALE.MESSAGES.MS.SUPERSCRIPT,{sup:a.LOCALE.MESSAGES.MS.SUPER,sub:a.LOCALE.MESSAGES.MS.SUB})},e.superscriptBrief=function(t){return m(t,a.LOCALE.MESSAGES.MS.SUP,{sup:a.LOCALE.MESSAGES.MS.SUP,sub:a.LOCALE.MESSAGES.MS.SUB})},e.baselineVerbose=function(t){const e=m(t,"",{sup:a.LOCALE.MESSAGES.MS.SUPER,sub:a.LOCALE.MESSAGES.MS.SUB});return e?e.replace(new RegExp(a.LOCALE.MESSAGES.MS.SUB+"$"),a.LOCALE.MESSAGES.MS.SUBSCRIPT).replace(new RegExp(a.LOCALE.MESSAGES.MS.SUPER+"$"),a.LOCALE.MESSAGES.MS.SUPERSCRIPT):a.LOCALE.MESSAGES.MS.BASELINE},e.baselineBrief=function(t){return m(t,"",{sup:a.LOCALE.MESSAGES.MS.SUP,sub:a.LOCALE.MESSAGES.MS.SUB})||a.LOCALE.MESSAGES.MS.BASE},e.radicalNestingDepth=y,e.nestedRadical=g,e.getRootIndex=b,e.openingRadicalVerbose=function(t){return g(t,a.LOCALE.MESSAGES.MS.NESTED,a.LOCALE.MESSAGES.MS.STARTROOT)},e.closingRadicalVerbose=function(t){return g(t,a.LOCALE.MESSAGES.MS.NESTED,a.LOCALE.MESSAGES.MS.ENDROOT)},e.indexRadicalVerbose=function(t){return g(t,a.LOCALE.MESSAGES.MS.NESTED,a.LOCALE.MESSAGES.MS.ROOTINDEX)},e.openingRadicalBrief=function(t){return g(t,a.LOCALE.MESSAGES.MS.NEST_ROOT,a.LOCALE.MESSAGES.MS.STARTROOT)},e.closingRadicalBrief=function(t){return g(t,a.LOCALE.MESSAGES.MS.NEST_ROOT,a.LOCALE.MESSAGES.MS.ENDROOT)},e.indexRadicalBrief=function(t){return g(t,a.LOCALE.MESSAGES.MS.NEST_ROOT,a.LOCALE.MESSAGES.MS.ROOTINDEX)},e.openingRadicalSbrief=function(t){return g(t,a.LOCALE.MESSAGES.MS.NEST_ROOT,a.LOCALE.MESSAGES.MS.ROOT)},e.indexRadicalSbrief=function(t){return g(t,a.LOCALE.MESSAGES.MS.NEST_ROOT,a.LOCALE.MESSAGES.MS.INDEX)},e.underscoreNestingDepth=v,e.nestedUnderscript=function(t){const e=v(t);return Array(e).join(a.LOCALE.MESSAGES.MS.UNDER)+a.LOCALE.MESSAGES.MS.UNDERSCRIPT},e.overscoreNestingDepth=_,e.endscripts=function(t){return a.LOCALE.MESSAGES.MS.ENDSCRIPTS},e.nestedOverscript=function(t){const e=_(t);return Array(e).join(a.LOCALE.MESSAGES.MS.OVER)+a.LOCALE.MESSAGES.MS.OVERSCRIPT},e.determinantIsSimple=function(t){if("matrix"!==t.tagName||"determinant"!==t.getAttribute("role"))return[];const e=i.evalXPath("children/row/children/cell/children/*",t);for(let t,r=0;t=e[r];r++)if("number"!==t.tagName){if("identifier"===t.tagName){const e=t.getAttribute("role");if("latinletter"===e||"greekletter"===e||"otherletter"===e)continue}return[]}return[t]},e.generateBaselineConstraint=function(){const t=t=>t.map((t=>"ancestor::"+t)),e=t=>"not("+t+")",r=e(t(["subscript","superscript","tensor"]).join(" or ")),n=t(["relseq","multrel"]),o=t(["fraction","punctuation","fenced","sqrt","root"]);let i=[];for(let t,e=0;t=o[e];e++)i=i.concat(n.map((function(e){return t+"/"+e})));return[["ancestor::*/following-sibling::*",r,e(i.join(" | "))].join(" and ")]},e.removeParens=function(t){if(!t.childNodes.length||!t.childNodes[0].childNodes.length||!t.childNodes[0].childNodes[0].childNodes.length)return"";const e=t.childNodes[0].childNodes[0].childNodes[0].textContent;return e.match(/^\(.+\)$/)?e.slice(1,-1):e};const S=new Map([[3,"CSFleftsuperscript"],[4,"CSFleftsubscript"],[2,"CSFbaseline"],[1,"CSFrightsubscript"],[0,"CSFrightsuperscript"]]),x=new Map([[4,2],[3,3],[2,1],[1,4],[0,5]]);function M(t){const e=[];let r="",n="",o=parseInt(t,2);for(let t=0;t<5;t++){const i="children/*["+x.get(t)+"]";if(1&o){const e=S.get(t%5);r="[t] "+e+"Verbose; [n] "+i+";"+r,n="[t] "+e+"Brief; [n] "+i+";"+n}else e.unshift("name("+i+')="empty"');o>>=1}return[e,r,n]}e.generateTensorRules=function(t,e=!0){const r=["11111","11110","11101","11100","10111","10110","10101","10100","01111","01110","01101","01100"];for(let n,o=0;n=r[o];o++){let r="tensor"+n,[o,i,a]=M(n);t.defineRule(r,"default",i,"self::tensor",...o),e&&(t.defineRule(r,"brief",a,"self::tensor",...o),t.defineRule(r,"sbrief",a,"self::tensor",...o));const s=S.get(2);i+="; [t]"+s+"Verbose",a+="; [t]"+s+"Brief",r+="-baseline";const l="((.//*[not(*)])[last()]/@id)!=(((.//ancestor::fraction|ancestor::root|ancestor::sqrt|ancestor::cell|ancestor::line|ancestor::stree)[1]//*[not(*)])[last()]/@id)";t.defineRule(r,"default",i,"self::tensor",l,...o),e&&(t.defineRule(r,"brief",a,"self::tensor",l,...o),t.defineRule(r,"sbrief",a,"self::tensor",l,...o))}},e.smallRoot=function(t){let e=Object.keys(a.LOCALE.MESSAGES.MSroots).length;if(!e)return[];if(e++,!t.childNodes||0===t.childNodes.length||!t.childNodes[0].childNodes)return[];const r=t.childNodes[0].childNodes[0].textContent;if(!/^\d+$/.test(r))return[];const n=parseInt(r,10);return n>1&&n<=e?[t]:[]}},6922:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.implicitIterator=e.relationIterator=e.propagateNumber=e.checkParent_=e.NUMBER_INHIBITORS_=e.NUMBER_PROPAGATORS_=e.enlargeFence=e.indexRadical=e.closingRadical=e.openingRadical=e.radicalNestingDepth=e.nestedRadical=e.overBevelledFraction=e.overFraction=e.closingFraction=e.openingFraction=void 0;const n=r(7052),o=r(5740),i=r(5274),a=r(2105),s=r(5897),l=r(7630),c=r(9265),u=r(4356),p=r(1378);function h(t,e){const r=d(t);return 1===r?e:new Array(r).join(u.LOCALE.MESSAGES.MS.NESTED)+e}function d(t,e){const r=e||0;return t.parentNode?d(t.parentNode,"root"===t.tagName||"sqrt"===t.tagName?r+1:r):r}function f(t){const e="\u2820";if(1===t.length)return e+t;const r=t.split("");return r.every((function(t){return"\u2833"===t}))?e+r.join(e):t.slice(0,-1)+e+t.slice(-1)}function m(t,r){const n=t.parent;if(!n)return!1;const o=n.type;return-1!==e.NUMBER_PROPAGATORS_.indexOf(o)||"prefixop"===o&&"negative"===n.role&&!r.script||"prefixop"===o&&"geometry"===n.role||!("punctuated"!==o||r.enclosed&&"text"!==n.role)}function y(t,r){return t.childNodes.length?(-1!==e.NUMBER_INHIBITORS_.indexOf(t.type)&&(r.script=!0),"fenced"===t.type?(r.number=!1,r.enclosed=!0,["",r]):(m(t,r)&&(r.number=!0,r.enclosed=!1),["",r])):(m(t,r)&&(r.number=!0,r.script=!1,r.enclosed=!1),[r.number?"number":"",{number:!1,enclosed:r.enclosed,script:r.script}])}e.openingFraction=function(t){const e=p.fractionNestingDepth(t);return new Array(e).join(u.LOCALE.MESSAGES.MS.FRACTION_REPEAT)+u.LOCALE.MESSAGES.MS.FRACTION_START},e.closingFraction=function(t){const e=p.fractionNestingDepth(t);return new Array(e).join(u.LOCALE.MESSAGES.MS.FRACTION_REPEAT)+u.LOCALE.MESSAGES.MS.FRACTION_END},e.overFraction=function(t){const e=p.fractionNestingDepth(t);return new Array(e).join(u.LOCALE.MESSAGES.MS.FRACTION_REPEAT)+u.LOCALE.MESSAGES.MS.FRACTION_OVER},e.overBevelledFraction=function(t){const e=p.fractionNestingDepth(t);return new Array(e).join(u.LOCALE.MESSAGES.MS.FRACTION_REPEAT)+"\u2838"+u.LOCALE.MESSAGES.MS.FRACTION_OVER},e.nestedRadical=h,e.radicalNestingDepth=d,e.openingRadical=function(t){return h(t,u.LOCALE.MESSAGES.MS.STARTROOT)},e.closingRadical=function(t){return h(t,u.LOCALE.MESSAGES.MS.ENDROOT)},e.indexRadical=function(t){return h(t,u.LOCALE.MESSAGES.MS.ROOTINDEX)},e.enlargeFence=f,a.Grammar.getInstance().setCorrection("enlargeFence",f),e.NUMBER_PROPAGATORS_=["multirel","relseq","appl","row","line"],e.NUMBER_INHIBITORS_=["subscript","superscript","overscore","underscore"],e.checkParent_=m,e.propagateNumber=y,(0,l.register)(new c.SemanticVisitor("nemeth","number",y,{number:!0})),e.relationIterator=function(t,e){const r=t.slice(0);let a,l=!0;return a=t.length>0?i.evalXPath("../../content/*",t[0]):[],function(){const t=a.shift(),i=r.shift(),c=r[0],h=e?[n.AuditoryDescription.create({text:e},{translate:!0})]:[];if(!t)return h;const d=i?p.nestedSubSuper(i,"",{sup:u.LOCALE.MESSAGES.MS.SUPER,sub:u.LOCALE.MESSAGES.MS.SUB}):"",f=i&&"EMPTY"!==o.tagName(i)||l&&t.parentNode.parentNode&&t.parentNode.parentNode.previousSibling?[n.AuditoryDescription.create({text:"\u2800"+d},{})]:[],m=c&&"EMPTY"!==o.tagName(c)||!a.length&&t.parentNode.parentNode&&t.parentNode.parentNode.nextSibling?[n.AuditoryDescription.create({text:"\u2800"},{})]:[],y=s.default.evaluateNode(t);return l=!1,h.concat(f,y,m)}},e.implicitIterator=function(t,e){const r=t.slice(0);let a;return a=t.length>0?i.evalXPath("../../content/*",t[0]):[],function(){const t=r.shift(),i=r[0],s=a.shift(),l=e?[n.AuditoryDescription.create({text:e},{translate:!0})]:[];if(!s)return l;const c=t&&"NUMBER"===o.tagName(t),u=i&&"NUMBER"===o.tagName(i);return l.concat(c&&u&&"space"===s.getAttribute("role")?[n.AuditoryDescription.create({text:"\u2800"},{})]:[])}}},8437:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.ordinalPosition=e.vulgarFraction=e.wordCounter=e.ordinalCounter=void 0;const n=r(9536),o=r(5740),i=r(4356),a=r(4977);e.ordinalCounter=function(t,e){let r=0;return function(){return i.LOCALE.NUMBERS.numericOrdinal(++r)+" "+e}},e.wordCounter=function(t,e){let r=0;return function(){return i.LOCALE.NUMBERS.numberToOrdinal(++r,!1)+" "+e}},e.vulgarFraction=function(t){const e=(0,a.convertVulgarFraction)(t,i.LOCALE.MESSAGES.MS.FRAC_OVER);return e.convertible&&e.enumerator&&e.denominator?[new n.Span(i.LOCALE.NUMBERS.numberToWords(e.enumerator),{extid:t.childNodes[0].childNodes[0].getAttribute("extid"),separator:""}),new n.Span(i.LOCALE.NUMBERS.vulgarSep,{separator:""}),new n.Span(i.LOCALE.NUMBERS.numberToOrdinal(e.denominator,1!==e.enumerator),{extid:t.childNodes[0].childNodes[1].getAttribute("extid")})]:[new n.Span(e.content||"",{extid:t.getAttribute("extid")})]},e.ordinalPosition=function(t){const e=o.toArray(t.parentNode.childNodes);return i.LOCALE.NUMBERS.numericOrdinal(e.indexOf(t)+1).toString()}},9284:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.BrailleRules=e.OtherRules=e.PrefixRules=void 0;const n=r(1676),o=r(365),i=r(1378),a=r(6922),s=r(8437),l=r(7283);e.PrefixRules=function(){l.addStore("en.prefix.default","",{CSFordinalPosition:s.ordinalPosition})},e.OtherRules=function(){l.addStore("en.speech.chromevox","",{CTFnodeCounter:o.nodeCounter,CTFcontentIterator:o.contentIterator}),l.addStore("en.speech.emacspeak","en.speech.chromevox",{CQFvulgarFractionSmall:i.isSmallVulgarFraction,CSFvulgarFraction:s.vulgarFraction})},e.BrailleRules=function(){l.addStore("nemeth.braille.default",n.DynamicCstr.BASE_LOCALE+".speech.mathspeak",{CSFopenFraction:a.openingFraction,CSFcloseFraction:a.closingFraction,CSFoverFraction:a.overFraction,CSFoverBevFraction:a.overBevelledFraction,CSFopenRadical:a.openingRadical,CSFcloseRadical:a.closingRadical,CSFindexRadical:a.indexRadical,CSFsubscript:i.subscriptVerbose,CSFsuperscript:i.superscriptVerbose,CSFbaseline:i.baselineVerbose,CGFtensorRules:t=>i.generateTensorRules(t,!1),CTFrelationIterator:a.relationIterator,CTFimplicitIterator:a.implicitIterator})}},7599:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.init=e.INIT_=void 0;const n=r(5425),o=r(9577),i=r(9284);e.INIT_=!1,e.init=function(){e.INIT_||((0,o.MathspeakRules)(),(0,n.ClearspeakRules)(),(0,i.PrefixRules)(),(0,i.OtherRules)(),(0,i.BrailleRules)(),e.INIT_=!0)}},7283:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.getStore=e.addStore=e.funcStore=void 0;const n=r(1676);e.funcStore=new Map,e.addStore=function(t,r,n){const o={};if(r){const t=e.funcStore.get(r)||{};Object.assign(o,t)}e.funcStore.set(t,Object.assign(o,n))},e.getStore=function(t,r,o){return e.funcStore.get([t,r,o].join("."))||e.funcStore.get([n.DynamicCstr.DEFAULT_VALUES[n.Axis.LOCALE],r,o].join("."))||e.funcStore.get([n.DynamicCstr.BASE_LOCALE,r,o].join("."))||{}}},7598:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.oneLeft=e.leftMostUnit=e.rightMostUnit=e.unitMultipliers=void 0;const n=r(7052),o=r(5274),i=r(4356);e.unitMultipliers=function(t,e){const r=t;let o=0;return function(){const t=n.AuditoryDescription.create({text:s(r[o])&&l(r[o+1])?i.LOCALE.MESSAGES.unitTimes:""},{});return o++,[t]}};const a=["superscript","subscript","overscore","underscore"];function s(t){for(;t;){if("unit"===t.getAttribute("role"))return!0;const e=t.tagName,r=o.evalXPath("children/*",t);t=-1!==a.indexOf(e)?r[0]:r[r.length-1]}return!1}function l(t){for(;t;){if("unit"===t.getAttribute("role"))return!0;t=o.evalXPath("children/*",t)[0]}return!1}e.rightMostUnit=s,e.leftMostUnit=l,e.oneLeft=function(t){for(;t;){if("number"===t.tagName&&"1"===t.textContent)return[t];if("infixop"!==t.tagName||"multiplication"!==t.getAttribute("role")&&"implicit"!==t.getAttribute("role"))return[];t=o.evalXPath("children/*",t)[0]}return[]}},3284:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractWalker=void 0;const n=r(7052),o=r(8290),i=r(5740),a=r(4440),s=r(6828),l=r(8496),c=r(2298),u=r(4356),p=r(2105),h=r(5656),d=r(9552),f=r(9543),m=r(8504),y=r(7730),g=r(1214),b=r(179),v=r(1204),_=r(5274);class S{constructor(t,e,r,n){this.node=t,this.generator=e,this.highlighter=r,this.modifier=!1,this.keyMapping=new Map([[l.KeyCode.UP,this.up.bind(this)],[l.KeyCode.DOWN,this.down.bind(this)],[l.KeyCode.RIGHT,this.right.bind(this)],[l.KeyCode.LEFT,this.left.bind(this)],[l.KeyCode.TAB,this.repeat.bind(this)],[l.KeyCode.DASH,this.expand.bind(this)],[l.KeyCode.SPACE,this.depth.bind(this)],[l.KeyCode.HOME,this.home.bind(this)],[l.KeyCode.X,this.summary.bind(this)],[l.KeyCode.Z,this.detail.bind(this)],[l.KeyCode.V,this.virtualize.bind(this)],[l.KeyCode.P,this.previous.bind(this)],[l.KeyCode.U,this.undo.bind(this)],[l.KeyCode.LESS,this.previousRules.bind(this)],[l.KeyCode.GREATER,this.nextRules.bind(this)]]),this.cursors=[],this.xml_=null,this.rebuilt_=null,this.focus_=null,this.active_=!1,this.node.id?this.id=this.node.id:this.node.hasAttribute(S.SRE_ID_ATTR)?this.id=this.node.getAttribute(S.SRE_ID_ATTR):(this.node.setAttribute(S.SRE_ID_ATTR,S.ID_COUNTER.toString()),this.id=S.ID_COUNTER++),this.rootNode=v.getSemanticRoot(t),this.rootId=this.rootNode.getAttribute(c.Attribute.ID),this.xmlString_=n,this.moved=b.WalkerMoves.ENTER}getXml(){return this.xml_||(this.xml_=i.parseInput(this.xmlString_)),this.xml_}getRebuilt(){return this.rebuilt_||this.rebuildStree(),this.rebuilt_}isActive(){return this.active_}activate(){this.isActive()||(this.generator.start(),this.toggleActive_())}deactivate(){this.isActive()&&(b.WalkerState.setState(this.id,this.primaryId()),this.generator.end(),this.toggleActive_())}getFocus(t=!1){return this.focus_||(this.focus_=this.singletonFocus(this.rootId)),t&&this.updateFocus(),this.focus_}setFocus(t){this.focus_=t}getDepth(){return this.levels.depth()-1}isSpeech(){return this.generator.modality===c.Attribute.SPEECH}focusDomNodes(){return this.getFocus().getDomNodes()}focusSemanticNodes(){return this.getFocus().getSemanticNodes()}speech(){const t=this.focusDomNodes();if(!t.length)return"";const e=this.specialMove();if(null!==e)return e;switch(this.moved){case b.WalkerMoves.DEPTH:return this.depth_();case b.WalkerMoves.SUMMARY:return this.summary_();case b.WalkerMoves.DETAIL:return this.detail_();default:{const e=[],r=this.focusSemanticNodes();for(let n=0,o=t.length;n<o;n++){const o=t[n],i=r[n];e.push(o?this.generator.getSpeech(o,this.getXml()):f.recomputeMarkup(i))}return this.mergePrefix_(e)}}}move(t){const e=this.keyMapping.get(t);if(!e)return null;const r=e();return!(!r||r===this.getFocus())&&(this.setFocus(r),this.moved===b.WalkerMoves.HOME&&(this.levels=this.initLevels()),!0)}up(){return this.moved=b.WalkerMoves.UP,this.getFocus()}down(){return this.moved=b.WalkerMoves.DOWN,this.getFocus()}left(){return this.moved=b.WalkerMoves.LEFT,this.getFocus()}right(){return this.moved=b.WalkerMoves.RIGHT,this.getFocus()}repeat(){return this.moved=b.WalkerMoves.REPEAT,this.getFocus().clone()}depth(){return this.moved=this.isSpeech()?b.WalkerMoves.DEPTH:b.WalkerMoves.REPEAT,this.getFocus().clone()}home(){this.moved=b.WalkerMoves.HOME;return this.singletonFocus(this.rootId)}getBySemanticId(t){return v.getBySemanticId(this.node,t)}primaryId(){return this.getFocus().getSemanticPrimary().id.toString()}expand(){const t=this.getFocus().getDomPrimary(),e=this.actionable_(t);return e?(this.moved=b.WalkerMoves.EXPAND,e.dispatchEvent(new Event("click")),this.getFocus().clone()):this.getFocus()}expandable(t){return!!this.actionable_(t)&&0===t.childNodes.length}collapsible(t){return!!this.actionable_(t)&&t.childNodes.length>0}restoreState(){if(!this.highlighter)return;const t=b.WalkerState.getState(this.id);if(!t)return;let e=this.getRebuilt().nodeDict[t];const r=[];for(;e;)r.push(e.id),e=e.parent;for(r.pop();r.length>0;){this.down();const t=r.pop(),e=this.findFocusOnLevel(t);if(!e)break;this.setFocus(e)}this.moved=b.WalkerMoves.ENTER}updateFocus(){this.setFocus(y.Focus.factory(this.getFocus().getSemanticPrimary().id.toString(),this.getFocus().getSemanticNodes().map((t=>t.id.toString())),this.getRebuilt(),this.node))}rebuildStree(){this.rebuilt_=new g.RebuildStree(this.getXml()),this.rootId=this.rebuilt_.stree.root.id.toString(),this.generator.setRebuilt(this.rebuilt_),this.skeleton=h.SemanticSkeleton.fromTree(this.rebuilt_.stree),this.skeleton.populate(),this.focus_=this.singletonFocus(this.rootId),this.levels=this.initLevels(),f.connectMactions(this.node,this.getXml(),this.rebuilt_.xml)}previousLevel(){const t=this.getFocus().getDomPrimary();return t?v.getAttribute(t,c.Attribute.PARENT):this.getFocus().getSemanticPrimary().parent.id.toString()}nextLevel(){const t=this.getFocus().getDomPrimary();let e,r;if(t){e=v.splitAttribute(v.getAttribute(t,c.Attribute.CHILDREN)),r=v.splitAttribute(v.getAttribute(t,c.Attribute.CONTENT));const n=v.getAttribute(t,c.Attribute.TYPE),o=v.getAttribute(t,c.Attribute.ROLE);return this.combineContentChildren(n,o,r,e)}const n=t=>t.id.toString(),o=this.getRebuilt().nodeDict[this.primaryId()];return e=o.childNodes.map(n),r=o.contentNodes.map(n),0===e.length?[]:this.combineContentChildren(o.type,o.role,r,e)}singletonFocus(t){this.getRebuilt();const e=this.retrieveVisuals(t);return this.focusFromId(t,e)}retrieveVisuals(t){if(!this.skeleton)return[t];const e=parseInt(t,10),r=this.skeleton.subtreeNodes(e);if(!r.length)return[t];r.unshift(e);const n={},o=[];_.updateEvaluator(this.getXml());for(const t of r)n[t]||(o.push(t.toString()),n[t]=!0,this.subtreeIds(t,n));return o}subtreeIds(t,e){const r=_.evalXPath(`//*[@data-semantic-id="${t}"]`,this.getXml());_.evalXPath("*//@data-semantic-id",r[0]).forEach((t=>e[parseInt(t.textContent,10)]=!0))}focusFromId(t,e){return y.Focus.factory(t,e,this.getRebuilt(),this.node)}summary(){return this.moved=this.isSpeech()?b.WalkerMoves.SUMMARY:b.WalkerMoves.REPEAT,this.getFocus().clone()}detail(){return this.moved=this.isSpeech()?b.WalkerMoves.DETAIL:b.WalkerMoves.REPEAT,this.getFocus().clone()}specialMove(){return null}virtualize(t){return this.cursors.push({focus:this.getFocus(),levels:this.levels,undo:t||!this.cursors.length}),this.levels=this.levels.clone(),this.getFocus().clone()}previous(){const t=this.cursors.pop();return t?(this.levels=t.levels,t.focus):this.getFocus()}undo(){let t;do{t=this.cursors.pop()}while(t&&!t.undo);return t?(this.levels=t.levels,t.focus):this.getFocus()}update(t){this.generator.setOptions(t),(0,s.setup)(t).then((()=>d.generator("Tree").getSpeech(this.node,this.getXml())))}nextRules(){const t=this.generator.getOptions();return"speech"!==t.modality?this.getFocus():(a.DOMAIN_TO_STYLES[t.domain]=t.style,t.domain="mathspeak"===t.domain?"clearspeak":"mathspeak",t.style=a.DOMAIN_TO_STYLES[t.domain],this.update(t),this.moved=b.WalkerMoves.REPEAT,this.getFocus().clone())}nextStyle(t,e){if("mathspeak"===t){const t=["default","brief","sbrief"],r=t.indexOf(e);return-1===r?e:r>=t.length-1?t[0]:t[r+1]}if("clearspeak"===t){const t=m.ClearspeakPreferences.getLocalePreferences().en;if(!t)return"default";const r=m.ClearspeakPreferences.relevantPreferences(this.getFocus().getSemanticPrimary()),n=m.ClearspeakPreferences.findPreference(e,r),o=t[r].map((function(t){return t.split("_")[1]})),i=o.indexOf(n);if(-1===i)return e;const a=i>=o.length-1?o[0]:o[i+1];return m.ClearspeakPreferences.addPreference(e,r,a)}return e}previousRules(){const t=this.generator.getOptions();return"speech"!==t.modality?this.getFocus():(t.style=this.nextStyle(t.domain,t.style),this.update(t),this.moved=b.WalkerMoves.REPEAT,this.getFocus().clone())}refocus(){let t,e=this.getFocus();for(;!e.getNodes().length;){t=this.levels.peek();const r=this.up();if(!r)break;this.setFocus(r),e=this.getFocus(!0)}this.levels.push(t),this.setFocus(e)}toggleActive_(){this.active_=!this.active_}mergePrefix_(t,e=[]){const r=this.isSpeech()?this.prefix_():"";r&&t.unshift(r);const n=this.isSpeech()?this.postfix_():"";return n&&t.push(n),o.finalize(o.merge(e.concat(t)))}prefix_(){const t=this.getFocus().getDomNodes(),e=this.getFocus().getSemanticNodes();return t[0]?v.getAttribute(t[0],c.Attribute.PREFIX):f.retrievePrefix(e[0])}postfix_(){const t=this.getFocus().getDomNodes();return t[0]?v.getAttribute(t[0],c.Attribute.POSTFIX):""}depth_(){const t=p.Grammar.getInstance().getParameter("depth");p.Grammar.getInstance().setParameter("depth",!0);const e=this.getFocus().getDomPrimary(),r=this.expandable(e)?u.LOCALE.MESSAGES.navigate.EXPANDABLE:this.collapsible(e)?u.LOCALE.MESSAGES.navigate.COLLAPSIBLE:"",i=u.LOCALE.MESSAGES.navigate.LEVEL+" "+this.getDepth(),a=this.getFocus().getSemanticNodes(),s=f.retrievePrefix(a[0]),l=[new n.AuditoryDescription({text:i,personality:{}}),new n.AuditoryDescription({text:s,personality:{}}),new n.AuditoryDescription({text:r,personality:{}})];return p.Grammar.getInstance().setParameter("depth",t),o.finalize(o.markup(l))}actionable_(t){const e=null==t?void 0:t.parentNode;return e&&this.highlighter.isMactionNode(e)?e:null}summary_(){const t=this.getFocus().getSemanticPrimary().id.toString(),e=this.getRebuilt().xml.getAttribute("id")===t?this.getRebuilt().xml:i.querySelectorAllByAttrValue(this.getRebuilt().xml,"id",t)[0],r=f.retrieveSummary(e);return this.mergePrefix_([r])}detail_(){const t=this.getFocus().getSemanticPrimary().id.toString(),e=this.getRebuilt().xml.getAttribute("id")===t?this.getRebuilt().xml:i.querySelectorAllByAttrValue(this.getRebuilt().xml,"id",t)[0],r=e.getAttribute("alternative");e.removeAttribute("alternative");const n=f.computeMarkup(e),o=this.mergePrefix_([n]);return e.setAttribute("alternative",r),o}}e.AbstractWalker=S,S.ID_COUNTER=0,S.SRE_ID_ATTR="sre-explorer-id"},162:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.DummyWalker=void 0;const n=r(3284);class o extends n.AbstractWalker{up(){return null}down(){return null}left(){return null}right(){return null}repeat(){return null}depth(){return null}home(){return null}getDepth(){return 0}initLevels(){return null}combineContentChildren(t,e,r,n){return[]}findFocusOnLevel(t){return null}}e.DummyWalker=o},7730:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.Focus=void 0;const n=r(1204);class o{constructor(t,e){this.nodes=t,this.primary=e,this.domNodes=[],this.domPrimary_=null,this.allNodes=[]}static factory(t,e,r,i){const a=t=>n.getBySemanticId(i,t),s=r.nodeDict,l=a(t),c=e.map(a),u=e.map((function(t){return s[t]})),p=new o(u,s[t]);return p.domNodes=c,p.domPrimary_=l,p.allNodes=o.generateAllVisibleNodes_(e,c,s,i),p}static generateAllVisibleNodes_(t,e,r,i){const a=t=>n.getBySemanticId(i,t);let s=[];for(let n=0,l=t.length;n<l;n++){if(e[n]){s.push(e[n]);continue}const l=r[t[n]];if(!l)continue;const c=l.childNodes.map((function(t){return t.id.toString()})),u=c.map(a);s=s.concat(o.generateAllVisibleNodes_(c,u,r,i))}return s}getSemanticPrimary(){return this.primary}getSemanticNodes(){return this.nodes}getNodes(){return this.allNodes}getDomNodes(){return this.domNodes}getDomPrimary(){return this.domPrimary_}toString(){return"Primary:"+this.domPrimary_+" Nodes:"+this.domNodes}clone(){const t=new o(this.nodes,this.primary);return t.domNodes=this.domNodes,t.domPrimary_=this.domPrimary_,t.allNodes=this.allNodes,t}}e.Focus=o},9797:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Levels=void 0;class r{constructor(){this.level_=[]}push(t){this.level_.push(t)}pop(){return this.level_.pop()}peek(){return this.level_[this.level_.length-1]||null}indexOf(t){const e=this.peek();return e?e.indexOf(t):null}find(t){const e=this.peek();if(!e)return null;for(let r=0,n=e.length;r<n;r++)if(t(e[r]))return e[r];return null}get(t){const e=this.peek();return!e||t<0||t>=e.length?null:e[t]}depth(){return this.level_.length}clone(){const t=new r;return t.level_=this.level_.slice(0),t}toString(){let t="";for(let e,r=0;e=this.level_[r];r++)t+="\n"+e.map((function(t){return t.toString()}));return t}}e.Levels=r},1214:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.RebuildStree=void 0;const n=r(5740),o=r(2298),i=r(3588),a=r(6537),s=r(3308),l=r(5656),c=r(7075),u=r(4795),p=r(1204);class h{constructor(t){this.mathml=t,this.factory=new a.SemanticNodeFactory,this.nodeDict={},this.mmlRoot=p.getSemanticRoot(t),this.streeRoot=this.assembleTree(this.mmlRoot),this.stree=c.SemanticTree.fromNode(this.streeRoot,this.mathml),this.xml=this.stree.xml(),s.default.getInstance().setNodeFactory(this.factory)}static addAttributes(t,e,r){r&&1===e.childNodes.length&&e.childNodes[0].nodeType!==n.NodeType.TEXT_NODE&&u.addAttributes(t,e.childNodes[0]),u.addAttributes(t,e)}static textContent(t,e,r){if(!r&&e.textContent)return void(t.textContent=e.textContent);const n=p.splitAttribute(p.getAttribute(e,o.Attribute.OPERATOR));n.length>1&&(t.textContent=n[1])}static isPunctuated(t){return!l.SemanticSkeleton.simpleCollapseStructure(t)&&t[1]&&l.SemanticSkeleton.contentCollapseStructure(t[1])}getTree(){return this.stree}assembleTree(t){const e=this.makeNode(t),r=p.splitAttribute(p.getAttribute(t,o.Attribute.CHILDREN)),n=p.splitAttribute(p.getAttribute(t,o.Attribute.CONTENT));if(h.addAttributes(e,t,!(r.length||n.length)),0===n.length&&0===r.length)return h.textContent(e,t),e;if(n.length>0){const t=p.getBySemanticId(this.mathml,n[0]);t&&h.textContent(e,t,!0)}e.contentNodes=n.map((t=>this.setParent(t,e))),e.childNodes=r.map((t=>this.setParent(t,e)));const i=p.getAttribute(t,o.Attribute.COLLAPSED);return i?this.postProcess(e,i):e}makeNode(t){const e=p.getAttribute(t,o.Attribute.TYPE),r=p.getAttribute(t,o.Attribute.ROLE),n=p.getAttribute(t,o.Attribute.FONT),i=p.getAttribute(t,o.Attribute.ANNOTATION)||"",a=p.getAttribute(t,o.Attribute.ID),s=p.getAttribute(t,o.Attribute.EMBELLISHED),l=p.getAttribute(t,o.Attribute.FENCEPOINTER),c=this.createNode(parseInt(a,10));return c.type=e,c.role=r,c.font=n||"unknown",c.parseAnnotation(i),l&&(c.fencePointer=l),s&&(c.embellished=s),c}makePunctuation(t){const e=this.createNode(t);return e.updateContent((0,i.invisibleComma)()),e.role="dummy",e}makePunctuated(t,e,r){const n=this.createNode(e[0]);n.type="punctuated",n.embellished=t.embellished,n.fencePointer=t.fencePointer,n.role=r;const o=e.splice(1,1)[0].slice(1);n.contentNodes=o.map(this.makePunctuation.bind(this)),this.collapsedChildren_(e)}makeEmpty(t,e,r){const n=this.createNode(e);n.type="empty",n.embellished=t.embellished,n.fencePointer=t.fencePointer,n.role=r}makeIndex(t,e,r){if(h.isPunctuated(e))return this.makePunctuated(t,e,r),void(e=e[0]);l.SemanticSkeleton.simpleCollapseStructure(e)&&!this.nodeDict[e.toString()]&&this.makeEmpty(t,e,r)}postProcess(t,e){const r=l.SemanticSkeleton.fromString(e).array;if("subsup"===t.type){const e=this.createNode(r[1][0]);return e.type="subscript",e.role="subsup",t.type="superscript",e.embellished=t.embellished,e.fencePointer=t.fencePointer,this.makeIndex(t,r[1][2],"rightsub"),this.makeIndex(t,r[2],"rightsuper"),this.collapsedChildren_(r),t}if("subscript"===t.type)return this.makeIndex(t,r[2],"rightsub"),this.collapsedChildren_(r),t;if("superscript"===t.type)return this.makeIndex(t,r[2],"rightsuper"),this.collapsedChildren_(r),t;if("tensor"===t.type)return this.makeIndex(t,r[2],"leftsub"),this.makeIndex(t,r[3],"leftsuper"),this.makeIndex(t,r[4],"rightsub"),this.makeIndex(t,r[5],"rightsuper"),this.collapsedChildren_(r),t;if("punctuated"===t.type){if(h.isPunctuated(r)){const e=r.splice(1,1)[0].slice(1);t.contentNodes=e.map(this.makePunctuation.bind(this))}return t}if("underover"===t.type){const e=this.createNode(r[1][0]);return"overaccent"===t.childNodes[1].role?(e.type="overscore",t.type="underscore"):(e.type="underscore",t.type="overscore"),e.role="underover",e.embellished=t.embellished,e.fencePointer=t.fencePointer,this.collapsedChildren_(r),t}return t}createNode(t){const e=this.factory.makeNode(t);return this.nodeDict[t.toString()]=e,e}collapsedChildren_(t){const e=t=>{const r=this.nodeDict[t[0]];r.childNodes=[];for(let n=1,o=t.length;n<o;n++){const o=t[n];r.childNodes.push(l.SemanticSkeleton.simpleCollapseStructure(o)?this.nodeDict[o]:e(o))}return r};e(t)}setParent(t,e){const r=p.getBySemanticId(this.mathml,t),n=this.assembleTree(r);return n.parent=e,n}}e.RebuildStree=h},6295:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SemanticWalker=void 0;const n=r(3284),o=r(9797);class i extends n.AbstractWalker{constructor(t,e,r,n){super(t,e,r,n),this.node=t,this.generator=e,this.highlighter=r,this.levels=null,this.restoreState()}initLevels(){const t=new o.Levels;return t.push([this.getFocus()]),t}up(){super.up();const t=this.previousLevel();if(!t)return null;this.levels.pop();return this.levels.find((function(e){return e.getSemanticNodes().some((function(e){return e.id.toString()===t}))}))}down(){super.down();const t=this.nextLevel();return 0===t.length?null:(this.levels.push(t),t[0])}combineContentChildren(t,e,r,n){switch(t){case"relseq":case"infixop":case"multirel":return this.makePairList(n,r);case"prefixop":return[this.focusFromId(n[0],r.concat(n))];case"postfixop":return[this.focusFromId(n[0],n.concat(r))];case"matrix":case"vector":case"fenced":return[this.focusFromId(n[0],[r[0],n[0],r[1]])];case"cases":return[this.focusFromId(n[0],[r[0],n[0]])];case"punctuated":return"text"===e?n.map(this.singletonFocus.bind(this)):n.length===r.length?r.map(this.singletonFocus.bind(this)):this.combinePunctuations(n,r,[],[]);case"appl":return[this.focusFromId(n[0],[n[0],r[0]]),this.singletonFocus(n[1])];case"root":return[this.singletonFocus(n[1]),this.singletonFocus(n[0])];default:return n.map(this.singletonFocus.bind(this))}}combinePunctuations(t,e,r,n){if(0===t.length)return n;const o=t.shift(),i=e.shift();return o===i?(r.push(i),this.combinePunctuations(t,e,r,n)):(e.unshift(i),r.push(o),t.length===e.length?(n.push(this.focusFromId(o,r.concat(e))),n):(n.push(this.focusFromId(o,r)),this.combinePunctuations(t,e,[],n)))}makePairList(t,e){if(0===t.length)return[];if(1===t.length)return[this.singletonFocus(t[0])];const r=[this.singletonFocus(t.shift())];for(let n=0,o=t.length;n<o;n++)r.push(this.focusFromId(t[n],[e[n],t[n]]));return r}left(){super.left();const t=this.levels.indexOf(this.getFocus());if(null===t)return null;const e=this.levels.get(t-1);return e||null}right(){super.right();const t=this.levels.indexOf(this.getFocus());if(null===t)return null;const e=this.levels.get(t+1);return e||null}findFocusOnLevel(t){return this.levels.find((e=>e.getSemanticPrimary().id===t))}}e.SemanticWalker=i},9806:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.SyntaxWalker=void 0;const n=r(707),o=r(3284),i=r(9797);class a extends o.AbstractWalker{constructor(t,e,r,n){super(t,e,r,n),this.node=t,this.generator=e,this.highlighter=r,this.levels=null,this.restoreState()}initLevels(){const t=new i.Levels;return t.push([this.primaryId()]),t}up(){super.up();const t=this.previousLevel();return t?(this.levels.pop(),this.singletonFocus(t)):null}down(){super.down();const t=this.nextLevel();if(0===t.length)return null;const e=this.singletonFocus(t[0]);return e&&this.levels.push(t),e}combineContentChildren(t,e,r,o){switch(t){case"relseq":case"infixop":case"multirel":return(0,n.interleaveLists)(o,r);case"prefixop":return r.concat(o);case"postfixop":return o.concat(r);case"matrix":case"vector":case"fenced":return o.unshift(r[0]),o.push(r[1]),o;case"cases":return o.unshift(r[0]),o;case"punctuated":return"text"===e?(0,n.interleaveLists)(o,r):o;case"appl":return[o[0],r[0],o[1]];case"root":return[o[1],o[0]];default:return o}}left(){super.left();const t=this.levels.indexOf(this.primaryId());if(null===t)return null;const e=this.levels.get(t-1);return e?this.singletonFocus(e):null}right(){super.right();const t=this.levels.indexOf(this.primaryId());if(null===t)return null;const e=this.levels.get(t+1);return e?this.singletonFocus(e):null}findFocusOnLevel(t){return this.singletonFocus(t.toString())}focusDomNodes(){return[this.getFocus().getDomPrimary()]}focusSemanticNodes(){return[this.getFocus().getSemanticPrimary()]}}e.SyntaxWalker=a},1799:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.TableWalker=void 0;const n=r(5740),o=r(8496),i=r(9806),a=r(179);class s extends i.SyntaxWalker{constructor(t,e,r,n){super(t,e,r,n),this.node=t,this.generator=e,this.highlighter=r,this.firstJump=null,this.key_=null,this.row_=0,this.currentTable_=null,this.keyMapping.set(o.KeyCode.ZERO,this.jumpCell.bind(this)),this.keyMapping.set(o.KeyCode.ONE,this.jumpCell.bind(this)),this.keyMapping.set(o.KeyCode.TWO,this.jumpCell.bind(this)),this.keyMapping.set(o.KeyCode.THREE,this.jumpCell.bind(this)),this.keyMapping.set(o.KeyCode.FOUR,this.jumpCell.bind(this)),this.keyMapping.set(o.KeyCode.FIVE,this.jumpCell.bind(this)),this.keyMapping.set(o.KeyCode.SIX,this.jumpCell.bind(this)),this.keyMapping.set(o.KeyCode.SEVEN,this.jumpCell.bind(this)),this.keyMapping.set(o.KeyCode.EIGHT,this.jumpCell.bind(this)),this.keyMapping.set(o.KeyCode.NINE,this.jumpCell.bind(this))}move(t){this.key_=t;const e=super.move(t);return this.modifier=!1,e}up(){return this.moved=a.WalkerMoves.UP,this.eligibleCell_()?this.verticalMove_(!1):super.up()}down(){return this.moved=a.WalkerMoves.DOWN,this.eligibleCell_()?this.verticalMove_(!0):super.down()}jumpCell(){if(!this.isInTable_()||null===this.key_)return this.getFocus();if(this.moved===a.WalkerMoves.ROW){this.moved=a.WalkerMoves.CELL;const t=this.key_-o.KeyCode.ZERO;return this.isLegalJump_(this.row_,t)?this.jumpCell_(this.row_,t):this.getFocus()}const t=this.key_-o.KeyCode.ZERO;return t>this.currentTable_.childNodes.length?this.getFocus():(this.row_=t,this.moved=a.WalkerMoves.ROW,this.getFocus().clone())}undo(){const t=super.undo();return t===this.firstJump&&(this.firstJump=null),t}eligibleCell_(){const t=this.getFocus().getSemanticPrimary();return this.modifier&&"cell"===t.type&&-1!==s.ELIGIBLE_CELL_ROLES.indexOf(t.role)}verticalMove_(t){const e=this.previousLevel();if(!e)return null;const r=this.getFocus(),n=this.levels.indexOf(this.primaryId()),o=this.levels.pop(),i=this.levels.indexOf(e),a=this.levels.get(t?i+1:i-1);if(!a)return this.levels.push(o),null;this.setFocus(this.singletonFocus(a));const s=this.nextLevel();return s[n]?(this.levels.push(s),this.singletonFocus(s[n])):(this.setFocus(r),this.levels.push(o),null)}jumpCell_(t,e){this.firstJump?this.virtualize(!1):(this.firstJump=this.getFocus(),this.virtualize(!0));const r=this.currentTable_.id.toString();let n;do{n=this.levels.pop()}while(-1===n.indexOf(r));this.levels.push(n),this.setFocus(this.singletonFocus(r)),this.levels.push(this.nextLevel());const o=this.currentTable_.childNodes[t-1];return this.setFocus(this.singletonFocus(o.id.toString())),this.levels.push(this.nextLevel()),this.singletonFocus(o.childNodes[e-1].id.toString())}isLegalJump_(t,e){const r=n.querySelectorAllByAttrValue(this.getRebuilt().xml,"id",this.currentTable_.id.toString())[0];if(!r||r.hasAttribute("alternative"))return!1;const o=this.currentTable_.childNodes[t-1];if(!o)return!1;const i=n.querySelectorAllByAttrValue(r,"id",o.id.toString())[0];return!(!i||i.hasAttribute("alternative"))&&!(!o||!o.childNodes[e-1])}isInTable_(){let t=this.getFocus().getSemanticPrimary();for(;t;){if(-1!==s.ELIGIBLE_TABLE_TYPES.indexOf(t.type))return this.currentTable_=t,!0;t=t.parent}return!1}}e.TableWalker=s,s.ELIGIBLE_CELL_ROLES=["determinant","rowvector","binomial","squarematrix","multiline","matrix","vector","cases","table"],s.ELIGIBLE_TABLE_TYPES=["multiline","matrix","vector","cases","table"]},179:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.WalkerState=e.WalkerMoves=void 0,function(t){t.UP="up",t.DOWN="down",t.LEFT="left",t.RIGHT="right",t.REPEAT="repeat",t.DEPTH="depth",t.ENTER="enter",t.EXPAND="expand",t.HOME="home",t.SUMMARY="summary",t.DETAIL="detail",t.ROW="row",t.CELL="cell"}(e.WalkerMoves||(e.WalkerMoves={}));class r{static resetState(t){delete r.STATE[t]}static setState(t,e){r.STATE[t]=e}static getState(t){return r.STATE[t]}}e.WalkerState=r,r.STATE={}},3362:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.walkerMapping_=e.walker=void 0;const n=r(162),o=r(6295),i=r(9806),a=r(1799);e.walker=function(t,r,n,o,i){return(e.walkerMapping_[t.toLowerCase()]||e.walkerMapping_.dummy)(r,n,o,i)},e.walkerMapping_={dummy:(t,e,r,o)=>new n.DummyWalker(t,e,r,o),semantic:(t,e,r,n)=>new o.SemanticWalker(t,e,r,n),syntax:(t,e,r,n)=>new i.SyntaxWalker(t,e,r,n),table:(t,e,r,n)=>new a.TableWalker(t,e,r,n)}},1204:function(t,e,r){Object.defineProperty(e,"__esModule",{value:!0}),e.getBySemanticId=e.getSemanticRoot=e.getAttribute=e.splitAttribute=void 0;const n=r(5740),o=r(2298);e.splitAttribute=function(t){return t?t.split(/,/):[]},e.getAttribute=function(t,e){return t.getAttribute(e)},e.getSemanticRoot=function(t){if(t.hasAttribute(o.Attribute.TYPE)&&!t.hasAttribute(o.Attribute.PARENT))return t;const e=n.querySelectorAllByAttr(t,o.Attribute.TYPE);for(let t,r=0;t=e[r];r++)if(!t.hasAttribute(o.Attribute.PARENT))return t;return t},e.getBySemanticId=function(t,e){return t.getAttribute(o.Attribute.ID)===e?t:n.querySelectorAllByAttrValue(t,o.Attribute.ID,e)[0]}}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var r=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t].call(r.exports,r,r.exports,__webpack_require__),r.exports}__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}();var __webpack_exports__={};!function(){var t=__webpack_require__(9515),e=__webpack_require__(3282),r=__webpack_require__(235),n=__webpack_require__(265),o=__webpack_require__(2388);function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}MathJax.loader&&MathJax.loader.checkVersion("startup",e.VERSION,"startup"),(0,t.combineWithMathJax)({_:{components:{loader:r,package:n,startup:o}}});var a,s={"a11y/semantic-enrich":["input/mml","a11y/sre"],"a11y/complexity":["a11y/semantic-enrich"],"a11y/explorer":["a11y/semantic-enrich","ui/menu"],"[mml]/mml3":["input/mml"],"[tex]/all-packages":["input/tex-base"],"[tex]/action":["input/tex-base","[tex]/newcommand"],"[tex]/autoload":["input/tex-base","[tex]/require"],"[tex]/ams":["input/tex-base"],"[tex]/amscd":["input/tex-base"],"[tex]/bbox":["input/tex-base","[tex]/ams","[tex]/newcommand"],"[tex]/boldsymbol":["input/tex-base"],"[tex]/braket":["input/tex-base"],"[tex]/bussproofs":["input/tex-base"],"[tex]/cancel":["input/tex-base","[tex]/enclose"],"[tex]/centernot":["input/tex-base"],"[tex]/color":["input/tex-base"],"[tex]/colorv2":["input/tex-base"],"[tex]/colortbl":["input/tex-base","[tex]/color"],"[tex]/configmacros":["input/tex-base","[tex]/newcommand"],"[tex]/enclose":["input/tex-base"],"[tex]/extpfeil":["input/tex-base","[tex]/newcommand","[tex]/ams"],"[tex]/html":["input/tex-base"],"[tex]/mathtools":["input/tex-base","[tex]/newcommand","[tex]/ams"],"[tex]/mhchem":["input/tex-base","[tex]/ams"],"[tex]/newcommand":["input/tex-base"],"[tex]/noerrors":["input/tex-base"],"[tex]/noundefined":["input/tex-base"],"[tex]/physics":["input/tex-base"],"[tex]/require":["input/tex-base"],"[tex]/setoptions":["input/tex-base"],"[tex]/tagformat":["input/tex-base"],"[tex]/textcomp":["input/tex-base","[tex]/textmacros"],"[tex]/textmacros":["input/tex-base"],"[tex]/unicode":["input/tex-base"],"[tex]/verb":["input/tex-base"],"[tex]/cases":["[tex]/empheq"],"[tex]/empheq":["input/tex-base","[tex]/ams"]},l=Array.from(Object.keys(s)).filter((function(t){return"[tex]"===t.substr(0,5)&&"[tex]/autoload"!==t&&"[tex]/colorv2"!==t&&"[tex]/all-packages"!==t})),c={startup:["loader"],"input/tex":["input/tex-base","[tex]/ams","[tex]/newcommand","[tex]/noundefined","[tex]/require","[tex]/autoload","[tex]/configmacros"],"input/tex-full":["input/tex-base","[tex]/all-packages"].concat((a=l,function(t){if(Array.isArray(t))return i(t)}(a)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(a)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}(a)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())),"[tex]/all-packages":l};(0,t.combineDefaults)(MathJax.config.loader,"dependencies",s),(0,t.combineDefaults)(MathJax.config.loader,"paths",{tex:"[mathjax]/input/tex/extensions",mml:"[mathjax]/input/mml/extensions",sre:"[mathjax]/sre/mathmaps"}),(0,t.combineDefaults)(MathJax.config.loader,"provides",c),(0,t.combineDefaults)(MathJax.config.loader,"source",{"[tex]/amsCd":"[tex]/amscd","[tex]/colorV2":"[tex]/colorv2","[tex]/configMacros":"[tex]/configmacros","[tex]/tagFormat":"[tex]/tagformat"}),r.Loader.preLoad("loader","startup","core","input/tex-full","output/chtml","output/chtml/fonts/tex.js","ui/menu","a11y/assistive-mml");var u=__webpack_require__(444),p=__webpack_require__(6191),h=__webpack_require__(5009),d=__webpack_require__(3494),f=__webpack_require__(3670),m=__webpack_require__(805),y=__webpack_require__(9206),g=__webpack_require__(5722),b=__webpack_require__(4474),v=__webpack_require__(9e3),_=__webpack_require__(91),S=__webpack_require__(6336),x=__webpack_require__(1759),M=__webpack_require__(3909),O=__webpack_require__(9007),E=__webpack_require__(3948),A=__webpack_require__(9145),C=__webpack_require__(142),w=__webpack_require__(7590),T=__webpack_require__(3233),N=__webpack_require__(1334),L=__webpack_require__(6661),P=__webpack_require__(1581),I=__webpack_require__(5410),k=__webpack_require__(6850),R=__webpack_require__(3985),j=__webpack_require__(450),B=__webpack_require__(6405),D=__webpack_require__(3050),F=__webpack_require__(2756),H=__webpack_require__(7238),q=__webpack_require__(5741),U=__webpack_require__(6145),G=__webpack_require__(9878),V=__webpack_require__(7265),X=__webpack_require__(6030),W=__webpack_require__(7131),z=__webpack_require__(1314),$=__webpack_require__(4461),J=__webpack_require__(1349),K=__webpack_require__(4359),Y=__webpack_require__(4770),Z=__webpack_require__(5022),Q=__webpack_require__(5184),tt=__webpack_require__(9102),et=__webpack_require__(6325),rt=__webpack_require__(4082),nt=__webpack_require__(9259),ot=__webpack_require__(2975),it=__webpack_require__(4574),at=__webpack_require__(4596),st=__webpack_require__(7860),lt=__webpack_require__(8823),ct=__webpack_require__(8912),ut=__webpack_require__(3811),pt=__webpack_require__(6272),ht=__webpack_require__(3683),dt=__webpack_require__(5138),ft=__webpack_require__(3726),mt=__webpack_require__(3363),yt=__webpack_require__(3335),gt=__webpack_require__(5713),bt=__webpack_require__(9923),vt=__webpack_require__(6469),_t=__webpack_require__(6751),St=__webpack_require__(5368),xt=__webpack_require__(7525),Mt=__webpack_require__(103),Ot=__webpack_require__(7233),Et=__webpack_require__(8666),At=__webpack_require__(4542),Ct=__webpack_require__(4139),wt=__webpack_require__(8054),Tt=__webpack_require__(6010),Nt=__webpack_require__(7875),Lt=__webpack_require__(505);MathJax.loader&&MathJax.loader.checkVersion("core",e.VERSION,"core"),(0,t.combineWithMathJax)({_:{adaptors:{HTMLAdaptor:u,browserAdaptor:p},components:{global:t},core:{DOMAdaptor:h,FindMath:d,Handler:f,HandlerList:m,InputJax:y,MathDocument:g,MathItem:b,MathList:v,MmlTree:{Attributes:_,MML:S,MathMLVisitor:x,MmlFactory:M,MmlNode:O,MmlNodes:{TeXAtom:E,maction:A,maligngroup:C,malignmark:w,math:T,mathchoice:N,menclose:L,merror:P,mfenced:I,mfrac:k,mglyph:R,mi:j,mmultiscripts:B,mn:D,mo:F,mpadded:H,mphantom:q,mroot:U,mrow:G,ms:V,mspace:X,msqrt:W,mstyle:z,msubsup:$,mtable:J,mtd:K,mtext:Y,mtr:Z,munderover:Q,semantics:tt},MmlVisitor:et,OperatorDictionary:rt,SerializedMmlVisitor:nt},OutputJax:ot,Tree:{Factory:it,Node:at,NodeFactory:st,Visitor:lt,Wrapper:ct,WrapperFactory:ut}},handlers:{html_ts:pt,html:{HTMLDocument:ht,HTMLDomStrings:dt,HTMLHandler:ft,HTMLMathItem:mt,HTMLMathList:yt}},mathjax:gt,util:{AsyncLoad:bt,BBox:vt,BitField:_t,Entities:St,FunctionList:xt,LinkedList:Mt,Options:Ot,PrioritizedList:Et,Retries:At,StyleList:Ct,Styles:wt,lengths:Tt,numeric:Nt,string:Lt}}}),MathJax.startup&&(MathJax.startup.registerConstructor("HTMLHandler",ft.HTMLHandler),MathJax.startup.registerConstructor("browserAdaptor",p.browserAdaptor),MathJax.startup.useHandler("HTMLHandler"),MathJax.startup.useAdaptor("browserAdaptor")),MathJax.loader&&(MathJax._.mathjax.mathjax.asyncLoad=function(t){return MathJax.loader.load(t)});var Pt=__webpack_require__(8462),It=__webpack_require__(210),kt=__webpack_require__(9899),Rt=__webpack_require__(4676),jt=__webpack_require__(7073),Bt=__webpack_require__(2947),Dt=__webpack_require__(8929),Ft=__webpack_require__(1256),Ht=__webpack_require__(5450),qt=__webpack_require__(8562),Ut=__webpack_require__(1130),Gt=__webpack_require__(9497),Vt=__webpack_require__(8292),Xt=__webpack_require__(5453),Wt=__webpack_require__(8803),zt=__webpack_require__(9140),$t=__webpack_require__(6521),Jt=__webpack_require__(8317),Kt=__webpack_require__(3971),Yt=__webpack_require__(8417),Zt=__webpack_require__(8174),Qt=__webpack_require__(583),te=__webpack_require__(7819),ee=__webpack_require__(8021),re=__webpack_require__(2790),ne=__webpack_require__(4387),oe=__webpack_require__(1275),ie=__webpack_require__(2942),ae=__webpack_require__(1181),se=__webpack_require__(7693),le=__webpack_require__(1186),ce=__webpack_require__(8603),ue=__webpack_require__(6538),pe=__webpack_require__(7191),he=__webpack_require__(8667),de=__webpack_require__(9499),fe=__webpack_require__(3980),me=__webpack_require__(4934),ye=__webpack_require__(1933),ge=__webpack_require__(8963),be=__webpack_require__(3752),ve=__webpack_require__(8227),_e=__webpack_require__(6648),Se=__webpack_require__(6628),xe=__webpack_require__(5860),Me=__webpack_require__(7960),Oe=__webpack_require__(2784),Ee=__webpack_require__(4207),Ae=__webpack_require__(8458),Ce=__webpack_require__(5464),we=__webpack_require__(6471),Te=__webpack_require__(1428),Ne=__webpack_require__(6121),Le=__webpack_require__(3078),Pe=__webpack_require__(8901),Ie=__webpack_require__(332),ke=__webpack_require__(7535),Re=__webpack_require__(6224),je=__webpack_require__(643),Be=__webpack_require__(1503),De=__webpack_require__(836),Fe=__webpack_require__(6944),He=__webpack_require__(1496),qe=__webpack_require__(6793),Ue=__webpack_require__(1110),Ge=__webpack_require__(5579),Ve=__webpack_require__(4234),Xe=__webpack_require__(4898),We=__webpack_require__(3168),ze=__webpack_require__(2612),$e=__webpack_require__(7157),Je=__webpack_require__(7741),Ke=__webpack_require__(9365),Ye=__webpack_require__(1527),Ze=__webpack_require__(2307),Qe=__webpack_require__(2675),tr=__webpack_require__(58),er=__webpack_require__(8728),rr=__webpack_require__(6841),nr=__webpack_require__(1442),or=__webpack_require__(1247);function ir(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(MathJax.startup){e&&(MathJax.startup.registerConstructor("tex",MathJax._.input.tex_ts.TeX),MathJax.startup.useInput("tex")),MathJax.config.tex||(MathJax.config.tex={});var r=MathJax.config.tex.packages;MathJax.config.tex.packages=t,r&&(0,Ot.insert)(MathJax.config.tex,{packages:r})}}function ar(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}MathJax.loader&&MathJax.loader.checkVersion("input/tex-full",e.VERSION,"input"),(0,t.combineWithMathJax)({_:{input:{tex_ts:Pt,tex:{AllPackages:It,Configuration:kt,FilterUtil:Rt,FindTeX:jt,MapHandler:Bt,NodeFactory:Dt,NodeUtil:Ft,ParseMethods:Ht,ParseOptions:qt,ParseUtil:Ut,Stack:Gt,StackItem:Vt,StackItemFactory:Xt,Symbol:Wt,SymbolMap:zt,Tags:$t,TexConstants:Jt,TexError:Kt,TexParser:Yt,action:{ActionConfiguration:Zt},amscd:{AmsCdConfiguration:Qt,AmsCdMethods:te},ams:{AmsConfiguration:ee,AmsItems:re,AmsMethods:ne},autoload:{AutoloadConfiguration:oe},base:{BaseConfiguration:ie,BaseItems:ae,BaseMethods:se},bbox:{BboxConfiguration:le},boldsymbol:{BoldsymbolConfiguration:ce},braket:{BraketConfiguration:ue,BraketItems:pe,BraketMethods:he},bussproofs:{BussproofsConfiguration:de,BussproofsItems:fe,BussproofsMethods:me,BussproofsUtil:ye},cancel:{CancelConfiguration:ge},cases:{CasesConfiguration:be},centernot:{CenternotConfiguration:ve},colortbl:{ColortblConfiguration:_e},colorv2:{ColorV2Configuration:Se},color:{ColorConfiguration:xe,ColorConstants:Me,ColorMethods:Oe,ColorUtil:Ee},configmacros:{ConfigMacrosConfiguration:Ae},empheq:{EmpheqConfiguration:Ce,EmpheqUtil:we},enclose:{EncloseConfiguration:Te},extpfeil:{ExtpfeilConfiguration:Ne},gensymb:{GensymbConfiguration:Le},html:{HtmlConfiguration:Pe,HtmlMethods:Ie},mathtools:{MathtoolsConfiguration:ke,MathtoolsItems:Re,MathtoolsMethods:je,MathtoolsTags:Be,MathtoolsUtil:De},mhchem:{MhchemConfiguration:Fe},newcommand:{NewcommandConfiguration:He,NewcommandItems:qe,NewcommandMethods:Ue,NewcommandUtil:Ge},noerrors:{NoErrorsConfiguration:Ve},noundefined:{NoUndefinedConfiguration:Xe},physics:{PhysicsConfiguration:We,PhysicsItems:ze,PhysicsMethods:$e},require:{RequireConfiguration:Je},setoptions:{SetOptionsConfiguration:Ke},tagformat:{TagFormatConfiguration:Ye},textcomp:{TextcompConfiguration:Ze},textmacros:{TextMacrosConfiguration:Qe,TextMacrosMethods:tr,TextParser:er},unicode:{UnicodeConfiguration:rr},upgreek:{UpgreekConfiguration:nr},verb:{VerbConfiguration:or}}}}}),MathJax.loader&&MathJax.loader.checkVersion("[tex]/all-packages",e.VERSION,"tex-extension"),(0,t.combineWithMathJax)({_:{input:{tex:{AllPackages:It,autoload:{AutoloadConfiguration:oe},require:{RequireConfiguration:Je}}}}}),MathJax.loader&&MathJax.loader.preLoad("[tex]/autoload","[tex]/require"),ir(["require"].concat(function(t){return function(t){if(Array.isArray(t))return ar(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return ar(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ar(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(It.AllPackages)),!1),MathJax.loader&&MathJax.loader.preLoad("input/tex-base","[tex]/all-packages"),ir();var sr=__webpack_require__(50),lr=__webpack_require__(8042),cr=__webpack_require__(8270),ur=__webpack_require__(6797),pr=__webpack_require__(5355),hr=__webpack_require__(9261),dr=__webpack_require__(9086),fr=__webpack_require__(95),mr=__webpack_require__(1148),yr=__webpack_require__(8102),gr=__webpack_require__(804),br=__webpack_require__(8147),vr=__webpack_require__(2275),_r=__webpack_require__(9063),Sr=__webpack_require__(6911),xr=__webpack_require__(1653),Mr=__webpack_require__(6781),Or=__webpack_require__(6460),Er=__webpack_require__(6287),Ar=__webpack_require__(5964),Cr=__webpack_require__(8776),wr=__webpack_require__(4798),Tr=__webpack_require__(4597),Nr=__webpack_require__(2970),Lr=__webpack_require__(5610),Pr=__webpack_require__(4300),Ir=__webpack_require__(8002),kr=__webpack_require__(7056),Rr=__webpack_require__(1259),jr=__webpack_require__(3571),Br=__webpack_require__(6590),Dr=__webpack_require__(8650),Fr=__webpack_require__(421),Hr=__webpack_require__(5884),qr=__webpack_require__(5552),Ur=__webpack_require__(3055),Gr=__webpack_require__(7519),Vr=__webpack_require__(4420),Xr=__webpack_require__(9800),Wr=__webpack_require__(1160),zr=__webpack_require__(1956),$r=__webpack_require__(7490),Jr=__webpack_require__(7313),Kr=__webpack_require__(7555),Yr=__webpack_require__(2688),Zr=__webpack_require__(5636),Qr=__webpack_require__(5723),tn=__webpack_require__(8009),en=__webpack_require__(5023),rn=__webpack_require__(7096),nn=__webpack_require__(6898),on=__webpack_require__(6991),an=__webpack_require__(8411),sn=__webpack_require__(4126),ln=__webpack_require__(258),cn=__webpack_require__(4093),un=__webpack_require__(905),pn=__webpack_require__(6237),hn=__webpack_require__(5164),dn=__webpack_require__(6319),fn=__webpack_require__(5766),mn=__webpack_require__(1971),yn=__webpack_require__(167),gn=__webpack_require__(5806);MathJax.loader&&MathJax.loader.checkVersion("output/chtml",e.VERSION,"output"),(0,t.combineWithMathJax)({_:{output:{chtml_ts:sr,chtml:{FontData:lr,Notation:cr,Usage:ur,Wrapper:pr,WrapperFactory:hr,Wrappers_ts:dr,Wrappers:{TeXAtom:fr,TextNode:mr,maction:yr,math:gr,menclose:br,mfenced:vr,mfrac:_r,mglyph:Sr,mi:xr,mmultiscripts:Mr,mn:Or,mo:Er,mpadded:Ar,mroot:Cr,mrow:wr,ms:Tr,mspace:Nr,msqrt:Lr,msubsup:Pr,mtable:Ir,mtd:kr,mtext:Rr,mtr:jr,munderover:Br,scriptbase:Dr,semantics:Fr}},common:{FontData:Hr,Notation:qr,OutputJax:Ur,Wrapper:Gr,WrapperFactory:Vr,Wrappers:{TeXAtom:Xr,TextNode:Wr,maction:zr,math:$r,menclose:Jr,mfenced:Kr,mfrac:Yr,mglyph:Zr,mi:Qr,mmultiscripts:tn,mn:en,mo:rn,mpadded:nn,mroot:on,mrow:an,ms:sn,mspace:ln,msqrt:cn,msubsup:un,mtable:pn,mtd:hn,mtext:dn,mtr:fn,munderover:mn,scriptbase:yn,semantics:gn}}}}}),MathJax.loader&&(0,t.combineDefaults)(MathJax.config.loader,"output/chtml",{checkReady:function(){return MathJax.loader.load("output/chtml/fonts/tex")}}),MathJax.startup&&(MathJax.startup.registerConstructor("chtml",sr.CHTML),MathJax.startup.useOutput("chtml"));var bn=__webpack_require__(2760),vn=__webpack_require__(4005),_n=__webpack_require__(1015),Sn=__webpack_require__(6555),xn=__webpack_require__(2183),Mn=__webpack_require__(3490),On=__webpack_require__(9056),En=__webpack_require__(3019),An=__webpack_require__(2713),Cn=__webpack_require__(7517),wn=__webpack_require__(4182),Tn=__webpack_require__(2679),Nn=__webpack_require__(5469),Ln=__webpack_require__(775),Pn=__webpack_require__(9551),In=__webpack_require__(6530),kn=__webpack_require__(4409),Rn=__webpack_require__(5292),jn=__webpack_require__(5887),Bn=__webpack_require__(1103),Dn=__webpack_require__(9124),Fn=__webpack_require__(6001),Hn=__webpack_require__(3696),qn=__webpack_require__(9587),Un=__webpack_require__(8348),Gn=__webpack_require__(1376),Vn=__webpack_require__(1439),Xn=__webpack_require__(331),Wn=__webpack_require__(4886),zn=__webpack_require__(4471),$n=__webpack_require__(5181),Jn=__webpack_require__(3526),Kn=__webpack_require__(5649),Yn=__webpack_require__(7153),Zn=__webpack_require__(5745),Qn=__webpack_require__(1411),to=__webpack_require__(6384),eo=__webpack_require__(6041),ro=__webpack_require__(8199),no=__webpack_require__(9848),oo=__webpack_require__(7906),io=__webpack_require__(2644),ao=__webpack_require__(4926);if(MathJax.loader&&MathJax.loader.checkVersion("output/chtml/fonts/tex",e.VERSION,"chtml-font"),(0,t.combineWithMathJax)({_:{output:{chtml:{fonts:{tex_ts:bn,tex:{"bold-italic":vn,bold:_n,"fraktur-bold":Sn,fraktur:xn,italic:Mn,largeop:On,monospace:En,normal:An,"sans-serif-bold-italic":Cn,"sans-serif-bold":wn,"sans-serif-italic":Tn,"sans-serif":Nn,smallop:Ln,"tex-calligraphic-bold":Pn,"tex-size3":In,"tex-size4":kn,"tex-variant":Rn}}},common:{fonts:{tex:{"bold-italic":jn,bold:Bn,delimiters:Dn,"double-struck":Fn,"fraktur-bold":Hn,fraktur:qn,italic:Un,largeop:Gn,monospace:Vn,normal:Xn,"sans-serif-bold-italic":Wn,"sans-serif-bold":zn,"sans-serif-italic":$n,"sans-serif":Jn,"script-bold":Kn,script:Yn,smallop:Zn,"tex-calligraphic-bold":Qn,"tex-calligraphic":to,"tex-mathit":eo,"tex-oldstyle-bold":ro,"tex-oldstyle":no,"tex-size3":oo,"tex-size4":io,"tex-variant":ao}}}}}}),MathJax.startup){(0,t.combineDefaults)(MathJax.config,"chtml",{fontURL:n.Package.resolvePath("output/chtml/fonts/woff-v2",!1)});var so=(0,Ot.selectOptionsFromKeys)(MathJax.config.chtml||{},bn.TeXFont.OPTIONS);(0,t.combineDefaults)(MathJax.config,"chtml",{font:new bn.TeXFont(so)})}var lo=__webpack_require__(5865),co=__webpack_require__(8310),uo=__webpack_require__(4001),po=__webpack_require__(473),ho=__webpack_require__(4414);MathJax.loader&&MathJax.loader.checkVersion("ui/menu",e.VERSION,"ui"),(0,t.combineWithMathJax)({_:{ui:{menu:{MJContextMenu:lo,Menu:co,MenuHandler:uo,MmlVisitor:po,SelectableInfo:ho}}}}),MathJax.startup&&"undefined"!=typeof window&&MathJax.startup.extendHandler((function(t){return(0,uo.MenuHandler)(t)}),20);var fo=__webpack_require__(351);function mo(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}MathJax.loader&&MathJax.loader.checkVersion("a11y/assistive-mml",e.VERSION,"a11y"),(0,t.combineWithMathJax)({_:{a11y:{"assistive-mml":fo}}}),MathJax.startup&&MathJax.startup.extendHandler((function(t){return(0,fo.AssistiveMmlHandler)(t)})),r.Loader.preLoad("loader"),r.Loader.load.apply(r.Loader,function(t){return function(t){if(Array.isArray(t))return mo(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return mo(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return mo(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(r.CONFIG.load)).then((function(){return r.CONFIG.ready()})).catch((function(t){return r.CONFIG.failed(t)}))}()})();</script>
  <!--[if lt IE 9]>
    <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
  <![endif]-->
</head>
<body>
<div class="wrapper">
<header id="title-block-header">
<h1 class="title" style="text-align:center">Quantities and units
library</h1>
<table style="border:none;float:right">
  <tr>
    <td>Document #:</td>
    <td>P3045R4</td>
  </tr>
  <tr>
    <td>Date:</td>
    <td>2024-11-15</td>
  </tr>
  <tr>
    <td style="vertical-align:top">Project:</td>
    <td>Programming Language C++</td>
  </tr>
  <tr>
    <td style="vertical-align:top">Audience:</td>
    <td>
      SG6 Numerics<br>
      SG16 Unicode<br>
      SG18 Library Evolution Working Group Incubator (LEWGI)<br>
    </td>
  </tr>
  <tr>
    <td style="vertical-align:top">Reply-to:</td>
    <td>
      Mateusz Pusz (<a href="http://www.epam.com">Epam
Systems</a>)<br>&lt;<a href="mailto:mateusz.pusz@gmail.com" class="email">mateusz.pusz@gmail.com</a>&gt;<br>
      Dominik Berner<br>&lt;<a href="mailto:dominik.berner@gmail.com" class="email">dominik.berner@gmail.com</a>&gt;<br>
      Johel Ernesto Guerrero Peña<br>&lt;<a href="mailto:johelegp@gmail.com" class="email">johelegp@gmail.com</a>&gt;<br>
      Chip Hogg (<a href="https://aurora.tech/">Aurora
Innovation</a>)<br>&lt;<a href="mailto:charles.r.hogg@gmail.com" class="email">charles.r.hogg@gmail.com</a>&gt;<br>
      Nicolas Holthaus<br>&lt;<a href="mailto:nholthaus@gmail.com" class="email">nholthaus@gmail.com</a>&gt;<br>
      Roth Michaels (<a href="https://www.native-instruments.com">Native
Instruments</a>)<br>&lt;<a href="mailto:isocxx@rothmichaels.us" class="email">isocxx@rothmichaels.us</a>&gt;<br>
      Vincent Reverdy<br>&lt;<a href="mailto:vince.rev@gmail.com" class="email">vince.rev@gmail.com</a>&gt;<br>
    </td>
  </tr>
</table>
</header>
<div style="clear:both">
<div id="TOC" role="doc-toc">
<h1 id="toctitle">Contents</h1>
<ul>
<li><a href="#revision-history" id="toc-revision-history"><span class="toc-section-number">1</span> Revision history<span></span></a>
<ul>
<li><a href="#changes-since-p3045r3" id="toc-changes-since-p3045r3"><span class="toc-section-number">1.1</span> Changes since <span class="citation" data-cites="P3045R3">[<span>P3045R3</span>]</span><span></span></a></li>
<li><a href="#changes-since-p3045r2" id="toc-changes-since-p3045r2"><span class="toc-section-number">1.2</span> Changes since <span class="citation" data-cites="P3045R2">[<span>P3045R2</span>]</span><span></span></a></li>
<li><a href="#changes-since-p3045r1" id="toc-changes-since-p3045r1"><span class="toc-section-number">1.3</span> Changes since <span class="citation" data-cites="P3045R1">[<span>P3045R1</span>]</span><span></span></a></li>
<li><a href="#changes-since-p3045r0" id="toc-changes-since-p3045r0"><span class="toc-section-number">1.4</span> Changes since <span class="citation" data-cites="P3045R0">[<span>P3045R0</span>]</span><span></span></a></li>
</ul></li>
<li><a href="#introduction" id="toc-introduction"><span class="toc-section-number">2</span> Introduction<span></span></a></li>
<li><a href="#scope-of-this-proposal" id="toc-scope-of-this-proposal"><span class="toc-section-number">3</span> Scope of this
proposal<span></span></a></li>
<li><a href="#terms-and-definitions" id="toc-terms-and-definitions"><span class="toc-section-number">4</span>
Terms and definitions<span></span></a></li>
<li><a href="#impact-on-the-c-standard" id="toc-impact-on-the-c-standard"><span class="toc-section-number">5</span> Impact on the C++
standard<span></span></a>
<ul>
<li><a href="#interaction-with-stdchrono-types-and-stdratio" id="toc-interaction-with-stdchrono-types-and-stdratio"><span class="toc-section-number">5.1</span> Interaction with
<code class="sourceCode cpp">std<span class="op">::</span>chrono</code>
types and
<code class="sourceCode cpp">std<span class="op">::</span>ratio</code><span></span></a></li>
<li><a href="#dependencies-on-other-proposals" id="toc-dependencies-on-other-proposals"><span class="toc-section-number">5.2</span> Dependencies on other
proposals<span></span></a></li>
</ul></li>
<li><a href="#about-authors" id="toc-about-authors"><span class="toc-section-number">6</span> About authors<span></span></a>
<ul>
<li><a href="#dominik-berner" id="toc-dominik-berner"><span class="toc-section-number">6.1</span> Dominik
Berner<span></span></a></li>
<li><a href="#johel-ernesto-guerrero-peña" id="toc-johel-ernesto-guerrero-peña"><span class="toc-section-number">6.2</span> Johel Ernesto Guerrero
Peña<span></span></a></li>
<li><a href="#charles-hogg" id="toc-charles-hogg"><span class="toc-section-number">6.3</span> Charles Hogg<span></span></a></li>
<li><a href="#nicolas-holthaus" id="toc-nicolas-holthaus"><span class="toc-section-number">6.4</span> Nicolas
Holthaus<span></span></a></li>
<li><a href="#roth-michaels" id="toc-roth-michaels"><span class="toc-section-number">6.5</span> Roth
Michaels<span></span></a></li>
<li><a href="#mateusz-pusz" id="toc-mateusz-pusz"><span class="toc-section-number">6.6</span> Mateusz Pusz<span></span></a></li>
<li><a href="#vincent-reverdy" id="toc-vincent-reverdy"><span class="toc-section-number">6.7</span> Vincent
Reverdy<span></span></a></li>
</ul></li>
<li><a href="#motivation" id="toc-motivation"><span class="toc-section-number">7</span> Motivation<span></span></a>
<ul>
<li><a href="#safety" id="toc-safety"><span class="toc-section-number">7.1</span> Safety<span></span></a></li>
<li><a href="#vocabulary-types" id="toc-vocabulary-types"><span class="toc-section-number">7.2</span> Vocabulary
types<span></span></a></li>
<li><a href="#certification" id="toc-certification"><span class="toc-section-number">7.3</span>
Certification<span></span></a></li>
<li><a href="#complex-and-complicated" id="toc-complex-and-complicated"><span class="toc-section-number">7.4</span> Complex and
complicated<span></span></a></li>
<li><a href="#extensibility" id="toc-extensibility"><span class="toc-section-number">7.5</span>
Extensibility<span></span></a></li>
<li><a href="#broad-industry-value" id="toc-broad-industry-value"><span class="toc-section-number">7.6</span> Broad industry
value<span></span></a></li>
<li><a href="#standardizing-existing-practice" id="toc-standardizing-existing-practice"><span class="toc-section-number">7.7</span> Standardizing existing
practice<span></span></a></li>
</ul></li>
<li><a href="#common-smells-when-there-is-no-library-for-quantities-and-units" id="toc-common-smells-when-there-is-no-library-for-quantities-and-units"><span class="toc-section-number">8</span> Common smells when there is no
library for quantities and units<span></span></a>
<ul>
<li><a href="#the-proliferation-of-double" id="toc-the-proliferation-of-double"><span class="toc-section-number">8.1</span> The proliferation of
<code class="sourceCode cpp"><span class="dt">double</span></code><span></span></a></li>
<li><a href="#the-proliferation-of-magic-numbers" id="toc-the-proliferation-of-magic-numbers"><span class="toc-section-number">8.2</span> The proliferation of magic
numbers<span></span></a></li>
<li><a href="#the-proliferation-of-conversion-macros" id="toc-the-proliferation-of-conversion-macros"><span class="toc-section-number">8.3</span> The proliferation of conversion
macros<span></span></a></li>
<li><a href="#lack-of-consistency" id="toc-lack-of-consistency"><span class="toc-section-number">8.4</span> Lack of
consistency<span></span></a></li>
<li><a href="#lack-of-a-conceptual-framework" id="toc-lack-of-a-conceptual-framework"><span class="toc-section-number">8.5</span> Lack of a conceptual
framework<span></span></a></li>
</ul></li>
<li><a href="#design-goals" id="toc-design-goals"><span class="toc-section-number">9</span> Design goals<span></span></a>
<ul>
<li><a href="#compile-time-safety" id="toc-compile-time-safety"><span class="toc-section-number">9.1</span> Compile-time
safety<span></span></a></li>
<li><a href="#performance" id="toc-performance"><span class="toc-section-number">9.2</span> Performance<span></span></a></li>
<li><a href="#great-user-experience" id="toc-great-user-experience"><span class="toc-section-number">9.3</span> Great user
experience<span></span></a></li>
<li><a href="#scope" id="toc-scope"><span class="toc-section-number">9.4</span> Scope<span></span></a></li>
<li><a href="#easy-to-extend" id="toc-easy-to-extend"><span class="toc-section-number">9.5</span> Easy to
extend<span></span></a></li>
<li><a href="#low-standardization-cost" id="toc-low-standardization-cost"><span class="toc-section-number">9.6</span> Low standardization
cost<span></span></a></li>
</ul></li>
<li><a href="#quick-domain-introduction" id="toc-quick-domain-introduction"><span class="toc-section-number">10</span> Quick domain
introduction<span></span></a>
<ul>
<li><a href="#dimension" id="toc-dimension"><span class="toc-section-number">10.1</span> Dimension<span></span></a></li>
<li><a href="#quantity-type" id="toc-quantity-type"><span class="toc-section-number">10.2</span> Quantity
type<span></span></a></li>
<li><a href="#quantity-reference" id="toc-quantity-reference"><span class="toc-section-number">10.3</span> Quantity
reference<span></span></a></li>
<li><a href="#quantity" id="toc-quantity"><span class="toc-section-number">10.4</span> Quantity<span></span></a></li>
</ul></li>
<li><a href="#api-overview" id="toc-api-overview"><span class="toc-section-number">11</span> API overview<span></span></a>
<ul>
<li><a href="#unit-based-quantities-simple-mode" id="toc-unit-based-quantities-simple-mode"><span class="toc-section-number">11.1</span> Unit-based quantities (simple
mode)<span></span></a>
<ul>
<li><a href="#constructing-a-quantity" id="toc-constructing-a-quantity"><span class="toc-section-number">11.1.1</span> Constructing a
quantity<span></span></a></li>
<li><a href="#typical-operations-on-quantities" id="toc-typical-operations-on-quantities"><span class="toc-section-number">11.1.2</span> Typical operations on
quantities<span></span></a>
<ul>
<li><a href="#unit-conversions" id="toc-unit-conversions"><span class="toc-section-number">11.1.2.1</span> Unit
conversions<span></span></a></li>
<li><a href="#obtaining-a-numerical-value-of-a-quantity" id="toc-obtaining-a-numerical-value-of-a-quantity"><span class="toc-section-number">11.1.2.2</span> Obtaining a numerical value
of a quantity<span></span></a></li>
</ul></li>
</ul></li>
<li><a href="#typed-quantities-safer-mode" id="toc-typed-quantities-safer-mode"><span class="toc-section-number">11.2</span> Typed quantities (safer
mode)<span></span></a></li>
<li><a href="#generic-interfaces" id="toc-generic-interfaces"><span class="toc-section-number">11.3</span> Generic
interfaces<span></span></a>
<ul>
<li><a href="#the-issues-with-unit-specific-interfaces" id="toc-the-issues-with-unit-specific-interfaces"><span class="toc-section-number">11.3.1</span> The issues with unit-specific
interfaces<span></span></a></li>
<li><a href="#constraining-function-parameters-with-concepts" id="toc-constraining-function-parameters-with-concepts"><span class="toc-section-number">11.3.2</span> Constraining function
parameters with concepts<span></span></a></li>
<li><a href="#constraining-the-function-return-type" id="toc-constraining-the-function-return-type"><span class="toc-section-number">11.3.3</span> Constraining the function
return type<span></span></a></li>
<li><a href="#constraining-a-variable-on-the-stack" id="toc-constraining-a-variable-on-the-stack"><span class="toc-section-number">11.3.4</span> Constraining a variable on the
stack<span></span></a></li>
</ul></li>
<li><a href="#the-affine-space" id="toc-the-affine-space"><span class="toc-section-number">11.4</span> The affine space<span></span></a>
<ul>
<li><a href="#operations-in-the-affine-space" id="toc-operations-in-the-affine-space"><span class="toc-section-number">11.4.1</span> Operations in the affine
space<span></span></a></li>
<li><a href="#points-are-more-common-than-most-of-us-imagine" id="toc-points-are-more-common-than-most-of-us-imagine"><span class="toc-section-number">11.4.2</span> <em>Points</em> are more common
than most of us imagine<span></span></a></li>
<li><a href="#displacement-vector-is-modeled-by-quantity" id="toc-displacement-vector-is-modeled-by-quantity"><span class="toc-section-number">11.4.3</span> <em>Displacement vector</em> is
modeled by
<code class="sourceCode cpp">quantity</code><span></span></a></li>
<li><a href="#point-is-modeled-by-quantity_point-and-pointorigin" id="toc-point-is-modeled-by-quantity_point-and-pointorigin"><span class="toc-section-number">11.4.4</span> <em>Point</em> is modeled by
<code class="sourceCode cpp">quantity_point</code> and
<code class="sourceCode cpp">PointOrigin</code><span></span></a>
<ul>
<li><a href="#quantity_point" id="toc-quantity_point"><span class="toc-section-number">11.4.4.1</span>
<code class="sourceCode cpp">quantity_point</code><span></span></a></li>
<li><a href="#zeroth_point_originquantityspec" id="toc-zeroth_point_originquantityspec"><span class="toc-section-number">11.4.4.2</span> <code class="sourceCode cpp">zeroth_point_origin<span class="op">&lt;</span>QuantitySpec<span class="op">&gt;</span></code><span></span></a></li>
<li><a href="#absolute-point-origin" id="toc-absolute-point-origin"><span class="toc-section-number">11.4.4.3</span> Absolute <em>point</em>
origin<span></span></a></li>
<li><a href="#relative-point-origin" id="toc-relative-point-origin"><span class="toc-section-number">11.4.4.4</span> Relative <em>point</em>
origin<span></span></a></li>
<li><a href="#converting-between-different-representations-of-the-same-point" id="toc-converting-between-different-representations-of-the-same-point"><span class="toc-section-number">11.4.4.5</span> Converting between different
representations of the same <em>point</em><span></span></a></li>
<li><a href="#temperature-support" id="toc-temperature-support"><span class="toc-section-number">11.4.4.6</span> Temperature
support<span></span></a></li>
</ul></li>
</ul></li>
<li><a href="#user-defined-representation-types" id="toc-user-defined-representation-types"><span class="toc-section-number">11.5</span> User-defined representation
types<span></span></a></li>
<li><a href="#vector-and-tensor-quantities" id="toc-vector-and-tensor-quantities"><span class="toc-section-number">11.6</span> Vector and tensor
quantities<span></span></a></li>
<li><a href="#logarithmic-quantities-and-units" id="toc-logarithmic-quantities-and-units"><span class="toc-section-number">11.7</span> Logarithmic quantities and
units<span></span></a></li>
</ul></li>
<li><a href="#usage-examples" id="toc-usage-examples"><span class="toc-section-number">12</span> Usage examples<span></span></a>
<ul>
<li><a href="#basic-quantity-equations" id="toc-basic-quantity-equations"><span class="toc-section-number">12.1</span> Basic quantity
equations<span></span></a></li>
<li><a href="#hello-units" id="toc-hello-units"><span class="toc-section-number">12.2</span> Hello units<span></span></a></li>
<li><a href="#storage-tank" id="toc-storage-tank"><span class="toc-section-number">12.3</span> Storage
tank<span></span></a></li>
<li><a href="#bridge-across-the-rhine" id="toc-bridge-across-the-rhine"><span class="toc-section-number">12.4</span> Bridge across the
Rhine<span></span></a></li>
<li><a href="#hardware-voltage-measurement-readout" id="toc-hardware-voltage-measurement-readout"><span class="toc-section-number">12.5</span> Hardware voltage measurement
readout<span></span></a></li>
<li><a href="#user-defined-quantities-and-units" id="toc-user-defined-quantities-and-units"><span class="toc-section-number">12.6</span> User defined quantities and
units<span></span></a></li>
</ul></li>
<li><a href="#why-do-we-need-typed-quantities" id="toc-why-do-we-need-typed-quantities"><span class="toc-section-number">13</span> Why do we need typed
quantities?<span></span></a>
<ul>
<li><a href="#limitations-of-units-only-solutions" id="toc-limitations-of-units-only-solutions"><span class="toc-section-number">13.1</span> Limitations of units-only
solutions<span></span></a>
<ul>
<li><a href="#no-way-to-specify-a-quantity-type-in-generic-interfaces" id="toc-no-way-to-specify-a-quantity-type-in-generic-interfaces"><span class="toc-section-number">13.1.1</span> No way to specify a quantity
type in generic interfaces<span></span></a></li>
<li><a href="#disjoint-units-of-the-same-quantity-type-do-not-work" id="toc-disjoint-units-of-the-same-quantity-type-do-not-work"><span class="toc-section-number">13.1.2</span> Disjoint units of the same
quantity type do not work<span></span></a></li>
</ul></li>
<li><a href="#dimensions-to-the-rescue" id="toc-dimensions-to-the-rescue"><span class="toc-section-number">13.2</span> Dimensions to the
rescue?<span></span></a>
<ul>
<li><a href="#limitations-of-dimensions" id="toc-limitations-of-dimensions"><span class="toc-section-number">13.2.1</span> Limitations of
dimensions<span></span></a></li>
<li><a href="#si-units-of-quantities-of-the-same-dimension-but-different-kinds" id="toc-si-units-of-quantities-of-the-same-dimension-but-different-kinds"><span class="toc-section-number">13.2.2</span> SI units of quantities of the
same dimension but different kinds<span></span></a></li>
<li><a href="#derived-quantities-of-the-same-dimension-but-different-kinds" id="toc-derived-quantities-of-the-same-dimension-but-different-kinds"><span class="toc-section-number">13.2.3</span> Derived quantities of the same
dimension but different kinds<span></span></a></li>
<li><a href="#various-quantities-of-the-same-dimension-and-kinds" id="toc-various-quantities-of-the-same-dimension-and-kinds"><span class="toc-section-number">13.2.4</span> Various quantities of the same
dimension and kinds<span></span></a></li>
</ul></li>
</ul></li>
<li><a href="#systems-of-quantities-and-units" id="toc-systems-of-quantities-and-units"><span class="toc-section-number">14</span> Systems of quantities and
units<span></span></a>
<ul>
<li><a href="#systems-of-quantities" id="toc-systems-of-quantities"><span class="toc-section-number">14.1</span> Systems of
quantities<span></span></a>
<ul>
<li><a href="#quantities-of-the-same-kind" id="toc-quantities-of-the-same-kind"><span class="toc-section-number">14.1.1</span> Quantities of the same
kind<span></span></a></li>
<li><a href="#system-of-quantities-is-not-only-about-kinds" id="toc-system-of-quantities-is-not-only-about-kinds"><span class="toc-section-number">14.1.2</span> System of quantities is not
only about kinds<span></span></a></li>
<li><a href="#converting-between-quantities-of-the-same-kind" id="toc-converting-between-quantities-of-the-same-kind"><span class="toc-section-number">14.1.3</span> Converting between quantities
of the same kind<span></span></a></li>
<li><a href="#comparing-adding-and-subtracting-quantities-of-the-same-kind" id="toc-comparing-adding-and-subtracting-quantities-of-the-same-kind"><span class="toc-section-number">14.1.4</span> Comparing, adding, and
subtracting quantities of the same kind<span></span></a></li>
<li><a href="#hierarchies-of-derived-quantities" id="toc-hierarchies-of-derived-quantities"><span class="toc-section-number">14.1.5</span> Hierarchies of derived
quantities<span></span></a></li>
<li><a href="#modeling-a-quantity-kind" id="toc-modeling-a-quantity-kind"><span class="toc-section-number">14.1.6</span> Modeling a quantity
kind<span></span></a></li>
</ul></li>
<li><a href="#systems-of-units" id="toc-systems-of-units"><span class="toc-section-number">14.2</span> Systems of units<span></span></a>
<ul>
<li><a href="#systems-of-units-are-based-on-systems-of-quantities" id="toc-systems-of-units-are-based-on-systems-of-quantities"><span class="toc-section-number">14.2.1</span> Systems of units are based on
systems of quantities<span></span></a></li>
<li><a href="#units-compose" id="toc-units-compose"><span class="toc-section-number">14.2.2</span> Units
compose<span></span></a></li>
<li><a href="#many-shades-of-the-same-unit" id="toc-many-shades-of-the-same-unit"><span class="toc-section-number">14.2.3</span> Many shades of the same
unit<span></span></a></li>
<li><a href="#constraining-a-derived-unit-to-work-only-with-a-specific-derived-quantity" id="toc-constraining-a-derived-unit-to-work-only-with-a-specific-derived-quantity"><span class="toc-section-number">14.2.4</span> Constraining a derived unit to
work only with a specific derived quantity<span></span></a></li>
<li><a href="#prefixed-units" id="toc-prefixed-units"><span class="toc-section-number">14.2.5</span> Prefixed
units<span></span></a></li>
<li><a href="#scaled-units" id="toc-scaled-units"><span class="toc-section-number">14.2.6</span> Scaled
units<span></span></a></li>
<li><a href="#common-units" id="toc-common-units"><span class="toc-section-number">14.2.7</span> Common
units<span></span></a></li>
<li><a href="#unit-symbols" id="toc-unit-symbols"><span class="toc-section-number">14.2.8</span> Unit
symbols<span></span></a></li>
</ul></li>
</ul></li>
<li><a href="#text-output" id="toc-text-output"><span class="toc-section-number">15</span> Text output<span></span></a>
<ul>
<li><a href="#symbols" id="toc-symbols"><span class="toc-section-number">15.1</span> Symbols<span></span></a>
<ul>
<li><a href="#symbol-definition-examples" id="toc-symbol-definition-examples"><span class="toc-section-number">15.1.1</span> Symbol definition
examples<span></span></a></li>
<li><a href="#lack-of-unicode-subscript-characters" id="toc-lack-of-unicode-subscript-characters"><span class="toc-section-number">15.1.2</span> Lack of Unicode subscript
characters<span></span></a></li>
<li><a href="#symbols-for-quantity-types" id="toc-symbols-for-quantity-types"><span class="toc-section-number">15.1.3</span> Symbols for quantity
types<span></span></a></li>
<li><a href="#fixed_string" id="toc-fixed_string"><span class="toc-section-number">15.1.4</span>
<code class="sourceCode cpp">fixed_string</code><span></span></a></li>
<li><a href="#symbol_text" id="toc-symbol_text"><span class="toc-section-number">15.1.5</span>
<code class="sourceCode cpp">symbol_text</code><span></span></a></li>
<li><a href="#symbols-for-derived-entities" id="toc-symbols-for-derived-entities"><span class="toc-section-number">15.1.6</span> Symbols for derived
entities<span></span></a>
<ul>
<li><a href="#text_encoding" id="toc-text_encoding"><span class="toc-section-number">15.1.6.1</span>
<code class="sourceCode cpp">text_encoding</code><span></span></a></li>
<li><a href="#symbols-of-derived-dimensions" id="toc-symbols-of-derived-dimensions"><span class="toc-section-number">15.1.6.2</span> Symbols of derived
dimensions<span></span></a></li>
<li><a href="#symbols-of-derived-units" id="toc-symbols-of-derived-units"><span class="toc-section-number">15.1.6.3</span> Symbols of derived
units<span></span></a></li>
</ul></li>
<li><a href="#symbols-of-scaled-units" id="toc-symbols-of-scaled-units"><span class="toc-section-number">15.1.7</span> Symbols of scaled
units<span></span></a></li>
<li><a href="#symbols-of-common-units" id="toc-symbols-of-common-units"><span class="toc-section-number">15.1.8</span> Symbols of common
units<span></span></a></li>
<li><a href="#unicode-characters-and-their-portable-replacements" id="toc-unicode-characters-and-their-portable-replacements"><span class="toc-section-number">15.1.9</span> Unicode characters and their
portable replacements<span></span></a></li>
</ul></li>
<li><a href="#space_before_unit_symbol-customization-point" id="toc-space_before_unit_symbol-customization-point"><span class="toc-section-number">15.2</span>
<code class="sourceCode cpp">space_before_unit_symbol</code>
customization point<span></span></a></li>
<li><a href="#output-streams" id="toc-output-streams"><span class="toc-section-number">15.3</span> Output streams<span></span></a>
<ul>
<li><a href="#output-stream-formatting" id="toc-output-stream-formatting"><span class="toc-section-number">15.3.1</span> Output stream
formatting<span></span></a></li>
</ul></li>
<li><a href="#text-formatting" id="toc-text-formatting"><span class="toc-section-number">15.4</span> Text formatting<span></span></a>
<ul>
<li><a href="#controlling-width-fill-and-alignment" id="toc-controlling-width-fill-and-alignment"><span class="toc-section-number">15.4.1</span> Controlling width, fill, and
alignment<span></span></a></li>
<li><a href="#dimension-formatting" id="toc-dimension-formatting"><span class="toc-section-number">15.4.2</span> Dimension
formatting<span></span></a></li>
<li><a href="#unit-formatting" id="toc-unit-formatting"><span class="toc-section-number">15.4.3</span> Unit
formatting<span></span></a></li>
<li><a href="#quantity-formatting" id="toc-quantity-formatting"><span class="toc-section-number">15.4.4</span> Quantity
formatting<span></span></a>
<ul>
<li><a href="#default-formatting" id="toc-default-formatting"><span class="toc-section-number">15.4.4.1</span> Default
formatting<span></span></a></li>
<li><a href="#quantity-numerical-value-unit-symbol-or-both" id="toc-quantity-numerical-value-unit-symbol-or-both"><span class="toc-section-number">15.4.4.2</span> Quantity numerical value,
unit symbol, or both?<span></span></a></li>
<li><a href="#formatting-of-the-quantity-numerical-value" id="toc-formatting-of-the-quantity-numerical-value"><span class="toc-section-number">15.4.4.3</span> Formatting of the quantity
numerical value<span></span></a></li>
</ul></li>
</ul></li>
<li><a href="#quantity-point-text-output" id="toc-quantity-point-text-output"><span class="toc-section-number">15.5</span> Quantity point text
output<span></span></a></li>
<li><a href="#text-output-open-questions" id="toc-text-output-open-questions"><span class="toc-section-number">15.6</span> Text output open
questions<span></span></a></li>
</ul></li>
<li><a href="#minimal-viable-product-mvp-scope" id="toc-minimal-viable-product-mvp-scope"><span class="toc-section-number">16</span> Minimal Viable Product (MVP)
scope<span></span></a></li>
<li><a href="#safety-1" id="toc-safety-1"><span class="toc-section-number">17</span> Safety<span></span></a>
<ul>
<li><a href="#safety-features" id="toc-safety-features"><span class="toc-section-number">17.1</span> Safety features<span></span></a>
<ul>
<li><a href="#safe-unit-conversions" id="toc-safe-unit-conversions"><span class="toc-section-number">17.1.1</span> Safe unit
conversions<span></span></a></li>
<li><a href="#preventing-truncation-of-data" id="toc-preventing-truncation-of-data"><span class="toc-section-number">17.1.2</span> Preventing truncation of
data<span></span></a></li>
<li><a href="#safety-introduced-by-the-affine-space-abstractions" id="toc-safety-introduced-by-the-affine-space-abstractions"><span class="toc-section-number">17.1.3</span> Safety introduced by the affine
space abstractions<span></span></a></li>
<li><a href="#explicit-is-not-explicit-enough" id="toc-explicit-is-not-explicit-enough"><span class="toc-section-number">17.1.4</span>
<code class="sourceCode cpp"><span class="kw">explicit</span></code> is
not explicit enough<span></span></a></li>
<li><a href="#safe-quantity-numerical-value-getters" id="toc-safe-quantity-numerical-value-getters"><span class="toc-section-number">17.1.5</span> Safe quantity numerical value
getters<span></span></a></li>
<li><a href="#preventing-dangling-references" id="toc-preventing-dangling-references"><span class="toc-section-number">17.1.6</span> Preventing dangling
references<span></span></a></li>
<li><a href="#quantity-kinds-improve-safety" id="toc-quantity-kinds-improve-safety"><span class="toc-section-number">17.1.7</span> Quantity kinds improve
safety<span></span></a></li>
<li><a href="#additional-safety-introduced-by-modeling-various-quantities-of-the-same-kind" id="toc-additional-safety-introduced-by-modeling-various-quantities-of-the-same-kind"><span class="toc-section-number">17.1.8</span> Additional safety introduced by
modeling various quantities of the same kind<span></span></a></li>
<li><a href="#non-negative-quantities" id="toc-non-negative-quantities"><span class="toc-section-number">17.1.9</span> Non-negative
quantities<span></span></a></li>
<li><a href="#safe-operations-of-vector-and-tensor-quantities" id="toc-safe-operations-of-vector-and-tensor-quantities"><span class="toc-section-number">17.1.10</span> Safe operations of vector and
tensor quantities<span></span></a></li>
</ul></li>
<li><a href="#safety-pitfalls" id="toc-safety-pitfalls"><span class="toc-section-number">17.2</span> Safety pitfalls<span></span></a>
<ul>
<li><a href="#integer-division" id="toc-integer-division"><span class="toc-section-number">17.2.1</span> Integer
division<span></span></a></li>
<li><a href="#lack-of-safe-numeric-types" id="toc-lack-of-safe-numeric-types"><span class="toc-section-number">17.2.2</span> Lack of safe numeric
types<span></span></a></li>
<li><a href="#potential-surprises-during-units-composition" id="toc-potential-surprises-during-units-composition"><span class="toc-section-number">17.2.3</span> Potential surprises during
units composition<span></span></a></li>
<li><a href="#limitations-of-systems-of-quantities" id="toc-limitations-of-systems-of-quantities"><span class="toc-section-number">17.2.4</span> Limitations of systems of
quantities<span></span></a>
<ul>
<li><a href="#allowing-irrational-quantity-combinations" id="toc-allowing-irrational-quantity-combinations"><span class="toc-section-number">17.2.4.1</span> Allowing irrational quantity
combinations<span></span></a></li>
<li><a href="#arithmetic-and-compatibility-of-quantities-of-dimension-one" id="toc-arithmetic-and-compatibility-of-quantities-of-dimension-one"><span class="toc-section-number">17.2.4.2</span> Arithmetic and compatibility
of quantities of dimension one<span></span></a></li>
</ul></li>
<li><a href="#potential-surprises-while-working-with-temperatures" id="toc-potential-surprises-while-working-with-temperatures"><span class="toc-section-number">17.2.5</span> Potential surprises while
working with temperatures<span></span></a></li>
<li><a href="#structural-types" id="toc-structural-types"><span class="toc-section-number">17.2.6</span> Structural
types<span></span></a></li>
</ul></li>
</ul></li>
<li><a href="#design-details-and-rationale" id="toc-design-details-and-rationale"><span class="toc-section-number">18</span> Design details and
rationale<span></span></a>
<ul>
<li><a href="#conventions" id="toc-conventions"><span class="toc-section-number">18.1</span> Conventions<span></span></a>
<ul>
<li><a href="#new-style-of-definitions" id="toc-new-style-of-definitions"><span class="toc-section-number">18.1.1</span> New style of
definitions<span></span></a></li>
<li><a href="#strong-types-instead-of-aliases" id="toc-strong-types-instead-of-aliases"><span class="toc-section-number">18.1.2</span> Strong types instead of
aliases<span></span></a></li>
<li><a href="#entities-composability" id="toc-entities-composability"><span class="toc-section-number">18.1.3</span> Entities
composability<span></span></a></li>
<li><a href="#value-based-equations" id="toc-value-based-equations"><span class="toc-section-number">18.1.4</span> Value-based
equations<span></span></a></li>
<li><a href="#framework-only-class-templates" id="toc-framework-only-class-templates"><span class="toc-section-number">18.1.5</span> Framework-only class
templates<span></span></a></li>
</ul></li>
<li><a href="#framework-entities" id="toc-framework-entities"><span class="toc-section-number">18.2</span> Framework
entities<span></span></a>
<ul>
<li><a href="#quantity-character" id="toc-quantity-character"><span class="toc-section-number">18.2.1</span> Quantity
character<span></span></a></li>
<li><a href="#quantity-specification" id="toc-quantity-specification"><span class="toc-section-number">18.2.2</span> Quantity
specification<span></span></a></li>
<li><a href="#unit" id="toc-unit"><span class="toc-section-number">18.2.3</span> Unit<span></span></a></li>
<li><a href="#quantity-representation" id="toc-quantity-representation"><span class="toc-section-number">18.2.4</span> Quantity
representation<span></span></a></li>
<li><a href="#point-origin" id="toc-point-origin"><span class="toc-section-number">18.2.5</span> Point
origin<span></span></a></li>
<li><a href="#quantity-point" id="toc-quantity-point"><span class="toc-section-number">18.2.6</span> Quantity
point<span></span></a></li>
</ul></li>
<li><a href="#library-namespace" id="toc-library-namespace"><span class="toc-section-number">18.3</span> Library
namespace<span></span></a></li>
<li><a href="#concepts" id="toc-concepts"><span class="toc-section-number">18.4</span> Concepts<span></span></a>
<ul>
<li><a href="#Dimension-concept" id="toc-Dimension-concept"><span class="toc-section-number">18.4.1</span> <code class="sourceCode cpp">Dimension<span class="op">&lt;</span>T<span class="op">&gt;</span> <span class="kw">concept</span></code><span></span></a>
<ul>
<li><a href="#DimensionOf-concept" id="toc-DimensionOf-concept"><span class="toc-section-number">18.4.1.1</span> <code class="sourceCode cpp">DimensionOf<span class="op">&lt;</span>T, V<span class="op">&gt;</span></code>
concept<span></span></a></li>
</ul></li>
<li><a href="#QuantitySpec-concept" id="toc-QuantitySpec-concept"><span class="toc-section-number">18.4.2</span> <code class="sourceCode cpp">QuantitySpec<span class="op">&lt;</span>T<span class="op">&gt;</span> <span class="kw">concept</span></code><span></span></a>
<ul>
<li><a href="#QuantitySpecOf-concept" id="toc-QuantitySpecOf-concept"><span class="toc-section-number">18.4.2.1</span> <code class="sourceCode cpp">QuantitySpecOf<span class="op">&lt;</span>T, V<span class="op">&gt;</span></code>
concept<span></span></a></li>
</ul></li>
<li><a href="#Unit-concept" id="toc-Unit-concept"><span class="toc-section-number">18.4.3</span> <code class="sourceCode cpp">Unit<span class="op">&lt;</span>T<span class="op">&gt;</span></code>
concept<span></span></a>
<ul>
<li><a href="#AssociatedUnit-concept" id="toc-AssociatedUnit-concept"><span class="toc-section-number">18.4.3.1</span> <code class="sourceCode cpp">AssociatedUnit<span class="op">&lt;</span>T<span class="op">&gt;</span></code>
concept<span></span></a></li>
<li><a href="#PrefixableUnit-concept" id="toc-PrefixableUnit-concept"><span class="toc-section-number">18.4.3.2</span> <code class="sourceCode cpp">PrefixableUnit<span class="op">&lt;</span>T<span class="op">&gt;</span></code>
concept<span></span></a></li>
<li><a href="#UnitOf-concept" id="toc-UnitOf-concept"><span class="toc-section-number">18.4.3.3</span> <code class="sourceCode cpp">UnitOf<span class="op">&lt;</span>T, V<span class="op">&gt;</span></code>
concept<span></span></a></li>
<li><a href="#UnitCompatibleWith-concept" id="toc-UnitCompatibleWith-concept"><span class="toc-section-number">18.4.3.4</span> <code class="sourceCode cpp">UnitCompatibleWith<span class="op">&lt;</span>T, V1, V2<span class="op">&gt;</span></code>
concept<span></span></a></li>
</ul></li>
<li><a href="#Reference-concept" id="toc-Reference-concept"><span class="toc-section-number">18.4.4</span> <code class="sourceCode cpp">Reference<span class="op">&lt;</span>T<span class="op">&gt;</span></code>
concept<span></span></a>
<ul>
<li><a href="#ReferenceOf-concept" id="toc-ReferenceOf-concept"><span class="toc-section-number">18.4.4.1</span> <code class="sourceCode cpp">ReferenceOf<span class="op">&lt;</span>T, V<span class="op">&gt;</span></code>
concept<span></span></a></li>
</ul></li>
<li><a href="#Representation-concept" id="toc-Representation-concept"><span class="toc-section-number">18.4.5</span> <code class="sourceCode cpp">Representation<span class="op">&lt;</span>T<span class="op">&gt;</span></code>
concept<span></span></a>
<ul>
<li><a href="#RepresentationOf-concept" id="toc-RepresentationOf-concept"><span class="toc-section-number">18.4.5.1</span> <code class="sourceCode cpp">RepresentationOf<span class="op">&lt;</span>T, Ch<span class="op">&gt;</span></code>
concept<span></span></a></li>
</ul></li>
<li><a href="#Quantity-concept" id="toc-Quantity-concept"><span class="toc-section-number">18.4.6</span> <code class="sourceCode cpp">Quantity<span class="op">&lt;</span>T<span class="op">&gt;</span></code>
concept<span></span></a>
<ul>
<li><a href="#QuantityOf-concept" id="toc-QuantityOf-concept"><span class="toc-section-number">18.4.6.1</span> <code class="sourceCode cpp">QuantityOf<span class="op">&lt;</span>T, V<span class="op">&gt;</span></code>
concept<span></span></a></li>
</ul></li>
<li><a href="#PointOrigin-concept" id="toc-PointOrigin-concept"><span class="toc-section-number">18.4.7</span> <code class="sourceCode cpp">PointOrigin<span class="op">&lt;</span>T<span class="op">&gt;</span></code>
concept<span></span></a>
<ul>
<li><a href="#PointOriginFor-concept" id="toc-PointOriginFor-concept"><span class="toc-section-number">18.4.7.1</span> <code class="sourceCode cpp">PointOriginFor<span class="op">&lt;</span>T, V<span class="op">&gt;</span></code>
concept<span></span></a></li>
</ul></li>
<li><a href="#QuantityPoint-concept" id="toc-QuantityPoint-concept"><span class="toc-section-number">18.4.8</span> <code class="sourceCode cpp">QuantityPoint<span class="op">&lt;</span>T<span class="op">&gt;</span></code>
concept<span></span></a>
<ul>
<li><a href="#QuantityPointOf-concept" id="toc-QuantityPointOf-concept"><span class="toc-section-number">18.4.8.1</span> <code class="sourceCode cpp">QuantityPointOf<span class="op">&lt;</span>T, V<span class="op">&gt;</span></code>
concept<span></span></a></li>
</ul></li>
<li><a href="#QuantityLike-concept" id="toc-QuantityLike-concept"><span class="toc-section-number">18.4.9</span> <code class="sourceCode cpp">QuantityLike<span class="op">&lt;</span>T<span class="op">&gt;</span></code>
concept<span></span></a></li>
<li><a href="#QuantityPointLike-concept" id="toc-QuantityPointLike-concept"><span class="toc-section-number">18.4.10</span> <code class="sourceCode cpp">QuantityPointLike<span class="op">&lt;</span>T<span class="op">&gt;</span></code>
concept<span></span></a></li>
</ul></li>
<li><a href="#expression-templates" id="toc-expression-templates"><span class="toc-section-number">18.5</span> Expression
templates<span></span></a>
<ul>
<li><a href="#derived-entities" id="toc-derived-entities"><span class="toc-section-number">18.5.1</span> Derived
entities<span></span></a></li>
<li><a href="#identities" id="toc-identities"><span class="toc-section-number">18.5.2</span>
Identities<span></span></a></li>
<li><a href="#supported-operations-and-their-results" id="toc-supported-operations-and-their-results"><span class="toc-section-number">18.5.3</span> Supported operations and their
results<span></span></a></li>
<li><a href="#simplifying-the-resulting-expression-templates" id="toc-simplifying-the-resulting-expression-templates"><span class="toc-section-number">18.5.4</span> Simplifying the resulting
expression templates<span></span></a></li>
<li><a href="#expression-templates-in-action" id="toc-expression-templates-in-action"><span class="toc-section-number">18.5.5</span> Expression templates in
action<span></span></a></li>
</ul></li>
<li><a href="#operations-on-units-dimensions-quantity-types-and-references" id="toc-operations-on-units-dimensions-quantity-types-and-references"><span class="toc-section-number">18.6</span> Operations on units, dimensions,
quantity types, and references<span></span></a>
<ul>
<li><a href="#equality-and-equivalence" id="toc-equality-and-equivalence"><span class="toc-section-number">18.6.1</span> Equality and
equivalence<span></span></a></li>
<li><a href="#ordering" id="toc-ordering"><span class="toc-section-number">18.6.2</span> Ordering<span></span></a></li>
<li><a href="#obtaininig-common-entities" id="toc-obtaininig-common-entities"><span class="toc-section-number">18.6.3</span> Obtaininig common
entities<span></span></a></li>
</ul></li>
<li><a href="#units" id="toc-units"><span class="toc-section-number">18.7</span> Units<span></span></a>
<ul>
<li><a href="#space_before_unit_symbol-alternatives" id="toc-space_before_unit_symbol-alternatives"><span class="toc-section-number">18.7.1</span>
<code class="sourceCode cpp">space_before_unit_symbol</code>
alternatives<span></span></a></li>
<li><a href="#prefixing-units-with-prefixes" id="toc-prefixing-units-with-prefixes"><span class="toc-section-number">18.7.2</span> Prefixing units with
prefixes<span></span></a></li>
</ul></li>
<li><a href="#unit-magnitudes" id="toc-unit-magnitudes"><span class="toc-section-number">18.8</span> Unit magnitudes<span></span></a>
<ul>
<li><a href="#requirements-and-representation" id="toc-requirements-and-representation"><span class="toc-section-number">18.8.1</span> Requirements and
representation<span></span></a>
<ul>
<li><a href="#vector-spaces-dimensions-and-prime-numbers" id="toc-vector-spaces-dimensions-and-prime-numbers"><span class="toc-section-number">18.8.1.1</span> Vector spaces, dimensions,
and prime numbers<span></span></a></li>
</ul></li>
<li><a href="#advantages-and-disadvantages" id="toc-advantages-and-disadvantages"><span class="toc-section-number">18.8.2</span> Advantages and
disadvantages<span></span></a></li>
<li><a href="#compile-time-factorization" id="toc-compile-time-factorization"><span class="toc-section-number">18.8.3</span> Compile-time
factorization<span></span></a></li>
<li><a href="#common-unit-magnitude" id="toc-common-unit-magnitude"><span class="toc-section-number">18.8.4</span> Common unit
magnitude<span></span></a></li>
</ul></li>
<li><a href="#physical-constants" id="toc-physical-constants"><span class="toc-section-number">18.9</span> Physical
constants<span></span></a>
<ul>
<li><a href="#simplifying-constants-in-an-equation" id="toc-simplifying-constants-in-an-equation"><span class="toc-section-number">18.9.1</span> Simplifying constants in an
equation<span></span></a></li>
<li><a href="#physical-constants-as-units" id="toc-physical-constants-as-units"><span class="toc-section-number">18.9.2</span> Physical constants as
units<span></span></a></li>
<li><a href="#physical-constants-usage-examples" id="toc-physical-constants-usage-examples"><span class="toc-section-number">18.9.3</span> Physical constants usage
examples<span></span></a></li>
</ul></li>
<li><a href="#quantity-specifications" id="toc-quantity-specifications"><span class="toc-section-number">18.10</span> Quantity
specifications<span></span></a>
<ul>
<li><a href="#bikeshedding-quantity_spec" id="toc-bikeshedding-quantity_spec"><span class="toc-section-number">18.10.1</span> Bikeshedding
<code class="sourceCode cpp">quantity_spec</code><span></span></a></li>
</ul></li>
<li><a href="#quantity-references" id="toc-quantity-references"><span class="toc-section-number">18.11</span> Quantity
references<span></span></a>
<ul>
<li><a href="#bikeshedding-reference" id="toc-bikeshedding-reference"><span class="toc-section-number">18.11.1</span> Bikeshedding
<code class="sourceCode cpp">reference</code><span></span></a></li>
</ul></li>
<li><a href="#quantities" id="toc-quantities"><span class="toc-section-number">18.12</span> Quantities<span></span></a>
<ul>
<li><a href="#multiply-syntax-commutativity" id="toc-multiply-syntax-commutativity"><span class="toc-section-number">18.12.1</span> Multiply syntax
commutativity<span></span></a></li>
<li><a href="#why-dont-we-use-udls-to-create-quantities" id="toc-why-dont-we-use-udls-to-create-quantities"><span class="toc-section-number">18.12.2</span> Why don’t we use UDLs to
create quantities?<span></span></a></li>
<li><a href="#special-values-of-a-quantity" id="toc-special-values-of-a-quantity"><span class="toc-section-number">18.12.3</span> Special values of a
quantity<span></span></a></li>
<li><a href="#quantity-arithmetics" id="toc-quantity-arithmetics"><span class="toc-section-number">18.12.4</span> Quantity
arithmetics<span></span></a>
<ul>
<li><a href="#quantity-is-a-numeric-wrapper" id="toc-quantity-is-a-numeric-wrapper"><span class="toc-section-number">18.12.4.1</span>
<code class="sourceCode cpp">quantity</code> is a numeric
wrapper<span></span></a></li>
<li><a href="#addition-and-subtraction" id="toc-addition-and-subtraction"><span class="toc-section-number">18.12.4.2</span> Addition and
subtraction<span></span></a></li>
<li><a href="#multiplication-and-division" id="toc-multiplication-and-division"><span class="toc-section-number">18.12.4.3</span> Multiplication and
division<span></span></a></li>
<li><a href="#modulo" id="toc-modulo"><span class="toc-section-number">18.12.4.4</span> Modulo<span></span></a></li>
<li><a href="#comparison-against-zero" id="toc-comparison-against-zero"><span class="toc-section-number">18.12.4.5</span> Comparison against
zero<span></span></a></li>
<li><a href="#other-maths" id="toc-other-maths"><span class="toc-section-number">18.12.4.6</span> Other
maths<span></span></a></li>
</ul></li>
<li><a href="#dimensionless-quantities" id="toc-dimensionless-quantities"><span class="toc-section-number">18.12.5</span> Dimensionless
quantities<span></span></a>
<ul>
<li><a href="#dividing-two-quantities-of-the-same-kind" id="toc-dividing-two-quantities-of-the-same-kind"><span class="toc-section-number">18.12.5.1</span> Dividing two quantities of
the same kind<span></span></a></li>
<li><a href="#counts-of-things" id="toc-counts-of-things"><span class="toc-section-number">18.12.5.2</span> Counts of
things<span></span></a></li>
<li><a href="#convertibility-from-fundamental-types" id="toc-convertibility-from-fundamental-types"><span class="toc-section-number">18.12.5.3</span> Convertibility from
fundamental types<span></span></a></li>
<li><a href="#predefined-units-of-the-dimensionless-quantity" id="toc-predefined-units-of-the-dimensionless-quantity"><span class="toc-section-number">18.12.5.4</span> Predefined units of the
dimensionless quantity<span></span></a></li>
<li><a href="#angular-quantities" id="toc-angular-quantities"><span class="toc-section-number">18.12.5.5</span> Angular
quantities<span></span></a></li>
<li><a href="#nested-quantity-kinds" id="toc-nested-quantity-kinds"><span class="toc-section-number">18.12.5.6</span> Nested quantity
kinds<span></span></a></li>
</ul></li>
<li><a href="#value-conversions" id="toc-value-conversions"><span class="toc-section-number">18.12.6</span> Value
conversions<span></span></a>
<ul>
<li><a href="#template-disambiguation-concerns" id="toc-template-disambiguation-concerns"><span class="toc-section-number">18.12.6.1</span>
<code class="sourceCode cpp"><span class="kw">template</span></code>
disambiguation concerns<span></span></a></li>
<li><a href="#value-conversions-summary" id="toc-value-conversions-summary"><span class="toc-section-number">18.12.6.2</span> Value conversions
summary<span></span></a></li>
<li><a href="#bikeshedding-force_inu" id="toc-bikeshedding-force_inu"><span class="toc-section-number">18.12.6.3</span> Bikeshedding <code class="sourceCode cpp">force_in<span class="op">(</span>U<span class="op">)</span></code><span></span></a></li>
<li><a href="#bikeshedding-quantityrep" id="toc-bikeshedding-quantityrep"><span class="toc-section-number">18.12.6.4</span> Bikeshedding <code class="sourceCode cpp">quantity<span class="op">::</span>rep</code><span></span></a></li>
</ul></li>
<li><a href="#binary-operators" id="toc-binary-operators"><span class="toc-section-number">18.12.7</span> Binary
operators<span></span></a></li>
</ul></li>
<li><a href="#quantity-points" id="toc-quantity-points"><span class="toc-section-number">18.13</span> Quantity Points<span></span></a>
<ul>
<li><a href="#delta-and-absolute-creation-helpers" id="toc-delta-and-absolute-creation-helpers"><span class="toc-section-number">18.13.1</span>
<code class="sourceCode cpp">delta</code> and
<code class="sourceCode cpp">absolute</code> creation
helpers<span></span></a></li>
<li><a href="#default_point_originreference-quantity_from_zero-and-zeroth_point_originquantityspec" id="toc-default_point_originreference-quantity_from_zero-and-zeroth_point_originquantityspec"><span class="toc-section-number">18.13.2</span> <code class="sourceCode cpp">default_point_origin<span class="op">&lt;</span>Reference<span class="op">&gt;</span></code>,
<code class="sourceCode cpp">quantity_from_zero<span class="op">()</span></code>,
and <code class="sourceCode cpp">zeroth_point_origin<span class="op">&lt;</span>QuantitySpec<span class="op">&gt;</span></code><span></span></a></li>
</ul></li>
<li><a href="#interoperability-with-other-libraries" id="toc-interoperability-with-other-libraries"><span class="toc-section-number">18.14</span> Interoperability with other
libraries<span></span></a>
<ul>
<li><a href="#specifying-a-conversion-kind" id="toc-specifying-a-conversion-kind"><span class="toc-section-number">18.14.1</span> Specifying a conversion
kind<span></span></a></li>
<li><a href="#quantities-conversions" id="toc-quantities-conversions"><span class="toc-section-number">18.14.2</span> Quantities
conversions<span></span></a></li>
<li><a href="#quantity-points-conversions" id="toc-quantity-points-conversions"><span class="toc-section-number">18.14.3</span> Quantity points
conversions<span></span></a></li>
<li><a href="#interoperability-with-the-stdchrono-abstractions" id="toc-interoperability-with-the-stdchrono-abstractions"><span class="toc-section-number">18.14.4</span> Interoperability with the
<code class="sourceCode cpp">std<span class="op">::</span>chrono</code>
abstractions<span></span></a></li>
</ul></li>
</ul></li>
<li><a href="#teachability" id="toc-teachability"><span class="toc-section-number">19</span> Teachability<span></span></a></li>
<li><a href="#acknowledgements" id="toc-acknowledgements"><span class="toc-section-number">20</span>
Acknowledgements<span></span></a></li>
<li><a href="#bibliography" id="toc-bibliography"><span class="toc-section-number">21</span> References<span></span></a></li>
</ul>
</div>
<h1 data-number="1" id="revision-history"><span class="header-section-number">1</span> Revision history<a href="#revision-history" class="self-link"></a></h1>
<h2 data-number="1.1" id="changes-since-p3045r3"><span class="header-section-number">1.1</span> Changes since <span class="citation" data-cites="P3045R3">[<a href="https://wg21.link/p3045r3" role="doc-biblioref">P3045R3</a>]</span><a href="#changes-since-p3045r3" class="self-link"></a></h2>
<ul>
<li><a href="#quantity-arithmetics">Quantity arithmetics</a> chapter
updated with improved quantity compound assignment.</li>
<li><code class="sourceCode cpp">𝜋</code> changed to
<code class="sourceCode cpp">π</code> after SG16 feedback.</li>
<li><code class="sourceCode cpp">quantity_like_traits</code>,
<code class="sourceCode cpp">quantity_point_like_traits</code>,
<code class="sourceCode cpp">QuantityLike</code>, and
<code class="sourceCode cpp">QuantityPointLike</code> refactored to use
<code class="sourceCode cpp">explicit_import</code> and
<code class="sourceCode cpp">explicit_export</code> flags instead of
wrapping tag types.</li>
<li><a href="#unicode-characters-and-their-portable-replacements">Unicode
characters and their portable replacements</a> chapter added.</li>
<li><a href="#framework-only-class-templates">Framework-only class
templates</a> chapter added.</li>
<li><a href="#special-values-of-a-quantity">Special values of a
quantity</a> chapter added.</li>
<li><code class="sourceCode cpp">RepresentationOf</code> concept
refactored.</li>
<li><em>position vector</em> moved under <em>displacement</em> in the
hierarchy of kind <em>length</em>.</li>
</ul>
<h2 data-number="1.2" id="changes-since-p3045r2"><span class="header-section-number">1.2</span> Changes since <span class="citation" data-cites="P3045R2">[<a href="https://wg21.link/p3045r2" role="doc-biblioref">P3045R2</a>]</span><a href="#changes-since-p3045r2" class="self-link"></a></h2>
<ul>
<li><code class="sourceCode cpp">ascii</code> renamed to
<code class="sourceCode cpp">portable</code> and
<code class="sourceCode cpp">unicode</code> renamed to
<code class="sourceCode cpp">utf8</code>.</li>
<li><a href="#space_before_unit_symbol-alternatives"><code class="sourceCode cpp">space_before_unit_symbol</code>
alternatives</a> chapter added.</li>
<li><a href="#prefixing-units-with-prefixes">Prefixing units with
prefixes</a> chapter added.</li>
<li><a href="#bikeshedding-force_inu">Bikeshedding <code class="sourceCode cpp">force_in<span class="op">(</span>U<span class="op">)</span></code></a>
chapter added.</li>
<li><a href="#bikeshedding-quantityrep">Bikeshedding <code class="sourceCode cpp">quantity<span class="op">::</span>rep</code></a>
chapter added.</li>
<li><a href="#minimal-viable-product-mvp-scope">Minimal Viable Product
(MVP) scope</a> chapter extended.</li>
<li><a href="#binary-operators">Binary operators</a> chapter added.</li>
<li><a href="#interoperability-with-the-stdchrono-abstractions">Interoperability
with the
<code class="sourceCode cpp">std<span class="op">::</span>chrono</code>
abstractions</a> chapter extended.</li>
<li><a href="#default_point_originreference-quantity_from_zero-and-zeroth_point_originquantityspec"><code class="sourceCode cpp">default_point_origin<span class="op">&lt;</span>Reference<span class="op">&gt;</span></code>,
<code class="sourceCode cpp">quantity_from_zero<span class="op">()</span></code>,
and <code class="sourceCode cpp">zeroth_point_origin<span class="op">&lt;</span>QuantitySpec<span class="op">&gt;</span></code></a>
chapter added.</li>
<li><a href="#multiply-syntax-commutativity">Multiply syntax
commutativity</a> chapter added.</li>
<li><a href="#quantity-specifications">Quantity specifications</a> and
<a href="#bikeshedding-quantity_spec">Bikeshedding
<code class="sourceCode cpp">quantity_spec</code></a> chapters
added.</li>
<li><a href="#bikeshedding-reference">Bikeshedding
<code class="sourceCode cpp">reference</code></a> chapter added.</li>
<li><code class="sourceCode cpp">𝜋</code> added as an alias for
<code class="sourceCode cpp">pi</code></li>
<li><a href="#library-namespace">Library namespace</a> chapter
added.</li>
</ul>
<h2 data-number="1.3" id="changes-since-p3045r1"><span class="header-section-number">1.3</span> Changes since <span class="citation" data-cites="P3045R1">[<a href="https://wg21.link/p3045r1" role="doc-biblioref">P3045R1</a>]</span><a href="#changes-since-p3045r1" class="self-link"></a></h2>
<ul>
<li><a href="#scope-of-this-proposal">Scope of this proposal</a> chapter
added.</li>
<li>Dimensions, quantity specification, units, and point origins marked
<code class="sourceCode cpp"><span class="kw">final</span></code>.</li>
<li><code class="sourceCode cpp">delta</code> and
<code class="sourceCode cpp">absolute</code> creation helpers added to
improve readability of the affine space entities creation.</li>
<li><code class="sourceCode cpp">std<span class="op">::</span>remove_const</code>
was not needed in prefixes definitions.</li>
<li>Compiler Explorer links updated to reflect the latest API
changes.</li>
<li><a href="#text-output">Text output</a> and <a href="#safety-1">Safety</a> chapters reordered.</li>
<li><code class="sourceCode cpp"><span class="kw">inline</span></code>
dropped from <code class="sourceCode cpp"><span class="kw">inline</span> <span class="kw">constexpr</span></code>
variable templates (based on <a href="https://cplusplus.github.io/CWG/issues/2387.html">CWG2387</a>)</li>
<li>After consulting with the LEWGI in St. Lois, <code class="sourceCode cpp">q<span class="op">.</span>in<span class="op">&lt;</span>Representation<span class="op">&gt;(</span>unit<span class="op">)</span></code>
support added despite possible
<code class="sourceCode cpp"><span class="kw">template</span></code>
disambiguator drawbacks.</li>
<li><code class="sourceCode cpp">quantity_point_like_traits</code>
member functions refactored to not depend on
<code class="sourceCode cpp">quantity</code>-like abstractions.</li>
<li><code class="sourceCode cpp">unit_can_be_prefixed</code> removed
from the design.</li>
<li><a href="#radians-and-degrees-support">Radians and degrees
support</a> chapter added.</li>
<li><a href="#delta-and-absolute-creation-helpers"><code class="sourceCode cpp">delta</code>
and <code class="sourceCode cpp">absolute</code> creation helpers</a>
chapter added.</li>
<li><a href="#unit-symbols">Unit symbols</a> chapter added.</li>
<li><a href="#superpowers-of-the-unit-one">Superpowers of the unit
<code class="sourceCode cpp">one</code></a> chapter added.</li>
<li><a href="#hardware-voltage-measurement-readout">Hardware voltage
measurement readout</a> chapter with a code example added.</li>
<li><a href="#why-do-we-need-typed-quantities">Why do we need typed
quantities?</a> chapter improved.</li>
<li>Code examples in the <a href="#converting-between-quantities-of-the-same-kind">Converting
between quantities of the same kind</a> chapter fixed and improved.</li>
<li><a href="#symbols-of-scaled-units">Symbols of scaled units</a> and
<a href="#symbols-of-common-units">Symbols of common units</a> chapters
added.</li>
<li><a href="#new-style-of-definitions">New style of definitions</a>
chapter extended.</li>
<li><code class="sourceCode cpp">mag_pi</code> replaced with <code class="sourceCode cpp">mag<span class="op">&lt;</span>pi<span class="op">&gt;</span></code></li>
<li><a href="#value-conversions">Value conversions</a> chapter
added.</li>
<li><a href="#common-units">Common units</a> chapter added.</li>
<li><a href="#text-output-open-questions">Text output open questions</a>
chapter added.</li>
<li><a href="#minimal-viable-product-mvp-scope">Minimal Viable Product
(MVP) scope</a> chapter added.</li>
<li><a href="#operations-on-units-dimensions-quantity-types-and-references">Operations
on units, dimensions, quantity types, and references</a> chapter
updated.</li>
<li><a href="#units">Units</a> chapter added.</li>
<li><a href="#common-unit-magnitude">Common unit magnitude</a> chapter
added.</li>
<li><a href="#addition-and-subtraction">Addition and subtraction</a>
chapter extended with the paragraph about irrational magnitudes.</li>
<li>“Lack of convertibility from fundamental types” chapter refactored
to <a href="#convertibility-from-fundamental-types">Convertibility from
fundamental types</a>.</li>
</ul>
<h2 data-number="1.4" id="changes-since-p3045r0"><span class="header-section-number">1.4</span> Changes since <span class="citation" data-cites="P3045R0">[<a href="https://wg21.link/p3045r0" role="doc-biblioref">P3045R0</a>]</span><a href="#changes-since-p3045r0" class="self-link"></a></h2>
<ul>
<li>One more dependency added to the table in the <a href="#dependencies-on-other-proposals">Dependencies on other
proposals</a> chapter.</li>
<li><a href="#safe-unit-conversions">Safe unit conversions</a> chapter
extended with more <code class="sourceCode cpp">value_cast</code>
overloads.</li>
<li><a href="#the-affine-space">The affine space</a> chapter rewritten
nearly from scratch.</li>
<li>[Magnitudes] chapter added.</li>
<li><code class="sourceCode cpp">qp<span class="op">.</span>quantity_from_zero<span class="op">()</span></code>
does not work for user’s named origins anymore.</li>
<li><code class="sourceCode cpp">qp<span class="op">.</span>quantity_from<span class="op">()</span></code>
now works with other quantity points as well.</li>
<li><code class="sourceCode cpp">basic_symbol_text</code> renamed to
<code class="sourceCode cpp">symbol_text</code>.</li>
<li><code class="sourceCode cpp"><span class="op">[[</span><span class="at">nodiscard</span><span class="op">]]</span></code>
removed from <code class="sourceCode cpp">symbol_text</code>.</li>
<li><code class="sourceCode cpp">symbol_text</code> constructors taking
string literals made
<code class="sourceCode cpp"><span class="kw">consteval</span></code>.</li>
<li><code class="sourceCode cpp">symbol_text</code> now always stores
<code class="sourceCode cpp"><span class="dt">char8_t</span></code> and
<code class="sourceCode cpp"><span class="dt">char</span></code>
versions of symbols.</li>
<li>In case UTF-8 symbol is used, now it has to be provided as an UTF-8
(<code class="sourceCode cpp">u8</code>) literal.</li>
<li><a href="#symbols-of-derived-dimensions">Symbols of derived
dimensions</a> added and the entire symbols generation text refactored
into the <a href="#symbols-for-derived-entities">Symbols for derived
entities</a> chapter.</li>
<li>Quantity formatting refactored to the new syntax agreed with Victor
Zverovich.</li>
<li>Minor editorial changes and additional clarifications added to the
<a href="#text-output">Text output</a> chapter.</li>
<li><code class="sourceCode cpp">mag<span class="op">&lt;</span>ratio<span class="op">{</span>N, D<span class="op">}&gt;</span></code>
replaced with <code class="sourceCode cpp">mag_ratio<span class="op">&lt;</span>N, D<span class="op">&gt;</span></code>
so the <code class="sourceCode cpp">ratio</code> type becomes the
implementation detail rather than the public interface of the
library</li>
<li>Compiler Explorer links updated to reflect the latest design changes
in the library</li>
</ul>
<h1 data-number="2" id="introduction"><span class="header-section-number">2</span> Introduction<a href="#introduction" class="self-link"></a></h1>
<p>Several groups in the ISO C++ Committee reviewed the “P1935: A C++
Approach to Physical Units” <span class="citation" data-cites="P1935R2">[<a href="https://wg21.link/p1935r2" role="doc-biblioref">P1935R2</a>]</span> proposal in Belfast 2019 and
Prague 2020. All those groups expressed interest in the potential
standardization of such a library and encouraged further work. The
authors also got valuable initial feedback that highly influenced the
design of the V2 version of the <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> library.</p>
<p>In the following years, the library’s authors focused on getting more
feedback from the production about the design and developed version 2 of
the <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> library that resolves the
issues raised by the users and Committee members. The features and
interfaces of this version are close to being the best we can get with
the current version of the C++ language standard.</p>
<p>This paper is authored by the <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> library developers, the
authors of other actively maintained similar libraries on the market,
and other active members of the C++ physical quantities and units
community who have worked on this subject for many years. We join our
forces to say with one voice that we deeply care about standardizing
such features as a part of the C++ Standard Library. Based on our long
and broad experience in the subject, we agree that the interfaces we
will provide in the upcoming proposals are the best we can get today in
the C++ language.</p>
<p>During the Kona 2023 ISO C++ Committee meeting, we got repeating
feedback that there should be one big, unified paper with all the
contents inside. Addressing this requirement, this paper adds a detailed
design description and also includes the most important parts of <span class="citation" data-cites="P2980R1">[<a href="https://wg21.link/p2980r1" role="doc-biblioref">P2980R1</a>]</span>, <span class="citation" data-cites="P2981R1">[<a href="https://wg21.link/p2981r1" role="doc-biblioref">P2981R1</a>]</span>, and <span class="citation" data-cites="P2982R1">[<a href="https://wg21.link/p2982r1" role="doc-biblioref">P2982R1</a>]</span>. With this, we assume that
<span class="citation" data-cites="P2981R1">[<a href="https://wg21.link/p2981r1" role="doc-biblioref">P2981R1</a>]</span> and <span class="citation" data-cites="P2982R1">[<a href="https://wg21.link/p2982r1" role="doc-biblioref">P2982R1</a>]</span> are superseded by this paper.
The plan and scope described in <span class="citation" data-cites="P2980R1">[<a href="https://wg21.link/p2980r1" role="doc-biblioref">P2980R1</a>]</span> might still be updated based on
the current progress and feedback from the upcoming discussions.</p>
<!-- TODO remove this note in the future -->
<p><em>Note: This paper is incomplete and many chapters are still
missing. It is published to gather early feedback and possibly get
acceptance for the major design decisions of the library. More details
will arrive in the next revisions of this paper.</em></p>
<h1 data-number="3" id="scope-of-this-proposal"><span class="header-section-number">3</span> Scope of this proposal<a href="#scope-of-this-proposal" class="self-link"></a></h1>
<p>This paper describes and defines a generic framework for quantities
and units library. Such framework should allow modeling various systems
of quantities and units customized according to specific user’s needs.
Such systems can be embraced with the affine space abstractions to
provide type-, unit-, and point origin-safe abstractions for many
industries.</p>
<p>Even if mentioned, this paper does not propose standardizing any
systems of quantities or units. Such definitions will arrive in
subsequent proposals.</p>
<p>In the extreme case, we can even discuss just providing a library
framework in the first C++ standard and standardize systems and
additional utilities (e.g., math) in the next iterations.</p>
<h1 data-number="4" id="terms-and-definitions"><span class="header-section-number">4</span> Terms and definitions<a href="#terms-and-definitions" class="self-link"></a></h1>
<p>This document consistently uses the official metrology vocabulary
defined in the <span class="citation" data-cites="ISO-GUIDE">[<a href="https://www.iso.org/obp/ui#iso:std:iso-iec:guide:99" role="doc-biblioref">ISO/IEC Guide 99</a>]</span> and <span class="citation" data-cites="BIPM-VIM">[<a href="https://jcgm.bipm.org/vim/en" role="doc-biblioref">JCGM
200:2012</a>]</span>.</p>
<h1 data-number="5" id="impact-on-the-c-standard"><span class="header-section-number">5</span> Impact on the C++ standard<a href="#impact-on-the-c-standard" class="self-link"></a></h1>
<p>This change is purely additive. It does not change, fix, or break any
of the existing tools in the C++ standard library.</p>
<h2 data-number="5.1" id="interaction-with-stdchrono-types-and-stdratio"><span class="header-section-number">5.1</span> Interaction with
<code class="sourceCode cpp">std<span class="op">::</span>chrono</code>
types and
<code class="sourceCode cpp">std<span class="op">::</span>ratio</code><a href="#interaction-with-stdchrono-types-and-stdratio" class="self-link"></a></h2>
<p>The only interaction of this proposal with the C++ standard
facilities is the compatibility mode with
<code class="sourceCode cpp">std<span class="op">::</span>chrono</code>
types (<code class="sourceCode cpp">duration</code> and
<code class="sourceCode cpp">time_point</code>) described in <a href="#interoperability-with-the-stdchrono-abstractions">Interoperability
with the
<code class="sourceCode cpp">std<span class="op">::</span>chrono</code>
abstractions</a>.</p>
<p>We should also mention the potential confusion of users with having
two different ways to deal with time abstractions in the C++ standard
library. If this proposal gets accepted:</p>
<ul>
<li><code class="sourceCode cpp">std<span class="op">::</span>chrono</code>
abstractions together with
<code class="sourceCode cpp">std<span class="op">::</span>ratio</code>
should be used primarily to deal with calendars and threading
facilities,</li>
<li>abstractions introduced in this proposal should be used in all other
use cases (e.g. physical quantities equations).</li>
</ul>
<h2 data-number="5.2" id="dependencies-on-other-proposals"><span class="header-section-number">5.2</span> Dependencies on other
proposals<a href="#dependencies-on-other-proposals" class="self-link"></a></h2>
<p>The features in this chapter are heavily used in the library but are
not domain-specific. Having them standardized (instead of left as
exposition-only) could not only improve this library’s specification,
but also serve as an essential building block for tools in other domains
that we can get in the future from other authors.</p>
<!-- markdownlint-disable MD013 -->
<table>
<colgroup>
<col style="width: 17%" />
<col style="width: 5%" />
<col style="width: 13%" />
<col style="width: 62%" />
</colgroup>
<thead>
<tr class="header">
<th><div style="text-align:center">
<strong>Feature</strong>
</div></th>
<th style="text-align: center;"><div style="text-align:center">
<strong>Priority</strong>
</div></th>
<th style="text-align: center;"><div style="text-align:center">
<strong>Papers</strong>
</div></th>
<th><div style="text-align:center">
<strong>Description</strong>
</div></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><code class="sourceCode cpp">fixed_string</code></td>
<td style="text-align: center;">1</td>
<td style="text-align: center;"><span class="citation" data-cites="P3094R0">[<a href="https://wg21.link/p3094r0" role="doc-biblioref">P3094R0</a>]</span></td>
<td>String-like structural type with inline storage (can be used as an
NTTP).</td>
</tr>
<tr class="even">
<td>Nested entities formatting</td>
<td style="text-align: center;">1</td>
<td style="text-align: center;">???</td>
<td>Possibility to override the format string in the parse and format
contexts.</td>
</tr>
<tr class="odd">
<td>Compile-time prime numbers</td>
<td style="text-align: center;">2</td>
<td style="text-align: center;"><span class="citation" data-cites="P3133R0">[<a href="https://wg21.link/p3133r0" role="doc-biblioref">P3133R0</a>]</span></td>
<td>Compile-time facilities to break any integral value to a product of
prime numbers and their powers.</td>
</tr>
<tr class="even">
<td>Value-preserving conversions</td>
<td style="text-align: center;">2</td>
<td style="text-align: center;"><span class="citation" data-cites="P0870R5">[<a href="https://wg21.link/p0870r5" role="doc-biblioref">P0870R5</a>]</span>, <span class="citation" data-cites="P2509R0">[<a href="https://wg21.link/p2509r0" role="doc-biblioref">P2509R0</a>]</span></td>
<td>Type trait stating if the conversion from one type to another is
value preserving or not.</td>
</tr>
<tr class="odd">
<td>Number concepts</td>
<td style="text-align: center;">2</td>
<td style="text-align: center;"><span class="citation" data-cites="P3003R0">[<a href="https://wg21.link/p3003r0" role="doc-biblioref">P3003R0</a>]</span></td>
<td>Concepts for vector- and point-space numbers.</td>
</tr>
<tr class="even">
<td>Bounded numeric types</td>
<td style="text-align: center;">3</td>
<td style="text-align: center;"><span class="citation" data-cites="P2993R0">[<a href="https://wg21.link/p2993r0" role="doc-biblioref">P2993R0</a>]</span></td>
<td>Numerical type wrappers with values bounded to a provided interval
(optionally with wraparound semantics).</td>
</tr>
</tbody>
</table>
<!-- markdownlint-enable MD013 -->
<p>Priorities used above:</p>
<ol type="1">
<li>Mandatory to implement the library or exposed in its public
interfaces.</li>
<li>Functional extension/improvement to the framework design but worse
alternatives are currently available.</li>
<li>Not needed for the library’s implementation but improves its use
cases.</li>
</ol>
<h1 data-number="6" id="about-authors"><span class="header-section-number">6</span> About authors<a href="#about-authors" class="self-link"></a></h1>
<h2 data-number="6.1" id="dominik-berner"><span class="header-section-number">6.1</span> Dominik Berner<a href="#dominik-berner" class="self-link"></a></h2>
<p>Dominik is a strong believer that the C++ language can provide very
high safety guarantees when programming through strong typing; a type
error caught during compilation saves hours of debugging. For the last
15 years, he has mainly coded in C++ and actively follows its evolution
through the new standards.</p>
<p>When working on regulated projects at Med-Tech, there usually were
very tight requirements on which data types were to be used for what,
which turned out to be lists of primitives to be memorized by each
developer. However, throughout his career, Dominik spent way too many
hours debugging and fixing issues caused by these types being incorrect.
In an attempt to bring a closer semantic meaning to these lists, he
eventually wrote <span class="citation" data-cites="SI_LIB">[<a href="https://si.dominikberner.ch/doc" role="doc-biblioref">SI
library</a>]</span> as a side project.</p>
<p>While <span class="citation" data-cites="SI_LIB">[<a href="https://si.dominikberner.ch/doc" role="doc-biblioref">SI
library</a>]</span> provides many useful features, such as type-safe
conversion between physical quantities as well as zero-overhead
computation for values of the same units, there are some shortcomings
which would require major rework. Instead of creating yet another
library, Dominik decided to join forces with the other authors of this
paper to push for standardizing support for more type-safety for
physical quantities. He hopes that this will eventually lead to a safer
and more robust C++ and open many more opportunities for the
language.</p>
<h2 data-number="6.2" id="johel-ernesto-guerrero-peña"><span class="header-section-number">6.2</span> Johel Ernesto Guerrero Peña<a href="#johel-ernesto-guerrero-peña" class="self-link"></a></h2>
<p>Johel got interested in the units domain while writing his first
hundred lines of game development. He got up to opening the game window,
so this milestone was not reached until years later. Instead, he looked
for the missing piece of abstraction, called “pixel” in the GUI
framework, but modeled as an
<code class="sourceCode cpp"><span class="dt">int</span></code>. He
found out about <span class="citation" data-cites="NHOLTHAUS-UNITS">[<a href="https://github.com/nholthaus/units" role="doc-biblioref">nholthaus/units</a>]</span>, and got fascinated
with the idea of a library that succinctly allows expressing his
domain’s units (<a href="https://github.com/nholthaus/units/issues/124#issuecomment-390773279" class="uri">https://github.com/nholthaus/units/issues/124#issuecomment-390773279</a>).</p>
<p>Johel became a contributor to <span class="citation" data-cites="NHOLTHAUS-UNITS">[<a href="https://github.com/nholthaus/units" role="doc-biblioref">nholthaus/units</a>]</span> v3 from 2018 to 2020.
He improved the interfaces and implementations by remodeling them after
<code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration</code>.
This included parameterizing the representation type with a template
parameter instead of a macro. He also improved the error messages by
mapping a list of types to an user-defined name.</p>
<p>By 2020, Johel had been aware of <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> v0 <code class="sourceCode cpp">quantity<span class="op">&lt;</span>dim_length, length, <span class="dt">int</span><span class="op">&gt;</span></code>,
put off by its verbosity. But then, he watched a talk by Mateusz Pusz on
<span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span>. It described how good error
messages was a stake in the ground for the library. Thanks to his
experience in the domain, Johel was convinced that <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> was the future.</p>
<p>Since 2020, Johel has been contributing to <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span>. He added
<code class="sourceCode cpp">quantity_point</code>, the generalization
of <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>time_point</code>,
closing #1. He also added
<code class="sourceCode cpp">quantity_kind</code>, which explored the
need of representing distinct quantities of the same dimension. To help
guide its evolution, he’s been constantly pointing in the direction of
<span class="citation" data-cites="BIPM-VIM">[<a href="https://jcgm.bipm.org/vim/en" role="doc-biblioref">JCGM
200:2012</a>]</span> as a source of truth. And more recently, to <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span>, also helping interpret
it.</p>
<p>Computing systems engineering graduate. (C++) programmer since 2014.
Lives at HEAD with C++Next and good practices. Performs in-depth code
reviews of familiarized code bases. Has an eye for identifying
automation opportunities, and acts on them. Mostly at <a href="https://github.com/JohelEGP/" class="uri">https://github.com/JohelEGP/</a>.</p>
<h2 data-number="6.3" id="charles-hogg"><span class="header-section-number">6.3</span> Charles Hogg<a href="#charles-hogg" class="self-link"></a></h2>
<p>Chip Hogg is a Staff Software Engineer on the Motion Planning Team at
Aurora Innovation, the self-driving vehicle company that is developing
the Aurora Driver. After obtaining his PhD in Physics from Carnegie
Mellon in 2010, he was a postdoctoral researcher and then staff
scientist at the National Institute of Standards and Technology (NIST),
doing Bayesian data analysis. He joined Google in 2012 as a software
engineer, leaving in 2016 to work on autonomous vehicles at Uber’s
Advanced Technologies Group (ATG), where he stayed until their
acquisition by Aurora in 2021.</p>
<p>Chip built his first C++ units library at Uber ATG in 2018, where he
first developed the concept of unit-safe interfaces. At Aurora in 2021,
he ported over only the test cases, writing a new and more powerful
units library from scratch. This included novel features such as vector
space magnitudes, and an adaptive conversion policy which guards against
overflow in integers.</p>
<p>He soon realized that there was a much broader need for Aurora’s
units library. No publicly available units library for C++14 or C++17
could match its ergonomics, developer experience, and performance. This
motivated him to create <span class="citation" data-cites="AU">[<a href="https://aurora-opensource.github.io/au" role="doc-biblioref">Au</a>]</span> in 2022: a new, zero-dependency
units library, which was a drop-in replacement for Aurora’s original
units library, but offered far more composable interfaces, and was built
on simpler, stronger foundations. Once Au proved its value internally,
Chip migrated it to a separate repository and led the open-sourcing
process, culminating in its public release in 2023.</p>
<p>While Au provides excellent ergonomics and robustness for pre-C++20
users, Chip also believes the C++ community would benefit from a
standard units library. For that reason, he has joined forces with the
<span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> project, contributing code and
design ideas.</p>
<h2 data-number="6.4" id="nicolas-holthaus"><span class="header-section-number">6.4</span> Nicolas Holthaus<a href="#nicolas-holthaus" class="self-link"></a></h2>
<p>Nicolas graduated Summa Cum Laude from Northwestern University with a
B.S. in Computer Engineering. He worked for several years at the United
States Naval Air Warfare Center - Manned Flight Simulator - designing
real-time C++ software for aircraft survivability simulation. He has
subsequently continued in the field at various start-ups, MIT Lincoln
Laboratory, and most recently, STR (Science and Technology
Research).</p>
<p>Nicolas became obsessed with dimensional analysis as a high school
JETS team member after learning that the $125M Mars Climate Orbiter was
destroyed due to a simple feet-to-meters miscalculation. He developed
the widely adopted C++ <span class="citation" data-cites="NHOLTHAUS-UNITS">[<a href="https://github.com/nholthaus/units" role="doc-biblioref">nholthaus/units</a>]</span> library based on the
findings of the 2002 white paper “Dimensional Analysis in C++” by Scott
Meyers. Astounded that no one smarter had already written such a
library, he continued with <code class="sourceCode cpp">units</code> 2.0
and 3.0 based on modern C++. Those libraries have been extensively
adopted in many fields, including modeling &amp; simulation,
agriculture, and geodesy.</p>
<p>In 2023, recognizing the limits of
<code class="sourceCode cpp">units</code>, he joined forces with Mateusz
Pusz in his effort to standardize his evolutionary dimensional analysis
library, with the goal of providing the highest-quality dimensional
analysis to all C++ users via the C++ standard library.</p>
<h2 data-number="6.5" id="roth-michaels"><span class="header-section-number">6.5</span> Roth Michaels<a href="#roth-michaels" class="self-link"></a></h2>
<p>Roth Michaels is a Principal Software Engineer at <a href="https://www.native-instruments.com">Native Instruments</a>, a
leading manufacturer of audio, and music, software and hardware. Working
in this domain, he has been involved with the creation of ad hoc typed
quantities/units for digital signal processing and GUI library
use-cases. Seeing both the complexity of development and practical uses
where developers need to leave the safety of these simple wrappers
encouraged Roth to explore various quantity/units libraries to see if
they would apply to this domain. He has been doing research into
defining and using digital audio and music domain-specific quantities
and units using first <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> as proposed in <span class="citation" data-cites="P1935R2">[<a href="https://wg21.link/p1935r2" role="doc-biblioref">P1935R2</a>]</span> and the new V2 library
described in this paper.</p>
<p>Before working for Native Instruments, Roth worked as a consultant in
multiple industries using a variety of programming languages. He was
involved with the Swift Evolution community in its early days before
focusing primarily on C++ after joining <a href="https://www.izotope.com">iZotope</a> and now Native
Instruments.</p>
<p>Holding a degree in music composition, Roth has over a decade of
experience working with quantities and units of measure related to
music, digital signal processing, analog audio, and acoustics. He has
joined the <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> project as a domain expert in
these areas and to provide perspective on logarithmic and non-linear
quantity/unit relationships.</p>
<h2 data-number="6.6" id="mateusz-pusz"><span class="header-section-number">6.6</span> Mateusz Pusz<a href="#mateusz-pusz" class="self-link"></a></h2>
<p>Mateusz got interested in the physical units subject while
contributing to the <span class="citation" data-cites="LK8000">[<a href="http://lk8000.it" role="doc-biblioref">LK8000</a>]</span> Tactical
Flight Computer Open Source project over 10 years ago. The project’s
code was far from being “safe” in the C++ sense, and this is when
Mateusz started to explore alternatives.</p>
<p>Through the following years, he tried to use several existing
solutions, which were always far from being user-friendly, so he also
tried to write a better framework a few times from scratch by
himself.</p>
<p>Finally, with the availability of brand new Concepts TS in the gcc-7,
the <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> project was created. It was
designed with safety and user experience in mind. After many years of
working on the project, the <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> library is probably the most
modern and complete solution in the C++ market.</p>
<p>Through the last few years, Mateusz has put much effort into building
a community around physical units. He provided many talks and workshops
on this subject at various C++ conferences. He also approached the
authors of other actively maintained libraries to get their feedback and
invited them to work together to find and agree on the best solution for
the C++ language. This paper is the result of those actions.</p>
<h2 data-number="6.7" id="vincent-reverdy"><span class="header-section-number">6.7</span> Vincent Reverdy<a href="#vincent-reverdy" class="self-link"></a></h2>
<p>Vincent is an astrophysicist, computer scientist, and a member of the
French delegation to the ISO C++ Committee, currently working as a full
researcher at the French National Centre for Scientific Research (CNRS).
He has been interested for years in units and quantities for programming
languages to ensure higher levels of both expressivity and safety in
computational physics codes. Back in 2019, he authored <span class="citation" data-cites="P1930R0">[<a href="https://wg21.link/p1930r0" role="doc-biblioref">P1930R0</a>]</span> to provide some context of what
could be a quantity and unit library for C++.</p>
<p>After designing and implementing several Domain-Specific Language
(DSL) demonstrators dedicated to units of measurements in C++, he became
more interested in the theoretical side of the problem. Today, one of
his research activities is dedicated to the mathematical formalization
of systems of quantities and systems of units as an interdisciplinary
problem between physics, mathematics, and computer science.</p>
<h1 data-number="7" id="motivation"><span class="header-section-number">7</span> Motivation<a href="#motivation" class="self-link"></a></h1>
<p>This chapter describes why we believe that physical quantities and
units should be part of a C++ Standard Library.</p>
<h2 data-number="7.1" id="safety"><span class="header-section-number">7.1</span> Safety<a href="#safety" class="self-link"></a></h2>
<p>It is no longer only the space industry or experienced pilots that
benefit from the autonomous operations of some machines. We live in a
world where more and more ordinary people trust machines with their
lives daily. In the near future, we will be allowed to sleep while our
car autonomously drives us home from a late party. As a result, many
more C++ engineers are expected to write life-critical software today
than it was a few years ago. However, writing safety-critical code
requires extensive training and experience, both of which are in short
demand. While there exists some standards and guidelines such as MISRA
C++ <span class="citation" data-cites="MISRA_CPP">[<a href="https://misra.org.uk/misra-c-plus-plus/" role="doc-biblioref">MISRA C++</a>]</span> with the aim of enforcing the
creation of safe code in C++, they are cumbersome to use and tend to
shift the burden on the discipline of the programmers to enforce these.
At the time of writing, the C++ language does not change fast enough to
enforce safe-by-construction code.</p>
<p>One of the ways C++ can significantly improve the safety of
applications being written by thousands of developers is by introducing
a type-safe, well-tested, standardized way to handle physical quantities
and their units. The rationale is that people tend to have problems
communicating or using proper units in code and daily life. Numerous
expensive failures and accidents happened due to using an invalid unit
or a quantity type.</p>
<p>The most famous and probably the most expensive example in the
software engineering domain is the Mars Climate Orbiter that in 1999
failed to enter Mars’ orbit and crashed while entering its atmosphere
<span class="citation" data-cites="MARS_ORBITER">[<a href="https://en.wikipedia.org/wiki/Mars_Climate_Orbiter" role="doc-biblioref">Mars Orbiter</a>]</span>. This is one of many
examples here. People tend to confuse units quite often. We see similar
errors occurring in various domains over the years:</p>
<ul>
<li>On October 12, 1492, Christopher Columbus unintentionally discovered
the sea route from Europe to America because, during his travel
preparations, he mixed the Arabic mile with a Roman mile, which led to
the wrong estimation of the equator and his expected travel distance
<span class="citation" data-cites="COLUMBUS">[<a href="https://en.wikipedia.org/wiki/Christopher_Columbus" role="doc-biblioref">Columbus</a>]</span>.</li>
<li>In 1628, a new warship, Vasa, accidentally had an asymmetrical hull
(being thicker on the port side than the starboard side), which was one
of the reasons for her sinking less than a mile into her maiden voyage,
resulting in the death of 30 people on board. This asymmetry could have
been caused by the use of different systems of measurement, as
archaeologists have found four rulers used by the workers who built the
ship. Two were calibrated in Swedish feet, which had 12 inches, while
the other two measured Amsterdam feet, which had 11 inches <span class="citation" data-cites="VASA">[<a href="https://theworld.org/stories/2012-02-23/new-clues-emerge-centuries-old-swedish-shipwreck" role="doc-biblioref">Vasa</a>]</span>.</li>
<li>Air Canada Flight 143 ran out of fuel on July 23, 1983, at an
altitude of 41 000 feet (12 000 metres), midway through the flight
because the fuel had been calculated in pounds instead of kilograms by
the ground crew <span class="citation" data-cites="GIMLI_GLIDER">[<a href="https://en.wikipedia.org/wiki/Gimli_Glider" role="doc-biblioref">Gimli Glider</a>]</span>.</li>
<li>The British rock band Black Sabbath, during its Born Again tour in
1983, ordered a replica of Stonehenge as props for the scene.
Unfortunately, they had to leave them in the storage area because, while
submitting the order, their manager wrote dimensions down in meters when
he meant feet, and so the stones didn’t fit the scene. “It cost a
fortune to make, but there was not a building on Earth that you could
fit it into” <span class="citation" data-cites="STONEHENGE">[<a href="https://www.telegraph.co.uk/films/2020/05/01/tiny-stones-giant-laughs-story-behind-spinal-taps-stonehenge" role="doc-biblioref">Stonehenge</a>]</span>.</li>
<li>On April 15, 1999, Korean Air Cargo Flight 6316 crashed due to a
miscommunication between pilots about the desired flight altitude <span class="citation" data-cites="FLIGHT_6316">[<a href="https://web.archive.org/web/20210917190721/https://www.ntsb.gov/news/press-releases/Pages/Korean_Air_Flight_6316_MD-11_Shanghai_China_-_April_15_1999.aspx" role="doc-biblioref">Flight 6316</a>]</span>.</li>
<li>In February 2001, the crew of the Moorpark College Zoo built an
enclosure for Clarence the Tortoise with a weight of 250 pounds instead
of 250 kilograms <span class="citation" data-cites="CLARENCE">[<a href="https://www.latimes.com/archives/la-xpm-2001-feb-09-me-23253-story.html" role="doc-biblioref">Clarence</a>]</span>.</li>
<li>In December 2003, one of the roller coaster’s cars at Tokyo
Disneyland’s Space Mountain attraction suddenly derailed due to a broken
axle caused by confusion after upgrading the specification from imperial
to metric units <span class="citation" data-cites="DISNEY">[<a href="https://web.archive.org/web/20040209033827/http://www.olc.co.jp/news/20040121_01en.html" role="doc-biblioref">Disney</a>]</span>.</li>
<li>During the construction of the Hochrheinbrücke bridge to connect the
small German town of Laufenburg with Swiss Laufenburg, the construction
team made a sign error that resulted in a discrepancy of 54 cm between
the two outer ends of the bridge <span class="citation" data-cites="HOCHRHEINBRÜCKE">[<a href="https://www.normaalamsterdamspeil.nl/wp-content/uploads/2015/03/website_bridge.pdf" role="doc-biblioref">Hochrheinbrücke</a>]</span>.</li>
<li>An American company sold a shipment of wild rice to a Japanese
customer, quoting a price of 39 cents per pound, but the customer
thought the quote was for 39 cents per kilogram <span class="citation" data-cites="WILD_RICE">[<a href="https://www.bizjournals.com/eastbay/stories/2001/07/09/focus3.html" role="doc-biblioref">Wild Rice</a>]</span>.</li>
<li>On October 17, 2023, The Guardian published an article titled
“Record Heat: Malawi swelters with temperatures nearly 68F above
average” with many issues related to the affine space types and
temperature units. Due to incorrect logic, probably during the
translation of the article to the U.S. market,
<code class="sourceCode cpp"><span class="dv">20</span> °C</code> above
the average temperature was converted to
<code class="sourceCode cpp"><span class="dv">68</span> °F</code>. The
actual temperature increase was
<code class="sourceCode cpp"><span class="dv">32</span> °F</code>, not
<code class="sourceCode cpp"><span class="dv">68</span> °F</code> <span class="citation" data-cites="THE_GUARDIAN">[<a href="https://randomascii.wordpress.com/2023/10/17/localization-failure-temperature-is-hard" role="doc-biblioref">The Guardian</a>]</span>.</li>
<li>A whole set of <span class="citation" data-cites="MEDICATION_DOSE_ERRORS">[<a href="https://onlinelibrary.wiley.com/doi/10.1111/jan.15072" role="doc-biblioref">Medication dose errors</a>]</span>…</li>
</ul>
<p>The safety subject is so vast and essential by itself that we
dedicated an entire <a href="#safety-features">Safety features</a>
chapter of this paper that discusses all the nuances in detail.</p>
<h2 data-number="7.2" id="vocabulary-types"><span class="header-section-number">7.2</span> Vocabulary types<a href="#vocabulary-types" class="self-link"></a></h2>
<p>We standardized many library features mostly used in the
implementation details (fmt, ranges, random-number generators, etc.).
However, we believe that the most important role of the C++ Standard is
to provide a standardized way of communication between different
vendors.</p>
<p>Let’s imagine a world without
<code class="sourceCode cpp">std<span class="op">::</span>string</code>
or
<code class="sourceCode cpp">std<span class="op">::</span>vector</code>.
Every vendor has their version of it, and of course, they are highly
incompatible with each other. As a result, when someone needs to
integrate software from different vendors, it turns out to be an
unnecessarily arduous task.</p>
<p>Introducing <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration</code>
and <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>time_point</code>
improved the interfaces a lot, but time is only one of many quantities
that we deal with in our software on a daily basis. We desperately need
to be able to express more quantities and units in a standardized way so
different libraries get means to communicate with each other.</p>
<p>If Lockheed Martin and NASA could have used standardized vocabulary
types in their interfaces, maybe they would not interpret pound-force
seconds as newton seconds, and the <span class="citation" data-cites="MARS_ORBITER">[<a href="https://en.wikipedia.org/wiki/Mars_Climate_Orbiter" role="doc-biblioref">Mars Orbiter</a>]</span> would not have crashed
during the Mars orbital insertion maneuver.</p>
<h2 data-number="7.3" id="certification"><span class="header-section-number">7.3</span> Certification<a href="#certification" class="self-link"></a></h2>
<p>Mission and life-critical projects, or those for embedded devices,
often have to obey the safety norms that care about software for
safety-critical systems (e.g., ISO 61508 is a basic functional safety
standard applicable to all industries, and ISO 26262 for automotive). As
a result, their company policy often forbid third-party tooling that
lacks official certification. Such certification requires a
specification to be certified against, and those tools often do not have
one. The risk and cost of self-certifying an Open Source project is too
high for many as well.</p>
<p>Companies often have a policy that the software they use must obey
all the rules MISRA provides. This is a common misconception, as many of
those rules are intended to be deviated from. However, those deviations
require rationale and documentation, which is also considered to be
risky and expensive by many.</p>
<p>All of those reasons often prevent the usage of an Open Source
product in a company, which is a huge issue, as those companies
typically are natural users of physical quantities and units
libraries.</p>
<p>Having the physical quantities and units library standardized would
solve those issues for many customers, and would allow them to produce
safer code for projects on which human life depends every single
day.</p>
<h2 data-number="7.4" id="complex-and-complicated"><span class="header-section-number">7.4</span> Complex and complicated<a href="#complex-and-complicated" class="self-link"></a></h2>
<p>Suppose vendors can’t use an Open Source library in a production
project for the above reasons. They are forced to write their own
abstractions by themselves. Besides being costly and time-consuming, it
also happens that writing a physical quantities and units library by
yourself is far from easy. Doing this is complex and complicated,
especially for engineers who are not experts in the domain. There are
many exceptional corner cases to cover that most developers do not even
realize before falling into a trap in production. On the other hand,
domain experts might find it difficult to put their knowledge into code
and create a correct implementation in C++. As a result, companies
either use really simple and unsafe numeric wrappers, or abandon the
effort entirely and just use built-in types, such as
<code class="sourceCode cpp"><span class="dt">float</span></code> or
<code class="sourceCode cpp"><span class="dt">int</span></code>, to
express quantity values, thus losing all semantic categorization. This
often leads to safety issues caused by accidentally using values
representing the wrong quantity or having an incorrect unit.</p>
<h2 data-number="7.5" id="extensibility"><span class="header-section-number">7.5</span> Extensibility<a href="#extensibility" class="self-link"></a></h2>
<p>Many applications of a quantity and units library may need to operate
on a combination of standard (e.g., SI) and domain-specific quantities
and units. The complexity of developing domain-specific solutions
highlights the value in being able to define new quantities and units
that have all the expressivity and safety as those provided by the
library.</p>
<p>Experience with writing ad hoc typed quantities without library
support that can be combined with or converted to <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration</code>
has shown the downside of bespoke solutions: If not all operations or
conversions are handled, users will need to leave the safety of typed
quantities to operate on primitive types.</p>
<p>The interfaces of the this library were designed with ease of
extensibility in mind. Each definition of a dimension, quantity type, or
unit typically takes only a single line of code. This is possible thanks
to the extensive usage of C++20 class types as Non-Type Template
Parameters (NTTP). For example, the following code presents how second
(a unit of time in the <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span>) and hertz (a unit of frequency in
the <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span>) can be defined:</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> second <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;s&quot;</span>, kind_of<span class="op">&lt;</span>isq<span class="op">::</span>time<span class="op">&gt;&gt;</span> <span class="op">{}</span> second;</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> hertz <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;Hz&quot;</span>, <span class="dv">1</span> <span class="op">/</span> second, kind_of<span class="op">&lt;</span>isq<span class="op">::</span>frequency<span class="op">&gt;&gt;</span> <span class="op">{}</span> hertz;</span></code></pre></div>
<h2 data-number="7.6" id="broad-industry-value"><span class="header-section-number">7.6</span> Broad industry value<a href="#broad-industry-value" class="self-link"></a></h2>
<p>When people think about industries that could use physical quantities
and unit libraries, they think of a few companies related to aerospace,
autonomous cars, or embedded industries. That is all true, but there are
many other potential users for such a library.</p>
<p>Here is a list of some less obvious candidates:</p>
<ul>
<li>Manufacturing,</li>
<li>maritime industry,</li>
<li>freight transport,</li>
<li>military,</li>
<li>astronomy,</li>
<li>3D design,</li>
<li>robotics,</li>
<li>audio,</li>
<li>medical devices,</li>
<li>national laboratories,</li>
<li>scientific institutions and universities,</li>
<li>all kinds of navigation and charting,</li>
<li>GUI frameworks,</li>
<li>finance (including HFT).</li>
</ul>
<p>As we can see, the range of domains for such a library is vast and
not limited to applications involving specifically physical units. Any
software that involves measurements, or operations on counts of some
standard or domain-specific quantities, could benefit from a zero-cost
abstraction for operating on quantity values and their units. The
library also provides affine space abstractions, which may prove useful
in many applications.</p>
<h2 data-number="7.7" id="standardizing-existing-practice"><span class="header-section-number">7.7</span> Standardizing existing
practice<a href="#standardizing-existing-practice" class="self-link"></a></h2>
<p>Plenty of physical units libraries have been available to the public
for many years. In 1998 Walter Brown provided an “Introduction to the SI
Library of Unit-Based Computation” paper for the International
Conference on Computing in High Energy Physics <span class="citation" data-cites="CHEP98">[<a href="https://digital.library.unt.edu/ark:/67531/metadc668099" role="doc-biblioref">CHEP’98</a>]</span>. It emphasizes the importance
of strong types and static type-checking. After that, it describes a
library modeling the <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span> to provide “strict compile-time
type-checking without run-time overhead”.</p>
<p>It also states that at this time, “in numeric programming,
programmers make heavy, near-exclusive, use of a language’s native
numeric types (e.g.,
<code class="sourceCode cpp"><span class="dt">double</span></code>)”.
Today, twenty-five years later, plenty of “Modern C++” production code
bases still use
<code class="sourceCode cpp"><span class="dt">double</span></code> to
represent various quantities and units. It is high time to change
this.</p>
<p>Throughout the years, we have learned the best practices for handling
specific cases in the domain. Various products may have different scopes
and support different C++ versions. Still, taking that aside, they use
really similar concepts, types, and operations under the hood. We know
how to do those things already.</p>
<p>The authors of this paper developed and delivered multiple successful
C++ libraries for this domain. Libraries developed by them <a href="https://github.com/topics/dimensional-analysis?l=c%2B%2B">have
more than 90% of all the stars on GitHub in the field of physical units
libraries for C++</a>. The <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> library, which is the base of
this proposal, has the most number of stars in this list, making it the
most popular project in the C++ industry.</p>
<p>The authors joined forces and are working together to propose the
best quantities and units library we can get with the latest version of
the C++ language. They spend their private time and efforts hoping that
the ISO C++ Committee will be willing to include such a feature in the
C++ standard library.</p>
<h1 data-number="8" id="common-smells-when-there-is-no-library-for-quantities-and-units"><span class="header-section-number">8</span> Common smells when there is no
library for quantities and units<a href="#common-smells-when-there-is-no-library-for-quantities-and-units" class="self-link"></a></h1>
<p>In this chapter, we are going to review typical safety issues related
to physical quantities and units in the C++ code when a proper library
is not used. Even though all the examples come from the Open Source
projects, expensive revenue-generating production source code often is
similar.</p>
<h2 data-number="8.1" id="the-proliferation-of-double"><span class="header-section-number">8.1</span> The proliferation of
<code class="sourceCode cpp"><span class="dt">double</span></code><a href="#the-proliferation-of-double" class="self-link"></a></h2>
<p>It turns out that in the C++ software, most of our calculations in
the physical quantities and units domain are handled with fundamental
types like
<code class="sourceCode cpp"><span class="dt">double</span></code>. Code
like below is a typical example here:</p>
<div class="sourceCode" id="cb2"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="dt">double</span> GlidePolar<span class="op">::</span>MacCreadyAltitude<span class="op">(</span><span class="dt">double</span> MCREADY,</span>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a>                                     <span class="dt">double</span> Distance,</span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a>                                     <span class="kw">const</span> <span class="dt">double</span> Bearing,</span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a>                                     <span class="kw">const</span> <span class="dt">double</span> WindSpeed,</span>
<span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a>                                     <span class="kw">const</span> <span class="dt">double</span> WindBearing,</span>
<span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a>                                     <span class="dt">double</span> <span class="op">*</span>BestCruiseTrack,</span>
<span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a>                                     <span class="dt">double</span> <span class="op">*</span>VMacCready,</span>
<span id="cb2-8"><a href="#cb2-8" aria-hidden="true" tabindex="-1"></a>                                     <span class="kw">const</span> <span class="dt">bool</span> isFinalGlide,</span>
<span id="cb2-9"><a href="#cb2-9" aria-hidden="true" tabindex="-1"></a>                                     <span class="dt">double</span> <span class="op">*</span>TimeToGo,</span>
<span id="cb2-10"><a href="#cb2-10" aria-hidden="true" tabindex="-1"></a>                                     <span class="kw">const</span> <span class="dt">double</span> AltitudeAboveTarget<span class="op">=</span><span class="fl">1.0e6</span>,</span>
<span id="cb2-11"><a href="#cb2-11" aria-hidden="true" tabindex="-1"></a>                                     <span class="kw">const</span> <span class="dt">double</span> cruise_efficiency<span class="op">=</span><span class="fl">1.0</span>,</span>
<span id="cb2-12"><a href="#cb2-12" aria-hidden="true" tabindex="-1"></a>                                     <span class="kw">const</span> <span class="dt">double</span> TaskAltDiff<span class="op">=-</span><span class="fl">1.0e6</span><span class="op">)</span>;</span></code></pre></div>
<p><a href="https://github.com/LK8000/LK8000/blob/af404168ff5f92b03ab0c5db336ed8f01a792cda/Common/Header/McReady.h#L7-L21">Original
code here</a>.</p>
<p>There are several problems with such an approach: The abundance of
<code class="sourceCode cpp"><span class="dt">double</span></code>
parameters makes it easy to accidentally switch values and there is no
way of noticing such a mistake at compile-time. The code is not
self-documenting in what units the parameters are expected. Is
<code class="sourceCode cpp">Distance</code> in meters or kilometers? Is
<code class="sourceCode cpp">WindSpeed</code> in meters per second or
knots? Different code bases choose different ways to encode this
information, which may be internally inconsistent. A strong type system
would help answer these questions at the time the interface is written,
and the compiler would verify it at compile-time.</p>
<h2 data-number="8.2" id="the-proliferation-of-magic-numbers"><span class="header-section-number">8.2</span> The proliferation of magic
numbers<a href="#the-proliferation-of-magic-numbers" class="self-link"></a></h2>
<p>There are a lot of constants and conversion factors involved in the
quantity equations. Source code responsible for such computations is
often trashed with magic numbers:</p>
<div class="sourceCode" id="cb3"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="dt">double</span> AirDensity<span class="op">(</span><span class="dt">double</span> hr, <span class="dt">double</span> temp, <span class="dt">double</span> abs_press<span class="op">)</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> <span class="op">(</span><span class="dv">1</span><span class="op">/(</span><span class="fl">287.06</span><span class="op">*(</span>temp<span class="op">+</span><span class="fl">273.15</span><span class="op">)))*(</span>abs_press <span class="op">-</span> <span class="fl">230.617</span> <span class="op">*</span> hr <span class="op">*</span> exp<span class="op">((</span><span class="fl">17.5043</span><span class="op">*</span>temp<span class="op">)/(</span><span class="fl">241.2</span><span class="op">+</span>temp<span class="op">)))</span>;</span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p><a href="https://github.com/LK8000/LK8000/blob/af404168ff5f92b03ab0c5db336ed8f01a792cda/Common/Source/Library/PressureFunctions.cpp#L134-L136">Original
code here</a>.</p>
<p>Apart from the obvious readability issues, such code is hard to
maintain, and it needs a lot of domain knowledge on the developer’s
side. While it would be easy to replace these numbers with named
constants, the question of which unit the constant is in remains. Is
<code class="sourceCode cpp"><span class="fl">287.06</span></code> in
pounds per square inch (psi) or millibars (mbar)?</p>
<h2 data-number="8.3" id="the-proliferation-of-conversion-macros"><span class="header-section-number">8.3</span> The proliferation of conversion
macros<a href="#the-proliferation-of-conversion-macros" class="self-link"></a></h2>
<p>The lack of automated unit conversions often results in handwritten
conversion functions or macros that are spread everywhere among the code
base:</p>
<div class="sourceCode" id="cb4"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="pp">#ifndef PI</span></span>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static</span> <span class="kw">const</span> <span class="dt">double</span> PI <span class="op">=</span> <span class="op">(</span><span class="dv">4</span><span class="op">*</span>atan<span class="op">(</span><span class="dv">1</span><span class="op">))</span>;</span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="pp">#endif</span></span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true" tabindex="-1"></a><span class="pp">#define EARTH_DIAMETER    </span><span class="fl">12733426.0</span><span class="pp">    </span><span class="co">// Diameter of earth in meters</span></span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true" tabindex="-1"></a><span class="pp">#define SQUARED_EARTH_DIAMETER  </span><span class="fl">162140137697476.0</span><span class="pp"> </span><span class="co">// Diameter of earth in meters (EARTH_DIAMETER*EARTH_DIAMETER)</span></span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true" tabindex="-1"></a><span class="pp">#ifndef DEG_TO_RAD</span></span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true" tabindex="-1"></a><span class="pp">#define DEG_TO_RAD  </span><span class="op">(</span>PI<span class="pp"> </span><span class="op">/</span><span class="pp"> </span><span class="dv">180</span><span class="op">)</span></span>
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true" tabindex="-1"></a><span class="pp">#define RAD_TO_DEG  </span><span class="op">(</span><span class="dv">180</span><span class="pp"> </span><span class="op">/</span><span class="pp"> </span>PI<span class="op">)</span></span>
<span id="cb4-9"><a href="#cb4-9" aria-hidden="true" tabindex="-1"></a><span class="pp">#endif</span></span>
<span id="cb4-10"><a href="#cb4-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-11"><a href="#cb4-11" aria-hidden="true" tabindex="-1"></a><span class="pp">#define NAUTICALMILESTOMETRES </span><span class="op">(</span><span class="dt">double</span><span class="op">)</span><span class="fl">1851.96</span></span>
<span id="cb4-12"><a href="#cb4-12" aria-hidden="true" tabindex="-1"></a><span class="pp">#define KNOTSTOMETRESSECONDS </span><span class="op">(</span><span class="dt">double</span><span class="op">)</span><span class="fl">0.5144</span></span>
<span id="cb4-13"><a href="#cb4-13" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-14"><a href="#cb4-14" aria-hidden="true" tabindex="-1"></a><span class="pp">#define TOKNOTS </span><span class="op">(</span><span class="dt">double</span><span class="op">)</span><span class="fl">1.944</span></span>
<span id="cb4-15"><a href="#cb4-15" aria-hidden="true" tabindex="-1"></a><span class="pp">#define TOFEETPERMINUTE </span><span class="op">(</span><span class="dt">double</span><span class="op">)</span><span class="fl">196.9</span></span>
<span id="cb4-16"><a href="#cb4-16" aria-hidden="true" tabindex="-1"></a><span class="pp">#define TOMPH   </span><span class="op">(</span><span class="dt">double</span><span class="op">)</span><span class="fl">2.237</span></span>
<span id="cb4-17"><a href="#cb4-17" aria-hidden="true" tabindex="-1"></a><span class="pp">#define TOKPH   </span><span class="op">(</span><span class="dt">double</span><span class="op">)</span><span class="fl">3.6</span></span>
<span id="cb4-18"><a href="#cb4-18" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb4-19"><a href="#cb4-19" aria-hidden="true" tabindex="-1"></a><span class="co">// meters to.. conversion</span></span>
<span id="cb4-20"><a href="#cb4-20" aria-hidden="true" tabindex="-1"></a><span class="pp">#define TONAUTICALMILES </span><span class="op">(</span><span class="fl">1.0</span><span class="pp"> </span><span class="op">/</span><span class="pp"> </span><span class="fl">1852.0</span><span class="op">)</span></span>
<span id="cb4-21"><a href="#cb4-21" aria-hidden="true" tabindex="-1"></a><span class="pp">#define TOMILES         </span><span class="op">(</span><span class="fl">1.0</span><span class="pp"> </span><span class="op">/</span><span class="pp"> </span><span class="fl">1609.344</span><span class="op">)</span></span>
<span id="cb4-22"><a href="#cb4-22" aria-hidden="true" tabindex="-1"></a><span class="pp">#define TOKILOMETER     </span><span class="op">(</span><span class="fl">0.001</span><span class="op">)</span></span>
<span id="cb4-23"><a href="#cb4-23" aria-hidden="true" tabindex="-1"></a><span class="pp">#define TOFEET          </span><span class="op">(</span><span class="fl">1.0</span><span class="pp"> </span><span class="op">/</span><span class="pp"> </span><span class="fl">0.3048</span><span class="op">)</span></span>
<span id="cb4-24"><a href="#cb4-24" aria-hidden="true" tabindex="-1"></a><span class="pp">#define TOMETER         </span><span class="op">(</span><span class="fl">1.0</span><span class="op">)</span></span></code></pre></div>
<p><a href="https://github.com/LK8000/LK8000/blob/052bbc20a106fda4db41874e788e39020fb86512/Common/Header/Defines.h#L901-L924">Original
code here</a>.</p>
<p>Again, the question of which unit the constant is in remains. Without
looking at the code, it is impossible to tell from which unit
<code class="sourceCode cpp">TOMETER</code> converts. Also, macros have
the problem that they are not scoped to a namespace and thus can easily
clash with other macros or functions, especially if they have such
common names like <code class="sourceCode cpp">PI</code> or
<code class="sourceCode cpp">RAD_TO_DEG</code>. A quick search through
open source C++ code bases reveals that, for example, the
<code class="sourceCode cpp">RAD_TO_DEG</code> macro is defined in a
multitude of different ways – sometimes even within the same
repository:</p>
<div class="sourceCode" id="cb5"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="pp">#define RAD_TO_DEG </span><span class="op">(</span><span class="dv">180</span><span class="pp"> </span><span class="op">/</span><span class="pp"> </span>PI<span class="op">)</span></span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="pp">#define RAD_TO_DEG </span><span class="fl">57.2957795131</span></span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="pp">#define RAD_TO_DEG </span><span class="op">(</span><span class="pp"> </span>radians<span class="pp"> </span><span class="op">)</span><span class="pp"> </span><span class="op">((</span>radians<span class="pp"> </span><span class="op">)</span><span class="pp"> </span><span class="op">*</span><span class="pp"> </span><span class="fl">180.0</span><span class="pp"> </span><span class="op">/</span><span class="pp"> </span>M_PI<span class="op">)</span></span>
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true" tabindex="-1"></a><span class="pp">#define RAD_TO_DEG </span><span class="fl">57.2957805</span><span class="bu">f</span></span>
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true" tabindex="-1"></a><span class="op">...</span></span></code></pre></div>
<p><a href="https://github.com/search?q=lang%3AC%2B%2B++%22%23define+RAD_TO_DEG%22&amp;type=code">Example
search across multiple repositories</a></p>
<p><a href="https://github.com/search?q=repo%3ALK8000%2FLK8000%20rad_to_deg&amp;type=code">Multiple
redefinitions in the same repository</a></p>
<p>Another safety issue occurring here is the fact that macro values can
be deliberately tainted by compiler settings at built time and can
acquire values that are not present in the source code. Human reviews
won’t catch such issues.</p>
<p>Also, most of the macros do not follow best practices. Often,
necessary parentheses are missing, processing in a preprocessor ends up
with redundant casts, or some compile-time constants use too many digits
for a value to be exact for a specific type (e.g.,
<code class="sourceCode cpp"><span class="dt">float</span></code>).</p>
<h2 data-number="8.4" id="lack-of-consistency"><span class="header-section-number">8.4</span> Lack of consistency<a href="#lack-of-consistency" class="self-link"></a></h2>
<p>If we not only lack strong types to isolate the abstractions from
each other, but also lack discipline to keep our code consistent, we end
up in an awful place:</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> DistanceBearing<span class="op">(</span><span class="dt">double</span> lat1, <span class="dt">double</span> lon1,</span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a>                     <span class="dt">double</span> lat2, <span class="dt">double</span> lon2,</span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a>                     <span class="dt">double</span> <span class="op">*</span>Distance, <span class="dt">double</span> <span class="op">*</span>Bearing<span class="op">)</span>;</span>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true" tabindex="-1"></a><span class="dt">double</span> DoubleDistance<span class="op">(</span><span class="dt">double</span> lat1, <span class="dt">double</span> lon1,</span>
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true" tabindex="-1"></a>                      <span class="dt">double</span> lat2, <span class="dt">double</span> lon2,</span>
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true" tabindex="-1"></a>                      <span class="dt">double</span> lat3, <span class="dt">double</span> lon3<span class="op">)</span>;</span>
<span id="cb6-8"><a href="#cb6-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-9"><a href="#cb6-9" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> FindLatitudeLongitude<span class="op">(</span><span class="dt">double</span> Lat, <span class="dt">double</span> Lon,</span>
<span id="cb6-10"><a href="#cb6-10" aria-hidden="true" tabindex="-1"></a>                           <span class="dt">double</span> Bearing, <span class="dt">double</span> Distance,</span>
<span id="cb6-11"><a href="#cb6-11" aria-hidden="true" tabindex="-1"></a>                           <span class="dt">double</span> <span class="op">*</span>lat_out, <span class="dt">double</span> <span class="op">*</span>lon_out<span class="op">)</span>;</span>
<span id="cb6-12"><a href="#cb6-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-13"><a href="#cb6-13" aria-hidden="true" tabindex="-1"></a><span class="dt">double</span> CrossTrackError<span class="op">(</span><span class="dt">double</span> lon1, <span class="dt">double</span> lat1,</span>
<span id="cb6-14"><a href="#cb6-14" aria-hidden="true" tabindex="-1"></a>                       <span class="dt">double</span> lon2, <span class="dt">double</span> lat2,</span>
<span id="cb6-15"><a href="#cb6-15" aria-hidden="true" tabindex="-1"></a>                       <span class="dt">double</span> lon3, <span class="dt">double</span> lat3,</span>
<span id="cb6-16"><a href="#cb6-16" aria-hidden="true" tabindex="-1"></a>                       <span class="dt">double</span> <span class="op">*</span>lon4, <span class="dt">double</span> <span class="op">*</span>lat4<span class="op">)</span>;</span>
<span id="cb6-17"><a href="#cb6-17" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb6-18"><a href="#cb6-18" aria-hidden="true" tabindex="-1"></a><span class="dt">double</span> ProjectedDistance<span class="op">(</span><span class="dt">double</span> lon1, <span class="dt">double</span> lat1,</span>
<span id="cb6-19"><a href="#cb6-19" aria-hidden="true" tabindex="-1"></a>                         <span class="dt">double</span> lon2, <span class="dt">double</span> lat2,</span>
<span id="cb6-20"><a href="#cb6-20" aria-hidden="true" tabindex="-1"></a>                         <span class="dt">double</span> lon3, <span class="dt">double</span> lat3,</span>
<span id="cb6-21"><a href="#cb6-21" aria-hidden="true" tabindex="-1"></a>                         <span class="dt">double</span> <span class="op">*</span>xtd, <span class="dt">double</span> <span class="op">*</span>crs<span class="op">)</span>;</span></code></pre></div>
<p><a href="https://github.com/LK8000/LK8000/blob/af404168ff5f92b03ab0c5db336ed8f01a792cda/Common/Header/NavFunctions.h#L7C1-L27">Original
code here</a>.</p>
<p>Users can easily make errors if the interface designers are not
consistent in ordering parameters. It is really hard to remember which
function takes latitude or <code class="sourceCode cpp">Bearing</code>
first and when a latitude or
<code class="sourceCode cpp">Distance</code> is in the front.</p>
<h2 data-number="8.5" id="lack-of-a-conceptual-framework"><span class="header-section-number">8.5</span> Lack of a conceptual
framework<a href="#lack-of-a-conceptual-framework" class="self-link"></a></h2>
<p>The previous points mean that the fundamental types can’t be
leveraged to model the different concepts of quantities and units
frameworks. There is no shared vocabulary between different libraries.
User-facing APIs use ad-hoc conventions. Even internal interfaces are
inconsistent between themselves.</p>
<p>Arithmetic types such as
<code class="sourceCode cpp"><span class="dt">int</span></code> and
<code class="sourceCode cpp"><span class="dt">double</span></code> are
used to model different concepts. They are used to represent any
abstraction (be it a magnitude, difference, point, or kind) of any
quantity type of any unit. These are weak types that make up
weakly-typed interfaces. The resulting interfaces and implementations
built with these types easily allow mixing up parameters and using
operations that are not part of the represented quantity.</p>
<h1 data-number="9" id="design-goals"><span class="header-section-number">9</span> Design goals<a href="#design-goals" class="self-link"></a></h1>
<p>The library facilities that we plan to propose in the upcoming papers
is designed with the following goals in mind.</p>
<h2 data-number="9.1" id="compile-time-safety"><span class="header-section-number">9.1</span> Compile-time safety<a href="#compile-time-safety" class="self-link"></a></h2>
<p>The most important property of any such a library is the safety it
brings to C++ projects. The correct handling of physical quantities,
units, and numerical values should be verifiable both by the compiler
and by humans with manual inspection of each individual line.</p>
<p>In some cases, we are even eager to prioritize safe interfaces over
the general usability experience (e.g., getters of the underlying raw
numerical value will always require a unit in which the value should be
returned in, which results in more typing and is sometimes
redundant).</p>
<p>More information on this subject can be found in <a href="#safety-features">Safety features</a>.</p>
<h2 data-number="9.2" id="performance"><span class="header-section-number">9.2</span> Performance<a href="#performance" class="self-link"></a></h2>
<p>The library should be as fast or even faster than working with
fundamental types. The should be no runtime overhead, and no space size
overhead should be needed to implement higher-level abstractions.</p>
<h2 data-number="9.3" id="great-user-experience"><span class="header-section-number">9.3</span> Great user experience<a href="#great-user-experience" class="self-link"></a></h2>
<p>The primary purpose of the library is to generate compile-time
errors. If users did not introduce any bugs in the manual handling of
quantities and units, the library would be of little use. This is why
the library is optimized for readable compilation errors and great
debugging experience.</p>
<p>The library is easy to use and flexible. The interfaces are
straight-forward and safe by default. Users should be able to easily
express any quantity and unit, which requires them to compose.</p>
<p>The above constraints imply the usage of special implementation
techniques. The library will not only provide types, but also
compile-time known values that will enable users to write easy to
understand and efficient equations on quantities and units.</p>
<h2 data-number="9.4" id="scope"><span class="header-section-number">9.4</span> Scope<a href="#scope" class="self-link"></a></h2>
<p>There are plenty of expectations from different parties regarding
such a library. It should support at least:</p>
<ul>
<li>Any unit’s magnitude (huge, small, floating-point).</li>
<li>Systems of Quantities.</li>
<li>Systems of Units.</li>
<li>The affine space.</li>
<li>Highly adjustable text-output formatting.</li>
</ul>
<p>Additionally, it would be good to also support the following
features:</p>
<ul>
<li>Scalar, vector, and tensor quantities.</li>
<li>Natural units systems.</li>
</ul>
<h2 data-number="9.5" id="easy-to-extend"><span class="header-section-number">9.5</span> Easy to extend<a href="#easy-to-extend" class="self-link"></a></h2>
<p>The library’s core framework does not assume the usage of any systems
of quantities or units. It is fully generic and allow defining any
system abstraction on top of it.</p>
<p>Most entities in the library can be defined with a single line of
code without preprocessor macros. Users can easily extend provided
systems with custom dimensions, quantities, and units.</p>
<h2 data-number="9.6" id="low-standardization-cost"><span class="header-section-number">9.6</span> Low standardization cost<a href="#low-standardization-cost" class="self-link"></a></h2>
<p>The set of entities required for standardization should be limited to
the bare minimum.</p>
<p>Most of the entities in systems definitions should be possible to
implement with a single line of code.</p>
<p>Derived units do not need separate library types. Instead, they can
be obtained through the composition of predefined named units. Units
should not be associated with User-Defined Literals (UDLs), as it is the
case with <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration</code>.
UDLs do not compose, have very limited scope and functionality, and are
expensive to standardize.</p>
<p>The user interface should have no preprocessor macros.</p>
<p>It should be possible for most proposed features (besides the text
output) to be freestanding.</p>
<h1 data-number="10" id="quick-domain-introduction"><span class="header-section-number">10</span> Quick domain introduction<a href="#quick-domain-introduction" class="self-link"></a></h1>
<p>This chapter provides a very brief introduction to the quantities and
units domain. Please refer to <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> and <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span> for more details.</p>
<!-- 
flowchart TD
    dimension --- quantity_type["quantity type"]
    quantity_type --- reference["quantity reference\n(e.g., unit)"]
    reference --- quantity
    number --- quantity
 -->
<p><img src="data:image/svg+xml;base64,PHN2ZyBhcmlhLXJvbGVkZXNjcmlwdGlvbj0iZmxvd2NoYXJ0LXYyIiByb2xlPSJncmFwaGljcy1kb2N1bWVudCBkb2N1bWVudCIgdmlld0JveD0iLTggLTggMjg1LjMxMjUgMzQ2IiBzdHlsZT0ibWF4LXdpZHRoOiAxMDAlOyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTAwJSIgaWQ9ImdyYXBoLWRpdiIgaGVpZ2h0PSIxMDAlIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PHN0eWxlPkBpbXBvcnQgdXJsKCJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9mb250LWF3ZXNvbWUvNi40LjIvY3NzL2FsbC5taW4uY3NzIik7Jzwvc3R5bGU+PHN0eWxlPiNncmFwaC1kaXZ7Zm9udC1mYW1pbHk6InRyZWJ1Y2hldCBtcyIsdmVyZGFuYSxhcmlhbCxzYW5zLXNlcmlmO2ZvbnQtc2l6ZToxNnB4O2ZpbGw6IzMzMzt9I2dyYXBoLWRpdiAuZXJyb3ItaWNvbntmaWxsOiM1NTIyMjI7fSNncmFwaC1kaXYgLmVycm9yLXRleHR7ZmlsbDojNTUyMjIyO3N0cm9rZTojNTUyMjIyO30jZ3JhcGgtZGl2IC5lZGdlLXRoaWNrbmVzcy1ub3JtYWx7c3Ryb2tlLXdpZHRoOjJweDt9I2d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nPjwvZz48L2c+PC9zdmc+" style="display: block; margin-left: auto; margin-right: auto; width: 30%;" /></p>
<p><em>Note: A more detailed graph of the framework’s entities can be
found in the <a href="#framework-entities">Framework entities</a>
chapter.</em></p>
<h2 data-number="10.1" id="dimension"><span class="header-section-number">10.1</span> Dimension<a href="#dimension" class="self-link"></a></h2>
<p><a href="https://jcgm.bipm.org/vim/en/1.7.html">Dimension</a>
specifies the dependence of a quantity on the base quantities of a
particular system of quantities. It is represented as a product of
powers of factors corresponding to the base quantities, omitting any
numerical factor.</p>
<p>Even though ISO does not officially define these, we find the below
terms useful when discussing the domain and its C++ implementation:</p>
<ul>
<li><strong>base dimension</strong> is the dimension of a <a href="https://jcgm.bipm.org/vim/en/1.4.html">base quantity</a>,</li>
<li><strong>derived dimension</strong> is the dimension of a <a href="https://jcgm.bipm.org/vim/en/1.5.html">derived quantity</a>.</li>
</ul>
<p>As stated above, ISO does not mention a “base dimension” term.
Nevertheless, it treats dimensions of base quantities in a special way
by:</p>
<ul>
<li>assigning unique identifiers/symbols to all of them,</li>
<li>stating that derived quantities have a dimension being a product of
dimensions of base quantities.</li>
</ul>
<p>For example:</p>
<ul>
<li><em>length</em> (<span class="math inline">\(L\)</span>),
<em>mass</em> (<span class="math inline">\(M\)</span>), <em>time</em>
(<span class="math inline">\(T\)</span>), <em>electric current</em>
(<span class="math inline">\(I\)</span>), <em>thermodynamic
temperature</em> (<span class="math inline">\(Θ\)</span>), <em>amount of
substance</em> (<span class="math inline">\(N\)</span>), and
<em>luminous intensity</em> (<span class="math inline">\(J\)</span>) are
the base dimensions of the ISQ.</li>
<li>A derived dimension of <em>force</em> in the ISQ is denoted by <span class="math inline">\(dim\;F = LMT^{–2}\)</span>.</li>
<li><span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> (part 13) provides
<em>traffic intensity</em> quantity that is measured in erlangs but not
in the unit one, which also implies that it should be introduced as a
base quantity with its own dimension.</li>
</ul>
<h2 data-number="10.2" id="quantity-type"><span class="header-section-number">10.2</span> Quantity type<a href="#quantity-type" class="self-link"></a></h2>
<p>Dimension is not enough to describe a quantity. This is why <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> provides hundreds of
named quantity types. It turns out that there are many more quantity
types in the ISQ than the named units in the <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span>.</p>
<p><span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> also defines the term
<strong>kind of quantity</strong> as an aspect common to mutually
comparable quantities. It explicitly says that two or more quantities
cannot be added or subtracted unless they belong to the same category of
mutually comparable quantities.</p>
<p>Quantities might be:</p>
<ul>
<li>of different dimensions (e.g., <em>length</em>, <em>time</em>,
<em>speed</em>, <em>power</em>),</li>
<li>of the same dimension but of a different kind (e.g., <em>work</em>
vs. <em>torque</em>, <em>frequency</em> vs. <em>activity</em>,
<em>area</em> vs. <em>fuel consumption</em>),</li>
<li>of the same dimension and kind but still distinct (e.g.,
<em>radius</em> vs. <em>width</em> vs. <em>height</em> or <em>potential
energy</em> vs. <em>kinetic energy</em> vs. <em>thermodynamic
energy</em>).</li>
</ul>
<p>Additionally, ISO explicitly specifies a quantity of dimension one,
which is commonly known as a dimensionless quantity. It is a quantity
for which all the exponents of the factors corresponding to the base
quantities in its quantity dimension are zero. Typically, they represent
ratios of two quantities of the same dimension or counts of things.</p>
<h2 data-number="10.3" id="quantity-reference"><span class="header-section-number">10.3</span> Quantity reference<a href="#quantity-reference" class="self-link"></a></h2>
<p><span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> defines a quantity
as:</p>
<blockquote>
<p>property of a phenomenon, body, or substance, where the property has
a magnitude that can be expressed as a number and a reference.</p>
<p>NOTE 2 A reference can be a measurement unit, a measurement
procedure, a reference material, or a combination of such.</p>
</blockquote>
<p>The term “reference” is repeated several times in that ISO
specification. For example:</p>
<ul>
<li><p>quantity value is defined as:</p>
<blockquote>
<p>Number and reference together expressing magnitude of a quantity.</p>
</blockquote></li>
<li><p>numerical quantity value is defined as:</p>
<blockquote>
<p>Number in the expression of a quantity value, other than any number
serving as the reference</p>
</blockquote></li>
</ul>
<p>We realize that the term “reference” might be overloaded in the C++
domain. However, preserving the official metrology terminology here is
still worth trying.</p>
<p>Measurement units are designated by conventionally assigned names and
symbols.</p>
<p>Measurement units of quantities of the same quantity dimension may be
designated by the same name and symbol even when the quantities are not
of the same kind. For example, joule per kelvin and J/K are,
respectively, the name and symbol of both a measurement unit of <em>heat
capacity</em> and a measurement unit of <em>entropy</em>, which are
generally considered to not be quantities of the same kind.</p>
<p>However, in some cases, special measurement unit names are restricted
to be used with quantities of specific kind only. For example, the
measurement unit ‘second to the power minus one’ (1/s) is called hertz
(Hz) when used for <em>frequencies</em> and becquerel (Bq) when used for
<em>activities of radionuclides</em>.</p>
<p>Measurement units of quantities of dimension one are numbers. In some
cases, these measurement units are given special names, e.g., radian,
steradian, and decibel, or are expressed by quotients such as millimole
per mole equal to <span class="math inline">\(10^{−3}\)</span> and
microgram per kilogram equal to <span class="math inline">\(10^{−9}\)</span>.</p>
<h2 data-number="10.4" id="quantity"><span class="header-section-number">10.4</span> Quantity<a href="#quantity" class="self-link"></a></h2>
<p>As stated above, <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> defines a quantity
as:</p>
<blockquote>
<p>property of a phenomenon, body, or substance, where the property has
a magnitude that can be expressed as a number and a reference.</p>
</blockquote>
<p>The above means that a quantity abstraction should store a runtime
value representing the quantity numerical value and a reference that
might be represented as a unit. It is a common practice to embed a
reference into the C++ type expressing the quantity so it does not
occupy a space/storage at runtime.</p>
<p>It is also worth mentioning here that the distinction between a
quantity and a quantity type is not clearly defined in <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span>. <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> even explicitly
states:</p>
<blockquote>
<p>It is customary to use the same term, “quantity”, to refer to both
general quantities, such as length, mass, etc., and their instances,
such as given lengths, given masses, etc. Accordingly, we are used to
saying both that length is a quantity and that a given length is a
quantity, by maintaining the specification – “general quantity, <span class="math inline">\(Q\)</span>” or “individual quantity, <span class="math inline">\(Q_a\)</span>” – implicit and exploiting the
linguistic context to remove the ambiguity.</p>
</blockquote>
<p>To prevent such ambiguities in this document, we will consistently
use the term:</p>
<ul>
<li>“quantity type” when we mean a general quantity,</li>
<li>“quantity” when we mean the instance of a quantity that also stores
its numerical value.</li>
</ul>
<p>It is also worth mentioning here that <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> does not distinguish
between point and vector/interval quantities of <a href="#the-affine-space">The affine space</a>.</p>
<h1 data-number="11" id="api-overview"><span class="header-section-number">11</span> API overview<a href="#api-overview" class="self-link"></a></h1>
<p>This chapter is intended to be a short overview and present the
proposed library’s final look and feel. We start with the most
straightforward use cases and gradually introduce more complex
abstractions. Thanks to that, the readers can assess the <a href="#teachability">Teachability</a> effort of this library by
themselves.</p>
<p>More details about the design, rationale for it, and alternative
syntaxes discussions can be found in the <a href="#design-details-and-rationale">Design details and rationale</a>
chapter.</p>
<h2 data-number="11.1" id="unit-based-quantities-simple-mode"><span class="header-section-number">11.1</span> Unit-based quantities (simple
mode)<a href="#unit-based-quantities-simple-mode" class="self-link"></a></h2>
<p>Consistently with a <a href="#quantity">Quantity</a> definition, a
<code class="sourceCode cpp">quantity</code> class template takes a
reference and a representation type as parameters:</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>Reference <span class="kw">auto</span> R,</span>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a>         RepresentationOf<span class="op">&lt;</span>get_quantity_spec<span class="op">(</span>R<span class="op">)&gt;</span> Rep <span class="op">=</span> <span class="dt">double</span><span class="op">&gt;</span></span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a><span class="kw">class</span> quantity;</span></code></pre></div>
<h3 data-number="11.1.1" id="constructing-a-quantity"><span class="header-section-number">11.1.1</span> Constructing a quantity<a href="#constructing-a-quantity" class="self-link"></a></h3>
<p>If we want to set a value for a quantity, we always have to provide a
number and a unit:</p>
<div class="sourceCode" id="cb8"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>si<span class="op">::</span>metre, <span class="dt">int</span><span class="op">&gt;</span> q<span class="op">{</span><span class="dv">42</span>, si<span class="op">::</span>metre<span class="op">}</span>;</span></code></pre></div>
<p>In case a quantity class template should use exactly the same unit
and a representation type as provided in the initializer, it is
recommended to use CTAD:</p>
<div class="sourceCode" id="cb9"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a>quantity q<span class="op">{</span><span class="dv">42</span>, si<span class="op">::</span>metre<span class="op">}</span>;</span></code></pre></div>
<p>Please, note that
<code class="sourceCode cpp"><span class="dt">double</span></code> is
used as a default representation type, so the following does not result
with a quantity of integral representation type:</p>
<div class="sourceCode" id="cb10"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">&gt;</span> q2<span class="op">{</span><span class="dv">42</span>, si<span class="op">::</span>metre<span class="op">}</span>;</span></code></pre></div>
<p>This is why CTAD usage is recommended when the user wants to prevent
potential conversion and just deduce the
<code class="sourceCode cpp">quantity</code> class template parameters
from the initializer. This often prevents unneeded conversions that can
affect runtime performance or memory footprint.</p>
<p>CTAD-based spelling is shorter but is still quite verbose. Consider
having to write:</p>
<div class="sourceCode" id="cb11"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a>quantity q <span class="op">=</span> quantity<span class="op">{</span><span class="dv">1</span>, si<span class="op">::</span>kilo<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">&gt;}</span> <span class="op">+</span> quantity<span class="op">{</span><span class="dv">200</span>, si<span class="op">::</span>metre<span class="op">}</span>;</span></code></pre></div>
<p>This is why the library offers an alternative way to construct a
quantity.</p>
<p>The <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span> says:</p>
<blockquote>
<p>The value of the quantity is the product of the number and the unit.
The space between the number and the unit is regarded as a
multiplication sign (just as a space between units implies
multiplication).</p>
</blockquote>
<p>Following the above, the value of a quantity can also be created by
multiplying a number with a predefined unit:</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb12-1"><a href="#cb12-1" aria-hidden="true" tabindex="-1"></a>quantity q <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> si<span class="op">::</span>metre;</span></code></pre></div>
<p>The above creates an instance of <code class="sourceCode cpp">quantity<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">()</span>, <span class="dt">int</span><span class="op">&gt;</span></code>.
It is worth noting here that the syntax with the reversed order of
arguments is invalid and will not compile (e.g., we can’t write <code class="sourceCode cpp">si<span class="op">::</span>metre <span class="op">*</span> <span class="dv">42</span></code>).</p>
<p>The same can be obtained using an optional unit symbol:</p>
<div class="sourceCode" id="cb13"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> <span class="kw">namespace</span> si<span class="op">::</span>unit_symbols;</span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb13-3"><a href="#cb13-3" aria-hidden="true" tabindex="-1"></a>quantity q <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> m;</span></code></pre></div>
<p>Unit symbols introduce a lot of short identifiers into the current
scope, which is why they are opt-in. A user has to explicitly “import”
them from a dedicated <code class="sourceCode cpp">unit_symbols</code>
namespace.</p>
<p><span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span> specifies 7 base and 22 coherent
derived units with special names. Additionally, it specifies 24
prefixes. There are also non-SI units accepted for use with SI. Some of
them are really popular, for example, minute, hour, day, degree, litre,
hectare, tonne. All of those entities compose to allow the creation of a
vast number of various derived units.</p>
<p>For example, we can create a quantity of speed with either:</p>
<div class="sourceCode" id="cb14"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb14-1"><a href="#cb14-1" aria-hidden="true" tabindex="-1"></a>quantity speed1 <span class="op">=</span> <span class="dv">60</span> <span class="op">*</span> si<span class="op">::</span>kilo<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">&gt;</span> <span class="op">/</span> non_si<span class="op">::</span>hour;</span>
<span id="cb14-2"><a href="#cb14-2" aria-hidden="true" tabindex="-1"></a>quantity speed2 <span class="op">=</span> <span class="dv">60</span> <span class="op">*</span> km <span class="op">/</span> h;</span></code></pre></div>
<p>In case a complex derived unit is used a lot in the project, for
convenience, a user can quickly provide a nicely named wrapper for it
with:</p>
<div class="sourceCode" id="cb15"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="kw">auto</span> kmph <span class="op">=</span> si<span class="op">::</span>kilo<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">&gt;</span> <span class="op">/</span> non_si<span class="op">::</span>hour;</span>
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true" tabindex="-1"></a>quantity speed3 <span class="op">=</span> <span class="dv">60</span> <span class="op">*</span> kmph;</span></code></pre></div>
<p>The library is optimized to generate short and easy-to-understand
types that highly improve the analysis of compile-time errors and
debugging experience. All of the above definitions will create an
instance of the type <code class="sourceCode cpp">quantity<span class="op">&lt;</span>derived_unit<span class="op">&lt;</span>si<span class="op">::</span>kilo_<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">&gt;</span>, per<span class="op">&lt;</span>non_si<span class="op">::</span>hour<span class="op">&gt;&gt;{}</span>, <span class="dt">int</span><span class="op">&gt;&gt;</span></code>.
As we can see, the type generation is optimized to be easily understood
even by non-experts in the domain. The library tries to keep the type’s
readability as close to English as possible.</p>
<p>To learn find more discussion on a quantity creation syntax please
refer to the following chapters:</p>
<ul>
<li><a href="#explicit-is-not-explicit-enough"><code class="sourceCode cpp"><span class="kw">explicit</span></code>
is not explicit enough</a>,</li>
<li><a href="#why-dont-we-use-udls-to-create-quantities">Why don’t we
use UDLs to create quantities?</a>,</li>
<li><a href="#potential-surprises-during-units-composition">Potential
surprises during units composition</a>.</li>
</ul>
<h3 data-number="11.1.2" id="typical-operations-on-quantities"><span class="header-section-number">11.1.2</span> Typical operations on
quantities<a href="#typical-operations-on-quantities" class="self-link"></a></h3>
<p>Various quantities can be multiplied or divided to obtain other
derived quantities. Quantities of the same kind can be added,
subtracted, and compared to each other. Quantities can also be easily
printed with output streams or formatting facilities.</p>
<div class="sourceCode" id="cb16"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb16-1"><a href="#cb16-1" aria-hidden="true" tabindex="-1"></a>quantity dist1 <span class="op">=</span> <span class="dv">80</span> <span class="op">*</span> km;</span>
<span id="cb16-2"><a href="#cb16-2" aria-hidden="true" tabindex="-1"></a>quantity dist2 <span class="op">=</span> <span class="dv">105</span> <span class="op">*</span> km;</span>
<span id="cb16-3"><a href="#cb16-3" aria-hidden="true" tabindex="-1"></a>quantity duration <span class="op">=</span> <span class="dv">2</span> <span class="op">*</span> h;</span>
<span id="cb16-4"><a href="#cb16-4" aria-hidden="true" tabindex="-1"></a>quantity speed_limit <span class="op">=</span> <span class="dv">100</span> <span class="op">*</span> km <span class="op">/</span> h;</span>
<span id="cb16-5"><a href="#cb16-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb16-6"><a href="#cb16-6" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> <span class="op">((</span>dist1 <span class="op">+</span> dist2<span class="op">)</span> <span class="op">/</span> duration <span class="op">&lt;</span> speed_limit<span class="op">)</span></span>
<span id="cb16-7"><a href="#cb16-7" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="st">&quot;Thanks for driving within the speed limit of &quot;</span> <span class="op">&lt;&lt;</span> speed_limit <span class="op">&lt;&lt;</span> <span class="st">&quot; :-)</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb16-8"><a href="#cb16-8" aria-hidden="true" tabindex="-1"></a><span class="cf">else</span></span>
<span id="cb16-9"><a href="#cb16-9" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Slow down! The speed limit here is {}!&quot;</span>, speed_limit<span class="op">)</span>;</span></code></pre></div>
<p>The above prints:</p>
<pre class="text"><code>Thanks for driving within the speed limit of 100 km/h :-)</code></pre>
<h4 data-number="11.1.2.1" id="unit-conversions"><span class="header-section-number">11.1.2.1</span> Unit conversions<a href="#unit-conversions" class="self-link"></a></h4>
<p>If we want to change the unit of a current quantity, we can use <code class="sourceCode cpp"><span class="op">.</span>in<span class="op">(</span>Unit<span class="op">)</span></code>
member function:</p>
<div class="sourceCode" id="cb17"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="st">&quot;The total distance in meters is &quot;</span> <span class="op">&lt;&lt;</span> <span class="op">(</span>dist1 <span class="op">+</span> dist2<span class="op">).</span>in<span class="op">(</span>m<span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span></code></pre></div>
<p>The <code class="sourceCode cpp"><span class="op">.</span>in</code>
utility has safety mechanisms to prevent accidentally losing precision.
For example, we could try doing the same thing to express
<code class="sourceCode cpp">speed_limit</code> in
<code class="sourceCode cpp">m<span class="op">/</span>s</code>, which
is equivalent to multiplying the underlying value by the non-integer
factor <span class="math inline">\(5 / 18\)</span>:</p>
<div class="sourceCode" id="cb18"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb18-1"><a href="#cb18-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="st">&quot;The speed limit in m/s is &quot;</span> <span class="op">&lt;&lt;</span> speed_limit<span class="op">.</span>in<span class="op">(</span>m <span class="op">/</span> s<span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb18-2"><a href="#cb18-2" aria-hidden="true" tabindex="-1"></a><span class="co">// Compiler error!  Does not work.</span></span></code></pre></div>
<p>However, scaling an integral type by a rational or irrational factor
is considered not value-preserving. To force such a conversion, we can
use either a <code class="sourceCode cpp"><span class="op">.</span>force_in<span class="op">(</span>Unit<span class="op">)</span></code>
member function or an explicit <code class="sourceCode cpp">value_cast<span class="op">&lt;</span>Unit<span class="op">&gt;(</span>Quantity<span class="op">)</span></code>.</p>
<div class="sourceCode" id="cb19"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="st">&quot;The speed limit in m/s is &quot;</span> <span class="op">&lt;&lt;</span> speed_limit<span class="op">.</span>force_in<span class="op">(</span>m <span class="op">/</span> s<span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb19-2"><a href="#cb19-2" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="st">&quot;The speed limit in m/s is &quot;</span> <span class="op">&lt;&lt;</span> value_cast<span class="op">&lt;</span>m <span class="op">/</span> s<span class="op">&gt;(</span>speed_limit<span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span></code></pre></div>
<p>We will get a truncated value of <code class="sourceCode cpp"><span class="dv">27</span> m<span class="op">/</span>s</code>
in both cases.</p>
<p>To prevent truncation, we must explicitly change the quantity
representation type to a value-preserving one with <code class="sourceCode cpp">value_cast<span class="op">&lt;</span>Representation<span class="op">&gt;(</span>Quantity<span class="op">)</span></code>
or <code class="sourceCode cpp"><span class="op">.</span>in<span class="op">&lt;</span>Representation<span class="op">&gt;()</span></code>
overload. For example:</p>
<div class="sourceCode" id="cb20"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb20-1"><a href="#cb20-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="st">&quot;The speed limit in m/s is &quot;</span> <span class="op">&lt;&lt;</span> value_cast<span class="op">&lt;</span><span class="dt">double</span><span class="op">&gt;(</span>speed_limit<span class="op">).</span>in<span class="op">(</span>m <span class="op">/</span> s<span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb20-2"><a href="#cb20-2" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="st">&quot;The speed limit in m/s is &quot;</span> <span class="op">&lt;&lt;</span> speed_limit<span class="op">.</span>in<span class="op">&lt;</span><span class="dt">double</span><span class="op">&gt;(</span>m <span class="op">/</span> s<span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span></code></pre></div>
<p>This time, we will see the following in the text output:</p>
<pre class="text"><code>The speed limit in m/s is 27.7778 m/s</code></pre>
<p>More details about conversions can be found in the <a href="#safe-unit-conversions">Safe unit conversions</a> and <a href="#preventing-truncation-of-data">Preventing truncation of data</a>
chapters.</p>
<h4 data-number="11.1.2.2" id="obtaining-a-numerical-value-of-a-quantity"><span class="header-section-number">11.1.2.2</span> Obtaining a numerical
value of a quantity<a href="#obtaining-a-numerical-value-of-a-quantity" class="self-link"></a></h4>
<p>Last but not least, if we need to obtain the numerical value of a
quantity and pass it to some the legacy unsafe interface, we can use
either <code class="sourceCode cpp"><span class="op">.</span>numerical_value_in<span class="op">(</span>Unit<span class="op">)</span></code>
or <code class="sourceCode cpp"><span class="op">.</span>force_numerical_value_in<span class="op">(</span>Unit<span class="op">)</span></code>
member functions:</p>
<div class="sourceCode" id="cb21"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> legacy_check_speed_limit<span class="op">(</span><span class="dt">int</span> speed_in_km_per_h<span class="op">)</span>;</span></code></pre></div>
<div class="sourceCode" id="cb22"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb22-1"><a href="#cb22-1" aria-hidden="true" tabindex="-1"></a>legacy_check_speed_limit<span class="op">(((</span>dist1 <span class="op">+</span> dist2<span class="op">)</span> <span class="op">/</span> duration<span class="op">).</span>numerical_value_in<span class="op">(</span>km <span class="op">/</span> h<span class="op">))</span>;</span></code></pre></div>
<p>Such a getter will explicitly enforce the usage of a correct unit
required by the underlying interface, which reduces a significant number
of safety-related issues.</p>
<p><code class="sourceCode cpp">numerical_value_in<span class="op">(</span>Unit<span class="op">)</span></code>
always returns by value as a quantity value conversion may be required
to adjust to the target unit. In case a user needs a reference to the
underlying storage <code class="sourceCode cpp"><span class="op">.</span>numerical_value_ref_in<span class="op">(</span>Unit<span class="op">)</span></code>
should be used:</p>
<div class="sourceCode" id="cb23"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> legacy_set_speed_limit<span class="op">(</span><span class="dt">int</span><span class="op">*</span> speed_in_km_per_h<span class="op">)</span> <span class="op">{</span> <span class="op">*</span>speed_in_km_per_h <span class="op">=</span> <span class="dv">100</span>; <span class="op">}</span></span></code></pre></div>
<div class="sourceCode" id="cb24"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb24-1"><a href="#cb24-1" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>km <span class="op">/</span> h, <span class="dt">int</span><span class="op">&gt;</span> speed_limit;</span>
<span id="cb24-2"><a href="#cb24-2" aria-hidden="true" tabindex="-1"></a>legacy_set_speed_limit<span class="op">(&amp;</span>speed_limit<span class="op">.</span>numerical_value_ref_in<span class="op">(</span>km <span class="op">/</span> h<span class="op">))</span>;</span></code></pre></div>
<p>This member function again requires a target unit to enforce safety.
This overload does not participate in overload resolution if the
provided unit has a different scaling factor than the current one.</p>
<p>Please refer to the <a href="#safe-quantity-numerical-value-getters">Safe quantity numerical
value getters</a> chapter for more details on this subject.</p>
<h2 data-number="11.2" id="typed-quantities-safer-mode"><span class="header-section-number">11.2</span> Typed quantities (safer
mode)<a href="#typed-quantities-safer-mode" class="self-link"></a></h2>
<p>Simple mode is all about and just about units. In case we care about
a specific quantity type, typed quantities should be preferred. Those
store information not only about a unit but also about a specific
quantity type we want to model.</p>
<p>There a few ways to obtain such a quantity:</p>
<div class="sourceCode" id="cb25"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb25-1"><a href="#cb25-1" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>m<span class="op">]</span>, <span class="dt">int</span><span class="op">&gt;</span> q1 <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> m;</span>
<span id="cb25-2"><a href="#cb25-2" aria-hidden="true" tabindex="-1"></a>quantity q2<span class="op">{</span><span class="dv">42</span>, isq<span class="op">::</span>height<span class="op">[</span>m<span class="op">]}</span>;</span>
<span id="cb25-3"><a href="#cb25-3" aria-hidden="true" tabindex="-1"></a>quantity q3 <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> isq<span class="op">::</span>height<span class="op">[</span>m<span class="op">]</span>;</span>
<span id="cb25-4"><a href="#cb25-4" aria-hidden="true" tabindex="-1"></a>quantity q4 <span class="op">=</span> isq<span class="op">::</span>height<span class="op">(</span><span class="dv">42</span> <span class="op">*</span> m<span class="op">)</span>;</span></code></pre></div>
<p>All of the above cases use a slightly different approach to get the
quantity, but all of them result in exactly the same
<code class="sourceCode cpp">quantity</code> class template
instantiation.</p>
<p>In the above examples, an expression of <code class="sourceCode cpp">isq<span class="op">::</span>height<span class="op">[</span>m<span class="op">]</span></code>
is called a quantity reference and results in <code class="sourceCode cpp">reference<span class="op">&lt;</span>isq<span class="op">::</span>height, si<span class="op">::</span>metre<span class="op">&gt;</span></code>
class template instantiation.</p>
<p><em>Note: The identifier
<code class="sourceCode cpp">reference</code> is being used in the <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> library but definitely will
need bikeshedding during the standardization process.</em></p>
<p>More about typed quantities can be found in the following
chapters:</p>
<ul>
<li><a href="#why-do-we-need-typed-quantities">Why do we need typed
quantities?</a> provides a detailed rationale.</li>
<li><a href="#systems-of-quantities">Systems of quantities</a> describes
their conversion and arithmetic rules.</li>
<li><a href="#constraining-a-derived-unit-to-work-only-with-a-specific-derived-quantity">Constraining
a derived unit to work only with a specific derived quantity</a>
provides a solution to the problem of units of quantities different
kinds but the same dimension.</li>
<li><a href="#quantity-kinds-improve-safety">Quantity kinds improve
safety</a> and <a href="#additional-safety-introduced-by-modeling-various-quantities-of-the-same-kind">Additional
safety introduced by modeling various quantities of the same kind</a>
discuss the safety benefits of quantity kinds.</li>
<li><a href="#limitations-of-systems-of-quantities">Limitations of
systems of quantities</a> discusses cases that can’t be addressed with
the current design of systems of quantities.</li>
</ul>
<h2 data-number="11.3" id="generic-interfaces"><span class="header-section-number">11.3</span> Generic interfaces<a href="#generic-interfaces" class="self-link"></a></h2>
<p>Using a concrete unit in the interface often has a lot of sense. It
is especially useful if we store the data internally in the object. In
such a case, we have to select a specific unit anyway.</p>
<p>For example, let’s consider a simple storage tank:</p>
<div class="sourceCode" id="cb26"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb26-1"><a href="#cb26-1" aria-hidden="true" tabindex="-1"></a><span class="kw">class</span> StorageTank <span class="op">{</span></span>
<span id="cb26-2"><a href="#cb26-2" aria-hidden="true" tabindex="-1"></a>  quantity<span class="op">&lt;</span>horizontal_area<span class="op">[</span>m2<span class="op">]&gt;</span> base_;</span>
<span id="cb26-3"><a href="#cb26-3" aria-hidden="true" tabindex="-1"></a>  quantity<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>m<span class="op">]&gt;</span> height_;</span>
<span id="cb26-4"><a href="#cb26-4" aria-hidden="true" tabindex="-1"></a>  quantity<span class="op">&lt;</span>isq<span class="op">::</span>mass_density<span class="op">[</span>kg <span class="op">/</span> m3<span class="op">]&gt;</span> density_ <span class="op">=</span> air_density;</span>
<span id="cb26-5"><a href="#cb26-5" aria-hidden="true" tabindex="-1"></a><span class="kw">public</span><span class="op">:</span></span>
<span id="cb26-6"><a href="#cb26-6" aria-hidden="true" tabindex="-1"></a>  <span class="kw">constexpr</span> StorageTank<span class="op">(</span><span class="kw">const</span> quantity<span class="op">&lt;</span>horizontal_area<span class="op">[</span>m2<span class="op">]&gt;&amp;</span> base, <span class="kw">const</span> quantity<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>m<span class="op">]&gt;&amp;</span> height<span class="op">)</span> <span class="op">:</span></span>
<span id="cb26-7"><a href="#cb26-7" aria-hidden="true" tabindex="-1"></a>      base_<span class="op">(</span>base<span class="op">)</span>, height_<span class="op">(</span>height<span class="op">)</span></span>
<span id="cb26-8"><a href="#cb26-8" aria-hidden="true" tabindex="-1"></a>  <span class="op">{</span></span>
<span id="cb26-9"><a href="#cb26-9" aria-hidden="true" tabindex="-1"></a>  <span class="op">}</span></span>
<span id="cb26-10"><a href="#cb26-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb26-11"><a href="#cb26-11" aria-hidden="true" tabindex="-1"></a>  <span class="co">// ...</span></span>
<span id="cb26-12"><a href="#cb26-12" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span></code></pre></div>
<p>As the quantities provided in the function’s interface are then
stored in the class, there is probably no sense in using generic
interfaces here.</p>
<h3 data-number="11.3.1" id="the-issues-with-unit-specific-interfaces"><span class="header-section-number">11.3.1</span> The issues with
unit-specific interfaces<a href="#the-issues-with-unit-specific-interfaces" class="self-link"></a></h3>
<p>However, in many cases, using a specific unit in the interface is
counterproductive. Let’s consider the following function:</p>
<div class="sourceCode" id="cb27"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb27-1"><a href="#cb27-1" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>km <span class="op">/</span> h<span class="op">&gt;</span> avg_speed<span class="op">(</span>quantity<span class="op">&lt;</span>km<span class="op">&gt;</span> distance, quantity<span class="op">&lt;</span>h<span class="op">&gt;</span> duration<span class="op">)</span></span>
<span id="cb27-2"><a href="#cb27-2" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb27-3"><a href="#cb27-3" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> distance <span class="op">/</span> duration;</span>
<span id="cb27-4"><a href="#cb27-4" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>Everything seems fine for now. It also works great if we call it
with:</p>
<div class="sourceCode" id="cb28"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb28-1"><a href="#cb28-1" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>km <span class="op">/</span> h<span class="op">&gt;</span> s1 <span class="op">=</span> avg_speed<span class="op">(</span><span class="dv">220</span> <span class="op">*</span> km, <span class="dv">2</span> <span class="op">*</span> h<span class="op">)</span>;</span></code></pre></div>
<p>However, if the user starts doing the following:</p>
<div class="sourceCode" id="cb29"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb29-1"><a href="#cb29-1" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>mi <span class="op">/</span> h<span class="op">&gt;</span> s2 <span class="op">=</span> avg_speed<span class="op">(</span><span class="dv">140</span> <span class="op">*</span> mi, <span class="dv">2</span> <span class="op">*</span> h<span class="op">)</span>;</span>
<span id="cb29-2"><a href="#cb29-2" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>m <span class="op">/</span> s<span class="op">&gt;</span> s3 <span class="op">=</span> avg_speed<span class="op">(</span><span class="dv">20</span> <span class="op">*</span> m, <span class="dv">2</span> <span class="op">*</span> s<span class="op">)</span>;</span></code></pre></div>
<p>some issues start to be clearly visible:</p>
<ol type="1">
<li><p>The arguments must be converted to units mandated by the
function’s parameters at each call. This involves potentially expensive
multiplication/division operations at runtime.</p></li>
<li><p>After the function returns the speed in a unit of
<code class="sourceCode cpp">km<span class="op">/</span>h</code>,
another potentially expensive multiplication/division operations have to
be performed to convert the resulting quantity into a unit being the
derived unit of the initial function’s arguments.</p></li>
<li><p>Besides the obvious runtime cost, some unit conversions may
result in a data truncation, which means that the result will not be
exactly equal to a direct division of the function’s arguments.</p></li>
<li><p>We have to use a floating-point representation type (the
<code class="sourceCode cpp">quantity</code> class template by default
uses <code class="sourceCode cpp"><span class="dt">double</span></code>
as a representation type) which is considered value preserving. Trying
to use an integral type in this scenario will work only for
<code class="sourceCode cpp">s1</code>, while
<code class="sourceCode cpp">s2</code> and
<code class="sourceCode cpp">s3</code> will fail to compile. Failing to
compile is a good thing here as the library tries to prevent the user
from doing a clearly wrong thing. To make the code compile, the user
needs to use dedicated <code class="sourceCode cpp">value_cast</code> or
<code class="sourceCode cpp">force_in</code> like this:</p>
<div class="sourceCode" id="cb30"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb30-1"><a href="#cb30-1" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>mi <span class="op">/</span> h<span class="op">&gt;</span> s2 <span class="op">=</span> avg_speed<span class="op">(</span>value_cast<span class="op">&lt;</span>km<span class="op">&gt;(</span><span class="dv">140</span> <span class="op">*</span> mi<span class="op">)</span>, <span class="dv">2</span> <span class="op">*</span> h<span class="op">)</span>;</span>
<span id="cb30-2"><a href="#cb30-2" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>m <span class="op">/</span> s<span class="op">&gt;</span> s3 <span class="op">=</span> avg_speed<span class="op">((</span><span class="dv">20</span> <span class="op">*</span> m<span class="op">).</span>force_in<span class="op">(</span>km<span class="op">)</span>, <span class="op">(</span><span class="dv">2</span> <span class="op">*</span> s<span class="op">).</span>force_in<span class="op">(</span>h<span class="op">))</span>;</span></code></pre></div>
<p>But the above will obviously provide an incorrect behavior (e.g.,
division by
<code class="sourceCode cpp"><span class="dv">0</span></code> in the
evaluation of <code class="sourceCode cpp">s3</code>).</p></li>
</ol>
<h3 data-number="11.3.2" id="constraining-function-parameters-with-concepts"><span class="header-section-number">11.3.2</span> Constraining function
parameters with concepts<a href="#constraining-function-parameters-with-concepts" class="self-link"></a></h3>
<p>Much better generic code can be implemented using basic concepts
provided with the library:</p>
<div class="sourceCode" id="cb31"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb31-1"><a href="#cb31-1" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> avg_speed<span class="op">(</span>QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">&gt;</span> <span class="kw">auto</span> distance,</span>
<span id="cb31-2"><a href="#cb31-2" aria-hidden="true" tabindex="-1"></a>               QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>time<span class="op">&gt;</span> <span class="kw">auto</span> duration<span class="op">)</span></span>
<span id="cb31-3"><a href="#cb31-3" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb31-4"><a href="#cb31-4" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> isq<span class="op">::</span>speed<span class="op">(</span>distance <span class="op">/</span> duration<span class="op">)</span>;</span>
<span id="cb31-5"><a href="#cb31-5" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>This explicitly states that the arguments passed by the user must not
only satisfy a <a href="#Quantity-concept"><code class="sourceCode cpp">Quantity</code></a>
concept, but also that their quantity specification must be implicitly
convertible to
<code class="sourceCode cpp">isq<span class="op">::</span>length</code>
and
<code class="sourceCode cpp">isq<span class="op">::</span>time</code>,
respectively. This no longer leaves room for error while still allowing
the compiler to generate the most efficient code.</p>
<p>Please, note that now it is safe just to use integral types all the
way, which again improves the runtime performance as the
multiplication/division operations are often faster on integral rather
than floating-point types.</p>
<h3 data-number="11.3.3" id="constraining-the-function-return-type"><span class="header-section-number">11.3.3</span> Constraining the function
return type<a href="#constraining-the-function-return-type" class="self-link"></a></h3>
<p>The above function template resolves all of the issues described
before. However, we can do even better here by additionally constraining
the return type:</p>
<div class="sourceCode" id="cb32"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb32-1"><a href="#cb32-1" aria-hidden="true" tabindex="-1"></a>QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>speed<span class="op">&gt;</span> <span class="kw">auto</span> avg_speed<span class="op">(</span>QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">&gt;</span> <span class="kw">auto</span> distance,</span>
<span id="cb32-2"><a href="#cb32-2" aria-hidden="true" tabindex="-1"></a>                                      QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>time<span class="op">&gt;</span> <span class="kw">auto</span> duration<span class="op">)</span></span>
<span id="cb32-3"><a href="#cb32-3" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb32-4"><a href="#cb32-4" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> isq<span class="op">::</span>speed<span class="op">(</span>distance <span class="op">/</span> duration<span class="op">)</span>;</span>
<span id="cb32-5"><a href="#cb32-5" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>Doing so has two important benefits:</p>
<ol type="1">
<li>It informs the users of our interface about what to expect to be the
result of a function invocation. It is superior to just returning
<code class="sourceCode cpp"><span class="kw">auto</span></code>, which
does not provide any hint about the thing being returned there.</li>
<li>Such a concept constrains the type returned from the function. This
means that it works as a unit test to verify if our function actually
performs what it is supposed to do. If there is an error in the quantity
equation, we will learn about it right away.</li>
</ol>
<h3 data-number="11.3.4" id="constraining-a-variable-on-the-stack"><span class="header-section-number">11.3.4</span> Constraining a variable on
the stack<a href="#constraining-a-variable-on-the-stack" class="self-link"></a></h3>
<p>If we know exactly what the function does in its internals and if we
know the exact argument types passed to such a function, we often know
the exact type that will be returned from its invocation.</p>
<p>However, if we care about performance, we should often use the
generic interfaces described in this chapter. A side effect is that we
sometimes are unsure about the return type. Even if we know it today, it
might change a week from now due to some code refactoring.</p>
<p>In such cases, we can again use
<code class="sourceCode cpp"><span class="kw">auto</span></code> to
denote the type:</p>
<div class="sourceCode" id="cb33"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb33-1"><a href="#cb33-1" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> s1 <span class="op">=</span> avg_speed<span class="op">(</span><span class="dv">220</span> <span class="op">*</span> km, <span class="dv">2</span> <span class="op">*</span> h<span class="op">)</span>;</span>
<span id="cb33-2"><a href="#cb33-2" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> s2 <span class="op">=</span> avg_speed<span class="op">(</span><span class="dv">140</span> <span class="op">*</span> mi, <span class="dv">2</span> <span class="op">*</span> h<span class="op">)</span>;</span>
<span id="cb33-3"><a href="#cb33-3" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> s3 <span class="op">=</span> avg_speed<span class="op">(</span><span class="dv">20</span> <span class="op">*</span> m, <span class="dv">2</span> <span class="op">*</span> s<span class="op">)</span>;</span></code></pre></div>
<p>In this case, it is probably OK to do so as the
<code class="sourceCode cpp">avg_speed</code> function name explicitly
provides the information on what to expect as a result.</p>
<p>In other scenarios where the returned quantity type is not so
obvious, it is again helpful to constrain the type with a concept like
so:</p>
<div class="sourceCode" id="cb34"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb34-1"><a href="#cb34-1" aria-hidden="true" tabindex="-1"></a>QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>speed<span class="op">&gt;</span> <span class="kw">auto</span> s1 <span class="op">=</span> avg_speed<span class="op">(</span><span class="dv">220</span> <span class="op">*</span> km, <span class="dv">2</span> <span class="op">*</span> h<span class="op">)</span>;</span>
<span id="cb34-2"><a href="#cb34-2" aria-hidden="true" tabindex="-1"></a>QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>speed<span class="op">&gt;</span> <span class="kw">auto</span> s2 <span class="op">=</span> avg_speed<span class="op">(</span><span class="dv">140</span> <span class="op">*</span> mi, <span class="dv">2</span> <span class="op">*</span> h<span class="op">)</span>;</span>
<span id="cb34-3"><a href="#cb34-3" aria-hidden="true" tabindex="-1"></a>QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>speed<span class="op">&gt;</span> <span class="kw">auto</span> s3 <span class="op">=</span> avg_speed<span class="op">(</span><span class="dv">20</span> <span class="op">*</span> m, <span class="dv">2</span> <span class="op">*</span> s<span class="op">)</span>;</span></code></pre></div>
<p>Again, this explicitly provides additional information about the
quantity we are dealing with in the code, and it serves as a unit test
checking if the “thing” returned from a function is actually what we
expected here.</p>
<h2 data-number="11.4" id="the-affine-space"><span class="header-section-number">11.4</span> The affine space<a href="#the-affine-space" class="self-link"></a></h2>
<p>The affine space has two types of entities:</p>
<ul>
<li><strong><em>point</em></strong> - a position specified with
coordinate values (e.g., location, address, etc.)</li>
<li><strong><em>displacement vector</em></strong> - the difference
between two points (e.g., shift, offset, displacement, duration,
etc.)</li>
</ul>
<p>The <em>displacement vector</em> described here is specific to the
affine space theory and is not the same thing as the quantity of a
vector character that we discuss later (although, in some cases, those
terms may overlap).</p>
<p>In the following subchapters, we will often refer to <em>displacement
vectors</em> simply as <em>vectors</em> for brevity.</p>
<h3 data-number="11.4.1" id="operations-in-the-affine-space"><span class="header-section-number">11.4.1</span> Operations in the affine
space<a href="#operations-in-the-affine-space" class="self-link"></a></h3>
<p>Here are the primary operations one can do in the affine space:</p>
<ul>
<li><em>vector</em> + <em>vector</em> -&gt; <em>vector</em></li>
<li><em>vector</em> - <em>vector</em> -&gt; <em>vector</em></li>
<li>-<em>vector</em> -&gt; <em>vector</em></li>
<li><em>vector</em> * scalar -&gt; <em>vector</em></li>
<li>scalar * <em>vector</em> -&gt; <em>vector</em></li>
<li><em>vector</em> / scalar -&gt; <em>vector</em></li>
<li><em>point</em> - <em>point</em> -&gt; <em>vector</em></li>
<li><em>point</em> + <em>vector</em> -&gt; <em>point</em></li>
<li><em>vector</em> + <em>point</em> -&gt; <em>point</em></li>
<li><em>point</em> - <em>vector</em> -&gt; <em>point</em></li>
</ul>
<p>It is not possible to:</p>
<ul>
<li>add two <em>points</em>,</li>
<li>subtract a <em>point</em> from a <em>vector</em>,</li>
<li>multiply nor divide <em>points</em> with anything else.</li>
</ul>
<h3 data-number="11.4.2" id="points-are-more-common-than-most-of-us-imagine"><span class="header-section-number">11.4.2</span> <em>Points</em> are more
common than most of us imagine<a href="#points-are-more-common-than-most-of-us-imagine" class="self-link"></a></h3>
<p><em>Point</em> abstractions should be used more often in the C++
software. They are not only about <em>temperature</em> or <em>time</em>.
<em>Points</em> are everywhere around us and should become more popular
in the products we implement. They can be used to implement:</p>
<ul>
<li><em>temperature</em> points,</li>
<li>timestamps,</li>
<li>daily <em>mass</em> readouts from the scale,</li>
<li><em>altitudes</em> of mountain peaks on a map,</li>
<li>current <em>path length</em> measured by the car’s odometer,</li>
<li>today’s <em>price</em> of instruments on the market,</li>
<li>and many more.</li>
</ul>
<p>Improving the affine space’s <em>Points</em> intuition will allow us
to write better and safer software.</p>
<h3 data-number="11.4.3" id="displacement-vector-is-modeled-by-quantity"><span class="header-section-number">11.4.3</span> <em>Displacement vector</em>
is modeled by <code class="sourceCode cpp">quantity</code><a href="#displacement-vector-is-modeled-by-quantity" class="self-link"></a></h3>
<p>Up until now, each time when we used a
<code class="sourceCode cpp">quantity</code> in our code, we were
modeling some kind of a difference between two things:</p>
<ul>
<li>the <em>distance</em> between two points,</li>
<li><em>duration</em> between two time points,</li>
<li>the difference in <em>speed</em> (even if relative to
<code class="sourceCode cpp"><span class="dv">0</span></code>).</li>
</ul>
<p>As we already know, a <code class="sourceCode cpp">quantity</code>
type provides all operations required for the <em>displacement
vector</em> abstraction in the affine space. It can be constructed
with:</p>
<ul>
<li>the multiply syntax which works for most of the units besides the
ones that provide a point origin in their definition (i.e., units of
temperature like <code class="sourceCode cpp">K</code>,
<code class="sourceCode cpp">deg_C</code>, and
<code class="sourceCode cpp">deg_F</code>),</li>
<li><code class="sourceCode cpp">delta<span class="op">&lt;</span>Reference<span class="op">&gt;</span></code>
construction helper (e.g., <code class="sourceCode cpp">delta<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>m<span class="op">]&gt;(</span><span class="dv">42</span><span class="op">)</span></code>,
<code class="sourceCode cpp">delta<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="dv">3</span><span class="op">)</span></code>),</li>
<li>two-parameter constructor taking a number and a quantity
reference/unit.</li>
</ul>
<p>A rationale for <code class="sourceCode cpp">delta</code> and
disabling the multiply syntax for some units can be found in the <a href="#delta-and-absolute-creation-helpers"><code class="sourceCode cpp">delta</code>
and <code class="sourceCode cpp">absolute</code> creation helpers</a>
chapter.</p>
<h3 data-number="11.4.4" id="point-is-modeled-by-quantity_point-and-pointorigin"><span class="header-section-number">11.4.4</span> <em>Point</em> is modeled by
<code class="sourceCode cpp">quantity_point</code> and
<code class="sourceCode cpp">PointOrigin</code><a href="#point-is-modeled-by-quantity_point-and-pointorigin" class="self-link"></a></h3>
<p>In the library, the <em>point</em> abstraction is modeled by:</p>
<ul>
<li>the <a href="#PointOrigin-concept"><code class="sourceCode cpp">PointOrigin</code></a>
concept that specifies a measurement’s origin, and</li>
<li>the <code class="sourceCode cpp">quantity_point</code> class
template that specifies a <em>point</em> relative to a predefined
origin.</li>
</ul>
<h4 data-number="11.4.4.1" id="quantity_point"><span class="header-section-number">11.4.4.1</span>
<code class="sourceCode cpp">quantity_point</code><a href="#quantity_point" class="self-link"></a></h4>
<p>The <code class="sourceCode cpp">quantity_point</code> class template
specifies an absolute quantity measured from a predefined origin:</p>
<div class="sourceCode" id="cb35"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb35-1"><a href="#cb35-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>Reference <span class="kw">auto</span> R,</span>
<span id="cb35-2"><a href="#cb35-2" aria-hidden="true" tabindex="-1"></a>         PointOriginFor<span class="op">&lt;</span>get_quantity_spec<span class="op">(</span>R<span class="op">)&gt;</span> <span class="kw">auto</span> PO <span class="op">=</span> default_point_origin<span class="op">(</span>R<span class="op">)</span>,</span>
<span id="cb35-3"><a href="#cb35-3" aria-hidden="true" tabindex="-1"></a>         RepresentationOf<span class="op">&lt;</span>get_quantity_spec<span class="op">(</span>R<span class="op">)&gt;</span> Rep <span class="op">=</span> <span class="dt">double</span><span class="op">&gt;</span></span>
<span id="cb35-4"><a href="#cb35-4" aria-hidden="true" tabindex="-1"></a><span class="kw">class</span> quantity_point;</span></code></pre></div>
<p>As we can see above, the
<code class="sourceCode cpp">quantity_point</code> class template
exposes one additional parameter compared to
<code class="sourceCode cpp">quantity</code>. The
<code class="sourceCode cpp">PO</code> parameter satisfies a <a href="#PointOriginFor-concept"><code class="sourceCode cpp">PointOriginFor</code></a>
concept and specifies the origin of our measurement scale.</p>
<p>Each <code class="sourceCode cpp">quantity_point</code> internally
stores a <code class="sourceCode cpp">quantity</code> object, which
represents a <em>displacement vector</em> from the predefined origin.
Thanks to this, an instantiation of a
<code class="sourceCode cpp">quantity_point</code> can be considered as
a model of a vector space from such an origin.</p>
<p>Forcing the user to manually predefine an origin for every domain may
be cumbersome and discourage users from using such abstractions at all.
This is why, by default, the <code class="sourceCode cpp">PO</code>
template parameter is initialized with the <code class="sourceCode cpp">default_point_origin<span class="op">(</span>R<span class="op">)</span></code>
that provides the quantity points’ scale zeroth point using the
following rules:</p>
<ul>
<li>if the measurement unit of a quantity specifies its point origin in
its definition (e.g., degree Celsius), then this origin is being
used,</li>
<li>otherwise, an instantiation of <code class="sourceCode cpp">zeroth_point_origin<span class="op">&lt;</span>QuantitySpec<span class="op">&gt;</span></code>
is being used which provides a well-established zeroth point for a
specific quantity type.</li>
</ul>
<p>Quantity points with default point origins may be constructed with
the <code class="sourceCode cpp">absolute</code> construction helper or
forcing an explicit conversion from the
<code class="sourceCode cpp">quantity</code>:</p>
<div class="sourceCode" id="cb36"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb36-1"><a href="#cb36-1" aria-hidden="true" tabindex="-1"></a><span class="co">// quantity_point qp1 = 42 * m;           // Compile-time error</span></span>
<span id="cb36-2"><a href="#cb36-2" aria-hidden="true" tabindex="-1"></a><span class="co">// quantity_point qp2 = 42 * K;           // Compile-time error</span></span>
<span id="cb36-3"><a href="#cb36-3" aria-hidden="true" tabindex="-1"></a><span class="co">// quantity_point qp3 = delta&lt;deg_C&gt;(42); // Compile-time error</span></span>
<span id="cb36-4"><a href="#cb36-4" aria-hidden="true" tabindex="-1"></a>quantity_point qp4<span class="op">(</span><span class="dv">42</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb36-5"><a href="#cb36-5" aria-hidden="true" tabindex="-1"></a>quantity_point qp5<span class="op">(</span><span class="dv">42</span> <span class="op">*</span> K<span class="op">)</span>;</span>
<span id="cb36-6"><a href="#cb36-6" aria-hidden="true" tabindex="-1"></a>quantity_point qp6<span class="op">(</span>delta<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="dv">42</span><span class="op">))</span>;</span>
<span id="cb36-7"><a href="#cb36-7" aria-hidden="true" tabindex="-1"></a>quantity_point qp7 <span class="op">=</span> absolute<span class="op">&lt;</span>m<span class="op">&gt;(</span><span class="dv">42</span><span class="op">)</span>;</span>
<span id="cb36-8"><a href="#cb36-8" aria-hidden="true" tabindex="-1"></a>quantity_point qp8 <span class="op">=</span> absolute<span class="op">&lt;</span>K<span class="op">&gt;(</span><span class="dv">42</span><span class="op">)</span>;</span>
<span id="cb36-9"><a href="#cb36-9" aria-hidden="true" tabindex="-1"></a>quantity_point qp9 <span class="op">=</span> absolute<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="dv">42</span><span class="op">)</span>;</span></code></pre></div>
<h4 data-number="11.4.4.2" id="zeroth_point_originquantityspec"><span class="header-section-number">11.4.4.2</span> <code class="sourceCode cpp">zeroth_point_origin<span class="op">&lt;</span>QuantitySpec<span class="op">&gt;</span></code><a href="#zeroth_point_originquantityspec" class="self-link"></a></h4>
<p><code class="sourceCode cpp">zeroth_point_origin<span class="op">&lt;</span>QuantitySpec<span class="op">&gt;</span></code>
is meant to be used in cases where the specific domain has a
well-established, non-controversial, and unique zeroth point on the
measurement scale. This saves the user from the need to write a
boilerplate code that would predefine such a type for this domain.</p>
<p><img src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgoKPHN2ZwogICB3aWR0aD0iOTYuNTE5NDQ3bW0iCiAgIGhlaWdodD0iMTguOTc3NTA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7ZmlsbC1vcGFjaXR5OjAuOTYwNzg0Oy1pbmtzY2FwZS1zdHJva2U6bm9uZSIKICAgICAgICAgZD0ibSAzOS4xMDc0MjIsOTguOTQ3MjY2IHYgMC4yNSBoIDU1LjAwNzgxMiB2IC0wLjI1IHoiCiAgICAgICAgIGlkPSJwYXRoNTctOCIgLz4KICAgICAgPGcKICAgICAgICAgaWQ9Imc1NS00Ij4KICAgICAgICA8cGF0aAogICAgICAgICAgIHN0eWxlPSJjb2xvcjojMDAwMDAwO2ZpbGw6I2E0YTRhNDstaW5rc2NhcGUtc3Ryb2tlOm5vbmUiCiAgICAgICAgICAgZD0ibSA5Mi44MjAzMTIsOTguMTY0MDYyIC0wLjE1ODIwMywwLjMxNjQwNyAxLjE4MzU5NCwwLjU5MTc5NyAtMS4xODM1OTQsMC41OTE3OTYgMC4xNTgyMDMsMC4zMTY0MDcgMS44MTY0MDcsLTAuOTA4MjAzIHoiCiAgICAgICAgICAgaWQ9InBhdGg1NS05IiAvPgogICAgICA8L2c+CiAgICA8L2c+CiAgPC9nPgo8L3N2Zz4K" style="display: block; margin-left: auto; margin-right: auto; width: 80%;" /></p>
<div class="sourceCode" id="cb37"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb37-1"><a href="#cb37-1" aria-hidden="true" tabindex="-1"></a>quantity_point<span class="op">&lt;</span>isq<span class="op">::</span>distance<span class="op">[</span>si<span class="op">::</span>metre<span class="op">]&gt;</span> qp1<span class="op">(</span><span class="dv">100</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb37-2"><a href="#cb37-2" aria-hidden="true" tabindex="-1"></a>quantity_point<span class="op">&lt;</span>isq<span class="op">::</span>distance<span class="op">[</span>si<span class="op">::</span>metre<span class="op">]&gt;</span> qp2 <span class="op">=</span> absolute<span class="op">&lt;</span>m<span class="op">&gt;(</span><span class="dv">120</span><span class="op">)</span>;</span>
<span id="cb37-3"><a href="#cb37-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb37-4"><a href="#cb37-4" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp1<span class="op">.</span>quantity_from_zero<span class="op">()</span> <span class="op">==</span> <span class="dv">100</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb37-5"><a href="#cb37-5" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2<span class="op">.</span>quantity_from_zero<span class="op">()</span> <span class="op">==</span> <span class="dv">120</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb37-6"><a href="#cb37-6" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2<span class="op">.</span>quantity_from<span class="op">(</span>qp1<span class="op">)</span> <span class="op">==</span> <span class="dv">20</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb37-7"><a href="#cb37-7" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp1<span class="op">.</span>quantity_from<span class="op">(</span>qp2<span class="op">)</span> <span class="op">==</span> <span class="op">-</span><span class="dv">20</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb37-8"><a href="#cb37-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb37-9"><a href="#cb37-9" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2 <span class="op">-</span> qp1 <span class="op">==</span> <span class="dv">20</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb37-10"><a href="#cb37-10" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp1 <span class="op">-</span> qp2 <span class="op">==</span> <span class="op">-</span><span class="dv">20</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb37-11"><a href="#cb37-11" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb37-12"><a href="#cb37-12" aria-hidden="true" tabindex="-1"></a><span class="co">// auto res = qp1 + qp2;   // Compile-time error</span></span></code></pre></div>
<p>In the above code <code class="sourceCode cpp"><span class="dv">100</span> <span class="op">*</span> m</code>
and <code class="sourceCode cpp"><span class="dv">120</span> <span class="op">*</span> m</code>
still create two quantities that serve as <em>displacement vectors</em>
here. Quantity point objects can be explicitly constructed from such
quantities only when their origin is an instantiation of the <code class="sourceCode cpp">zeroth_point_origin<span class="op">&lt;</span>QuantitySpec<span class="op">&gt;</span></code>.</p>
<p>It is really important to understand that even though we can use
<code class="sourceCode cpp"><span class="op">.</span>quantity_from_zero<span class="op">()</span></code>
to obtain the <em>displacement vector</em> of a point from the origin,
the point by itself does not represent or have any associated physical
value. It is just a point in some space. The same point can be expressed
with different <em>displacement vectors</em> from different origins.</p>
<p>It is also worth mentioning that simplicity comes with a safety cost
here. For some users, it might be surprising that the usage of <code class="sourceCode cpp">zeroth_point_origin<span class="op">&lt;</span>QuantitySpec<span class="op">&gt;</span></code>
makes various quantity point objects compatible as long as quantity
types used in the origin and reference are compatible:</p>
<div class="sourceCode" id="cb38"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb38-1"><a href="#cb38-1" aria-hidden="true" tabindex="-1"></a>quantity_point<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">&gt;</span> qp1<span class="op">{</span>isq<span class="op">::</span>distance<span class="op">(</span><span class="dv">100</span> <span class="op">*</span> m<span class="op">)}</span>;</span>
<span id="cb38-2"><a href="#cb38-2" aria-hidden="true" tabindex="-1"></a>quantity_point<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">&gt;</span> qp2 <span class="op">=</span> absolute<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>m<span class="op">]&gt;(</span><span class="dv">120</span><span class="op">)</span>;</span>
<span id="cb38-3"><a href="#cb38-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb38-4"><a href="#cb38-4" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2<span class="op">.</span>quantity_from<span class="op">(</span>qp1<span class="op">)</span> <span class="op">==</span> <span class="dv">20</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb38-5"><a href="#cb38-5" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp1<span class="op">.</span>quantity_from<span class="op">(</span>qp2<span class="op">)</span> <span class="op">==</span> <span class="op">-</span><span class="dv">20</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb38-6"><a href="#cb38-6" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2 <span class="op">-</span> qp1 <span class="op">==</span> <span class="dv">20</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb38-7"><a href="#cb38-7" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp1 <span class="op">-</span> qp2 <span class="op">==</span> <span class="op">-</span><span class="dv">20</span> <span class="op">*</span> m<span class="op">)</span>;</span></code></pre></div>
<h4 data-number="11.4.4.3" id="absolute-point-origin"><span class="header-section-number">11.4.4.3</span> Absolute <em>point</em>
origin<a href="#absolute-point-origin" class="self-link"></a></h4>
<p>In cases where we want to implement an isolated independent space in
which points are not compatible with other spaces, even of the same
quantity type, we should manually predefine an absolute point
origin.</p>
<p><img src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgoKPHN2ZwogICB3aWR0aD0iOTYuNDAzMjM2bW0iCiAgIGhlaWdodD0iMTguOTA0OTM0bW0iCiAgIHZpZXdCb3g9IjAgMCA5Ni40MDMyMzYgMTguOTA0OTM0IgogICB2ZXJzaW9uPSIxLjEiCiAgIGlkPSJzdmcxIgogICB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogI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hNGE0Oy1pbmtzY2FwZS1zdHJva2U6bm9uZSIKICAgICAgICAgICBkPSJtIDkyLjgyMDMxMiw5OC4xNjQwNjIgLTAuMTU4MjAzLDAuMzE2NDA3IDEuMTgzNTk0LDAuNTkxNzk3IC0xLjE4MzU5NCwwLjU5MTc5NiAwLjE1ODIwMywwLjMxNjQwNyAxLjgxNjQwNywtMC45MDgyMDMgeiIKICAgICAgICAgICBpZD0icGF0aDU1LTktNCIgLz4KICAgICAgPC9nPgogICAgPC9nPgogIDwvZz4KPC9zdmc+Cg==" style="display: block; margin-left: auto; margin-right: auto; width: 80%;" /></p>
<div class="sourceCode" id="cb39"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb39-1"><a href="#cb39-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> origin <span class="kw">final</span> <span class="op">:</span> absolute_point_origin<span class="op">&lt;</span>isq<span class="op">::</span>distance<span class="op">&gt;</span> <span class="op">{}</span> origin;</span>
<span id="cb39-2"><a href="#cb39-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb39-3"><a href="#cb39-3" aria-hidden="true" tabindex="-1"></a><span class="co">// quantity_point&lt;si::metre, origin&gt; qp1{100 * m};        // Compile-time error</span></span>
<span id="cb39-4"><a href="#cb39-4" aria-hidden="true" tabindex="-1"></a><span class="co">// quantity_point&lt;si::metre, origin&gt; qp2{delta&lt;m&gt;(120)};  // Compile-time error</span></span>
<span id="cb39-5"><a href="#cb39-5" aria-hidden="true" tabindex="-1"></a>quantity_point<span class="op">&lt;</span>si<span class="op">::</span>metre, origin<span class="op">&gt;</span> qp1 <span class="op">=</span> origin <span class="op">+</span> <span class="dv">100</span> <span class="op">*</span> m;</span>
<span id="cb39-6"><a href="#cb39-6" aria-hidden="true" tabindex="-1"></a>quantity_point<span class="op">&lt;</span>si<span class="op">::</span>metre, origin<span class="op">&gt;</span> qp2 <span class="op">=</span> <span class="dv">120</span> <span class="op">*</span> m <span class="op">+</span> origin;</span>
<span id="cb39-7"><a href="#cb39-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb39-8"><a href="#cb39-8" aria-hidden="true" tabindex="-1"></a><span class="co">// assert(qp1.quantity_from_zero() == 100 * m);   // Compile-time error</span></span>
<span id="cb39-9"><a href="#cb39-9" aria-hidden="true" tabindex="-1"></a><span class="co">// assert(qp2.quantity_from_zero() == 120 * m);   // Compile-time error</span></span>
<span id="cb39-10"><a href="#cb39-10" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp1<span class="op">.</span>quantity_from<span class="op">(</span>origin<span class="op">)</span> <span class="op">==</span> <span class="dv">100</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb39-11"><a href="#cb39-11" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2<span class="op">.</span>quantity_from<span class="op">(</span>origin<span class="op">)</span> <span class="op">==</span> <span class="dv">120</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb39-12"><a href="#cb39-12" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2<span class="op">.</span>quantity_from<span class="op">(</span>qp1<span class="op">)</span> <span class="op">==</span> <span class="dv">20</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb39-13"><a href="#cb39-13" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp1<span class="op">.</span>quantity_from<span class="op">(</span>qp2<span class="op">)</span> <span class="op">==</span> <span class="op">-</span><span class="dv">20</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb39-14"><a href="#cb39-14" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb39-15"><a href="#cb39-15" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp1 <span class="op">-</span> origin <span class="op">==</span> <span class="dv">100</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb39-16"><a href="#cb39-16" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2 <span class="op">-</span> origin <span class="op">==</span> <span class="dv">120</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb39-17"><a href="#cb39-17" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2 <span class="op">-</span> qp1 <span class="op">==</span> <span class="dv">20</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb39-18"><a href="#cb39-18" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp1 <span class="op">-</span> qp2 <span class="op">==</span> <span class="op">-</span><span class="dv">20</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb39-19"><a href="#cb39-19" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb39-20"><a href="#cb39-20" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>origin <span class="op">-</span> qp1 <span class="op">==</span> <span class="op">-</span><span class="dv">100</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb39-21"><a href="#cb39-21" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>origin <span class="op">-</span> qp2 <span class="op">==</span> <span class="op">-</span><span class="dv">120</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb39-22"><a href="#cb39-22" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb39-23"><a href="#cb39-23" aria-hidden="true" tabindex="-1"></a><span class="co">// assert(origin - origin == 0 * m);   // Compile-time error</span></span></code></pre></div>
<p>We can’t construct a quantity point directly from the quantity
anymore when a custom, named origin is used. To prevent potential safety
and maintenance issues, we always need to explicitly provide both a
compatible origin and a quantity measured from it to construct a
quantity point.</p>
<p>Said otherwise, a quantity point defined in terms of a specific
origin is the result of adding the origin and the <em>displacement
vector</em> measured from it to the point we create.</p>
<p>Similarly to quantities, if someone does not like the arithmetic way
to construct a quantity point a two-parameter constructor can be
used:</p>
<div class="sourceCode" id="cb40"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb40-1"><a href="#cb40-1" aria-hidden="true" tabindex="-1"></a>quantity_point qp1<span class="op">{</span><span class="dv">100</span> <span class="op">*</span> m, origin<span class="op">}</span>;</span></code></pre></div>
<p>Again, CTAD always helps to use precisely the type we need in a
current case.</p>
<p>We can’t construct a quantity point directly from the quantity
anymore when a custom, named origin is used. To prevent potential safety
and maintenance issues, we always need to explicitly provide both a
compatible origin and a quantity measured from it to construct a
quantity point.</p>
<p>Said otherwise, a quantity point defined in terms of a specific
origin is the result of adding the origin and the <em>displacement
vector</em> measured from it to the point we create.</p>
<p>Finally, please note that it is not allowed to subtract two point
origins defined in terms of
<code class="sourceCode cpp">absolute_point_origin</code> (e.g., <code class="sourceCode cpp">origin <span class="op">-</span> origin</code>)
as those do not contain information about the unit, so we cannot
determine a resulting <code class="sourceCode cpp">quantity</code>
type.</p>
<h5 data-number="11.4.4.3.1" id="modeling-independent-spaces-in-one-domain"><span class="header-section-number">11.4.4.3.1</span> Modeling independent
spaces in one domain<a href="#modeling-independent-spaces-in-one-domain" class="self-link"></a></h5>
<p>Absolute point origins are also perfect for establishing independent
spaces even if the same quantity type and unit is being used:</p>
<p><img src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgoKPHN2ZwogICB3aWR0aD0iOTYuOTk5Mzc0bW0iCiAgIGhlaWdodD0iMjEuOTU4ODI2bW0iCiAgIHZpZXdCb3g9IjAgMCA5Ni45OTkzNzQgMjEuOTU4ODI2IgogICB2ZXJzaW9uPSIxLjEiCiAgIGlkPSJzdmcxIgogICBpbmtzY2FwZTp2ZXJzaW9uPSIxLjMuMiAoMDkxZTIwZSwgMjAyMy0xMS0yNSwgY3VzdG9tKSIKICAg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MDkzNzUsMC4yNjE3MTkgMC45ODYzMjgsLTAuMzU3NDIyIC0wLjMwNDY4OCwxLjAwMzkwNiAwLjI2NzU3OCwwLjA4MDA4IHoiCiAgICAgICAgICAgaWQ9InBhdGgzNiIgLz4KICAgICAgPC9nPgogICAgPC9nPgogICAgPHRleHQKICAgICAgIHhtbDpzcGFjZT0icHJlc2VydmUiCiAgICAgICBzdHlsZT0iZm9udC13ZWlnaHQ6Ym9sZDtmb250LXNpemU6Mi44MjIyMnB4O2ZvbnQtZmFtaWx5OkFyaWFsOy1pbmtzY2FwZS1mb250LXNwZWNpZmljYXRpb246J0FyaWFsIEJvbGQnO2ZpbGw6IzAwMDAwMDtzdHJva2U6IzAwMDAwMDtzdHJva2Utd2lkdGg6MCIKICAgICAgIHg9IjEyMC4wNDk0OCIKICAgICAgIHk9IjcyLjg3MTYyIgogICAgICAgaWQ9InRleHQxLTAiPjx0c3BhbgogICAgICAgICBzb2RpcG9kaTpyb2xlPSJsaW5lIgogICAgICAgICBpZD0idHNwYW4xLTEiCiAgICAgICAgIHN0eWxlPSJmb250LXNpemU6Mi44MjIyMnB4O3N0cm9rZS13aWR0aDowIgogICAgICAgICB4PSIxMjAuMDQ5NDgiCiAgICAgICAgIHk9IjcyLjg3MTYyIj5RPC90c3Bhbj48L3RleHQ+CiAgPC9nPgo8L3N2Zz4K" style="display: block; margin-left: auto; margin-right: auto; width: 80%;" /></p>
<div class="sourceCode" id="cb41"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb41-1"><a href="#cb41-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> origin1 <span class="kw">final</span> <span class="op">:</span> absolute_point_origin<span class="op">&lt;</span>isq<span class="op">::</span>distance<span class="op">&gt;</span> <span class="op">{}</span> origin1;</span>
<span id="cb41-2"><a href="#cb41-2" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> origin2 <span class="kw">final</span> <span class="op">:</span> absolute_point_origin<span class="op">&lt;</span>isq<span class="op">::</span>distance<span class="op">&gt;</span> <span class="op">{}</span> origin2;</span>
<span id="cb41-3"><a href="#cb41-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb41-4"><a href="#cb41-4" aria-hidden="true" tabindex="-1"></a>quantity_point qp1 <span class="op">=</span> origin1 <span class="op">+</span> <span class="dv">100</span> <span class="op">*</span> m;</span>
<span id="cb41-5"><a href="#cb41-5" aria-hidden="true" tabindex="-1"></a>quantity_point qp2 <span class="op">=</span> origin2 <span class="op">+</span> <span class="dv">120</span> <span class="op">*</span> m;</span>
<span id="cb41-6"><a href="#cb41-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb41-7"><a href="#cb41-7" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp1<span class="op">.</span>quantity_from<span class="op">(</span>origin1<span class="op">)</span> <span class="op">==</span> <span class="dv">100</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb41-8"><a href="#cb41-8" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2<span class="op">.</span>quantity_from<span class="op">(</span>origin2<span class="op">)</span> <span class="op">==</span> <span class="dv">120</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb41-9"><a href="#cb41-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb41-10"><a href="#cb41-10" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp1 <span class="op">-</span> origin1 <span class="op">==</span> <span class="dv">100</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb41-11"><a href="#cb41-11" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2 <span class="op">-</span> origin2 <span class="op">==</span> <span class="dv">120</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb41-12"><a href="#cb41-12" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>origin1 <span class="op">-</span> qp1 <span class="op">==</span> <span class="op">-</span><span class="dv">100</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb41-13"><a href="#cb41-13" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>origin2 <span class="op">-</span> qp2 <span class="op">==</span> <span class="op">-</span><span class="dv">120</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb41-14"><a href="#cb41-14" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb41-15"><a href="#cb41-15" aria-hidden="true" tabindex="-1"></a><span class="co">// assert(qp2 - qp1 == 20 * m);                    // Compile-time error</span></span>
<span id="cb41-16"><a href="#cb41-16" aria-hidden="true" tabindex="-1"></a><span class="co">// assert(qp1 - origin2 == 100 * m);               // Compile-time error</span></span>
<span id="cb41-17"><a href="#cb41-17" aria-hidden="true" tabindex="-1"></a><span class="co">// assert(qp2 - origin1 == 120 * m);               // Compile-time error</span></span>
<span id="cb41-18"><a href="#cb41-18" aria-hidden="true" tabindex="-1"></a><span class="co">// assert(qp2.quantity_from(qp1) == 20 * m);       // Compile-time error</span></span>
<span id="cb41-19"><a href="#cb41-19" aria-hidden="true" tabindex="-1"></a><span class="co">// assert(qp1.quantity_from(origin2) == 100 * m);  // Compile-time error</span></span>
<span id="cb41-20"><a href="#cb41-20" aria-hidden="true" tabindex="-1"></a><span class="co">// assert(qp2.quantity_from(origin1) == 120 * m);  // Compile-time error</span></span></code></pre></div>
<h4 data-number="11.4.4.4" id="relative-point-origin"><span class="header-section-number">11.4.4.4</span> Relative <em>point</em>
origin<a href="#relative-point-origin" class="self-link"></a></h4>
<p>We often do not have only one ultimate “zero” point when we measure
things. Often, we have one common scale, but we measure various
quantities relative to different points and expect those points to be
compatible. There are many examples here, but probably the most common
are temperatures, timestamps, and altitudes.</p>
<p>For such cases, relative point origins should be used:</p>
<p><img src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz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AgIGlkPSJwYXRoOS0wLTYtOCI+CiAgICAgIDxwYXRoCiAgICAgICAgIHN0eWxlPSJjb2xvcjojMDAwMDAwO2ZpbGw6IzAwMDAwMDstaW5rc2NhcGUtc3Ryb2tlOm5vbmUiCiAgICAgICAgIGQ9Im0gNjcuNDI5Njg3LDExNi40ODYzMyAtNC40NTUwNzgsNC4xMTEzMyAwLjEzNDc2NiwwLjE0NjQ4IDQuNDUzMTI1LC00LjExMTMzIHoiCiAgICAgICAgIGlkPSJwYXRoNjgiIC8+CiAgICAgIDxnCiAgICAgICAgIGlkPSJnNjciPgogICAgICAgIDxwYXRoCiAgICAgICAgICAgc3R5bGU9ImNvbG9yOiMwMDAwMDA7ZmlsbDojMDAwMDAwOy1pbmtzY2FwZS1zdHJva2U6bm9uZSIKICAgICAgICAgICBkPSJtIDY3Ljc5ODgyOCwxMTYuMjc5MyAtMS41NDQ5MjIsMC40NDcyNiAwLjA3ODEzLDAuMjY5NTMgMS4wMDc4MTMsLTAuMjkxMDEgLTAuMzcxMDk0LDAuOTgwNDcgMC4yNjE3MTksMC4wOTc2IHoiCiAgICAgICAgICAgaWQ9InBhdGg2NyIgLz4KICAgICAgPC9nPgogICAgPC9nPgogIDwvZz4KPC9zdmc+Cg==" style="display: block; margin-left: auto; margin-right: auto; width: 80%;" /></p>
<div class="sourceCode" id="cb42"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb42-1"><a href="#cb42-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> A <span class="kw">final</span> <span class="op">:</span> absolute_point_origin<span class="op">&lt;</span>isq<span class="op">::</span>distance<span class="op">&gt;</span> <span class="op">{}</span> A;</span>
<span id="cb42-2"><a href="#cb42-2" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> B <span class="kw">final</span> <span class="op">:</span> relative_point_origin<span class="op">&lt;</span>A <span class="op">+</span> <span class="dv">10</span> <span class="op">*</span> m<span class="op">&gt;</span> <span class="op">{}</span> B;</span>
<span id="cb42-3"><a href="#cb42-3" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> C <span class="kw">final</span> <span class="op">:</span> relative_point_origin<span class="op">&lt;</span>B <span class="op">+</span> <span class="dv">10</span> <span class="op">*</span> m<span class="op">&gt;</span> <span class="op">{}</span> C;</span>
<span id="cb42-4"><a href="#cb42-4" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> D <span class="kw">final</span> <span class="op">:</span> relative_point_origin<span class="op">&lt;</span>A <span class="op">+</span> <span class="dv">30</span> <span class="op">*</span> m<span class="op">&gt;</span> <span class="op">{}</span> D;</span>
<span id="cb42-5"><a href="#cb42-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb42-6"><a href="#cb42-6" aria-hidden="true" tabindex="-1"></a>quantity_point qp1 <span class="op">=</span> C <span class="op">+</span> <span class="dv">100</span> <span class="op">*</span> m;</span>
<span id="cb42-7"><a href="#cb42-7" aria-hidden="true" tabindex="-1"></a>quantity_point qp2 <span class="op">=</span> D <span class="op">+</span> <span class="dv">120</span> <span class="op">*</span> m;</span>
<span id="cb42-8"><a href="#cb42-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb42-9"><a href="#cb42-9" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp1<span class="op">.</span>quantity_ref_from<span class="op">(</span>qp1<span class="op">.</span>point_origin<span class="op">)</span> <span class="op">==</span> <span class="dv">100</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-10"><a href="#cb42-10" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2<span class="op">.</span>quantity_ref_from<span class="op">(</span>qp2<span class="op">.</span>point_origin<span class="op">)</span> <span class="op">==</span> <span class="dv">120</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-11"><a href="#cb42-11" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb42-12"><a href="#cb42-12" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2<span class="op">.</span>quantity_from<span class="op">(</span>qp1<span class="op">)</span> <span class="op">==</span> <span class="dv">30</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-13"><a href="#cb42-13" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp1<span class="op">.</span>quantity_from<span class="op">(</span>qp2<span class="op">)</span> <span class="op">==</span> <span class="op">-</span><span class="dv">30</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-14"><a href="#cb42-14" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2 <span class="op">-</span> qp1 <span class="op">==</span> <span class="dv">30</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-15"><a href="#cb42-15" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp1 <span class="op">-</span> qp2 <span class="op">==</span> <span class="op">-</span><span class="dv">30</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-16"><a href="#cb42-16" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb42-17"><a href="#cb42-17" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp1<span class="op">.</span>quantity_from<span class="op">(</span>A<span class="op">)</span> <span class="op">==</span> <span class="dv">120</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-18"><a href="#cb42-18" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp1<span class="op">.</span>quantity_from<span class="op">(</span>B<span class="op">)</span> <span class="op">==</span> <span class="dv">110</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-19"><a href="#cb42-19" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp1<span class="op">.</span>quantity_from<span class="op">(</span>C<span class="op">)</span> <span class="op">==</span> <span class="dv">100</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-20"><a href="#cb42-20" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp1<span class="op">.</span>quantity_from<span class="op">(</span>D<span class="op">)</span> <span class="op">==</span> <span class="dv">90</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-21"><a href="#cb42-21" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp1 <span class="op">-</span> A <span class="op">==</span> <span class="dv">120</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-22"><a href="#cb42-22" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp1 <span class="op">-</span> B <span class="op">==</span> <span class="dv">110</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-23"><a href="#cb42-23" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp1 <span class="op">-</span> C <span class="op">==</span> <span class="dv">100</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-24"><a href="#cb42-24" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp1 <span class="op">-</span> D <span class="op">==</span> <span class="dv">90</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-25"><a href="#cb42-25" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb42-26"><a href="#cb42-26" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2<span class="op">.</span>quantity_from<span class="op">(</span>A<span class="op">)</span> <span class="op">==</span> <span class="dv">150</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-27"><a href="#cb42-27" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2<span class="op">.</span>quantity_from<span class="op">(</span>B<span class="op">)</span> <span class="op">==</span> <span class="dv">140</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-28"><a href="#cb42-28" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2<span class="op">.</span>quantity_from<span class="op">(</span>C<span class="op">)</span> <span class="op">==</span> <span class="dv">130</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-29"><a href="#cb42-29" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2<span class="op">.</span>quantity_from<span class="op">(</span>D<span class="op">)</span> <span class="op">==</span> <span class="dv">120</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-30"><a href="#cb42-30" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2 <span class="op">-</span> A <span class="op">==</span> <span class="dv">150</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-31"><a href="#cb42-31" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2 <span class="op">-</span> B <span class="op">==</span> <span class="dv">140</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-32"><a href="#cb42-32" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2 <span class="op">-</span> C <span class="op">==</span> <span class="dv">130</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-33"><a href="#cb42-33" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2 <span class="op">-</span> D <span class="op">==</span> <span class="dv">120</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-34"><a href="#cb42-34" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb42-35"><a href="#cb42-35" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>B <span class="op">-</span> A <span class="op">==</span> <span class="dv">10</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-36"><a href="#cb42-36" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>C <span class="op">-</span> A <span class="op">==</span> <span class="dv">20</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-37"><a href="#cb42-37" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>D <span class="op">-</span> A <span class="op">==</span> <span class="dv">30</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-38"><a href="#cb42-38" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>D <span class="op">-</span> C <span class="op">==</span> <span class="dv">10</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-39"><a href="#cb42-39" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb42-40"><a href="#cb42-40" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>B <span class="op">-</span> B <span class="op">==</span> <span class="dv">0</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb42-41"><a href="#cb42-41" aria-hidden="true" tabindex="-1"></a><span class="co">// assert(A - A == 0 * m);  // Compile-time error</span></span></code></pre></div>
<p>Even though we can’t subtract two absolute point origins from each
other, it is possible to subtract relative ones or relative and absolute
ones.</p>
<h4 data-number="11.4.4.5" id="converting-between-different-representations-of-the-same-point"><span class="header-section-number">11.4.4.5</span> Converting between
different representations of the same <em>point</em><a href="#converting-between-different-representations-of-the-same-point" class="self-link"></a></h4>
<p>As we might represent the same <em>point</em> with <em>displacement
vectors</em> from various origins, the library provides facilities to
convert the same <em>point</em> to the
<code class="sourceCode cpp">quantity_point</code> class templates
expressed in terms of different origins.</p>
<p><img src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgoKPHN2ZwogICB3aWR0aD0iOTYuMzI2OTQybW0iCiA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LjU0Njg4IC0xLjA5Mzc1LDAuNTQ2ODcgMC4xNDY0OSwwLjI5Mjk3IDEuNjc3NzMsLTAuODM5ODQgeiIKICAgICAgICAgaWQ9InBhdGg1Mi05LTQtNCIgLz4KICAgIDwvZz4KICAgIDxwYXRoCiAgICAgICBzdHlsZT0iZmlsbDojMDAwMDAwO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDowLjM4MTI5ODtzdHJva2UtZGFzaGFycmF5Om5vbmUiCiAgICAgICBkPSJNIDYxLjE4MDMzNSwxNDguMDcxODcgViAxNTAuMTUyIgogICAgICAgaWQ9InBhdGgyLTUtNy01LTItMS03LTMiIC8+CiAgPC9nPgo8L3N2Zz4K" style="display: block; margin-left: auto; margin-right: auto; width: 80%;" /></p>
<p>For this purpose, we can use either:</p>
<ul>
<li><p>A converting constructor:</p>
<div class="sourceCode" id="cb43"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb43-1"><a href="#cb43-1" aria-hidden="true" tabindex="-1"></a>quantity_point<span class="op">&lt;</span>si<span class="op">::</span>metre, C<span class="op">&gt;</span> qp2C <span class="op">=</span> qp2;</span>
<span id="cb43-2"><a href="#cb43-2" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2C<span class="op">.</span>quantity_ref_from<span class="op">(</span>qp2C<span class="op">.</span>point_origin<span class="op">)</span> <span class="op">==</span> <span class="dv">130</span> <span class="op">*</span> m<span class="op">)</span>;</span></code></pre></div></li>
<li><p>A dedicated conversion interface:</p>
<div class="sourceCode" id="cb44"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb44-1"><a href="#cb44-1" aria-hidden="true" tabindex="-1"></a>quantity_point qp2B <span class="op">=</span> qp2<span class="op">.</span>point_for<span class="op">(</span>B<span class="op">)</span>;</span>
<span id="cb44-2"><a href="#cb44-2" aria-hidden="true" tabindex="-1"></a>quantity_point qp2A <span class="op">=</span> qp2<span class="op">.</span>point_for<span class="op">(</span>A<span class="op">)</span>;</span>
<span id="cb44-3"><a href="#cb44-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb44-4"><a href="#cb44-4" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2B<span class="op">.</span>quantity_ref_from<span class="op">(</span>qp2B<span class="op">.</span>point_origin<span class="op">)</span> <span class="op">==</span> <span class="dv">140</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb44-5"><a href="#cb44-5" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2A<span class="op">.</span>quantity_ref_from<span class="op">(</span>qp2A<span class="op">.</span>point_origin<span class="op">)</span> <span class="op">==</span> <span class="dv">150</span> <span class="op">*</span> m<span class="op">)</span>;</span></code></pre></div></li>
</ul>
<p>It is important to understand that all such translations still
describe exactly the same point (e.g., all of them compare equal):</p>
<div class="sourceCode" id="cb45"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb45-1"><a href="#cb45-1" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2 <span class="op">==</span> qp2C<span class="op">)</span>;</span>
<span id="cb45-2"><a href="#cb45-2" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2 <span class="op">==</span> qp2B<span class="op">)</span>;</span>
<span id="cb45-3"><a href="#cb45-3" aria-hidden="true" tabindex="-1"></a><span class="ot">assert</span><span class="op">(</span>qp2 <span class="op">==</span> qp2A<span class="op">)</span>;</span></code></pre></div>
<p>It is only allowed to convert between various origins defined in
terms of the same
<code class="sourceCode cpp">absolute_point_origin</code>. Even if it is
possible to express the same <em>point</em> as a <em>displacement
vector</em> from another
<code class="sourceCode cpp">absolute_point_origin</code>, the library
will not provide such a conversion. A custom user-defined conversion
function will be needed to add such a functionality.</p>
<p>Said another way, in the library, there is no way to spell how two
distinct <code class="sourceCode cpp">absolute_point_origin</code> types
relate to each other.</p>
<h4 data-number="11.4.4.6" id="temperature-support"><span class="header-section-number">11.4.4.6</span> Temperature support<a href="#temperature-support" class="self-link"></a></h4>
<p>Support for temperature quantity points is probably one of the most
common examples of relative point origins in action that we use in daily
life.</p>
<p>The <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span> definition in the library provides a
few predefined point origins for this purpose:</p>
<div class="sourceCode" id="cb46"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb46-1"><a href="#cb46-1" aria-hidden="true" tabindex="-1"></a><span class="kw">namespace</span> si <span class="op">{</span></span>
<span id="cb46-2"><a href="#cb46-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb46-3"><a href="#cb46-3" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> absolute_zero <span class="kw">final</span> <span class="op">:</span> absolute_point_origin<span class="op">&lt;</span>isq<span class="op">::</span>thermodynamic_temperature<span class="op">&gt;</span> <span class="op">{}</span> absolute_zero;</span>
<span id="cb46-4"><a href="#cb46-4" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> zeroth_kelvin <span class="op">=</span> absolute_zero;</span>
<span id="cb46-5"><a href="#cb46-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb46-6"><a href="#cb46-6" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> ice_point <span class="kw">final</span> <span class="op">:</span> relative_point_origin<span class="op">&lt;</span>absolute<span class="op">&lt;</span>milli<span class="op">&lt;</span>kelvin<span class="op">&gt;&gt;(</span><span class="dv">273&#39;150</span><span class="op">)&gt;</span> <span class="op">{}</span> ice_point;</span>
<span id="cb46-7"><a href="#cb46-7" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> zeroth_degree_Celsius <span class="op">=</span> ice_point;</span>
<span id="cb46-8"><a href="#cb46-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb46-9"><a href="#cb46-9" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<span id="cb46-10"><a href="#cb46-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb46-11"><a href="#cb46-11" aria-hidden="true" tabindex="-1"></a><span class="kw">namespace</span> usc <span class="op">{</span></span>
<span id="cb46-12"><a href="#cb46-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb46-13"><a href="#cb46-13" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> zeroth_degree_Fahrenheit <span class="kw">final</span> <span class="op">:</span></span>
<span id="cb46-14"><a href="#cb46-14" aria-hidden="true" tabindex="-1"></a>  relative_point_origin<span class="op">&lt;</span>absolute<span class="op">&lt;</span>mag_ratio<span class="op">&lt;</span><span class="dv">5</span>, <span class="dv">9</span><span class="op">&gt;</span> <span class="op">*</span> si<span class="op">::</span>degree_Celsius<span class="op">&gt;(-</span><span class="dv">32</span><span class="op">)&gt;</span> <span class="op">{}</span> zeroth_degree_Fahrenheit;</span>
<span id="cb46-15"><a href="#cb46-15" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb46-16"><a href="#cb46-16" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>The above is a great example of how point origins can be stacked on
top of each other:</p>
<ul>
<li><code class="sourceCode cpp">usc<span class="op">::</span>zeroth_degree_Fahrenheit</code>
is defined relative to <code class="sourceCode cpp">si<span class="op">::</span>zeroth_degree_Celsius</code></li>
<li><code class="sourceCode cpp">si<span class="op">::</span>zeroth_degree_Celsius</code>
is defined relative to <code class="sourceCode cpp">si<span class="op">::</span>zeroth_kelvin</code>.</li>
</ul>
<p><em>Note: Notice that while stacking point origins, we can use
different representation types and units for origins and a point. In the
above example, the relative point origin for degree Celsius is defined
in terms of
<code class="sourceCode cpp">si<span class="op">::</span>kelvin</code>,
while the quantity point for it will use <code class="sourceCode cpp">si<span class="op">::</span>degree_Celsius</code>
as a unit.</em></p>
<p>The temperature point origins defined above are provided explicitly
in the respective units’ definitions:</p>
<div class="sourceCode" id="cb47"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb47-1"><a href="#cb47-1" aria-hidden="true" tabindex="-1"></a><span class="kw">namespace</span> si <span class="op">{</span></span>
<span id="cb47-2"><a href="#cb47-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb47-3"><a href="#cb47-3" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> kelvin <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;K&quot;</span>, kind_of<span class="op">&lt;</span>isq<span class="op">::</span>thermodynamic_temperature<span class="op">&gt;</span>, zeroth_kelvin<span class="op">&gt;</span> <span class="op">{}</span> kelvin;</span>
<span id="cb47-4"><a href="#cb47-4" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> degree_Celsius <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;{</span><span class="st">u8&quot;℃&quot;</span>, <span class="st">&quot;`C&quot;</span><span class="op">}</span>, kelvin, zeroth_degree_Celsius<span class="op">&gt;</span> <span class="op">{}</span> degree_Celsius;</span>
<span id="cb47-5"><a href="#cb47-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb47-6"><a href="#cb47-6" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<span id="cb47-7"><a href="#cb47-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb47-8"><a href="#cb47-8" aria-hidden="true" tabindex="-1"></a><span class="kw">namespace</span> usc <span class="op">{</span></span>
<span id="cb47-9"><a href="#cb47-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb47-10"><a href="#cb47-10" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> degree_Fahrenheit <span class="kw">final</span> <span class="op">:</span></span>
<span id="cb47-11"><a href="#cb47-11" aria-hidden="true" tabindex="-1"></a>    named_unit<span class="op">&lt;{</span><span class="st">u8&quot;℉&quot;</span>, <span class="st">&quot;`F&quot;</span><span class="op">}</span>, mag_ratio<span class="op">&lt;</span><span class="dv">5</span>, <span class="dv">9</span><span class="op">&gt;</span> <span class="op">*</span> si<span class="op">::</span>degree_Celsius, zeroth_degree_Fahrenheit<span class="op">&gt;</span> <span class="op">{}</span> degree_Fahrenheit;</span>
<span id="cb47-12"><a href="#cb47-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb47-13"><a href="#cb47-13" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>As it was described above, <code class="sourceCode cpp">default_point_origin<span class="op">(</span>R<span class="op">)</span></code>
returns a <code class="sourceCode cpp">zeroth_point_origin<span class="op">&lt;</span>QuantitySpec<span class="op">&gt;</span></code>
when a unit does not provide any origin in its definition. As of today,
the units of temperature are the only ones in the entire library that
provide such origins.</p>
<p>Now, let’s see how we can benefit from the above definitions. We have
quite a few alternatives to choose from here. Depending on our needs or
tastes, we can:</p>
<ul>
<li><p>be explicit about the unit and origin:</p>
<div class="sourceCode" id="cb48"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb48-1"><a href="#cb48-1" aria-hidden="true" tabindex="-1"></a>quantity_point<span class="op">&lt;</span>si<span class="op">::</span>degree_Celsius, si<span class="op">::</span>zeroth_degree_Celsius<span class="op">&gt;</span> q1 <span class="op">=</span> si<span class="op">::</span>zeroth_degree_Celsius <span class="op">+</span> delta<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="fl">20.5</span><span class="op">)</span>;</span>
<span id="cb48-2"><a href="#cb48-2" aria-hidden="true" tabindex="-1"></a>quantity_point<span class="op">&lt;</span>si<span class="op">::</span>degree_Celsius, si<span class="op">::</span>zeroth_degree_Celsius<span class="op">&gt;</span> q2<span class="op">{</span>delta<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="fl">20.5</span><span class="op">)</span>, si<span class="op">::</span>zeroth_degree_Celsius<span class="op">}</span>;</span>
<span id="cb48-3"><a href="#cb48-3" aria-hidden="true" tabindex="-1"></a>quantity_point<span class="op">&lt;</span>si<span class="op">::</span>degree_Celsius, si<span class="op">::</span>zeroth_degree_Celsius<span class="op">&gt;</span> q3<span class="op">{</span>delta<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="fl">20.5</span><span class="op">)}</span>;</span>
<span id="cb48-4"><a href="#cb48-4" aria-hidden="true" tabindex="-1"></a>quantity_point<span class="op">&lt;</span>si<span class="op">::</span>degree_Celsius, si<span class="op">::</span>zeroth_degree_Celsius<span class="op">&gt;</span> q4 <span class="op">=</span> absolute<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="fl">20.5</span><span class="op">)</span>;</span></code></pre></div></li>
<li><p>specify a unit and use its zeroth point origin implicitly:</p>
<div class="sourceCode" id="cb49"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb49-1"><a href="#cb49-1" aria-hidden="true" tabindex="-1"></a>quantity_point<span class="op">&lt;</span>si<span class="op">::</span>degree_Celsius<span class="op">&gt;</span> q5 <span class="op">=</span> si<span class="op">::</span>zeroth_degree_Celsius <span class="op">+</span> delta<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="fl">20.5</span><span class="op">)</span>;</span>
<span id="cb49-2"><a href="#cb49-2" aria-hidden="true" tabindex="-1"></a>quantity_point<span class="op">&lt;</span>si<span class="op">::</span>degree_Celsius<span class="op">&gt;</span> q6<span class="op">{</span>delta<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="fl">20.5</span><span class="op">)</span>, si<span class="op">::</span>zeroth_degree_Celsius<span class="op">}</span>;</span>
<span id="cb49-3"><a href="#cb49-3" aria-hidden="true" tabindex="-1"></a>quantity_point<span class="op">&lt;</span>si<span class="op">::</span>degree_Celsius<span class="op">&gt;</span> q7<span class="op">{</span>delta<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="fl">20.5</span><span class="op">)}</span>;</span>
<span id="cb49-4"><a href="#cb49-4" aria-hidden="true" tabindex="-1"></a>quantity_point<span class="op">&lt;</span>si<span class="op">::</span>degree_Celsius<span class="op">&gt;</span> q8 <span class="op">=</span> absolute<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="fl">20.5</span><span class="op">)</span>;</span></code></pre></div></li>
<li><p>benefit from CTAD:</p>
<div class="sourceCode" id="cb50"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb50-1"><a href="#cb50-1" aria-hidden="true" tabindex="-1"></a>quantity_point q9 <span class="op">=</span> si<span class="op">::</span>zeroth_degree_Celsius <span class="op">+</span> delta<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="fl">20.5</span><span class="op">)</span>;</span>
<span id="cb50-2"><a href="#cb50-2" aria-hidden="true" tabindex="-1"></a>quantity_point q10<span class="op">{</span>delta<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="fl">20.5</span><span class="op">)</span>, si<span class="op">::</span>zeroth_degree_Celsius<span class="op">}</span>;</span>
<span id="cb50-3"><a href="#cb50-3" aria-hidden="true" tabindex="-1"></a>quantity_point q11<span class="op">{</span>delta<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="fl">20.5</span><span class="op">)}</span>;</span>
<span id="cb50-4"><a href="#cb50-4" aria-hidden="true" tabindex="-1"></a>quantity_point q12 <span class="op">=</span> absolute<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="fl">20.5</span><span class="op">)</span>;</span></code></pre></div></li>
</ul>
<p>In all of the above cases, we end up with the
<code class="sourceCode cpp">quantity_point</code> of the same type and
value.</p>
<p>To play a bit more with temperatures, we can implement a simple room
AC temperature controller in the following way:</p>
<p><img src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjwh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MDAwMDA7LWlua3NjYXBlLXN0cm9rZTpub25lIgogICAgICAgICAgICAgZD0ibSA0NS4zMDY2NDEsNzguNzIyNjU2IC0xLjM1MTU2MywxLjA2MjUgMC4xODU1NDcsMC4yMzQzNzUgMC44ODA4NTksLTAuNjkxNDA2IDAuMDI1MzksMS4xMTkxNDEgMC4yOTg4MjgsLTAuMDA3OCB6IgogICAgICAgICAgICAgaWQ9InBhdGg5NCIgLz4KICAgICAgICA8L2c+CiAgICAgIDwvZz4KICAgIDwvZz4KICA8L2c+Cjwvc3ZnPgo=" style="display: block; margin-left: auto; margin-right: auto; width: 80%;" /></p>
<div class="sourceCode" id="cb51"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb51-1"><a href="#cb51-1" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="kw">struct</span> room_reference_temp <span class="kw">final</span> <span class="op">:</span> relative_point_origin<span class="op">&lt;</span>absolute<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="dv">21</span><span class="op">)&gt;</span> <span class="op">{}</span> room_reference_temp;</span>
<span id="cb51-2"><a href="#cb51-2" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> room_temp <span class="op">=</span> quantity_point<span class="op">&lt;</span>isq<span class="op">::</span>Celsius_temperature<span class="op">[</span>deg_C<span class="op">]</span>, room_reference_temp<span class="op">&gt;</span>;</span>
<span id="cb51-3"><a href="#cb51-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb51-4"><a href="#cb51-4" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="kw">auto</span> step_delta <span class="op">=</span> delta<span class="op">&lt;</span>isq<span class="op">::</span>Celsius_temperature<span class="op">&lt;</span>deg_C<span class="op">&gt;&gt;(</span><span class="fl">0.5</span><span class="op">)</span>;</span>
<span id="cb51-5"><a href="#cb51-5" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="dt">int</span> number_of_steps <span class="op">=</span> <span class="dv">6</span>;</span>
<span id="cb51-6"><a href="#cb51-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb51-7"><a href="#cb51-7" aria-hidden="true" tabindex="-1"></a>room_temp room_ref<span class="op">{}</span>;</span>
<span id="cb51-8"><a href="#cb51-8" aria-hidden="true" tabindex="-1"></a>room_temp room_low <span class="op">=</span> room_ref <span class="op">-</span> number_of_steps <span class="op">*</span> step_delta;</span>
<span id="cb51-9"><a href="#cb51-9" aria-hidden="true" tabindex="-1"></a>room_temp room_high <span class="op">=</span> room_ref <span class="op">+</span> number_of_steps <span class="op">*</span> step_delta;</span>
<span id="cb51-10"><a href="#cb51-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb51-11"><a href="#cb51-11" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Room reference temperature: {} ({}, {::N[.2f]})</span><span class="sc">\n</span><span class="st">&quot;</span>,</span>
<span id="cb51-12"><a href="#cb51-12" aria-hidden="true" tabindex="-1"></a>             room_ref<span class="op">.</span>quantity_from_zero<span class="op">()</span>,</span>
<span id="cb51-13"><a href="#cb51-13" aria-hidden="true" tabindex="-1"></a>             room_ref<span class="op">.</span>in<span class="op">(</span>deg_F<span class="op">).</span>quantity_from_zero<span class="op">()</span>,</span>
<span id="cb51-14"><a href="#cb51-14" aria-hidden="true" tabindex="-1"></a>             room_ref<span class="op">.</span>in<span class="op">(</span>K<span class="op">).</span>quantity_from_zero<span class="op">())</span>;</span>
<span id="cb51-15"><a href="#cb51-15" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb51-16"><a href="#cb51-16" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;| {:&lt;18} | {:^18} | {:^18} | {:^18} |&quot;</span>,</span>
<span id="cb51-17"><a href="#cb51-17" aria-hidden="true" tabindex="-1"></a>             <span class="st">&quot;Temperature delta&quot;</span>, <span class="st">&quot;Room reference&quot;</span>, <span class="st">&quot;Ice point&quot;</span>, <span class="st">&quot;Absolute zero&quot;</span><span class="op">)</span>;</span>
<span id="cb51-18"><a href="#cb51-18" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;|{0:=^20}|{0:=^20}|{0:=^20}|{0:=^20}|&quot;</span>, <span class="st">&quot;&quot;</span><span class="op">)</span>;</span>
<span id="cb51-19"><a href="#cb51-19" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb51-20"><a href="#cb51-20" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> print_temp <span class="op">=</span> <span class="op">[&amp;](</span>std<span class="op">::</span>string_view label, <span class="kw">auto</span> v<span class="op">)</span> <span class="op">{</span></span>
<span id="cb51-21"><a href="#cb51-21" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;| {:&lt;18} | {:^18} | {:^18} | {:^18:N[.2f]} |&quot;</span>, label,</span>
<span id="cb51-22"><a href="#cb51-22" aria-hidden="true" tabindex="-1"></a>               v <span class="op">-</span> room_reference_temp, <span class="op">(</span>v <span class="op">-</span> si<span class="op">::</span>ice_point<span class="op">).</span>in<span class="op">(</span>deg_C<span class="op">)</span>, <span class="op">(</span>v <span class="op">-</span> si<span class="op">::</span>absolute_zero<span class="op">).</span>in<span class="op">(</span>deg_C<span class="op">))</span>;</span>
<span id="cb51-23"><a href="#cb51-23" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span>
<span id="cb51-24"><a href="#cb51-24" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb51-25"><a href="#cb51-25" aria-hidden="true" tabindex="-1"></a>print_temp<span class="op">(</span><span class="st">&quot;Lowest&quot;</span>, room_low<span class="op">)</span>;</span>
<span id="cb51-26"><a href="#cb51-26" aria-hidden="true" tabindex="-1"></a>print_temp<span class="op">(</span><span class="st">&quot;Default&quot;</span>, room_ref<span class="op">)</span>;</span>
<span id="cb51-27"><a href="#cb51-27" aria-hidden="true" tabindex="-1"></a>print_temp<span class="op">(</span><span class="st">&quot;Highest&quot;</span>, room_high<span class="op">)</span>;</span></code></pre></div>
<p>The above prints:</p>
<pre class="text"><code>Room reference temperature: 21 ℃ (69.8 ℉, 294.15 K)

| Temperature delta  |   Room reference   |     Ice point      |   Absolute zero    |
|====================|====================|====================|====================|
| Lowest             |       -3 ℃        |       18 ℃        |     291.15 ℃      |
| Default            |        0 ℃        |       21 ℃        |     294.15 ℃      |
| Highest            |        3 ℃        |       24 ℃        |     297.15 ℃      |</code></pre>
<p>More about temperatures can be found in the <a href="#potential-surprises-while-working-with-temperatures">Potential
surprises while working with temperatures</a> chapter.</p>
<h2 data-number="11.5" id="user-defined-representation-types"><span class="header-section-number">11.5</span> User-defined representation
types<a href="#user-defined-representation-types" class="self-link"></a></h2>
<p>The library of physical quantities and units library should work with
any custom representation type. Those can be used to:</p>
<ul>
<li>improve safety (e.g., prevent overflows, restrict the range of
accepted values, etc.),</li>
<li>provide additional information (e.g., not only a quantity value but
also the uncertainty of the measurement), and</li>
<li>enable linear algebra usage.</li>
</ul>
<p>As of right now, we have two other concurrent proposals to SG6 in
this subject on the fly (<span class="citation" data-cites="P2993R0">[<a href="https://wg21.link/p2993r0" role="doc-biblioref">P2993R0</a>]</span> and <span class="citation" data-cites="P3003R0">[<a href="https://wg21.link/p3003r0" role="doc-biblioref">P3003R0</a>]</span>), so we do not provide any
concrete requirements or recommendations here so far.</p>
<p>Based on the results of discussions on the mentioned proposals, we
will provide correct guidelines in the next revisions of this paper.</p>
<p>By default all floating-point and integral (besides
<code class="sourceCode cpp"><span class="dt">bool</span></code>) types
are treated as scalars.</p>
<h2 data-number="11.6" id="vector-and-tensor-quantities"><span class="header-section-number">11.6</span> Vector and tensor quantities<a href="#vector-and-tensor-quantities" class="self-link"></a></h2>
<p>TBD</p>
<h2 data-number="11.7" id="logarithmic-quantities-and-units"><span class="header-section-number">11.7</span> Logarithmic quantities and
units<a href="#logarithmic-quantities-and-units" class="self-link"></a></h2>
<p>TBD</p>
<h1 data-number="12" id="usage-examples"><span class="header-section-number">12</span> Usage examples<a href="#usage-examples" class="self-link"></a></h1>
<h2 data-number="12.1" id="basic-quantity-equations"><span class="header-section-number">12.1</span> Basic quantity equations<a href="#basic-quantity-equations" class="self-link"></a></h2>
<p>Let’s start with a really simple example presenting basic operations
that every physical quantities and units library should provide:</p>
<div class="sourceCode" id="cb52"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb52-1"><a href="#cb52-1" aria-hidden="true" tabindex="-1"></a><span class="kw">import</span> mp_units;</span>
<span id="cb52-2"><a href="#cb52-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb52-3"><a href="#cb52-3" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> <span class="kw">namespace</span> mp_units;</span>
<span id="cb52-4"><a href="#cb52-4" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> <span class="kw">namespace</span> mp_units<span class="op">::</span>si<span class="op">::</span>unit_symbols;</span>
<span id="cb52-5"><a href="#cb52-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb52-6"><a href="#cb52-6" aria-hidden="true" tabindex="-1"></a><span class="co">// simple numeric operations</span></span>
<span id="cb52-7"><a href="#cb52-7" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">10</span> <span class="op">*</span> km <span class="op">/</span> <span class="dv">2</span> <span class="op">==</span> <span class="dv">5</span> <span class="op">*</span> km<span class="op">)</span>;</span>
<span id="cb52-8"><a href="#cb52-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb52-9"><a href="#cb52-9" aria-hidden="true" tabindex="-1"></a><span class="co">// conversions to common units</span></span>
<span id="cb52-10"><a href="#cb52-10" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">1</span> <span class="op">*</span> h <span class="op">==</span> <span class="dv">3600</span> <span class="op">*</span> s<span class="op">)</span>;</span>
<span id="cb52-11"><a href="#cb52-11" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">1</span> <span class="op">*</span> km <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> m <span class="op">==</span> <span class="dv">1001</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb52-12"><a href="#cb52-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb52-13"><a href="#cb52-13" aria-hidden="true" tabindex="-1"></a><span class="co">// derived quantities</span></span>
<span id="cb52-14"><a href="#cb52-14" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">1</span> <span class="op">*</span> km <span class="op">/</span> <span class="op">(</span><span class="dv">1</span> <span class="op">*</span> s<span class="op">)</span> <span class="op">==</span> <span class="dv">1000</span> <span class="op">*</span> m <span class="op">/</span> s<span class="op">)</span>;</span>
<span id="cb52-15"><a href="#cb52-15" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">2</span> <span class="op">*</span> km <span class="op">/</span> h <span class="op">*</span> <span class="op">(</span><span class="dv">2</span> <span class="op">*</span> h<span class="op">)</span> <span class="op">==</span> <span class="dv">4</span> <span class="op">*</span> km<span class="op">)</span>;</span>
<span id="cb52-16"><a href="#cb52-16" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">2</span> <span class="op">*</span> km <span class="op">/</span> <span class="op">(</span><span class="dv">2</span> <span class="op">*</span> km <span class="op">/</span> h<span class="op">)</span> <span class="op">==</span> <span class="dv">1</span> <span class="op">*</span> h<span class="op">)</span>;</span>
<span id="cb52-17"><a href="#cb52-17" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb52-18"><a href="#cb52-18" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">2</span> <span class="op">*</span> m <span class="op">*</span> <span class="op">(</span><span class="dv">3</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">==</span> <span class="dv">6</span> <span class="op">*</span> m2<span class="op">)</span>;</span>
<span id="cb52-19"><a href="#cb52-19" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb52-20"><a href="#cb52-20" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">10</span> <span class="op">*</span> km <span class="op">/</span> <span class="op">(</span><span class="dv">5</span> <span class="op">*</span> km<span class="op">)</span> <span class="op">==</span> <span class="dv">2</span><span class="op">)</span>;</span>
<span id="cb52-21"><a href="#cb52-21" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb52-22"><a href="#cb52-22" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">1000</span> <span class="op">/</span> <span class="op">(</span><span class="dv">1</span> <span class="op">*</span> s<span class="op">)</span> <span class="op">==</span> <span class="dv">1</span> <span class="op">*</span> kHz<span class="op">)</span>;</span></code></pre></div>
<p>Try it in <a href="https://godbolt.org/z/fT1r4sohs">the Compiler
Explorer</a>.</p>
<h2 data-number="12.2" id="hello-units"><span class="header-section-number">12.2</span> Hello units<a href="#hello-units" class="self-link"></a></h2>
<p>The next example serves as a showcase of various features available
in the <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> library.</p>
<div class="sourceCode" id="cb53"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb53-1"><a href="#cb53-1" aria-hidden="true" tabindex="-1"></a><span class="kw">import</span> mp_units;</span>
<span id="cb53-2"><a href="#cb53-2" aria-hidden="true" tabindex="-1"></a><span class="kw">import</span> std;</span>
<span id="cb53-3"><a href="#cb53-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb53-4"><a href="#cb53-4" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> <span class="kw">namespace</span> mp_units;</span>
<span id="cb53-5"><a href="#cb53-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb53-6"><a href="#cb53-6" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>speed<span class="op">&gt;</span> <span class="kw">auto</span> avg_speed<span class="op">(</span>QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">&gt;</span> <span class="kw">auto</span> d,</span>
<span id="cb53-7"><a href="#cb53-7" aria-hidden="true" tabindex="-1"></a>                                                QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>time<span class="op">&gt;</span> <span class="kw">auto</span> t<span class="op">)</span></span>
<span id="cb53-8"><a href="#cb53-8" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb53-9"><a href="#cb53-9" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> d <span class="op">/</span> t;</span>
<span id="cb53-10"><a href="#cb53-10" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<span id="cb53-11"><a href="#cb53-11" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb53-12"><a href="#cb53-12" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> main<span class="op">()</span></span>
<span id="cb53-13"><a href="#cb53-13" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb53-14"><a href="#cb53-14" aria-hidden="true" tabindex="-1"></a>  <span class="kw">using</span> <span class="kw">namespace</span> mp_units<span class="op">::</span>si<span class="op">::</span>unit_symbols;</span>
<span id="cb53-15"><a href="#cb53-15" aria-hidden="true" tabindex="-1"></a>  <span class="kw">using</span> <span class="kw">namespace</span> mp_units<span class="op">::</span>international<span class="op">::</span>unit_symbols;</span>
<span id="cb53-16"><a href="#cb53-16" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb53-17"><a href="#cb53-17" aria-hidden="true" tabindex="-1"></a>  <span class="kw">constexpr</span> quantity v1 <span class="op">=</span> <span class="dv">110</span> <span class="op">*</span> km <span class="op">/</span> h;</span>
<span id="cb53-18"><a href="#cb53-18" aria-hidden="true" tabindex="-1"></a>  <span class="kw">constexpr</span> quantity v2 <span class="op">=</span> <span class="dv">70</span> <span class="op">*</span> mph;</span>
<span id="cb53-19"><a href="#cb53-19" aria-hidden="true" tabindex="-1"></a>  <span class="kw">constexpr</span> quantity v3 <span class="op">=</span> avg_speed<span class="op">(</span><span class="fl">220.</span> <span class="op">*</span> isq<span class="op">::</span>distance<span class="op">[</span>km<span class="op">]</span>, <span class="dv">2</span> <span class="op">*</span> h<span class="op">)</span>;</span>
<span id="cb53-20"><a href="#cb53-20" aria-hidden="true" tabindex="-1"></a>  <span class="kw">constexpr</span> quantity v4 <span class="op">=</span> avg_speed<span class="op">(</span>isq<span class="op">::</span>distance<span class="op">(</span><span class="fl">140.</span> <span class="op">*</span> mi<span class="op">)</span>, <span class="dv">2</span> <span class="op">*</span> h<span class="op">)</span>;</span>
<span id="cb53-21"><a href="#cb53-21" aria-hidden="true" tabindex="-1"></a>  <span class="kw">constexpr</span> quantity v5 <span class="op">=</span> v3<span class="op">.</span>in<span class="op">(</span>m <span class="op">/</span> s<span class="op">)</span>;</span>
<span id="cb53-22"><a href="#cb53-22" aria-hidden="true" tabindex="-1"></a>  <span class="kw">constexpr</span> quantity v6 <span class="op">=</span> value_cast<span class="op">&lt;</span>m <span class="op">/</span> s<span class="op">&gt;(</span>v4<span class="op">)</span>;</span>
<span id="cb53-23"><a href="#cb53-23" aria-hidden="true" tabindex="-1"></a>  <span class="kw">constexpr</span> quantity v7 <span class="op">=</span> value_cast<span class="op">&lt;</span><span class="dt">int</span><span class="op">&gt;(</span>v6<span class="op">)</span>;</span>
<span id="cb53-24"><a href="#cb53-24" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb53-25"><a href="#cb53-25" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> v1 <span class="op">&lt;&lt;</span> <span class="ch">&#39;</span><span class="sc">\n</span><span class="ch">&#39;</span>;                                        <span class="co">// 110 km/h</span></span>
<span id="cb53-26"><a href="#cb53-26" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> std<span class="op">::</span>setw<span class="op">(</span><span class="dv">10</span><span class="op">)</span> <span class="op">&lt;&lt;</span> std<span class="op">::</span>setfill<span class="op">(</span><span class="ch">&#39;*&#39;</span><span class="op">)</span> <span class="op">&lt;&lt;</span> v2 <span class="op">&lt;&lt;</span> <span class="ch">&#39;</span><span class="sc">\n</span><span class="ch">&#39;</span>;  <span class="co">// ***70 mi/h</span></span>
<span id="cb53-27"><a href="#cb53-27" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> std<span class="op">::</span>format<span class="op">(</span><span class="st">&quot;{:*^10}</span><span class="sc">\n</span><span class="st">&quot;</span>, v3<span class="op">)</span>;                      <span class="co">// *110 km/h*</span></span>
<span id="cb53-28"><a href="#cb53-28" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{:%N in %U of %D}&quot;</span>, v4<span class="op">)</span>;                          <span class="co">// 70 in mi/h of LT⁻¹</span></span>
<span id="cb53-29"><a href="#cb53-29" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[.2f]}&quot;</span>, v5<span class="op">)</span>;                                 <span class="co">// 30.56 m/s</span></span>
<span id="cb53-30"><a href="#cb53-30" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[.2f]U[dn]}&quot;</span>, v6<span class="op">)</span>;                            <span class="co">// 31.29 m⋅s⁻¹</span></span>
<span id="cb53-31"><a href="#cb53-31" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{:%N}&quot;</span>, v7<span class="op">)</span>;                                      <span class="co">// 31</span></span>
<span id="cb53-32"><a href="#cb53-32" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>Try it in <a href="https://godbolt.org/z/nhqhT8Mzb">the Compiler
Explorer</a>.</p>
<h2 data-number="12.3" id="storage-tank"><span class="header-section-number">12.3</span> Storage tank<a href="#storage-tank" class="self-link"></a></h2>
<p>This example estimates the process of filling a storage tank with
some contents. It presents:</p>
<ul>
<li><a href="https://mpusz.github.io/mp-units/2.0/users_guide/framework_basics/systems_of_quantities/#system-of-quantities-is-not-only-about-kinds">The
importance of supporting more than one distinct quantity of the same
kind</a>,</li>
<li><a href="https://mpusz.github.io/mp-units/2.0/users_guide/framework_basics/faster_than_lightspeed_constants/">faster-than-lightspeed
constants</a>,</li>
<li>how easy it is to <a href="https://mpusz.github.io/mp-units/2.0/users_guide/framework_basics/systems_of_quantities/#defining-quantities">add
custom quantity types</a> when needed, and</li>
<li><a href="https://mpusz.github.io/mp-units/2.1/users_guide/framework_basics/concepts/#QuantityLike">interoperability
with <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration</code></a>.</li>
</ul>
<div class="sourceCode" id="cb54"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb54-1"><a href="#cb54-1" aria-hidden="true" tabindex="-1"></a><span class="kw">import</span> mp_units;</span>
<span id="cb54-2"><a href="#cb54-2" aria-hidden="true" tabindex="-1"></a><span class="kw">import</span> std;</span>
<span id="cb54-3"><a href="#cb54-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb54-4"><a href="#cb54-4" aria-hidden="true" tabindex="-1"></a><span class="co">// allows standard gravity (acceleration) and weight (force) to be expressed with scalar representation</span></span>
<span id="cb54-5"><a href="#cb54-5" aria-hidden="true" tabindex="-1"></a><span class="co">// types instead of requiring the usage of Linear Algebra library for this simple example</span></span>
<span id="cb54-6"><a href="#cb54-6" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span><span class="kw">class</span> T<span class="op">&gt;</span></span>
<span id="cb54-7"><a href="#cb54-7" aria-hidden="true" tabindex="-1"></a>  <span class="kw">requires</span> mp_units<span class="op">::</span>is_scalar<span class="op">&lt;</span>T<span class="op">&gt;</span></span>
<span id="cb54-8"><a href="#cb54-8" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="dt">bool</span> mp_units<span class="op">::</span>is_vector<span class="op">&lt;</span>T<span class="op">&gt;</span> <span class="op">=</span> <span class="kw">true</span>;</span>
<span id="cb54-9"><a href="#cb54-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb54-10"><a href="#cb54-10" aria-hidden="true" tabindex="-1"></a><span class="kw">namespace</span> <span class="op">{</span></span>
<span id="cb54-11"><a href="#cb54-11" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb54-12"><a href="#cb54-12" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> <span class="kw">namespace</span> mp_units;</span>
<span id="cb54-13"><a href="#cb54-13" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> <span class="kw">namespace</span> mp_units<span class="op">::</span>si<span class="op">::</span>unit_symbols;</span>
<span id="cb54-14"><a href="#cb54-14" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb54-15"><a href="#cb54-15" aria-hidden="true" tabindex="-1"></a><span class="co">// add a custom quantity type of kind isq::length</span></span>
<span id="cb54-16"><a href="#cb54-16" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> horizontal_length <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">&gt;</span> <span class="op">{}</span> horizontal_length;</span>
<span id="cb54-17"><a href="#cb54-17" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb54-18"><a href="#cb54-18" aria-hidden="true" tabindex="-1"></a><span class="co">// add a custom derived quantity type of kind isq::area</span></span>
<span id="cb54-19"><a href="#cb54-19" aria-hidden="true" tabindex="-1"></a><span class="co">// with a constrained quantity equation</span></span>
<span id="cb54-20"><a href="#cb54-20" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> horizontal_area <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>horizontal_length <span class="op">*</span> isq<span class="op">::</span>width<span class="op">&gt;</span> <span class="op">{}</span> horizontal_area;</span>
<span id="cb54-21"><a href="#cb54-21" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb54-22"><a href="#cb54-22" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> g <span class="op">=</span> <span class="dv">1</span> <span class="op">*</span> si<span class="op">::</span>standard_gravity;</span>
<span id="cb54-23"><a href="#cb54-23" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> air_density <span class="op">=</span> isq<span class="op">::</span>mass_density<span class="op">(</span><span class="fl">1.225</span> <span class="op">*</span> kg <span class="op">/</span> m3<span class="op">)</span>;</span>
<span id="cb54-24"><a href="#cb54-24" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb54-25"><a href="#cb54-25" aria-hidden="true" tabindex="-1"></a><span class="kw">class</span> StorageTank <span class="op">{</span></span>
<span id="cb54-26"><a href="#cb54-26" aria-hidden="true" tabindex="-1"></a>  quantity<span class="op">&lt;</span>horizontal_area<span class="op">[</span>m2<span class="op">]&gt;</span> base_;</span>
<span id="cb54-27"><a href="#cb54-27" aria-hidden="true" tabindex="-1"></a>  quantity<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>m<span class="op">]&gt;</span> height_;</span>
<span id="cb54-28"><a href="#cb54-28" aria-hidden="true" tabindex="-1"></a>  quantity<span class="op">&lt;</span>isq<span class="op">::</span>mass_density<span class="op">[</span>kg <span class="op">/</span> m3<span class="op">]&gt;</span> density_ <span class="op">=</span> air_density;</span>
<span id="cb54-29"><a href="#cb54-29" aria-hidden="true" tabindex="-1"></a><span class="kw">public</span><span class="op">:</span></span>
<span id="cb54-30"><a href="#cb54-30" aria-hidden="true" tabindex="-1"></a>  <span class="kw">constexpr</span> StorageTank<span class="op">(</span><span class="kw">const</span> quantity<span class="op">&lt;</span>horizontal_area<span class="op">[</span>m2<span class="op">]&gt;&amp;</span> base, <span class="kw">const</span> quantity<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>m<span class="op">]&gt;&amp;</span> height<span class="op">)</span> <span class="op">:</span></span>
<span id="cb54-31"><a href="#cb54-31" aria-hidden="true" tabindex="-1"></a>      base_<span class="op">(</span>base<span class="op">)</span>, height_<span class="op">(</span>height<span class="op">)</span></span>
<span id="cb54-32"><a href="#cb54-32" aria-hidden="true" tabindex="-1"></a>  <span class="op">{</span></span>
<span id="cb54-33"><a href="#cb54-33" aria-hidden="true" tabindex="-1"></a>  <span class="op">}</span></span>
<span id="cb54-34"><a href="#cb54-34" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb54-35"><a href="#cb54-35" aria-hidden="true" tabindex="-1"></a>  <span class="kw">constexpr</span> <span class="dt">void</span> set_contents_density<span class="op">(</span><span class="kw">const</span> quantity<span class="op">&lt;</span>isq<span class="op">::</span>mass_density<span class="op">[</span>kg <span class="op">/</span> m3<span class="op">]&gt;&amp;</span> density<span class="op">)</span></span>
<span id="cb54-36"><a href="#cb54-36" aria-hidden="true" tabindex="-1"></a>  <span class="op">{</span></span>
<span id="cb54-37"><a href="#cb54-37" aria-hidden="true" tabindex="-1"></a>    <span class="ot">assert</span><span class="op">(</span>density <span class="op">&gt;</span> air_density<span class="op">)</span>;</span>
<span id="cb54-38"><a href="#cb54-38" aria-hidden="true" tabindex="-1"></a>    density_ <span class="op">=</span> density;</span>
<span id="cb54-39"><a href="#cb54-39" aria-hidden="true" tabindex="-1"></a>  <span class="op">}</span></span>
<span id="cb54-40"><a href="#cb54-40" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb54-41"><a href="#cb54-41" aria-hidden="true" tabindex="-1"></a>  <span class="op">[[</span><span class="at">nodiscard</span><span class="op">]]</span> <span class="kw">constexpr</span> QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>weight<span class="op">&gt;</span> <span class="kw">auto</span> filled_weight<span class="op">()</span> <span class="kw">const</span></span>
<span id="cb54-42"><a href="#cb54-42" aria-hidden="true" tabindex="-1"></a>  <span class="op">{</span></span>
<span id="cb54-43"><a href="#cb54-43" aria-hidden="true" tabindex="-1"></a>    <span class="kw">const</span> <span class="kw">auto</span> volume <span class="op">=</span> isq<span class="op">::</span>volume<span class="op">(</span>base_ <span class="op">*</span> height_<span class="op">)</span>;</span>
<span id="cb54-44"><a href="#cb54-44" aria-hidden="true" tabindex="-1"></a>    <span class="kw">const</span> QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>mass<span class="op">&gt;</span> <span class="kw">auto</span> mass <span class="op">=</span> density_ <span class="op">*</span> volume;</span>
<span id="cb54-45"><a href="#cb54-45" aria-hidden="true" tabindex="-1"></a>    <span class="cf">return</span> isq<span class="op">::</span>weight<span class="op">(</span>mass <span class="op">*</span> g<span class="op">)</span>;</span>
<span id="cb54-46"><a href="#cb54-46" aria-hidden="true" tabindex="-1"></a>  <span class="op">}</span></span>
<span id="cb54-47"><a href="#cb54-47" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb54-48"><a href="#cb54-48" aria-hidden="true" tabindex="-1"></a>  <span class="op">[[</span><span class="at">nodiscard</span><span class="op">]]</span> <span class="kw">constexpr</span> quantity<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>m<span class="op">]&gt;</span> fill_level<span class="op">(</span><span class="kw">const</span> quantity<span class="op">&lt;</span>isq<span class="op">::</span>mass<span class="op">[</span>kg<span class="op">]&gt;&amp;</span> measured_mass<span class="op">)</span> <span class="kw">const</span></span>
<span id="cb54-49"><a href="#cb54-49" aria-hidden="true" tabindex="-1"></a>  <span class="op">{</span></span>
<span id="cb54-50"><a href="#cb54-50" aria-hidden="true" tabindex="-1"></a>    <span class="cf">return</span> height_ <span class="op">*</span> measured_mass <span class="op">*</span> g <span class="op">/</span> filled_weight<span class="op">()</span>;</span>
<span id="cb54-51"><a href="#cb54-51" aria-hidden="true" tabindex="-1"></a>  <span class="op">}</span></span>
<span id="cb54-52"><a href="#cb54-52" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb54-53"><a href="#cb54-53" aria-hidden="true" tabindex="-1"></a>  <span class="op">[[</span><span class="at">nodiscard</span><span class="op">]]</span> <span class="kw">constexpr</span> quantity<span class="op">&lt;</span>isq<span class="op">::</span>volume<span class="op">[</span>m3<span class="op">]&gt;</span> spare_capacity<span class="op">(</span><span class="kw">const</span> quantity<span class="op">&lt;</span>isq<span class="op">::</span>mass<span class="op">[</span>kg<span class="op">]&gt;&amp;</span> measured_mass<span class="op">)</span> <span class="kw">const</span></span>
<span id="cb54-54"><a href="#cb54-54" aria-hidden="true" tabindex="-1"></a>  <span class="op">{</span></span>
<span id="cb54-55"><a href="#cb54-55" aria-hidden="true" tabindex="-1"></a>    <span class="cf">return</span> <span class="op">(</span>height_ <span class="op">-</span> fill_level<span class="op">(</span>measured_mass<span class="op">))</span> <span class="op">*</span> base_;</span>
<span id="cb54-56"><a href="#cb54-56" aria-hidden="true" tabindex="-1"></a>  <span class="op">}</span></span>
<span id="cb54-57"><a href="#cb54-57" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span>
<span id="cb54-58"><a href="#cb54-58" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb54-59"><a href="#cb54-59" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb54-60"><a href="#cb54-60" aria-hidden="true" tabindex="-1"></a><span class="kw">class</span> CylindricalStorageTank <span class="op">:</span> <span class="kw">public</span> StorageTank <span class="op">{</span></span>
<span id="cb54-61"><a href="#cb54-61" aria-hidden="true" tabindex="-1"></a><span class="kw">public</span><span class="op">:</span></span>
<span id="cb54-62"><a href="#cb54-62" aria-hidden="true" tabindex="-1"></a>  <span class="kw">constexpr</span> CylindricalStorageTank<span class="op">(</span><span class="kw">const</span> quantity<span class="op">&lt;</span>isq<span class="op">::</span>radius<span class="op">[</span>m<span class="op">]&gt;&amp;</span> radius, <span class="kw">const</span> quantity<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>m<span class="op">]&gt;&amp;</span> height<span class="op">)</span> <span class="op">:</span></span>
<span id="cb54-63"><a href="#cb54-63" aria-hidden="true" tabindex="-1"></a>      StorageTank<span class="op">(</span>quantity_cast<span class="op">&lt;</span>horizontal_area<span class="op">&gt;(</span>std<span class="op">::</span>numbers<span class="op">::</span>pi <span class="op">*</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>radius<span class="op">))</span>, height<span class="op">)</span></span>
<span id="cb54-64"><a href="#cb54-64" aria-hidden="true" tabindex="-1"></a>  <span class="op">{</span></span>
<span id="cb54-65"><a href="#cb54-65" aria-hidden="true" tabindex="-1"></a>  <span class="op">}</span></span>
<span id="cb54-66"><a href="#cb54-66" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span>
<span id="cb54-67"><a href="#cb54-67" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb54-68"><a href="#cb54-68" aria-hidden="true" tabindex="-1"></a><span class="kw">class</span> RectangularStorageTank <span class="op">:</span> <span class="kw">public</span> StorageTank <span class="op">{</span></span>
<span id="cb54-69"><a href="#cb54-69" aria-hidden="true" tabindex="-1"></a><span class="kw">public</span><span class="op">:</span></span>
<span id="cb54-70"><a href="#cb54-70" aria-hidden="true" tabindex="-1"></a>  <span class="kw">constexpr</span> RectangularStorageTank<span class="op">(</span><span class="kw">const</span> quantity<span class="op">&lt;</span>horizontal_length<span class="op">[</span>m<span class="op">]&gt;&amp;</span> length, <span class="kw">const</span> quantity<span class="op">&lt;</span>isq<span class="op">::</span>width<span class="op">[</span>m<span class="op">]&gt;&amp;</span> width,</span>
<span id="cb54-71"><a href="#cb54-71" aria-hidden="true" tabindex="-1"></a>                                   <span class="kw">const</span> quantity<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>m<span class="op">]&gt;&amp;</span> height<span class="op">)</span> <span class="op">:</span></span>
<span id="cb54-72"><a href="#cb54-72" aria-hidden="true" tabindex="-1"></a>      StorageTank<span class="op">(</span>length <span class="op">*</span> width, height<span class="op">)</span></span>
<span id="cb54-73"><a href="#cb54-73" aria-hidden="true" tabindex="-1"></a>  <span class="op">{</span></span>
<span id="cb54-74"><a href="#cb54-74" aria-hidden="true" tabindex="-1"></a>  <span class="op">}</span></span>
<span id="cb54-75"><a href="#cb54-75" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span>
<span id="cb54-76"><a href="#cb54-76" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb54-77"><a href="#cb54-77" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>  <span class="co">// namespace</span></span>
<span id="cb54-78"><a href="#cb54-78" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb54-79"><a href="#cb54-79" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb54-80"><a href="#cb54-80" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> main<span class="op">()</span></span>
<span id="cb54-81"><a href="#cb54-81" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb54-82"><a href="#cb54-82" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> quantity height <span class="op">=</span> isq<span class="op">::</span>height<span class="op">(</span><span class="dv">200</span> <span class="op">*</span> mm<span class="op">)</span>;</span>
<span id="cb54-83"><a href="#cb54-83" aria-hidden="true" tabindex="-1"></a>  <span class="kw">auto</span> tank <span class="op">=</span> RectangularStorageTank<span class="op">(</span>horizontal_length<span class="op">(</span><span class="dv">1&#39;000</span> <span class="op">*</span> mm<span class="op">)</span>, isq<span class="op">::</span>width<span class="op">(</span><span class="dv">500</span> <span class="op">*</span> mm<span class="op">)</span>, height<span class="op">)</span>;</span>
<span id="cb54-84"><a href="#cb54-84" aria-hidden="true" tabindex="-1"></a>  tank<span class="op">.</span>set_contents_density<span class="op">(</span><span class="dv">1&#39;000</span> <span class="op">*</span> kg <span class="op">/</span> m3<span class="op">)</span>;</span>
<span id="cb54-85"><a href="#cb54-85" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb54-86"><a href="#cb54-86" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> <span class="kw">auto</span> duration <span class="op">=</span> std<span class="op">::</span>chrono<span class="op">::</span>seconds<span class="op">{</span><span class="dv">200</span><span class="op">}</span>;</span>
<span id="cb54-87"><a href="#cb54-87" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> quantity fill_time <span class="op">=</span> value_cast<span class="op">&lt;</span><span class="dt">int</span><span class="op">&gt;(</span>quantity<span class="op">{</span>duration<span class="op">})</span>;  <span class="co">// time since starting fill</span></span>
<span id="cb54-88"><a href="#cb54-88" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> quantity measured_mass <span class="op">=</span> <span class="fl">20.</span> <span class="op">*</span> kg;                         <span class="co">// measured mass at fill_time</span></span>
<span id="cb54-89"><a href="#cb54-89" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb54-90"><a href="#cb54-90" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> quantity fill_level <span class="op">=</span> tank<span class="op">.</span>fill_level<span class="op">(</span>measured_mass<span class="op">)</span>;</span>
<span id="cb54-91"><a href="#cb54-91" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> quantity spare_capacity <span class="op">=</span> tank<span class="op">.</span>spare_capacity<span class="op">(</span>measured_mass<span class="op">)</span>;</span>
<span id="cb54-92"><a href="#cb54-92" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> quantity filled_weight <span class="op">=</span> tank<span class="op">.</span>filled_weight<span class="op">()</span>;</span>
<span id="cb54-93"><a href="#cb54-93" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb54-94"><a href="#cb54-94" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>mass_change_rate<span class="op">&gt;</span> <span class="kw">auto</span> input_flow_rate <span class="op">=</span> measured_mass <span class="op">/</span> fill_time;</span>
<span id="cb54-95"><a href="#cb54-95" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>speed<span class="op">&gt;</span> <span class="kw">auto</span> float_rise_rate <span class="op">=</span> fill_level <span class="op">/</span> fill_time;</span>
<span id="cb54-96"><a href="#cb54-96" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>time<span class="op">&gt;</span> <span class="kw">auto</span> fill_time_left <span class="op">=</span> <span class="op">(</span>height <span class="op">/</span> fill_level <span class="op">-</span> <span class="dv">1</span> <span class="op">*</span> one<span class="op">)</span> <span class="op">*</span> fill_time;</span>
<span id="cb54-97"><a href="#cb54-97" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb54-98"><a href="#cb54-98" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> quantity fill_ratio <span class="op">=</span> fill_level <span class="op">/</span> height;</span>
<span id="cb54-99"><a href="#cb54-99" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb54-100"><a href="#cb54-100" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;fill height at {} = {} ({} full)&quot;</span>, fill_time, fill_level, fill_ratio<span class="op">.</span>in<span class="op">(</span>percent<span class="op">))</span>;</span>
<span id="cb54-101"><a href="#cb54-101" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;fill weight at {} = {} ({})&quot;</span>, fill_time, filled_weight, filled_weight<span class="op">.</span>in<span class="op">(</span>N<span class="op">))</span>;</span>
<span id="cb54-102"><a href="#cb54-102" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;spare capacity at {} = {}&quot;</span>, fill_time, spare_capacity<span class="op">)</span>;</span>
<span id="cb54-103"><a href="#cb54-103" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;input flow rate = {}&quot;</span>, input_flow_rate<span class="op">)</span>;</span>
<span id="cb54-104"><a href="#cb54-104" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;float rise rate = {}&quot;</span>, float_rise_rate<span class="op">)</span>;</span>
<span id="cb54-105"><a href="#cb54-105" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;tank full E.T.A. at current flow rate = {}&quot;</span>, fill_time_left<span class="op">.</span>in<span class="op">(</span>s<span class="op">))</span>;</span>
<span id="cb54-106"><a href="#cb54-106" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>The above code outputs:</p>
<pre class="text"><code>fill height at 200 s = 0.04 m (20% full)
fill weight at 200 s = 100 g₀ kg (980.665 N)
spare capacity at 200 s = 0.08 m³
input flow rate = 0.1 kg/s
float rise rate = 2e-04 m/s
tank full E.T.A. at current flow rate = 800 s</code></pre>
<p>Try it in <a href="https://godbolt.org/z/5M54z45aa">the Compiler
Explorer</a>.</p>
<h2 data-number="12.4" id="bridge-across-the-rhine"><span class="header-section-number">12.4</span> Bridge across the Rhine<a href="#bridge-across-the-rhine" class="self-link"></a></h2>
<p>The following example codifies the history of a famous issue during
the construction of a bridge across the Rhine River between the German
and Swiss parts of the town Laufenburg <span class="citation" data-cites="HOCHRHEINBRÜCKE">[<a href="https://www.normaalamsterdamspeil.nl/wp-content/uploads/2015/03/website_bridge.pdf" role="doc-biblioref">Hochrheinbrücke</a>]</span>. It also nicely
presents how <a href="https://mpusz.github.io/mp-units/latest/users_guide/framework_basics/the_affine_space/">the
Affine Space is being modeled in the library</a>.</p>
<div class="sourceCode" id="cb55"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb55-1"><a href="#cb55-1" aria-hidden="true" tabindex="-1"></a><span class="kw">import</span> mp_units;</span>
<span id="cb55-2"><a href="#cb55-2" aria-hidden="true" tabindex="-1"></a><span class="kw">import</span> std;</span>
<span id="cb55-3"><a href="#cb55-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb55-4"><a href="#cb55-4" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> <span class="kw">namespace</span> mp_units;</span>
<span id="cb55-5"><a href="#cb55-5" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> <span class="kw">namespace</span> mp_units<span class="op">::</span>si<span class="op">::</span>unit_symbols;</span>
<span id="cb55-6"><a href="#cb55-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb55-7"><a href="#cb55-7" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> amsterdam_sea_level <span class="kw">final</span> <span class="op">:</span> absolute_point_origin<span class="op">&lt;</span>isq<span class="op">::</span>altitude<span class="op">&gt;</span> <span class="op">{</span></span>
<span id="cb55-8"><a href="#cb55-8" aria-hidden="true" tabindex="-1"></a><span class="op">}</span> amsterdam_sea_level;</span>
<span id="cb55-9"><a href="#cb55-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb55-10"><a href="#cb55-10" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> mediterranean_sea_level <span class="kw">final</span> <span class="op">:</span> relative_point_origin<span class="op">&lt;</span>amsterdam_sea_level <span class="op">-</span> <span class="dv">27</span> <span class="op">*</span> cm<span class="op">&gt;</span> <span class="op">{</span></span>
<span id="cb55-11"><a href="#cb55-11" aria-hidden="true" tabindex="-1"></a><span class="op">}</span> mediterranean_sea_level;</span>
<span id="cb55-12"><a href="#cb55-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb55-13"><a href="#cb55-13" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> altitude_DE <span class="op">=</span> quantity_point<span class="op">&lt;</span>isq<span class="op">::</span>altitude<span class="op">[</span>m<span class="op">]</span>, amsterdam_sea_level<span class="op">&gt;</span>;</span>
<span id="cb55-14"><a href="#cb55-14" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> altitude_CH <span class="op">=</span> quantity_point<span class="op">&lt;</span>isq<span class="op">::</span>altitude<span class="op">[</span>m<span class="op">]</span>, mediterranean_sea_level<span class="op">&gt;</span>;</span>
<span id="cb55-15"><a href="#cb55-15" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb55-16"><a href="#cb55-16" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span><span class="kw">auto</span> R, <span class="kw">typename</span> Rep<span class="op">&gt;</span></span>
<span id="cb55-17"><a href="#cb55-17" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>ostream<span class="op">&amp;</span> <span class="kw">operator</span><span class="op">&lt;&lt;(</span>std<span class="op">::</span>ostream<span class="op">&amp;</span> os, quantity_point<span class="op">&lt;</span>R, altitude_DE<span class="op">::</span>point_origin, Rep<span class="op">&gt;</span> alt<span class="op">)</span></span>
<span id="cb55-18"><a href="#cb55-18" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb55-19"><a href="#cb55-19" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> os <span class="op">&lt;&lt;</span> alt<span class="op">.</span>quantity_ref_from<span class="op">(</span>altitude_DE<span class="op">::</span>point_origin<span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="st">&quot; AMSL(DE)&quot;</span>;</span>
<span id="cb55-20"><a href="#cb55-20" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<span id="cb55-21"><a href="#cb55-21" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb55-22"><a href="#cb55-22" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span><span class="kw">auto</span> R, <span class="kw">typename</span> Rep<span class="op">&gt;</span></span>
<span id="cb55-23"><a href="#cb55-23" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>ostream<span class="op">&amp;</span> <span class="kw">operator</span><span class="op">&lt;&lt;(</span>std<span class="op">::</span>ostream<span class="op">&amp;</span> os, quantity_point<span class="op">&lt;</span>R, altitude_CH<span class="op">::</span>point_origin, Rep<span class="op">&gt;</span> alt<span class="op">)</span></span>
<span id="cb55-24"><a href="#cb55-24" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb55-25"><a href="#cb55-25" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> os <span class="op">&lt;&lt;</span> alt<span class="op">.</span>quantity_ref_from<span class="op">(</span>altitude_CH<span class="op">::</span>point_origin<span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="st">&quot; AMSL(CH)&quot;</span>;</span>
<span id="cb55-26"><a href="#cb55-26" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<span id="cb55-27"><a href="#cb55-27" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb55-28"><a href="#cb55-28" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span><span class="kw">auto</span> R, <span class="kw">typename</span> Rep<span class="op">&gt;</span></span>
<span id="cb55-29"><a href="#cb55-29" aria-hidden="true" tabindex="-1"></a><span class="kw">struct</span> std<span class="op">::</span>formatter<span class="op">&lt;</span>quantity_point<span class="op">&lt;</span>R, altitude_DE<span class="op">::</span>point_origin, Rep<span class="op">&gt;&gt;</span> <span class="op">:</span> formatter<span class="op">&lt;</span>quantity<span class="op">&lt;</span>R, Rep<span class="op">&gt;&gt;</span> <span class="op">{</span></span>
<span id="cb55-30"><a href="#cb55-30" aria-hidden="true" tabindex="-1"></a>  <span class="kw">template</span><span class="op">&lt;</span><span class="kw">typename</span> FormatContext<span class="op">&gt;</span></span>
<span id="cb55-31"><a href="#cb55-31" aria-hidden="true" tabindex="-1"></a>  <span class="kw">auto</span> format<span class="op">(</span><span class="kw">const</span> quantity_point<span class="op">&lt;</span>R, altitude_DE<span class="op">::</span>point_origin, Rep<span class="op">&gt;&amp;</span> alt, FormatContext<span class="op">&amp;</span> ctx<span class="op">)</span> <span class="kw">const</span></span>
<span id="cb55-32"><a href="#cb55-32" aria-hidden="true" tabindex="-1"></a>  <span class="op">{</span></span>
<span id="cb55-33"><a href="#cb55-33" aria-hidden="true" tabindex="-1"></a>    formatter<span class="op">&lt;</span>quantity<span class="op">&lt;</span>R, Rep<span class="op">&gt;&gt;::</span>format<span class="op">(</span>alt<span class="op">.</span>quantity_ref_from<span class="op">(</span>altitude_DE<span class="op">::</span>point_origin<span class="op">)</span>, ctx<span class="op">)</span>;</span>
<span id="cb55-34"><a href="#cb55-34" aria-hidden="true" tabindex="-1"></a>    <span class="cf">return</span> std<span class="op">::</span>format_to<span class="op">(</span>ctx<span class="op">.</span>out<span class="op">()</span>, <span class="st">&quot; AMSL(DE)&quot;</span><span class="op">)</span>;</span>
<span id="cb55-35"><a href="#cb55-35" aria-hidden="true" tabindex="-1"></a>  <span class="op">}</span></span>
<span id="cb55-36"><a href="#cb55-36" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span>
<span id="cb55-37"><a href="#cb55-37" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb55-38"><a href="#cb55-38" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span><span class="kw">auto</span> R, <span class="kw">typename</span> Rep<span class="op">&gt;</span></span>
<span id="cb55-39"><a href="#cb55-39" aria-hidden="true" tabindex="-1"></a><span class="kw">struct</span> std<span class="op">::</span>formatter<span class="op">&lt;</span>quantity_point<span class="op">&lt;</span>R, altitude_CH<span class="op">::</span>point_origin, Rep<span class="op">&gt;&gt;</span> <span class="op">:</span> formatter<span class="op">&lt;</span>quantity<span class="op">&lt;</span>R, Rep<span class="op">&gt;&gt;</span> <span class="op">{</span></span>
<span id="cb55-40"><a href="#cb55-40" aria-hidden="true" tabindex="-1"></a>  <span class="kw">template</span><span class="op">&lt;</span><span class="kw">typename</span> FormatContext<span class="op">&gt;</span></span>
<span id="cb55-41"><a href="#cb55-41" aria-hidden="true" tabindex="-1"></a>  <span class="kw">auto</span> format<span class="op">(</span><span class="kw">const</span> quantity_point<span class="op">&lt;</span>R, altitude_CH<span class="op">::</span>point_origin, Rep<span class="op">&gt;&amp;</span> alt, FormatContext<span class="op">&amp;</span> ctx<span class="op">)</span> <span class="kw">const</span></span>
<span id="cb55-42"><a href="#cb55-42" aria-hidden="true" tabindex="-1"></a>  <span class="op">{</span></span>
<span id="cb55-43"><a href="#cb55-43" aria-hidden="true" tabindex="-1"></a>    formatter<span class="op">&lt;</span>quantity<span class="op">&lt;</span>R, Rep<span class="op">&gt;&gt;::</span>format<span class="op">(</span>alt<span class="op">.</span>quantity_ref_from<span class="op">(</span>altitude_CH<span class="op">::</span>point_origin<span class="op">)</span>, ctx<span class="op">)</span>;</span>
<span id="cb55-44"><a href="#cb55-44" aria-hidden="true" tabindex="-1"></a>    <span class="cf">return</span> std<span class="op">::</span>format_to<span class="op">(</span>ctx<span class="op">.</span>out<span class="op">()</span>, <span class="st">&quot; AMSL(CH)&quot;</span><span class="op">)</span>;</span>
<span id="cb55-45"><a href="#cb55-45" aria-hidden="true" tabindex="-1"></a>  <span class="op">}</span></span>
<span id="cb55-46"><a href="#cb55-46" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span>
<span id="cb55-47"><a href="#cb55-47" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb55-48"><a href="#cb55-48" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> main<span class="op">()</span></span>
<span id="cb55-49"><a href="#cb55-49" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb55-50"><a href="#cb55-50" aria-hidden="true" tabindex="-1"></a>  <span class="co">// expected bridge altitude in a specific reference system</span></span>
<span id="cb55-51"><a href="#cb55-51" aria-hidden="true" tabindex="-1"></a>  quantity_point expected_bridge_alt <span class="op">=</span> amsterdam_sea_level <span class="op">+</span> <span class="dv">330</span> <span class="op">*</span> m;</span>
<span id="cb55-52"><a href="#cb55-52" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb55-53"><a href="#cb55-53" aria-hidden="true" tabindex="-1"></a>  <span class="co">// some nearest landmark altitudes on both sides of the river</span></span>
<span id="cb55-54"><a href="#cb55-54" aria-hidden="true" tabindex="-1"></a>  <span class="co">// equal but not equal ;-)</span></span>
<span id="cb55-55"><a href="#cb55-55" aria-hidden="true" tabindex="-1"></a>  altitude_DE landmark_alt_DE <span class="op">=</span> altitude_DE<span class="op">::</span>point_origin <span class="op">+</span> <span class="dv">300</span> <span class="op">*</span> m;</span>
<span id="cb55-56"><a href="#cb55-56" aria-hidden="true" tabindex="-1"></a>  altitude_CH landmark_alt_CH <span class="op">=</span> altitude_CH<span class="op">::</span>point_origin <span class="op">+</span> <span class="dv">300</span> <span class="op">*</span> m;</span>
<span id="cb55-57"><a href="#cb55-57" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb55-58"><a href="#cb55-58" aria-hidden="true" tabindex="-1"></a>  <span class="co">// artifical deltas from landmarks of the bridge base on both sides of the river</span></span>
<span id="cb55-59"><a href="#cb55-59" aria-hidden="true" tabindex="-1"></a>  quantity delta_DE <span class="op">=</span> isq<span class="op">::</span>height<span class="op">(</span><span class="dv">3</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb55-60"><a href="#cb55-60" aria-hidden="true" tabindex="-1"></a>  quantity delta_CH <span class="op">=</span> isq<span class="op">::</span>height<span class="op">(-</span><span class="dv">2</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb55-61"><a href="#cb55-61" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb55-62"><a href="#cb55-62" aria-hidden="true" tabindex="-1"></a>  <span class="co">// artificial altitude of the bridge base on both sides of the river</span></span>
<span id="cb55-63"><a href="#cb55-63" aria-hidden="true" tabindex="-1"></a>  quantity_point bridge_base_alt_DE <span class="op">=</span> landmark_alt_DE <span class="op">+</span> delta_DE;</span>
<span id="cb55-64"><a href="#cb55-64" aria-hidden="true" tabindex="-1"></a>  quantity_point bridge_base_alt_CH <span class="op">=</span> landmark_alt_CH <span class="op">+</span> delta_CH;</span>
<span id="cb55-65"><a href="#cb55-65" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb55-66"><a href="#cb55-66" aria-hidden="true" tabindex="-1"></a>  <span class="co">// artificial height of the required bridge pilar height on both sides of the river</span></span>
<span id="cb55-67"><a href="#cb55-67" aria-hidden="true" tabindex="-1"></a>  quantity bridge_pilar_height_DE <span class="op">=</span> expected_bridge_alt <span class="op">-</span> bridge_base_alt_DE;</span>
<span id="cb55-68"><a href="#cb55-68" aria-hidden="true" tabindex="-1"></a>  quantity bridge_pilar_height_CH <span class="op">=</span> expected_bridge_alt <span class="op">-</span> bridge_base_alt_CH;</span>
<span id="cb55-69"><a href="#cb55-69" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb55-70"><a href="#cb55-70" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Bridge pillars height:&quot;</span><span class="op">)</span>;</span>
<span id="cb55-71"><a href="#cb55-71" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;- Germany:     {}&quot;</span>, bridge_pilar_height_DE<span class="op">)</span>;</span>
<span id="cb55-72"><a href="#cb55-72" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;- Switzerland: {}&quot;</span>, bridge_pilar_height_CH<span class="op">)</span>;</span>
<span id="cb55-73"><a href="#cb55-73" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb55-74"><a href="#cb55-74" aria-hidden="true" tabindex="-1"></a>  <span class="co">// artificial bridge altitude on both sides of the river in both systems</span></span>
<span id="cb55-75"><a href="#cb55-75" aria-hidden="true" tabindex="-1"></a>  quantity_point bridge_road_alt_DE <span class="op">=</span> bridge_base_alt_DE <span class="op">+</span> bridge_pilar_height_DE;</span>
<span id="cb55-76"><a href="#cb55-76" aria-hidden="true" tabindex="-1"></a>  quantity_point bridge_road_alt_CH <span class="op">=</span> bridge_base_alt_CH <span class="op">+</span> bridge_pilar_height_CH;</span>
<span id="cb55-77"><a href="#cb55-77" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb55-78"><a href="#cb55-78" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Bridge road altitude:&quot;</span><span class="op">)</span>;</span>
<span id="cb55-79"><a href="#cb55-79" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;- Germany:     {}&quot;</span>, bridge_road_alt_DE<span class="op">)</span>;</span>
<span id="cb55-80"><a href="#cb55-80" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;- Switzerland: {}&quot;</span>, bridge_road_alt_CH<span class="op">)</span>;</span>
<span id="cb55-81"><a href="#cb55-81" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb55-82"><a href="#cb55-82" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Bridge road altitude relative to the Amsterdam Sea Level:&quot;</span><span class="op">)</span>;</span>
<span id="cb55-83"><a href="#cb55-83" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;- Germany:     {}&quot;</span>, bridge_road_alt_DE<span class="op">.</span>quantity_from<span class="op">(</span>amsterdam_sea_level<span class="op">))</span>;</span>
<span id="cb55-84"><a href="#cb55-84" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;- Switzerland: {}&quot;</span>, bridge_road_alt_CH<span class="op">.</span>quantity_from<span class="op">(</span>amsterdam_sea_level<span class="op">))</span>;</span>
<span id="cb55-85"><a href="#cb55-85" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>The above provides the following text output:</p>
<pre class="text"><code>Bridge pillars height:
- Germany:     27 m
- Switzerland: 3227 cm
Bridge road altitude:
- Germany:     330 m AMSL(DE)
- Switzerland: 33027 cm AMSL(CH)
Bridge road altitude relative to the Amsterdam Sea Level:
- Germany:     330 m
- Switzerland: 33000 cm</code></pre>
<p>Try it in <a href="https://godbolt.org/z/zv6eenqq3">the Compiler
Explorer</a>.</p>
<h2 data-number="12.5" id="hardware-voltage-measurement-readout"><span class="header-section-number">12.5</span> Hardware voltage measurement
readout<a href="#hardware-voltage-measurement-readout" class="self-link"></a></h2>
<p>Every measurement can (and probably should) be modelled as a
<code class="sourceCode cpp">quantity_point</code> and this is a perfect
example of such a use case.</p>
<p>This example implements a simplified scenario of measuring voltage
read from hardware through a mapped 16-bits register. The actual voltage
range of [-10 V, 10 V] is mapped to [-32767, 32767] on hardware.
Translation of the value requires not only scaling of the value but also
applying of an offset.</p>
<div class="sourceCode" id="cb56"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb56-1"><a href="#cb56-1" aria-hidden="true" tabindex="-1"></a><span class="kw">import</span> mp_units;</span>
<span id="cb56-2"><a href="#cb56-2" aria-hidden="true" tabindex="-1"></a><span class="kw">import</span> std;</span>
<span id="cb56-3"><a href="#cb56-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb56-4"><a href="#cb56-4" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> <span class="kw">namespace</span> mp_units;</span>
<span id="cb56-5"><a href="#cb56-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb56-6"><a href="#cb56-6" aria-hidden="true" tabindex="-1"></a><span class="co">// real voltage range</span></span>
<span id="cb56-7"><a href="#cb56-7" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="dt">int</span> min_voltage <span class="op">=</span> <span class="op">-</span><span class="dv">10</span>;</span>
<span id="cb56-8"><a href="#cb56-8" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="dt">int</span> max_voltage <span class="op">=</span> <span class="dv">10</span>;</span>
<span id="cb56-9"><a href="#cb56-9" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="dt">int</span> voltage_range <span class="op">=</span> max_voltage <span class="op">-</span> min_voltage;</span>
<span id="cb56-10"><a href="#cb56-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb56-11"><a href="#cb56-11" aria-hidden="true" tabindex="-1"></a><span class="co">// hardware encoding of voltage</span></span>
<span id="cb56-12"><a href="#cb56-12" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> voltage_hw_t <span class="op">=</span> std<span class="op">::</span><span class="dt">uint16_t</span>;</span>
<span id="cb56-13"><a href="#cb56-13" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> voltage_hw_t voltage_hw_error <span class="op">=</span> std<span class="op">::</span>numeric_limits<span class="op">&lt;</span>voltage_hw_t<span class="op">&gt;::</span>max<span class="op">()</span>;</span>
<span id="cb56-14"><a href="#cb56-14" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> voltage_hw_t voltage_hw_min <span class="op">=</span> <span class="dv">0</span>;</span>
<span id="cb56-15"><a href="#cb56-15" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> voltage_hw_t voltage_hw_max <span class="op">=</span> voltage_hw_error <span class="op">-</span> <span class="dv">1</span>;</span>
<span id="cb56-16"><a href="#cb56-16" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> voltage_hw_t voltage_hw_range <span class="op">=</span> voltage_hw_max <span class="op">-</span> voltage_hw_min;</span>
<span id="cb56-17"><a href="#cb56-17" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> voltage_hw_t voltage_hw_zero <span class="op">=</span> voltage_hw_range <span class="op">/</span> <span class="dv">2</span>;</span>
<span id="cb56-18"><a href="#cb56-18" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb56-19"><a href="#cb56-19" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> hw_voltage_origin <span class="kw">final</span> <span class="op">:</span></span>
<span id="cb56-20"><a href="#cb56-20" aria-hidden="true" tabindex="-1"></a>  relative_point_origin<span class="op">&lt;</span>absolute<span class="op">&lt;</span>si<span class="op">::</span>volt<span class="op">&gt;(</span>min_voltage<span class="op">)&gt;</span> <span class="op">{}</span> hw_voltage_origin;</span>
<span id="cb56-21"><a href="#cb56-21" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb56-22"><a href="#cb56-22" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> hw_voltage_unit <span class="kw">final</span> <span class="op">:</span></span>
<span id="cb56-23"><a href="#cb56-23" aria-hidden="true" tabindex="-1"></a>  named_unit<span class="op">&lt;</span><span class="st">&quot;hwV&quot;</span>, mag_ratio<span class="op">&lt;</span>voltage_range, voltage_hw_range<span class="op">&gt;</span> <span class="op">*</span> si<span class="op">::</span>volt, hw_voltage_origin<span class="op">&gt;</span> <span class="op">{}</span> hw_voltage_unit;</span>
<span id="cb56-24"><a href="#cb56-24" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb56-25"><a href="#cb56-25" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> hw_voltage_quantity_point <span class="op">=</span> quantity_point<span class="op">&lt;</span>hw_voltage_unit, hw_voltage_origin, voltage_hw_t<span class="op">&gt;</span>;</span>
<span id="cb56-26"><a href="#cb56-26" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb56-27"><a href="#cb56-27" aria-hidden="true" tabindex="-1"></a><span class="co">// mapped HW register</span></span>
<span id="cb56-28"><a href="#cb56-28" aria-hidden="true" tabindex="-1"></a><span class="kw">volatile</span> voltage_hw_t hw_voltage_value;</span>
<span id="cb56-29"><a href="#cb56-29" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb56-30"><a href="#cb56-30" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>optional<span class="op">&lt;</span>hw_voltage_quantity_point<span class="op">&gt;</span> read_hw_voltage<span class="op">()</span></span>
<span id="cb56-31"><a href="#cb56-31" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb56-32"><a href="#cb56-32" aria-hidden="true" tabindex="-1"></a>  voltage_hw_t local_copy <span class="op">=</span> hw_voltage_value;</span>
<span id="cb56-33"><a href="#cb56-33" aria-hidden="true" tabindex="-1"></a>  <span class="cf">if</span> <span class="op">(</span>local_copy <span class="op">==</span> voltage_hw_error<span class="op">)</span> <span class="cf">return</span> std<span class="op">::</span>nullopt;</span>
<span id="cb56-34"><a href="#cb56-34" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> absolute<span class="op">&lt;</span>hw_voltage_unit<span class="op">&gt;(</span>local_copy<span class="op">)</span>;</span>
<span id="cb56-35"><a href="#cb56-35" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<span id="cb56-36"><a href="#cb56-36" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb56-37"><a href="#cb56-37" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> print<span class="op">(</span>QuantityPoint <span class="kw">auto</span> qp<span class="op">)</span></span>
<span id="cb56-38"><a href="#cb56-38" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb56-39"><a href="#cb56-39" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{:10} ({:5})&quot;</span>, qp<span class="op">.</span>quantity_from_zero<span class="op">()</span>,</span>
<span id="cb56-40"><a href="#cb56-40" aria-hidden="true" tabindex="-1"></a>               value_cast<span class="op">&lt;</span><span class="dt">double</span>, si<span class="op">::</span>volt<span class="op">&gt;(</span>qp<span class="op">).</span>quantity_from_zero<span class="op">())</span>;</span>
<span id="cb56-41"><a href="#cb56-41" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<span id="cb56-42"><a href="#cb56-42" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb56-43"><a href="#cb56-43" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> main<span class="op">()</span></span>
<span id="cb56-44"><a href="#cb56-44" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb56-45"><a href="#cb56-45" aria-hidden="true" tabindex="-1"></a>  <span class="co">// simulate reading of 3 values from the hardware</span></span>
<span id="cb56-46"><a href="#cb56-46" aria-hidden="true" tabindex="-1"></a>  hw_voltage_value <span class="op">=</span> voltage_hw_min;</span>
<span id="cb56-47"><a href="#cb56-47" aria-hidden="true" tabindex="-1"></a>  quantity_point qp1 <span class="op">=</span> read_hw_voltage<span class="op">().</span>value<span class="op">()</span>;</span>
<span id="cb56-48"><a href="#cb56-48" aria-hidden="true" tabindex="-1"></a>  hw_voltage_value <span class="op">=</span> voltage_hw_zero;</span>
<span id="cb56-49"><a href="#cb56-49" aria-hidden="true" tabindex="-1"></a>  quantity_point qp2 <span class="op">=</span> read_hw_voltage<span class="op">().</span>value<span class="op">()</span>;</span>
<span id="cb56-50"><a href="#cb56-50" aria-hidden="true" tabindex="-1"></a>  hw_voltage_value <span class="op">=</span> voltage_hw_max;</span>
<span id="cb56-51"><a href="#cb56-51" aria-hidden="true" tabindex="-1"></a>  quantity_point qp3 <span class="op">=</span> read_hw_voltage<span class="op">().</span>value<span class="op">()</span>;</span>
<span id="cb56-52"><a href="#cb56-52" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb56-53"><a href="#cb56-53" aria-hidden="true" tabindex="-1"></a>  print<span class="op">(</span>qp1<span class="op">)</span>;</span>
<span id="cb56-54"><a href="#cb56-54" aria-hidden="true" tabindex="-1"></a>  print<span class="op">(</span>qp2<span class="op">)</span>;</span>
<span id="cb56-55"><a href="#cb56-55" aria-hidden="true" tabindex="-1"></a>  print<span class="op">(</span>qp3<span class="op">)</span>;</span>
<span id="cb56-56"><a href="#cb56-56" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>The above prints:</p>
<pre class="text"><code>     0 hwV (-10 V)
 32767 hwV (  0 V)
 65534 hwV ( 10 V)</code></pre>
<p>Try it in <a href="https://godbolt.org/z/51TbGn6nn">the Compiler
Explorer</a>.</p>
<h2 data-number="12.6" id="user-defined-quantities-and-units"><span class="header-section-number">12.6</span> User defined quantities and
units<a href="#user-defined-quantities-and-units" class="self-link"></a></h2>
<p>Users can easily define new quantities and units for domain-specific
use-cases. This example from digital signal processing domain will show
how to define custom strongly typed dimensionless quantities, units for
them, and how they can be converted to time measured in
milliseconds:</p>
<div class="sourceCode" id="cb57"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb57-1"><a href="#cb57-1" aria-hidden="true" tabindex="-1"></a><span class="kw">import</span> mp_units;</span>
<span id="cb57-2"><a href="#cb57-2" aria-hidden="true" tabindex="-1"></a><span class="kw">import</span> std;</span>
<span id="cb57-3"><a href="#cb57-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-4"><a href="#cb57-4" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> <span class="kw">namespace</span> mp_units;</span>
<span id="cb57-5"><a href="#cb57-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-6"><a href="#cb57-6" aria-hidden="true" tabindex="-1"></a><span class="kw">namespace</span> ni <span class="op">{</span></span>
<span id="cb57-7"><a href="#cb57-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-8"><a href="#cb57-8" aria-hidden="true" tabindex="-1"></a><span class="co">// quantities</span></span>
<span id="cb57-9"><a href="#cb57-9" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> SampleCount <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>dimensionless, is_kind<span class="op">&gt;</span> <span class="op">{}</span> SampleCount;</span>
<span id="cb57-10"><a href="#cb57-10" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> SampleDuration <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>isq<span class="op">::</span>period_duration<span class="op">&gt;</span> <span class="op">{}</span> SampleDuration;</span>
<span id="cb57-11"><a href="#cb57-11" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> SamplingRate <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>isq<span class="op">::</span>frequency, SampleCount <span class="op">/</span> SampleDuration<span class="op">&gt;</span> <span class="op">{}</span> SamplingRate;</span>
<span id="cb57-12"><a href="#cb57-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-13"><a href="#cb57-13" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> UnitSampleAmount <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>dimensionless, is_kind<span class="op">&gt;</span> <span class="op">{}</span> UnitSampleAmount;</span>
<span id="cb57-14"><a href="#cb57-14" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> Amplitude <span class="op">=</span> UnitSampleAmount;</span>
<span id="cb57-15"><a href="#cb57-15" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> Level <span class="op">=</span> UnitSampleAmount;</span>
<span id="cb57-16"><a href="#cb57-16" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> Power <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>Level <span class="op">*</span> Level<span class="op">&gt;</span> <span class="op">{}</span> Power;</span>
<span id="cb57-17"><a href="#cb57-17" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-18"><a href="#cb57-18" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> MIDIClock <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>dimensionless, is_kind<span class="op">&gt;</span> <span class="op">{}</span> MIDIClock;</span>
<span id="cb57-19"><a href="#cb57-19" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-20"><a href="#cb57-20" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> BeatCount <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>dimensionless, is_kind<span class="op">&gt;</span> <span class="op">{}</span> BeatCount;</span>
<span id="cb57-21"><a href="#cb57-21" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> BeatDuration <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>isq<span class="op">::</span>period_duration<span class="op">&gt;</span> <span class="op">{}</span> BeatDuration;</span>
<span id="cb57-22"><a href="#cb57-22" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> Tempo <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>isq<span class="op">::</span>frequency, BeatCount <span class="op">/</span> BeatDuration<span class="op">&gt;</span> <span class="op">{}</span> Tempo;</span>
<span id="cb57-23"><a href="#cb57-23" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-24"><a href="#cb57-24" aria-hidden="true" tabindex="-1"></a><span class="co">// units</span></span>
<span id="cb57-25"><a href="#cb57-25" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> Sample <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;Smpl&quot;</span>, one, kind_of<span class="op">&lt;</span>SampleCount<span class="op">&gt;&gt;</span> <span class="op">{}</span> Sample;</span>
<span id="cb57-26"><a href="#cb57-26" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> SampleValue <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;PCM&quot;</span>, one, kind_of<span class="op">&lt;</span>UnitSampleAmount<span class="op">&gt;&gt;</span> <span class="op">{}</span> SampleValue;</span>
<span id="cb57-27"><a href="#cb57-27" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> MIDIPulse <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;p&quot;</span>, one, kind_of<span class="op">&lt;</span>MIDIClock<span class="op">&gt;&gt;</span> <span class="op">{}</span> MIDIPulse;</span>
<span id="cb57-28"><a href="#cb57-28" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-29"><a href="#cb57-29" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> QuarterNote <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;q&quot;</span>, one, kind_of<span class="op">&lt;</span>BeatCount<span class="op">&gt;&gt;</span> <span class="op">{}</span> QuarterNote;</span>
<span id="cb57-30"><a href="#cb57-30" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> HalfNote <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;h&quot;</span>, mag<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;</span> <span class="op">*</span> QuarterNote<span class="op">&gt;</span> <span class="op">{}</span> HalfNote;</span>
<span id="cb57-31"><a href="#cb57-31" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> DottedHalfNote <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;h.&quot;</span>, mag<span class="op">&lt;</span><span class="dv">3</span><span class="op">&gt;</span> <span class="op">*</span> QuarterNote<span class="op">&gt;</span> <span class="op">{}</span> DottedHalfNote;</span>
<span id="cb57-32"><a href="#cb57-32" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> WholeNote <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;w&quot;</span>, mag<span class="op">&lt;</span><span class="dv">4</span><span class="op">&gt;</span> <span class="op">*</span> QuarterNote<span class="op">&gt;</span> <span class="op">{}</span> WholeNote;</span>
<span id="cb57-33"><a href="#cb57-33" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> EightNote <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;8th&quot;</span>, mag_ratio<span class="op">&lt;</span><span class="dv">1</span>, <span class="dv">2</span><span class="op">&gt;</span> <span class="op">*</span> QuarterNote<span class="op">&gt;</span> <span class="op">{}</span> EightNote;</span>
<span id="cb57-34"><a href="#cb57-34" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> DottedQuarterNote <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;q.&quot;</span>, mag<span class="op">&lt;</span><span class="dv">3</span><span class="op">&gt;</span> <span class="op">*</span> EightNote<span class="op">&gt;</span> <span class="op">{}</span> DottedQuarterNote;</span>
<span id="cb57-35"><a href="#cb57-35" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> QuarterNoteTriplet <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;qt&quot;</span>, mag_ratio<span class="op">&lt;</span><span class="dv">1</span>, <span class="dv">3</span><span class="op">&gt;</span> <span class="op">*</span> HalfNote<span class="op">&gt;</span> <span class="op">{}</span> QuarterNoteTriplet;</span>
<span id="cb57-36"><a href="#cb57-36" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> SixteenthNote <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;16th&quot;</span>, mag_ratio<span class="op">&lt;</span><span class="dv">1</span>, <span class="dv">2</span><span class="op">&gt;</span> <span class="op">*</span> EightNote<span class="op">&gt;</span> <span class="op">{}</span> SixteenthNote;</span>
<span id="cb57-37"><a href="#cb57-37" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> DottedEightNote <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;q.&quot;</span>, mag<span class="op">&lt;</span><span class="dv">3</span><span class="op">&gt;</span> <span class="op">*</span> SixteenthNote<span class="op">&gt;</span> <span class="op">{}</span> DottedEightNote;</span>
<span id="cb57-38"><a href="#cb57-38" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-39"><a href="#cb57-39" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> Beat <span class="op">=</span> QuarterNote;</span>
<span id="cb57-40"><a href="#cb57-40" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-41"><a href="#cb57-41" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> BeatsPerMinute <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;bpm&quot;</span>, Beat <span class="op">/</span> si<span class="op">::</span>minute<span class="op">&gt;</span> <span class="op">{}</span> BeatsPerMinute;</span>
<span id="cb57-42"><a href="#cb57-42" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> MIDIPulsePerQuarter <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;ppqn&quot;</span>, MIDIPulse <span class="op">/</span> QuarterNote<span class="op">&gt;</span> <span class="op">{}</span> MIDIPulsePerQuarter;</span>
<span id="cb57-43"><a href="#cb57-43" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-44"><a href="#cb57-44" aria-hidden="true" tabindex="-1"></a><span class="kw">namespace</span> unit_symbols <span class="op">{</span></span>
<span id="cb57-45"><a href="#cb57-45" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-46"><a href="#cb57-46" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> Smpl <span class="op">=</span> Sample;</span>
<span id="cb57-47"><a href="#cb57-47" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> pcm <span class="op">=</span> SampleValue;</span>
<span id="cb57-48"><a href="#cb57-48" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> p <span class="op">=</span> MIDIPulse;</span>
<span id="cb57-49"><a href="#cb57-49" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-50"><a href="#cb57-50" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> n_wd <span class="op">=</span> <span class="dv">3</span> <span class="op">*</span> HalfNote;</span>
<span id="cb57-51"><a href="#cb57-51" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> n_w <span class="op">=</span> WholeNote;</span>
<span id="cb57-52"><a href="#cb57-52" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> n_hd <span class="op">=</span> DottedHalfNote;</span>
<span id="cb57-53"><a href="#cb57-53" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> n_h <span class="op">=</span> HalfNote;</span>
<span id="cb57-54"><a href="#cb57-54" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> n_qd <span class="op">=</span> DottedQuarterNote;</span>
<span id="cb57-55"><a href="#cb57-55" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> n_q <span class="op">=</span> QuarterNote;</span>
<span id="cb57-56"><a href="#cb57-56" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> n_qt <span class="op">=</span> QuarterNoteTriplet;</span>
<span id="cb57-57"><a href="#cb57-57" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> n_8thd <span class="op">=</span> DottedEightNote;</span>
<span id="cb57-58"><a href="#cb57-58" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> n_8th <span class="op">=</span> EightNote;</span>
<span id="cb57-59"><a href="#cb57-59" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> n_16th <span class="op">=</span> SixteenthNote;</span>
<span id="cb57-60"><a href="#cb57-60" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-61"><a href="#cb57-61" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<span id="cb57-62"><a href="#cb57-62" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-63"><a href="#cb57-63" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>BeatsPerMinute, <span class="dt">float</span><span class="op">&gt;</span> GetTempo<span class="op">()</span></span>
<span id="cb57-64"><a href="#cb57-64" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb57-65"><a href="#cb57-65" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> <span class="dv">110</span> <span class="op">*</span> BeatsPerMinute;</span>
<span id="cb57-66"><a href="#cb57-66" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<span id="cb57-67"><a href="#cb57-67" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-68"><a href="#cb57-68" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>MIDIPulsePerQuarter, <span class="dt">unsigned</span><span class="op">&gt;</span> GetPPQN<span class="op">()</span></span>
<span id="cb57-69"><a href="#cb57-69" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb57-70"><a href="#cb57-70" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> <span class="dv">960</span> <span class="op">*</span> MIDIPulse <span class="op">/</span> QuarterNote;</span>
<span id="cb57-71"><a href="#cb57-71" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<span id="cb57-72"><a href="#cb57-72" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-73"><a href="#cb57-73" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>MIDIPulse, <span class="dt">unsigned</span><span class="op">&gt;</span> GetTransportPos<span class="op">()</span></span>
<span id="cb57-74"><a href="#cb57-74" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb57-75"><a href="#cb57-75" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> <span class="dv">15&#39;836</span> <span class="op">*</span> MIDIPulse;</span>
<span id="cb57-76"><a href="#cb57-76" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<span id="cb57-77"><a href="#cb57-77" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-78"><a href="#cb57-78" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>SamplingRate<span class="op">[</span>si<span class="op">::</span>hertz<span class="op">]</span>, <span class="dt">float</span><span class="op">&gt;</span> GetSampleRate<span class="op">()</span></span>
<span id="cb57-79"><a href="#cb57-79" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb57-80"><a href="#cb57-80" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> <span class="fl">44&#39;100.</span><span class="bu">f</span> <span class="op">*</span> si<span class="op">::</span>hertz;</span>
<span id="cb57-81"><a href="#cb57-81" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<span id="cb57-82"><a href="#cb57-82" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-83"><a href="#cb57-83" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<span id="cb57-84"><a href="#cb57-84" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-85"><a href="#cb57-85" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> main<span class="op">()</span></span>
<span id="cb57-86"><a href="#cb57-86" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb57-87"><a href="#cb57-87" aria-hidden="true" tabindex="-1"></a>  <span class="kw">using</span> <span class="kw">namespace</span> ni<span class="op">::</span>unit_symbols;</span>
<span id="cb57-88"><a href="#cb57-88" aria-hidden="true" tabindex="-1"></a>  <span class="kw">using</span> <span class="kw">namespace</span> mp_units<span class="op">::</span>si<span class="op">::</span>unit_symbols;</span>
<span id="cb57-89"><a href="#cb57-89" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-90"><a href="#cb57-90" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> <span class="kw">auto</span> sr1 <span class="op">=</span> ni<span class="op">::</span>GetSampleRate<span class="op">()</span>;</span>
<span id="cb57-91"><a href="#cb57-91" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> <span class="kw">auto</span> sr2 <span class="op">=</span> <span class="fl">48&#39;000.</span><span class="bu">f</span> <span class="op">*</span> Smpl <span class="op">/</span> s;</span>
<span id="cb57-92"><a href="#cb57-92" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-93"><a href="#cb57-93" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> <span class="kw">auto</span> samples <span class="op">=</span> <span class="dv">512</span> <span class="op">*</span> Smpl;</span>
<span id="cb57-94"><a href="#cb57-94" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-95"><a href="#cb57-95" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> <span class="kw">auto</span> sampleTime1 <span class="op">=</span> <span class="op">(</span>samples <span class="op">/</span> sr1<span class="op">).</span>in<span class="op">(</span>s<span class="op">)</span>;</span>
<span id="cb57-96"><a href="#cb57-96" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> <span class="kw">auto</span> sampleTime2 <span class="op">=</span> <span class="op">(</span>samples <span class="op">/</span> sr2<span class="op">).</span>in<span class="op">(</span>ms<span class="op">)</span>;</span>
<span id="cb57-97"><a href="#cb57-97" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-98"><a href="#cb57-98" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> <span class="kw">auto</span> sampleDuration1 <span class="op">=</span> <span class="op">(</span><span class="dv">1</span> <span class="op">/</span> sr1<span class="op">).</span>in<span class="op">(</span>ms<span class="op">)</span>;</span>
<span id="cb57-99"><a href="#cb57-99" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> <span class="kw">auto</span> sampleDuration2 <span class="op">=</span> <span class="op">(</span><span class="dv">1</span> <span class="op">/</span> sr2<span class="op">).</span>in<span class="op">(</span>ms<span class="op">)</span>;</span>
<span id="cb57-100"><a href="#cb57-100" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-101"><a href="#cb57-101" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> <span class="kw">auto</span> rampTime <span class="op">=</span> <span class="fl">35.</span><span class="bu">f</span> <span class="op">*</span> ms;</span>
<span id="cb57-102"><a href="#cb57-102" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> <span class="kw">auto</span> rampSamples1 <span class="op">=</span> <span class="op">(</span>rampTime <span class="op">*</span> sr1<span class="op">).</span>force_in<span class="op">&lt;</span><span class="dt">int</span><span class="op">&gt;(</span>Smpl<span class="op">)</span>;</span>
<span id="cb57-103"><a href="#cb57-103" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> <span class="kw">auto</span> rampSamples2 <span class="op">=</span> <span class="op">(</span>rampTime <span class="op">*</span> sr2<span class="op">).</span>force_in<span class="op">&lt;</span><span class="dt">int</span><span class="op">&gt;(</span>Smpl<span class="op">)</span>;</span>
<span id="cb57-104"><a href="#cb57-104" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-105"><a href="#cb57-105" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Sample rate 1 is: {}&quot;</span>, sr1<span class="op">)</span>;</span>
<span id="cb57-106"><a href="#cb57-106" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Sample rate 2 is: {}&quot;</span>, sr2<span class="op">)</span>;</span>
<span id="cb57-107"><a href="#cb57-107" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-108"><a href="#cb57-108" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{} @ {} is {::N[.5f]}&quot;</span>, samples, sr1, sampleTime1<span class="op">)</span>;</span>
<span id="cb57-109"><a href="#cb57-109" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{} @ {} is {::N[.5f]}&quot;</span>, samples, sr2, sampleTime2<span class="op">)</span>;</span>
<span id="cb57-110"><a href="#cb57-110" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-111"><a href="#cb57-111" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;One sample @ {} is {::N[.5f]}&quot;</span>, sr1, sampleDuration1<span class="op">)</span>;</span>
<span id="cb57-112"><a href="#cb57-112" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;One sample @ {} is {::N[.5f]}&quot;</span>, sr2, sampleDuration2<span class="op">)</span>;</span>
<span id="cb57-113"><a href="#cb57-113" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-114"><a href="#cb57-114" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{} is {} @ {}&quot;</span>, rampTime, rampSamples1, sr1<span class="op">)</span>;</span>
<span id="cb57-115"><a href="#cb57-115" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{} is {} @ {}&quot;</span>, rampTime, rampSamples2, sr2<span class="op">)</span>;</span>
<span id="cb57-116"><a href="#cb57-116" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-117"><a href="#cb57-117" aria-hidden="true" tabindex="-1"></a>  <span class="kw">auto</span> sampleValue <span class="op">=</span> <span class="op">-</span><span class="fl">0.4</span><span class="bu">f</span> <span class="op">*</span> pcm;</span>
<span id="cb57-118"><a href="#cb57-118" aria-hidden="true" tabindex="-1"></a>  <span class="kw">auto</span> power1 <span class="op">=</span> sampleValue <span class="op">*</span> sampleValue;</span>
<span id="cb57-119"><a href="#cb57-119" aria-hidden="true" tabindex="-1"></a>  <span class="kw">auto</span> power2 <span class="op">=</span> <span class="op">-</span><span class="fl">0.2</span> <span class="op">*</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>pcm<span class="op">)</span>;</span>
<span id="cb57-120"><a href="#cb57-120" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-121"><a href="#cb57-121" aria-hidden="true" tabindex="-1"></a>  <span class="kw">auto</span> tempo <span class="op">=</span> ni<span class="op">::</span>GetTempo<span class="op">()</span>;</span>
<span id="cb57-122"><a href="#cb57-122" aria-hidden="true" tabindex="-1"></a>  <span class="kw">auto</span> reverbBeats <span class="op">=</span> <span class="dv">1</span> <span class="op">*</span> n_qd;</span>
<span id="cb57-123"><a href="#cb57-123" aria-hidden="true" tabindex="-1"></a>  <span class="kw">auto</span> reverbTime <span class="op">=</span> reverbBeats <span class="op">/</span> tempo;</span>
<span id="cb57-124"><a href="#cb57-124" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-125"><a href="#cb57-125" aria-hidden="true" tabindex="-1"></a>  <span class="kw">auto</span> pulsePerQuarter <span class="op">=</span> value_cast<span class="op">&lt;</span><span class="dt">float</span><span class="op">&gt;(</span>ni<span class="op">::</span>GetPPQN<span class="op">())</span>;</span>
<span id="cb57-126"><a href="#cb57-126" aria-hidden="true" tabindex="-1"></a>  <span class="kw">auto</span> transportPosition <span class="op">=</span> ni<span class="op">::</span>GetTransportPos<span class="op">()</span>;</span>
<span id="cb57-127"><a href="#cb57-127" aria-hidden="true" tabindex="-1"></a>  <span class="kw">auto</span> transportBeats <span class="op">=</span> <span class="op">(</span>transportPosition <span class="op">/</span> pulsePerQuarter<span class="op">).</span>in<span class="op">(</span>n_q<span class="op">)</span>;</span>
<span id="cb57-128"><a href="#cb57-128" aria-hidden="true" tabindex="-1"></a>  <span class="kw">auto</span> transportTime <span class="op">=</span> <span class="op">(</span>transportBeats <span class="op">/</span> tempo<span class="op">).</span>in<span class="op">(</span>s<span class="op">)</span>;</span>
<span id="cb57-129"><a href="#cb57-129" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-130"><a href="#cb57-130" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;SampleValue is: {}&quot;</span>, sampleValue<span class="op">)</span>;</span>
<span id="cb57-131"><a href="#cb57-131" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Power 1 is: {}&quot;</span>, power1<span class="op">)</span>;</span>
<span id="cb57-132"><a href="#cb57-132" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Power 2 is: {}&quot;</span>, power2<span class="op">)</span>;</span>
<span id="cb57-133"><a href="#cb57-133" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-134"><a href="#cb57-134" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Tempo is: {}&quot;</span>, tempo<span class="op">)</span>;</span>
<span id="cb57-135"><a href="#cb57-135" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Reverb Beats is: {}&quot;</span>, reverbBeats<span class="op">)</span>;</span>
<span id="cb57-136"><a href="#cb57-136" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Reverb Time is: {}&quot;</span>, reverbTime<span class="op">.</span>in<span class="op">(</span>s<span class="op">))</span>;</span>
<span id="cb57-137"><a href="#cb57-137" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Pulse Per Quarter is: {}&quot;</span>, pulsePerQuarter<span class="op">)</span>;</span>
<span id="cb57-138"><a href="#cb57-138" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Transport Position is: {}&quot;</span>, transportPosition<span class="op">)</span>;</span>
<span id="cb57-139"><a href="#cb57-139" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Transport Beats is: {}&quot;</span>, transportBeats<span class="op">)</span>;</span>
<span id="cb57-140"><a href="#cb57-140" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Transport Time is: {}&quot;</span>, transportTime<span class="op">)</span>;</span>
<span id="cb57-141"><a href="#cb57-141" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb57-142"><a href="#cb57-142" aria-hidden="true" tabindex="-1"></a>  <span class="co">// auto error = 1 * Smpl + 1 * pcm + 1 * p + 1 * Beat;  // Compile-time error</span></span>
<span id="cb57-143"><a href="#cb57-143" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>The above code outputs:</p>
<pre class="text"><code>Sample rate 1 is: 44100 Hz
Sample rate 2 is: 48000 Smpl/s
512 Smpl @ 44100 Hz is 0.01161 s
512 Smpl @ 48000 Smpl/s is 10.66667 ms
One sample @ 44100 Hz is 0.02268 ms
One sample @ 48000 Smpl/s is 0.02083 ms
35 ms is 1543 Smpl @ 44100 Hz
35 ms is 1680 Smpl @ 48000 Smpl/s
SampleValue is: -0.4 PCM
Power 1 is: 0.16000001 PCM²
Power 2 is: -0.2 PCM²
Tempo is: 110 bpm
Reverb Beats is: 1 q.
Reverb Time is: 0.8181818 s
Pulse Per Quarter is: 960 ppqn
Transport Position is: 15836 p
Transport Beats is: 16.495832 q
Transport Time is: 8.997726 s</code></pre>
<p>Try it in <a href="https://godbolt.org/z/a7eYa91cM">the Compiler
Explorer</a>.</p>
<p><em>Note: More about this example can be found in <a href="https://www.youtube.com/watch?v=oxnCdIfC4Z4">“Exploration of
Strongly-typed Units in C++: A Case Study from Digital Audio”</a> CppCon
2023 talk by Roth Michaels.</em></p>
<h1 data-number="13" id="why-do-we-need-typed-quantities"><span class="header-section-number">13</span> Why do we need typed
quantities?<a href="#why-do-we-need-typed-quantities" class="self-link"></a></h1>
<h2 data-number="13.1" id="limitations-of-units-only-solutions"><span class="header-section-number">13.1</span> Limitations of units-only
solutions<a href="#limitations-of-units-only-solutions" class="self-link"></a></h2>
<p>Units-only is not a good design for a quantities and units library.
It works to some extent, but plenty of use cases can’t be addressed, and
for those that somehow work, we miss important safety improvements
provided by additional abstractions in this chapter. But before we talk
about those extensions, let’s first discuss some limitations of the
units-only solution.</p>
<p><em>Note: The issues described below do not apply to the proposed
library, because with the proposed interfaces, even if we decide to only
use the simple mode, units are still backed up by quantity kinds under
the framework’s hood.</em></p>
<h3 data-number="13.1.1" id="no-way-to-specify-a-quantity-type-in-generic-interfaces"><span class="header-section-number">13.1.1</span> No way to specify a quantity
type in generic interfaces<a href="#no-way-to-specify-a-quantity-type-in-generic-interfaces" class="self-link"></a></h3>
<p>A common requirement in the domain is to write unit-agnostic generic
interfaces. For example, let’s try to implement a generic
<code class="sourceCode cpp">avg_speed</code> function template that
takes a quantity of any unit and produces the result. So if we call it
with <em>distance</em> in <code class="sourceCode cpp">km</code> and
<em>time</em> in <code class="sourceCode cpp">h</code>, we will get
<code class="sourceCode cpp">km <span class="op">/</span> h</code> as a
result, but if we call it with <code class="sourceCode cpp">mi</code>
and <code class="sourceCode cpp">h</code>, we expect
<code class="sourceCode cpp">mi <span class="op">/</span> h</code> to be
returned.</p>
<div class="sourceCode" id="cb58"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb58-1"><a href="#cb58-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>Unit <span class="kw">auto</span> U1, <span class="kw">typename</span> Rep1, Unit <span class="kw">auto</span> U2, <span class="kw">typename</span> Rep2<span class="op">&gt;</span></span>
<span id="cb58-2"><a href="#cb58-2" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> avg_speed<span class="op">(</span>quantity<span class="op">&lt;</span>U1, Rep1<span class="op">&gt;</span> distance, quantity<span class="op">&lt;</span>U2, Rep2<span class="op">&gt;</span> time<span class="op">)</span></span>
<span id="cb58-3"><a href="#cb58-3" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb58-4"><a href="#cb58-4" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> distance <span class="op">/</span> time;</span>
<span id="cb58-5"><a href="#cb58-5" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<span id="cb58-6"><a href="#cb58-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb58-7"><a href="#cb58-7" aria-hidden="true" tabindex="-1"></a>quantity speed <span class="op">=</span> avg_speed<span class="op">(</span><span class="dv">120</span> <span class="op">*</span> km, <span class="dv">2</span> <span class="op">*</span> h<span class="op">)</span>;</span></code></pre></div>
<p>This function works but does not provide any type safety to the
users. The function arguments can be easily reordered on the call site.
Also, we do not get any information about the return type of the
function and any safety to ensure that the function logic actually
returns a quantity of <em>speed</em>.</p>
<p>To improve safety, with a units-only library, we have to write the
function in the following way:</p>
<div class="sourceCode" id="cb59"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb59-1"><a href="#cb59-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span><span class="kw">typename</span> Rep1, <span class="kw">typename</span> Rep2<span class="op">&gt;</span></span>
<span id="cb59-2"><a href="#cb59-2" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>si<span class="op">::</span>metre <span class="op">/</span> si<span class="op">::</span>second, <span class="kw">decltype</span><span class="op">(</span>Rep1<span class="op">{}</span> <span class="op">/</span> Rep2<span class="op">{})&gt;</span> avg_speed<span class="op">(</span>quantity<span class="op">&lt;</span>si<span class="op">::</span>metre, Rep1<span class="op">&gt;</span> distance,</span>
<span id="cb59-3"><a href="#cb59-3" aria-hidden="true" tabindex="-1"></a>                                                                      quantity<span class="op">&lt;</span>si<span class="op">::</span>second, Rep2<span class="op">&gt;</span> time<span class="op">)</span></span>
<span id="cb59-4"><a href="#cb59-4" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb59-5"><a href="#cb59-5" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> distance <span class="op">/</span> time;</span>
<span id="cb59-6"><a href="#cb59-6" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<span id="cb59-7"><a href="#cb59-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb59-8"><a href="#cb59-8" aria-hidden="true" tabindex="-1"></a>avg_speed<span class="op">(</span><span class="dv">120</span> <span class="op">*</span> km, <span class="dv">2</span> <span class="op">*</span> h<span class="op">).</span>in<span class="op">(</span>km <span class="op">/</span> h<span class="op">)</span>;</span></code></pre></div>
<p>Despite being safer, the above code decreased the performance because
we always pay for the conversion at the function’s input and output.</p>
<p>Moreover, in a good library, the above code should not compile. The
reason for this is that even though the conversion from
<code class="sourceCode cpp">km</code> to
<code class="sourceCode cpp">m</code> and from
<code class="sourceCode cpp">h</code> to
<code class="sourceCode cpp">s</code> is considered value-preserving, it
is not true in the opposite direction. When we will try to convert the
result stored in an integral type from the unit of
<code class="sourceCode cpp">m<span class="op">/</span>s</code> to
<code class="sourceCode cpp">km<span class="op">/</span>h</code> we will
inevitably loose some data.</p>
<p>We could try to provide concepts like <code class="sourceCode cpp">ScaledUnitOf<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">&gt;</span></code>
that would take a set of units while trying to constrain them somehow,
but it leads to even more problems with the unit definitions. For
example, are <code class="sourceCode cpp">Hz</code> and
<code class="sourceCode cpp">Bq</code> just scaled versions of <code class="sourceCode cpp"><span class="dv">1</span><span class="op">/</span>s</code>?
If we constrain the interface to just prefixed units, then litre and a
cubic metre or kilometre and mile will be incompatible. What about
radian and steradian or a litre per 100 kilometre (popular unit of a
fuel consumption) and a squared metre? Should those be compatible?</p>
<h3 data-number="13.1.2" id="disjoint-units-of-the-same-quantity-type-do-not-work"><span class="header-section-number">13.1.2</span> Disjoint units of the same
quantity type do not work<a href="#disjoint-units-of-the-same-quantity-type-do-not-work" class="self-link"></a></h3>
<p>Sometimes, we need to define several units describing the same
quantity but which should not convert to each other in the library’s
framework. A typical example here is currency. A user may want to define
EURO and USD as units of currency, so both of them can be used for such
quantities. However, it is impossible to predefine one fixed conversion
factor for those, as a currency exchange rate varies over time, and the
library’s framework can’t provide such an information as an input to the
built-in conversion function. User’s application may have more
information in this domain and handle such a conversion at runtime with
custom logic (e.g., using an additional time point function argument).
If we would like to model that in a unit-only solution, how can we
specify that EURO and USD are units of quantities of currency, but are
not convertible to each other?</p>
<h2 data-number="13.2" id="dimensions-to-the-rescue"><span class="header-section-number">13.2</span> Dimensions to the rescue?<a href="#dimensions-to-the-rescue" class="self-link"></a></h2>
<p>To prevent the above issues, most of the libraries on the market
introduce dimension abstraction. Thanks to that, we could solve the
first issue of the previous chapter with:</p>
<div class="sourceCode" id="cb60"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb60-1"><a href="#cb60-1" aria-hidden="true" tabindex="-1"></a>QuantityOf<span class="op">&lt;</span>dim_speed<span class="op">&gt;</span> <span class="kw">auto</span> avg_speed<span class="op">(</span>QuantityOf<span class="op">&lt;</span>dim_length<span class="op">&gt;</span> <span class="kw">auto</span> distance, </span>
<span id="cb60-2"><a href="#cb60-2" aria-hidden="true" tabindex="-1"></a>                                     QuantityOf<span class="op">&lt;</span>dim_time<span class="op">&gt;</span> <span class="kw">auto</span> time<span class="op">)</span></span>
<span id="cb60-3"><a href="#cb60-3" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb60-4"><a href="#cb60-4" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> distance <span class="op">/</span> time;</span>
<span id="cb60-5"><a href="#cb60-5" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>and the second one by specifying that both EURO and USD are units of
<code class="sourceCode cpp">dim_currency</code>. This is a significant
improvement but still has some issues.</p>
<h3 data-number="13.2.1" id="limitations-of-dimensions"><span class="header-section-number">13.2.1</span> Limitations of dimensions<a href="#limitations-of-dimensions" class="self-link"></a></h3>
<p>Let’s first look again at the above solution. A domain expert seeing
this code will immediately say there is no such thing as a speed
dimension. The ISQ specifies only 7 dimensions with unique symbols
assigned, and the dimensions of all the ISQ quantities are created as a
vector product of those. For example, a quantity of <em>speed</em> has a
dimension of <span class="math inline">\(L^1T^{-1}\)</span>. So, to be
physically correct, the above code should be rewritten as:</p>
<div class="sourceCode" id="cb61"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb61-1"><a href="#cb61-1" aria-hidden="true" tabindex="-1"></a>QuantityOf<span class="op">&lt;</span>dim_length <span class="op">/</span> dim_time<span class="op">&gt;</span> <span class="kw">auto</span> avg_speed<span class="op">(</span>QuantityOf<span class="op">&lt;</span>dim_length<span class="op">&gt;</span> <span class="kw">auto</span> distance, </span>
<span id="cb61-2"><a href="#cb61-2" aria-hidden="true" tabindex="-1"></a>                                                 QuantityOf<span class="op">&lt;</span>dim_time<span class="op">&gt;</span> <span class="kw">auto</span> time<span class="op">)</span></span>
<span id="cb61-3"><a href="#cb61-3" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb61-4"><a href="#cb61-4" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> distance <span class="op">/</span> time;</span>
<span id="cb61-5"><a href="#cb61-5" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>Most of the libraries on the market ignore this fact and try to model
distinct quantities through their dimensions, giving a false sense of
safety. A dimension is not enough to describe a quantity. This has been
known for a long time now. The <span class="citation" data-cites="MSRMT_DATA">[<a href="https://www.bkent.net/Doc/mdarchiv.pdf" role="doc-biblioref">Measurement Data</a>]</span> report from 1996 says
explicitly, “Dimensional analysis does not adequately model the
semantics of measurement data”.</p>
<p>In the following chapters, we will see a few use cases that can’t be
solved with an approach that only relies on units or dimensions.</p>
<h3 data-number="13.2.2" id="si-units-of-quantities-of-the-same-dimension-but-different-kinds"><span class="header-section-number">13.2.2</span> SI units of quantities of
the same dimension but different kinds<a href="#si-units-of-quantities-of-the-same-dimension-but-different-kinds" class="self-link"></a></h3>
<p>The <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span> provides several units for distinct
quantities of the same dimension but different kinds. For example:</p>
<ul>
<li>hertz (Hz) is a unit of <em>frequency</em> and becquerel (Bq) is a
unit of <em>activity</em>. Both are defined as <span class="math inline">\(s^{-1}\)</span>, and have the same dimension of
<span class="math inline">\(T^{-1}\)</span>.</li>
<li>gray (Gy) is a unit of <em>absorbed dose</em> and sievert (Sv) is a
unit of <em>dose equivalent</em>. Both are defined as <span class="math inline">\(m^2 s^{-2}\)</span>, and have the same dimension
of <span class="math inline">\(L^2T^{-2}\)</span></li>
<li>radian (rad) is a unit of <em>plane angle</em> defined as <span class="math inline">\(m/m\)</span>, and steradian (sr) is a unit of
<em>solid angle</em> defined as <span class="math inline">\(m^2/m^2\)</span>. Both are quantities of dimension
one, which also has its own units like one (1) and percent (%).</li>
</ul>
<p>There are many more similar examples in <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span>. For example, <em>storage
capacity</em> quantity can be measured in units of one, bit, octet, and
byte.</p>
<p>The above conflicts can’t be solved with dimensions, and they yield
many safety issues. For example, we can ask ourselves what should be the
result of the following:</p>
<ol type="1">
<li><code class="sourceCode cpp">quantity q <span class="op">=</span> <span class="dv">1</span> <span class="op">*</span> Hz <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> Bq;</code></li>
<li><code class="sourceCode cpp">quantity<span class="op">&lt;</span>Gy<span class="op">&gt;</span> q <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> Sv;</code></li>
<li><code class="sourceCode cpp"><span class="dt">bool</span> b <span class="op">=</span> <span class="op">(</span><span class="dv">1</span> <span class="op">*</span> rad <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> bit<span class="op">)</span> <span class="op">==</span> <span class="dv">2</span> <span class="op">*</span> sr;</code></li>
</ol>
<p>None of the above code should compile, but most of the libraries on
the market happily accept it and provide meaningless results. Some of
them decide not to define one or more of the above units at all to avoid
potential safety issues. For example, <a href="https://github.com/aurora-opensource/au/pull/157">the Au library
does not define <code class="sourceCode cpp">Sv</code> to avoid mixing
it up with Gy</a>.</p>
<h3 data-number="13.2.3" id="derived-quantities-of-the-same-dimension-but-different-kinds"><span class="header-section-number">13.2.3</span> Derived quantities of the
same dimension but different kinds<a href="#derived-quantities-of-the-same-dimension-but-different-kinds" class="self-link"></a></h3>
<p>Even if some quantities do not have a specially assigned unit, they
may still have a totally different physical meaning even if they share
the same dimension:</p>
<ul>
<li><em>work</em> vs. <em>moment of force</em> both of the same
dimension <span class="math inline">\(L^2MT^{-2}\)</span></li>
<li><em>fuel consumption</em> expressed in <span class="math inline">\(\frac{l}{100\;km}\)</span> vs. <em>area</em>
expressed in <span class="math inline">\(m^2\)</span> both of the same
dimension <span class="math inline">\(L^2\)</span></li>
</ul>
<p>Again, we don’t want to accidentally mix those.</p>
<h3 data-number="13.2.4" id="various-quantities-of-the-same-dimension-and-kinds"><span class="header-section-number">13.2.4</span> Various quantities of the
same dimension and kinds<a href="#various-quantities-of-the-same-dimension-and-kinds" class="self-link"></a></h3>
<p>Even if we somehow address all the above, there are plenty of use
cases that still can’t be safely implemented with such abstractions.</p>
<p>Let’s consider that we want to implement a freight transport
application to position cargo in the container. In majority of the
products on the market we will end up with something like:</p>
<div class="sourceCode" id="cb62"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb62-1"><a href="#cb62-1" aria-hidden="true" tabindex="-1"></a><span class="kw">class</span> Box <span class="op">{</span></span>
<span id="cb62-2"><a href="#cb62-2" aria-hidden="true" tabindex="-1"></a>  length length_;</span>
<span id="cb62-3"><a href="#cb62-3" aria-hidden="true" tabindex="-1"></a>  length width_;</span>
<span id="cb62-4"><a href="#cb62-4" aria-hidden="true" tabindex="-1"></a>  length height_;</span>
<span id="cb62-5"><a href="#cb62-5" aria-hidden="true" tabindex="-1"></a><span class="kw">public</span><span class="op">:</span></span>
<span id="cb62-6"><a href="#cb62-6" aria-hidden="true" tabindex="-1"></a>  Box<span class="op">(</span>length l, length w, length h<span class="op">):</span> length_<span class="op">(</span>l<span class="op">)</span>, width_<span class="op">(</span>w<span class="op">)</span>, height_<span class="op">(</span>h<span class="op">)</span> <span class="op">{}</span></span>
<span id="cb62-7"><a href="#cb62-7" aria-hidden="true" tabindex="-1"></a>  area floor<span class="op">()</span> <span class="kw">const</span> <span class="op">{</span> <span class="cf">return</span> length_ <span class="op">*</span> width_; <span class="op">}</span></span>
<span id="cb62-8"><a href="#cb62-8" aria-hidden="true" tabindex="-1"></a>  <span class="co">// ...</span></span>
<span id="cb62-9"><a href="#cb62-9" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span></code></pre></div>
<div class="sourceCode" id="cb63"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb63-1"><a href="#cb63-1" aria-hidden="true" tabindex="-1"></a>Box my_box<span class="op">(</span><span class="dv">2</span> <span class="op">*</span> m, <span class="dv">3</span> <span class="op">*</span> m, <span class="dv">1</span> <span class="op">*</span> m<span class="op">)</span>;</span></code></pre></div>
<p>Such interfaces are not much safer than just using plain fundamental
types (e.g.,
<code class="sourceCode cpp"><span class="dt">double</span></code>). One
of the main reasons of using a quantities and units library was to
introduce strong-type interfaces to prevent such issues. In this
scenario, we need to be able to discriminate between <em>length</em>,
<em>width</em>, and <em>height</em> of the package.</p>
<p>A similar but also really important use case is in aviation. The
current <em>altitude</em> is a totally different quantity than the
<em>distance</em> to the destination. The same is true for <em>forward
speed</em> and <em>sink rate</em>. We do not want to accidentally mix
those.</p>
<p>When we deal with <em>energy</em>, we should be able to implicitly
construct it from a proper product of any <em>mass</em>,
<em>length</em>, and <em>time</em>. However, when we want to calculate
<em>gravitational potential energy</em>, we may not want it to be
implicitly initialized from any expression of matching dimensions. Such
an implicit construction should be allowed only if we multiply a
<em>mass</em> with <em>acceleration of free fall</em> and
<em>height</em>. All other conversions should have an explicit
annotation to make it clear that something potentially unsafe is being
done in the code. Also, we should not be able to assign a <em>potential
energy</em> to a quantity of <em>kinetic energy</em>. However, both of
them (possibly accumulated with each other) should be convertible to a
<em>mechanical energy</em> quantity.</p>
<div class="sourceCode" id="cb64"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb64-1"><a href="#cb64-1" aria-hidden="true" tabindex="-1"></a>mass m <span class="op">=</span> <span class="dv">1</span> <span class="op">*</span> kg;</span>
<span id="cb64-2"><a href="#cb64-2" aria-hidden="true" tabindex="-1"></a>length l <span class="op">=</span> <span class="dv">1</span> <span class="op">*</span> m;</span>
<span id="cb64-3"><a href="#cb64-3" aria-hidden="true" tabindex="-1"></a>time t <span class="op">=</span> <span class="dv">1</span> <span class="op">*</span> s;</span>
<span id="cb64-4"><a href="#cb64-4" aria-hidden="true" tabindex="-1"></a>acceleration_of_free_fall g <span class="op">=</span> <span class="fl">9.81</span> <span class="op">*</span> m <span class="op">/</span> s2;</span>
<span id="cb64-5"><a href="#cb64-5" aria-hidden="true" tabindex="-1"></a>height h <span class="op">=</span> <span class="dv">1</span> <span class="op">*</span> m;</span>
<span id="cb64-6"><a href="#cb64-6" aria-hidden="true" tabindex="-1"></a>speed v <span class="op">=</span> <span class="dv">1</span> <span class="op">*</span> m <span class="op">/</span> s;</span>
<span id="cb64-7"><a href="#cb64-7" aria-hidden="true" tabindex="-1"></a>energy e <span class="op">=</span> m <span class="op">*</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>l<span class="op">)</span> <span class="op">/</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>t<span class="op">)</span>;                     <span class="co">// OK</span></span>
<span id="cb64-8"><a href="#cb64-8" aria-hidden="true" tabindex="-1"></a>potential_energy ep1 <span class="op">=</span> e;                                 <span class="co">// should not compile</span></span>
<span id="cb64-9"><a href="#cb64-9" aria-hidden="true" tabindex="-1"></a>potential_energy ep2 <span class="op">=</span> <span class="kw">static_cast</span><span class="op">&lt;</span>potential_energy<span class="op">&gt;(</span>e<span class="op">)</span>;  <span class="co">// OK</span></span>
<span id="cb64-10"><a href="#cb64-10" aria-hidden="true" tabindex="-1"></a>potential_energy ep3 <span class="op">=</span> m <span class="op">*</span> g <span class="op">*</span> h;                         <span class="co">// OK</span></span>
<span id="cb64-11"><a href="#cb64-11" aria-hidden="true" tabindex="-1"></a>kinetic_energy ek1 <span class="op">=</span> m <span class="op">*</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>v<span class="op">)</span> <span class="op">/</span> <span class="dv">2</span>;                   <span class="co">// OK</span></span>
<span id="cb64-12"><a href="#cb64-12" aria-hidden="true" tabindex="-1"></a>kinetic_energy ek2 <span class="op">=</span> ep3 <span class="op">+</span> ek1;                           <span class="co">// should not compile</span></span>
<span id="cb64-13"><a href="#cb64-13" aria-hidden="true" tabindex="-1"></a>mechanical_energy me <span class="op">=</span> ep3 <span class="op">+</span> ek1;                         <span class="co">// OK</span></span></code></pre></div>
<p>Yet another example comes from the audio industry. In the audio
software, we want to treat specific counts (e.g., <em>beats</em>,
<em>samples</em>) as separate quantities. We could assign dedicated base
dimensions to them. However, if we divide them by <em>duration</em>, we
should obtain a quantity convertible to <em>frequency</em> and even be
able to express the result in a unit of
<code class="sourceCode cpp">Hz</code>. With the dedicated dimensions
approach, this wouldn’t work as the dimension of frequency is just <span class="math inline">\(T^{-1}\)</span>, which would not match the results
of our dimensional equations. This is why we can’t assign dedicated
dimensions to such counts.</p>
<p>The last example that we want to mention here comes from finance.
This time, we need to model <em>currency volume</em> as a special
quantity of <em>currency</em>. <em>currency volume</em> can be obtained
by multiplying <em>currency</em> by the dimensionless <em>market
quantity</em>. Of course, both <em>currency</em> and <em>currency
volume</em> should be expressed in the same units (e.g., USD).</p>
<p>None of the above scenarios can be addressed with just units and
dimensions. We need a better abstraction to safely implement them.</p>
<h1 data-number="14" id="systems-of-quantities-and-units"><span class="header-section-number">14</span> Systems of quantities and
units<a href="#systems-of-quantities-and-units" class="self-link"></a></h1>
<!-- 
flowchart TD
    system_of_quantities["System of Quantities"]
    system_of_quantities --- system_of_units1[System of Units #1]
    system_of_quantities --- system_of_units2[System of Units #2]
    system_of_quantities --- system_of_units3[System of Units #3]
 -->
<p><img src="data:image/svg+xml;base64,PHN2ZyBhcmlhLXJvbGVkZXNjcmlwdGlvbj0iZmxvd2NoYXJ0LXYyIiByb2xlPSJncmFwaGljcy1kb2N1bWVudCBkb2N1bWVudCIgdmlld0JveD0iLTggLTggNTU4Ljk2ODc1IDE0NCIgc3R5bGU9Im1heC13aWR0aDogMTAwJTsiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGlkPSJncmFwaC1kaXYiIGhlaWdodD0iMTAwJSIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxzdHlsZT5AaW1wb3J0IHVybCgiaHR0cHM6Ly9jZG5qcy5jbG91ZGZ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g9IjEzMi42NTYyNSI+PGRpdiBzdHlsZT0iZGlzcGxheTogaW5saW5lLWJsb2NrOyB3aGl0ZS1zcGFjZTogbm93cmFwOyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGh0bWwiPjxzcGFuIGNsYXNzPSJub2RlTGFiZWwiPlN5c3RlbSBvZiBVbml0cyAjMzwvc3Bhbj48L2Rpdj48L2ZvcmVpZ25PYmplY3Q+PC9nPjwvZz48L2c+PC9nPjwvZz48L3N2Zz4=" style="display: block; margin-left: auto; margin-right: auto; width: 70%;" /></p>
<p>A <a href="https://jcgm.bipm.org/vim/en/1.3.html">system of
quantities</a> is a set of quantities together with a set of
noncontradictory equations relating those quantities.</p>
<p>The <a href="https://jcgm.bipm.org/vim/en/1.6.html">International
System of Quantities (ISQ)</a> is a system of quantities based on the
seven base quantities: <em>length</em>, <em>mass</em>, <em>time</em>,
<em>electric current</em>, <em>thermodynamic temperature</em>,
<em>amount of substance</em>, and <em>luminous intensity</em>. This
system of quantities is published in <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span>, “Quantities and
units”.</p>
<p>A <a href="https://jcgm.bipm.org/vim/en/1.13.html">system of
units</a> is a set of base units and derived units, together with their
multiples and submultiples, defined in accordance with given rules, for
a given system of quantities.</p>
<p>The <a href="https://jcgm.bipm.org/vim/en/1.16.html">International
System of Units (SI)</a> is a system of units, based on the
International System of Quantities, their names and symbols, including a
series of prefixes and their names and symbols, together with rules for
their use, adopted by the General Conference on Weights and Measures
(CGPM).</p>
<h2 data-number="14.1" id="systems-of-quantities"><span class="header-section-number">14.1</span> Systems of quantities<a href="#systems-of-quantities" class="self-link"></a></h2>
<p>The physical units libraries on the market typically only focus on
modeling one or more systems of units. However, this is not the only
system kind to model. Another, and maybe even more important, is a
system of quantities. The most important example here is the
International System of Quantities (ISQ) defined by <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span>.</p>
<h3 data-number="14.1.1" id="quantities-of-the-same-kind"><span class="header-section-number">14.1.1</span> Quantities of the same
kind<a href="#quantities-of-the-same-kind" class="self-link"></a></h3>
<p>As it was described in <a href="#limitations-of-dimensions">Limitations of dimensions</a>,
dimension is not enough to describe a quantity. We need a better
abstraction to provide safety to our calculations.</p>
<p>The <span class="citation" data-cites="ISO-GUIDE">[<a href="https://www.iso.org/obp/ui#iso:std:iso-iec:guide:99" role="doc-biblioref">ISO/IEC Guide 99</a>]</span> says:</p>
<ul>
<li>Quantities may be grouped together into categories of quantities
that are <strong>mutually comparable</strong></li>
<li>Mutually comparable quantities are called <strong>quantities of the
same kind</strong></li>
<li>Two or more quantities <strong>cannot be added or subtracted unless
they belong to the same category of mutually comparable
quantities</strong></li>
<li>Quantities of the <strong>same kind</strong> within a given system
of quantities <strong>have the same quantity dimension</strong></li>
<li>Quantities of the <strong>same dimension are not necessarily of the
same kind</strong></li>
</ul>
<p><span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> also explicitly
notes:</p>
<blockquote>
<p><strong>Measurement units of quantities of the same quantity
dimension may be designated by the same name and symbol even when the
quantities are not of the same kind</strong>. For example, joule per
kelvin and J/K are respectively the name and symbol of both a
measurement unit of heat capacity and a measurement unit of entropy,
which are generally not considered to be quantities of the same kind.
<strong>However, in some cases special measurement unit names are
restricted to be used with quantities of specific kind only</strong>.
For example, the measurement unit ‘second to the power minus one’ (1/s)
is called hertz (Hz) when used for frequencies and becquerel (Bq) when
used for activities of radionuclides. As another example, the joule (J)
is used as a unit of energy, but never as a unit of moment of force,
i.e. the newton metre (N · m).</p>
</blockquote>
<p>Those provide answers to all the issues mentioned above. More than
one quantity may be defined for the same dimension:</p>
<ul>
<li>quantities of different kinds (e.g., <em>frequency</em>,
<em>modulation rate</em>, <em>activity</em>)</li>
<li>quantities of the same kind (e.g., <em>length</em>, <em>width</em>,
<em>altitude</em>, <em>distance</em>, <em>radius</em>,
<em>wavelength</em>, <em>position vector</em>)</li>
</ul>
<p>Two quantities can’t be added, subtracted, or compared unless they
belong to the same quantity kind.</p>
<h3 data-number="14.1.2" id="system-of-quantities-is-not-only-about-kinds"><span class="header-section-number">14.1.2</span> System of quantities is not
only about kinds<a href="#system-of-quantities-is-not-only-about-kinds" class="self-link"></a></h3>
<p><span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> specifies hundreds of
different quantities. Plenty of various kinds are provided, and often,
each kind contains more than one quantity. It turns out that such
quantities form a hierarchy of quantities of the same kind.</p>
<p>For example, here are all quantities of the kind <em>length</em>
provided in <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> (part 1):</p>
<p><img src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPD94bWwtc3R5bGVzaGVldCBocmVmPSJodHRwczovL2NkbmpzLmNsb3VkZmxhcmUuY29tL2FqYXgvbGlicy9mb250LWF3ZXNvbWUvNi42LjAvY3NzL2FsbC5taW4uY3NzIiB0eXBlPSJ0ZXh0L2NzcyI/Pgo8c3ZnIGFyaWEtcm9sZWRlc2NyaXB0aW9uPSJmbG93Y2hhcnQtdjIiIHJvbGU9ImdyYXBoaWNzLWRvY3VtZW50IGRvY3VtZW50IiB2aWV3Qm94PSIwIDAgMTIwOS41MTk1MzEyNSA0MzAiIHN0eWxlPSJtYXgtd2lkdGg6IDEwMCU7IiBjbGFzcz0iZmxvd2NoYXJ0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAlIiBpZD0iZ3JhcGgtZGl2IiBoZWlnaHQ9IjEwMCUiIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW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lcjsiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hodG1sIj48c3BhbiBjbGFzcz0ibm9kZUxhYmVsIj48cD48Yj5wb3NpdGlvbl92ZWN0b3I8L2I+PC9wPjwvc3Bhbj48L2Rpdj48L2ZvcmVpZ25PYmplY3Q+PC9nPjwvZz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSg0MTguNTIzNDM3NSwgMzk1KSIgaWQ9ImZsb3djaGFydC1yYWRpdXNfb2ZfY3VydmF0dXJlLTE0OSIgY2xhc3M9Im5vZGUgZGVmYXVsdCI+PHJlY3QgaGVpZ2h0PSI1NCIgd2lkdGg9IjIxMi4yNSIgeT0iLTI3IiB4PSItMTA2LjEyNSIgc3R5bGU9IiIgY2xhc3M9ImJhc2ljIGxhYmVsLWNvbnRhaW5lciI+PC9yZWN0PjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKC03Ni4xMjUsIC0xMikiIHN0eWxlPSIiIGNsYXNzPSJsYWJlbCI+PHJlY3Q+PC9yZWN0Pjxmb3JlaWduT2JqZWN0IGhlaWdodD0iMjQiIHdpZHRoPSIxNTIuMjUiPjxkaXYgc3R5bGU9ImRpc3BsYXk6IHRhYmxlLWNlbGw7IHdoaXRlLXNwYWNlOiBub3dyYXA7IGxpbmUtaGVpZ2h0OiAxLjU7IG1heC13aWR0aDogMjAwcHg7IHRleHQtYWxpZ246IGNlbnRlcjsiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hodG1sIj48c3BhbiBjbGFzcz0ibm9kZUxhYmVsIj48cD48Yj5yYWRpdXNfb2ZfY3VydmF0dXJlPC9iPjwvcD48L3NwYW4+PC9kaXY+PC9mb3JlaWduT2JqZWN0PjwvZz48L2c+PC9nPjwvZz48L2c+PC9zdmc+" /></p>
<p>Each of the above quantities expresses some kind of <em>length</em>,
and each can be measured with meters, which is the unit defined by the
<span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span> for quantities of <em>length</em>.
However, each has different properties, usage, and sometimes even a
different character (<em>position vector</em> and <em>displacement</em>
are vector quantities).</p>
<p>The below presents how such a hierarchy tree can be defined in the
library:</p>
<div class="sourceCode" id="cb65"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb65-1"><a href="#cb65-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> dim_length <span class="kw">final</span> <span class="op">:</span> base_dimension<span class="op">&lt;</span><span class="st">&quot;L&quot;</span><span class="op">&gt;</span> <span class="op">{}</span> dim_length;</span>
<span id="cb65-2"><a href="#cb65-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb65-3"><a href="#cb65-3" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> length <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>dim_length<span class="op">&gt;</span> <span class="op">{}</span> length;</span>
<span id="cb65-4"><a href="#cb65-4" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> width <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>length<span class="op">&gt;</span> <span class="op">{}</span> width;</span>
<span id="cb65-5"><a href="#cb65-5" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> breadth <span class="op">=</span> width;</span>
<span id="cb65-6"><a href="#cb65-6" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> height <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>length<span class="op">&gt;</span> <span class="op">{}</span> height;</span>
<span id="cb65-7"><a href="#cb65-7" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> depth <span class="op">=</span> height;</span>
<span id="cb65-8"><a href="#cb65-8" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> altitude <span class="op">=</span> height;</span>
<span id="cb65-9"><a href="#cb65-9" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> thickness <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>width<span class="op">&gt;</span> <span class="op">{}</span> thickness;</span>
<span id="cb65-10"><a href="#cb65-10" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> diameter <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>width<span class="op">&gt;</span> <span class="op">{}</span> diameter;</span>
<span id="cb65-11"><a href="#cb65-11" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> radius <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>width<span class="op">&gt;</span> <span class="op">{}</span> radius;</span>
<span id="cb65-12"><a href="#cb65-12" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> radius_of_curvature <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>radius<span class="op">&gt;</span> <span class="op">{}</span> radius_of_curvature;</span>
<span id="cb65-13"><a href="#cb65-13" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> path_length <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>length<span class="op">&gt;</span> <span class="op">{}</span> path_length;</span>
<span id="cb65-14"><a href="#cb65-14" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> arc_length <span class="op">=</span> path_length;</span>
<span id="cb65-15"><a href="#cb65-15" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> distance <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>path_length<span class="op">&gt;</span> <span class="op">{}</span> distance;</span>
<span id="cb65-16"><a href="#cb65-16" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> radial_distance <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>distance<span class="op">&gt;</span> <span class="op">{}</span> radial_distance;</span>
<span id="cb65-17"><a href="#cb65-17" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> wavelength <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>length<span class="op">&gt;</span> <span class="op">{}</span> wavelength;</span>
<span id="cb65-18"><a href="#cb65-18" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> displacement <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>length, quantity_character<span class="op">::</span>vector<span class="op">&gt;</span> <span class="op">{}</span> displacement;</span>
<span id="cb65-19"><a href="#cb65-19" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> position_vector <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>displacement<span class="op">&gt;</span> <span class="op">{}</span> position_vector;</span></code></pre></div>
<p>In the above code:</p>
<ul>
<li><code class="sourceCode cpp">length</code> takes the base dimension
to indicate that we are creating a base quantity that will serve as a
root for a tree of quantities of the same kind,</li>
<li><code class="sourceCode cpp">width</code> and following quantities
are branches and leaves of this tree with the parent always provided as
the first argument to <code class="sourceCode cpp">quantity_spec</code>
class template,</li>
<li><code class="sourceCode cpp">breadth</code> is an alias name for the
same quantity as <code class="sourceCode cpp">width</code>.</li>
</ul>
<p>Please note that some quantities may be specified by <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> as vector or tensor
quantities (e.g., <code class="sourceCode cpp">displacement</code>).</p>
<h3 data-number="14.1.3" id="converting-between-quantities-of-the-same-kind"><span class="header-section-number">14.1.3</span> Converting between
quantities of the same kind<a href="#converting-between-quantities-of-the-same-kind" class="self-link"></a></h3>
<p>Quantity conversion rules can be defined based on the same hierarchy
of quantities of kind length.</p>
<ol type="1">
<li><p><strong>Implicit conversions</strong></p>
<ul>
<li>Every <em>width</em> is a <em>length</em>.</li>
<li>Every <em>radius</em> is a <em>width</em>.</li>
</ul>
<div class="sourceCode" id="cb66"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb66-1"><a href="#cb66-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>width, isq<span class="op">::</span>length<span class="op">))</span>;</span>
<span id="cb66-2"><a href="#cb66-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>radius, isq<span class="op">::</span>length<span class="op">))</span>;</span>
<span id="cb66-3"><a href="#cb66-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>radius, isq<span class="op">::</span>width<span class="op">))</span>;</span></code></pre></div>
<p>Implicit conversions are allowed on copy-initialization:</p>
<div class="sourceCode" id="cb67"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb67-1"><a href="#cb67-1" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> foo<span class="op">(</span>quantity<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">[</span>m<span class="op">]&gt;</span> q<span class="op">)</span>;</span></code></pre></div>
<div class="sourceCode" id="cb68"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb68-1"><a href="#cb68-1" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>isq<span class="op">::</span>width<span class="op">[</span>m<span class="op">]&gt;</span> q1 <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> m;</span>
<span id="cb68-2"><a href="#cb68-2" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">[</span>m<span class="op">]&gt;</span> q2 <span class="op">=</span> q1;  <span class="co">// implicit quantity conversion</span></span>
<span id="cb68-3"><a href="#cb68-3" aria-hidden="true" tabindex="-1"></a>foo<span class="op">(</span>q1<span class="op">)</span>;                           <span class="co">// implicit quantity conversion</span></span></code></pre></div></li>
<li><p><strong>Explicit conversions</strong></p>
<ul>
<li>Not every <em>length</em> is a <em>width</em>.</li>
<li>Not every <em>width</em> is a <em>radius</em>.</li>
</ul>
<div class="sourceCode" id="cb69"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb69-1"><a href="#cb69-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(!</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>length, isq<span class="op">::</span>width<span class="op">))</span>;</span>
<span id="cb69-2"><a href="#cb69-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(!</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>length, isq<span class="op">::</span>radius<span class="op">))</span>;</span>
<span id="cb69-3"><a href="#cb69-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(!</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>width, isq<span class="op">::</span>radius<span class="op">))</span>;</span>
<span id="cb69-4"><a href="#cb69-4" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>explicitly_convertible<span class="op">(</span>isq<span class="op">::</span>length, isq<span class="op">::</span>width<span class="op">))</span>;</span>
<span id="cb69-5"><a href="#cb69-5" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>explicitly_convertible<span class="op">(</span>isq<span class="op">::</span>length, isq<span class="op">::</span>radius<span class="op">))</span>;</span>
<span id="cb69-6"><a href="#cb69-6" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>explicitly_convertible<span class="op">(</span>isq<span class="op">::</span>width, isq<span class="op">::</span>radius<span class="op">))</span>;</span></code></pre></div>
<p>Explicit conversions are forced by passing the quantity to a call
operator of a <code class="sourceCode cpp">quantity_spec</code>
type:</p>
<div class="sourceCode" id="cb70"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb70-1"><a href="#cb70-1" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> foo<span class="op">(</span>quantity<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>m<span class="op">]&gt;</span> q<span class="op">)</span>;</span></code></pre></div>
<div class="sourceCode" id="cb71"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb71-1"><a href="#cb71-1" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">[</span>m<span class="op">]&gt;</span> q1 <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> m;</span>
<span id="cb71-2"><a href="#cb71-2" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>m<span class="op">]&gt;</span> q2 <span class="op">=</span> isq<span class="op">::</span>height<span class="op">(</span>q1<span class="op">)</span>;  <span class="co">// explicit quantity conversion</span></span>
<span id="cb71-3"><a href="#cb71-3" aria-hidden="true" tabindex="-1"></a>foo<span class="op">(</span>isq<span class="op">::</span>height<span class="op">(</span>q1<span class="op">))</span>;                           <span class="co">// explicit quantity conversion</span></span></code></pre></div></li>
<li><p><strong>Explicit casts</strong></p>
<ul>
<li><em>height</em> is never a <em>width</em>, and vice versa.</li>
<li>Both <em>height</em> and <em>width</em> are quantities of kind
<em>length</em>.</li>
</ul>
<div class="sourceCode" id="cb72"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb72-1"><a href="#cb72-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(!</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>height, isq<span class="op">::</span>width<span class="op">))</span>;</span>
<span id="cb72-2"><a href="#cb72-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(!</span>explicitly_convertible<span class="op">(</span>isq<span class="op">::</span>height, isq<span class="op">::</span>width<span class="op">))</span>;</span>
<span id="cb72-3"><a href="#cb72-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>castable<span class="op">(</span>isq<span class="op">::</span>height, isq<span class="op">::</span>width<span class="op">))</span>;</span></code></pre></div>
<p>Explicit casts are forced with a dedicated
<code class="sourceCode cpp">quantity_cast</code> function:</p>
<div class="sourceCode" id="cb73"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb73-1"><a href="#cb73-1" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> foo<span class="op">(</span>quantity<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>m<span class="op">]&gt;</span> q<span class="op">)</span>;</span></code></pre></div>
<div class="sourceCode" id="cb74"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb74-1"><a href="#cb74-1" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>isq<span class="op">::</span>width<span class="op">[</span>m<span class="op">]&gt;</span> q1 <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> m;</span>
<span id="cb74-2"><a href="#cb74-2" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>m<span class="op">]&gt;</span> q2 <span class="op">=</span> quantity_cast<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">&gt;(</span>q1<span class="op">)</span>;  <span class="co">// explicit quantity cast</span></span>
<span id="cb74-3"><a href="#cb74-3" aria-hidden="true" tabindex="-1"></a>foo<span class="op">(</span>quantity_cast<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">&gt;(</span>q1<span class="op">))</span>;                           <span class="co">// explicit quantity cast</span></span></code></pre></div></li>
<li><p><strong>No conversion</strong></p>
<ul>
<li><em>time</em> has nothing in common with <em>length</em>.</li>
</ul>
<div class="sourceCode" id="cb75"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb75-1"><a href="#cb75-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(!</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>time, isq<span class="op">::</span>length<span class="op">))</span>;</span>
<span id="cb75-2"><a href="#cb75-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(!</span>explicitly_convertible<span class="op">(</span>isq<span class="op">::</span>time, isq<span class="op">::</span>length<span class="op">))</span>;</span>
<span id="cb75-3"><a href="#cb75-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(!</span>castable<span class="op">(</span>isq<span class="op">::</span>time, isq<span class="op">::</span>length<span class="op">))</span>;</span></code></pre></div>
<p>Even the explicit casts will not force such a conversion:</p>
<div class="sourceCode" id="cb76"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb76-1"><a href="#cb76-1" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> foo<span class="op">(</span>quantity<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">[</span>m<span class="op">]&gt;)</span>;</span></code></pre></div>
<div class="sourceCode" id="cb77"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb77-1"><a href="#cb77-1" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">[</span>m<span class="op">]&gt;</span> q1 <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> s;    <span class="co">// Compile-time error</span></span>
<span id="cb77-2"><a href="#cb77-2" aria-hidden="true" tabindex="-1"></a>foo<span class="op">(</span>quantity_cast<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">&gt;(</span><span class="dv">42</span> <span class="op">*</span> s<span class="op">))</span>; <span class="co">// Compile-time error</span></span></code></pre></div></li>
</ol>
<h3 data-number="14.1.4" id="comparing-adding-and-subtracting-quantities-of-the-same-kind"><span class="header-section-number">14.1.4</span> Comparing, adding, and
subtracting quantities of the same kind<a href="#comparing-adding-and-subtracting-quantities-of-the-same-kind" class="self-link"></a></h3>
<p><span class="citation" data-cites="ISO-GUIDE">[<a href="https://www.iso.org/obp/ui#iso:std:iso-iec:guide:99" role="doc-biblioref">ISO/IEC Guide 99</a>]</span> explicitly states that
<em>width</em> and <em>height</em> are quantities of the same kind and
as such they:</p>
<ul>
<li>are mutually comparable, and</li>
<li>can be added and subtracted.</li>
</ul>
<p>If we take the above for granted, the only reasonable result of <code class="sourceCode cpp"><span class="dv">1</span> <span class="op">*</span> width <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> height</code>
is <code class="sourceCode cpp"><span class="dv">2</span> <span class="op">*</span> length</code>,
where the result of <code class="sourceCode cpp">length</code> is known
as a common quantity type. A result of such an equation is always the
first common node in a hierarchy tree of the same kind. For example:</p>
<div class="sourceCode" id="cb78"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb78-1"><a href="#cb78-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">((</span>isq<span class="op">::</span>width<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">+</span> isq<span class="op">::</span>height<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">)).</span>quantity_spec <span class="op">==</span> isq<span class="op">::</span>length<span class="op">)</span>;</span>
<span id="cb78-2"><a href="#cb78-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">((</span>isq<span class="op">::</span>thickness<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">+</span> isq<span class="op">::</span>radius<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">)).</span>quantity_spec <span class="op">==</span> isq<span class="op">::</span>width<span class="op">)</span>;</span>
<span id="cb78-3"><a href="#cb78-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">((</span>isq<span class="op">::</span>distance<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">+</span> isq<span class="op">::</span>path_length<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">)).</span>quantity_spec <span class="op">==</span> isq<span class="op">::</span>path_length<span class="op">)</span>;</span></code></pre></div>
<p>One could argue that allowing to add or compare quantities of
<em>height</em> and <em>width</em> might be a safety issue, but we need
to be consistent with the requirements of <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span>. Moreover, from our
experience, disallowing such operations and requiring an explicit cast
to a common quantity in every single place makes the code so cluttered
with casts that it nearly renders the library unusable.</p>
<p>Fortunately, the above-mentioned conversion rules make the code safe
by construction anyway. Let’s analyze the following example:</p>
<div class="sourceCode" id="cb79"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb79-1"><a href="#cb79-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> horizontal_length <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">&gt;</span> <span class="op">{}</span> horizontal_length;</span>
<span id="cb79-2"><a href="#cb79-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb79-3"><a href="#cb79-3" aria-hidden="true" tabindex="-1"></a><span class="kw">namespace</span> christmas <span class="op">{</span></span>
<span id="cb79-4"><a href="#cb79-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb79-5"><a href="#cb79-5" aria-hidden="true" tabindex="-1"></a><span class="kw">struct</span> gift <span class="op">{</span></span>
<span id="cb79-6"><a href="#cb79-6" aria-hidden="true" tabindex="-1"></a>  quantity<span class="op">&lt;</span>horizontal_length<span class="op">[</span>m<span class="op">]&gt;</span> length;</span>
<span id="cb79-7"><a href="#cb79-7" aria-hidden="true" tabindex="-1"></a>  quantity<span class="op">&lt;</span>isq<span class="op">::</span>width<span class="op">[</span>m<span class="op">]&gt;</span> width;</span>
<span id="cb79-8"><a href="#cb79-8" aria-hidden="true" tabindex="-1"></a>  quantity<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>m<span class="op">]&gt;</span> height;</span>
<span id="cb79-9"><a href="#cb79-9" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span>
<span id="cb79-10"><a href="#cb79-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb79-11"><a href="#cb79-11" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>array<span class="op">&lt;</span>quantity<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">[</span>m<span class="op">]&gt;</span>, <span class="dv">2</span><span class="op">&gt;</span> gift_wrapping_paper_size<span class="op">(</span><span class="kw">const</span> gift<span class="op">&amp;</span> g<span class="op">)</span></span>
<span id="cb79-12"><a href="#cb79-12" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb79-13"><a href="#cb79-13" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> <span class="kw">auto</span> dim1 <span class="op">=</span> <span class="dv">2</span> <span class="op">*</span> g<span class="op">.</span>width <span class="op">+</span> <span class="dv">2</span> <span class="op">*</span> g<span class="op">.</span>height <span class="op">+</span> <span class="fl">0.5</span> <span class="op">*</span> g<span class="op">.</span>width;</span>
<span id="cb79-14"><a href="#cb79-14" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> <span class="kw">auto</span> dim2 <span class="op">=</span> g<span class="op">.</span>length <span class="op">+</span> <span class="dv">2</span> <span class="op">*</span> <span class="fl">0.75</span> <span class="op">*</span> g<span class="op">.</span>height;</span>
<span id="cb79-15"><a href="#cb79-15" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> <span class="op">{</span> dim1, dim2 <span class="op">}</span>;</span>
<span id="cb79-16"><a href="#cb79-16" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<span id="cb79-17"><a href="#cb79-17" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb79-18"><a href="#cb79-18" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>  <span class="co">// namespace christmas</span></span>
<span id="cb79-19"><a href="#cb79-19" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb79-20"><a href="#cb79-20" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> main<span class="op">()</span></span>
<span id="cb79-21"><a href="#cb79-21" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb79-22"><a href="#cb79-22" aria-hidden="true" tabindex="-1"></a>  <span class="kw">const</span> christmas<span class="op">::</span>gift lego <span class="op">=</span> <span class="op">{</span> horizontal_length<span class="op">(</span><span class="dv">40</span> <span class="op">*</span> cm<span class="op">)</span>, isq<span class="op">::</span>width<span class="op">(</span><span class="dv">30</span> <span class="op">*</span> cm<span class="op">)</span>, isq<span class="op">::</span>height<span class="op">(</span><span class="dv">15</span> <span class="op">*</span> cm<span class="op">)</span> <span class="op">}</span>;</span>
<span id="cb79-23"><a href="#cb79-23" aria-hidden="true" tabindex="-1"></a>  <span class="kw">auto</span> paper <span class="op">=</span> christmas<span class="op">::</span>gift_wrapping_paper_size<span class="op">(</span>lego<span class="op">)</span>;</span>
<span id="cb79-24"><a href="#cb79-24" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb79-25"><a href="#cb79-25" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="st">&quot;Paper needed to pack a lego box:</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb79-26"><a href="#cb79-26" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="st">&quot;- &quot;</span> <span class="op">&lt;&lt;</span> paper<span class="op">[</span><span class="dv">0</span><span class="op">]</span> <span class="op">&lt;&lt;</span> <span class="st">&quot; X &quot;</span> <span class="op">&lt;&lt;</span> paper<span class="op">[</span><span class="dv">1</span><span class="op">]</span> <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;  <span class="co">// - 1.05 m X 0.625 m</span></span>
<span id="cb79-27"><a href="#cb79-27" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="st">&quot;- area = &quot;</span> <span class="op">&lt;&lt;</span> paper<span class="op">[</span><span class="dv">0</span><span class="op">]</span> <span class="op">*</span> paper<span class="op">[</span><span class="dv">1</span><span class="op">]</span> <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;     <span class="co">// - area = 0.65625 m²</span></span>
<span id="cb79-28"><a href="#cb79-28" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>In the beginning, we introduce a custom quantity
<code class="sourceCode cpp">horizontal_length</code> of a kind
<em>length</em>, which then, together with
<code class="sourceCode cpp">isq<span class="op">::</span>width</code>
and
<code class="sourceCode cpp">isq<span class="op">::</span>height</code>,
are used to define the dimensions of a Christmas gift. Next, we provide
a function that calculates the dimensions of a gift wrapping paper with
some wraparound. The result of both those expressions is a quantity of
<code class="sourceCode cpp">isq<span class="op">::</span>length</code>,
as this is the closest common quantity for the arguments used in this
quantity equation.</p>
<p>Regarding safety, it is important to mention here, that thanks to the
conversion rules provided above, it would be impossible to accidentally
do the following:</p>
<div class="sourceCode" id="cb80"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb80-1"><a href="#cb80-1" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> foo<span class="op">(</span>quantity<span class="op">&lt;</span>horizontal_length<span class="op">[</span>m<span class="op">]&gt;</span> q<span class="op">)</span>;</span>
<span id="cb80-2"><a href="#cb80-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb80-3"><a href="#cb80-3" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>isq<span class="op">::</span>width<span class="op">[</span>m<span class="op">]&gt;</span> q1 <span class="op">=</span> dim1;  <span class="co">// Compile-time error</span></span>
<span id="cb80-4"><a href="#cb80-4" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>m<span class="op">]&gt;</span> q2<span class="op">{</span>dim1<span class="op">}</span>;  <span class="co">// Compile-time error</span></span>
<span id="cb80-5"><a href="#cb80-5" aria-hidden="true" tabindex="-1"></a>foo<span class="op">(</span>dim1<span class="op">)</span>;                          <span class="co">// Compile-time error</span></span></code></pre></div>
<p>The reason of compilation errors above is the fact that
<code class="sourceCode cpp">isq<span class="op">::</span>length</code>
is not implicitly convertible to the quantities defined based on it. To
make the above code compile, an explicit conversion of a quantity type
is needed:</p>
<div class="sourceCode" id="cb81"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb81-1"><a href="#cb81-1" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> foo<span class="op">(</span>quantity<span class="op">&lt;</span>horizontal_length<span class="op">[</span>m<span class="op">]&gt;</span> q<span class="op">)</span>;</span>
<span id="cb81-2"><a href="#cb81-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb81-3"><a href="#cb81-3" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>isq<span class="op">::</span>width<span class="op">[</span>m<span class="op">]&gt;</span> q1 <span class="op">=</span> isq<span class="op">::</span>width<span class="op">(</span>dim1<span class="op">)</span>;</span>
<span id="cb81-4"><a href="#cb81-4" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>m<span class="op">]&gt;</span> q2<span class="op">{</span>isq<span class="op">::</span>height<span class="op">(</span>dim1<span class="op">)}</span>;</span>
<span id="cb81-5"><a href="#cb81-5" aria-hidden="true" tabindex="-1"></a>foo<span class="op">(</span>horizontal_length<span class="op">(</span>dim1<span class="op">))</span>;</span></code></pre></div>
<p>To summarize, rules for addition, subtraction, and comparison of
quantities improve the library usability, while the conversion rules
enhance the safety of the library compared to the libraries that do not
model quantity kinds.</p>
<h3 data-number="14.1.5" id="hierarchies-of-derived-quantities"><span class="header-section-number">14.1.5</span> Hierarchies of derived
quantities<a href="#hierarchies-of-derived-quantities" class="self-link"></a></h3>
<p>The same rules propagate to derived quantities. For example, we can
define strongly typed horizontal length and area:</p>
<div class="sourceCode" id="cb82"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb82-1"><a href="#cb82-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> horizontal_length <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">&gt;</span> <span class="op">{}</span> horizontal_length;</span>
<span id="cb82-2"><a href="#cb82-2" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> horizontal_area <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>isq<span class="op">::</span>area, horizontal_length <span class="op">*</span> isq<span class="op">::</span>width<span class="op">&gt;</span> <span class="op">{}</span> horizontal_area;</span></code></pre></div>
<p>The first definition says that a
<code class="sourceCode cpp">horizontal_length</code> is a more
specialized quantity than
<code class="sourceCode cpp">isq<span class="op">::</span>length</code>
and belongs to the same quantity kind. The second line defines a
<code class="sourceCode cpp">horizontal_area</code>, which is a more
specialized quantity than
<code class="sourceCode cpp">isq<span class="op">::</span>area</code>,
so it has a more constrained recipe as well. Thanks to that:</p>
<div class="sourceCode" id="cb83"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb83-1"><a href="#cb83-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>implicitly_convertible<span class="op">(</span>horizontal_length, isq<span class="op">::</span>length<span class="op">))</span>;</span>
<span id="cb83-2"><a href="#cb83-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(!</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>length, horizontal_length<span class="op">))</span>;</span>
<span id="cb83-3"><a href="#cb83-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>explicitly_convertible<span class="op">(</span>isq<span class="op">::</span>length, horizontal_length<span class="op">))</span>;</span>
<span id="cb83-4"><a href="#cb83-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb83-5"><a href="#cb83-5" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>implicitly_convertible<span class="op">(</span>horizontal_area, isq<span class="op">::</span>area<span class="op">))</span>;</span>
<span id="cb83-6"><a href="#cb83-6" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(!</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>area, horizontal_area<span class="op">))</span>;</span>
<span id="cb83-7"><a href="#cb83-7" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>explicitly_convertible<span class="op">(</span>isq<span class="op">::</span>area, horizontal_area<span class="op">))</span>;</span>
<span id="cb83-8"><a href="#cb83-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb83-9"><a href="#cb83-9" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>length <span class="op">*</span> isq<span class="op">::</span>length, isq<span class="op">::</span>area<span class="op">))</span>;</span>
<span id="cb83-10"><a href="#cb83-10" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(!</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>length <span class="op">*</span> isq<span class="op">::</span>length, horizontal_area<span class="op">))</span>;</span>
<span id="cb83-11"><a href="#cb83-11" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>explicitly_convertible<span class="op">(</span>isq<span class="op">::</span>length <span class="op">*</span> isq<span class="op">::</span>length, horizontal_area<span class="op">))</span>;</span>
<span id="cb83-12"><a href="#cb83-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb83-13"><a href="#cb83-13" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>implicitly_convertible<span class="op">(</span>horizontal_length <span class="op">*</span> isq<span class="op">::</span>width, isq<span class="op">::</span>area<span class="op">))</span>;</span>
<span id="cb83-14"><a href="#cb83-14" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>implicitly_convertible<span class="op">(</span>horizontal_length <span class="op">*</span> isq<span class="op">::</span>width, horizontal_area<span class="op">))</span>;</span></code></pre></div>
<p>Unfortunately, derived quantity equations often do not automatically
form a hierarchy tree. This is why sometimes it is not obvious what such
a tree should look like. Also, the <span class="citation" data-cites="ISO-GUIDE">[<a href="https://www.iso.org/obp/ui#iso:std:iso-iec:guide:99" role="doc-biblioref">ISO/IEC Guide 99</a>]</span> explicitly states:</p>
<blockquote>
<p>The division of ‘quantity’ according to ‘kind of quantity’ is, to
some extent, arbitrary.</p>
</blockquote>
<p>The below presents some arbitrary hierarchy of derived quantities of
kind <em>energy</em>:</p>
<p><img src="data:image/svg+xml;base64,PHN2ZyBhcmlhLXJvbGVkZXNjcmlwdGlvbj0iZmxvd2NoYXJ0LXYyIiByb2xlPSJncmFwaGljcy1kb2N1bWVudCBkb2N1bWVudCIgdmlld0JveD0iLTggLTggMTM4OS41NTQ2ODc1IDM5NCIgc3R5bGU9Im1heC13aWR0aDogMTAwJTsiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGlkPSJncmFwaC1kaXYiIGhlaWdodD0iMTAwJSIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveG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MzkiIHdpZHRoPSIxMTUuNTIzNDM3NSIgeT0iLTE5LjUiIHg9Ii01Ny43NjE3MTg3NSIgcnk9IjAiIHJ4PSIwIiBzdHlsZT0iIiBjbGFzcz0iYmFzaWMgbGFiZWwtY29udGFpbmVyIj48L3JlY3Q+PGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTUwLjI2MTcxODc1LCAtMTIpIiBzdHlsZT0iIiBjbGFzcz0ibGFiZWwiPjxyZWN0PjwvcmVjdD48Zm9yZWlnbk9iamVjdCBoZWlnaHQ9IjI0IiB3aWR0aD0iMTAwLjUyMzQzNzUiPjxkaXYgc3R5bGU9ImRpc3BsYXk6IGlubGluZS1ibG9jazsgd2hpdGUtc3BhY2U6IG5vd3JhcDsiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hodG1sIj48c3BhbiBjbGFzcz0ibm9kZUxhYmVsIj5hY3RpdmVfZW5lcmd5PC9zcGFuPjwvZGl2PjwvZm9yZWlnbk9iamVjdD48L2c+PC9nPjwvZz48L2c+PC9nPjwvc3ZnPg==" /></p>
<p>Notice, that even though all of those quantities have the same
dimension and can be expressed in the same units, they have different
quantity equations used to create them implicitly:</p>
<ul>
<li><p><code class="sourceCode cpp">energy</code> is the most generic
one and thus can be created from base quantities of
<code class="sourceCode cpp">mass</code>,
<code class="sourceCode cpp">length</code>, and
<code class="sourceCode cpp">time</code>. As those are also the roots of
quantities of their kinds and all other quantities are implicitly
convertible to them, it means that an
<code class="sourceCode cpp">energy</code> can be implicitly constructed
from any quantity having proper powers of <em>mass</em>,
<em>length</em>, and <em>time</em>.</p>
<div class="sourceCode" id="cb84"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb84-1"><a href="#cb84-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>mass <span class="op">*</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>isq<span class="op">::</span>length<span class="op">)</span> <span class="op">/</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>isq<span class="op">::</span>time<span class="op">)</span>, isq<span class="op">::</span>energy<span class="op">))</span>;</span>
<span id="cb84-2"><a href="#cb84-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>mass <span class="op">*</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>isq<span class="op">::</span>height<span class="op">)</span> <span class="op">/</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>isq<span class="op">::</span>time<span class="op">)</span>, isq<span class="op">::</span>energy<span class="op">))</span>;</span></code></pre></div></li>
<li><p><code class="sourceCode cpp">mechanical_energy</code> is a more
“specialized” quantity than <code class="sourceCode cpp">energy</code>
(not every <code class="sourceCode cpp">energy</code> is a
<code class="sourceCode cpp">mechanical_energy</code>). It is why an
explicit cast is needed to convert from either
<code class="sourceCode cpp">energy</code> or the results of its
quantity equation.</p>
<div class="sourceCode" id="cb85"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb85-1"><a href="#cb85-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(!</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>energy, isq<span class="op">::</span>mechanical_energy<span class="op">))</span>;</span>
<span id="cb85-2"><a href="#cb85-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>explicitly_convertible<span class="op">(</span>isq<span class="op">::</span>energy, isq<span class="op">::</span>mechanical_energy<span class="op">))</span>;</span>
<span id="cb85-3"><a href="#cb85-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(!</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>mass <span class="op">*</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>isq<span class="op">::</span>length<span class="op">)</span> <span class="op">/</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>isq<span class="op">::</span>time<span class="op">)</span>, isq<span class="op">::</span>mechanical_energy<span class="op">))</span>;</span>
<span id="cb85-4"><a href="#cb85-4" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>explicitly_convertible<span class="op">(</span>isq<span class="op">::</span>mass <span class="op">*</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>isq<span class="op">::</span>length<span class="op">)</span> <span class="op">/</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>isq<span class="op">::</span>time<span class="op">)</span>, isq<span class="op">::</span>mechanical_energy<span class="op">))</span>;</span></code></pre></div></li>
<li><p><code class="sourceCode cpp">gravitational_potential_energy</code>
is not only even more specialized one but additionally, it is special in
a way that it provides its own “constrained” quantity equation. Maybe
not every <code class="sourceCode cpp">mass <span class="op">*</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>length<span class="op">)</span> <span class="op">/</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>time<span class="op">)</span></code>
is a <code class="sourceCode cpp">gravitational_potential_energy</code>,
but every <code class="sourceCode cpp">mass <span class="op">*</span> acceleration_of_free_fall <span class="op">*</span> height</code>
is.</p>
<div class="sourceCode" id="cb86"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb86-1"><a href="#cb86-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(!</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>energy, gravitational_potential_energy<span class="op">))</span>;</span>
<span id="cb86-2"><a href="#cb86-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>explicitly_convertible<span class="op">(</span>isq<span class="op">::</span>energy, gravitational_potential_energy<span class="op">))</span>;</span>
<span id="cb86-3"><a href="#cb86-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(!</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>mass <span class="op">*</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>isq<span class="op">::</span>length<span class="op">)</span> <span class="op">/</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>isq<span class="op">::</span>time<span class="op">)</span>, gravitational_potential_energy<span class="op">))</span>;</span>
<span id="cb86-4"><a href="#cb86-4" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>explicitly_convertible<span class="op">(</span>isq<span class="op">::</span>mass <span class="op">*</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>isq<span class="op">::</span>length<span class="op">)</span> <span class="op">/</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>isq<span class="op">::</span>time<span class="op">)</span>, gravitational_potential_energy<span class="op">))</span>;</span>
<span id="cb86-5"><a href="#cb86-5" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>mass <span class="op">*</span> isq<span class="op">::</span>acceleration_of_free_fall <span class="op">*</span> isq<span class="op">::</span>height, gravitational_potential_energy<span class="op">))</span>;</span></code></pre></div></li>
</ul>
<h3 data-number="14.1.6" id="modeling-a-quantity-kind"><span class="header-section-number">14.1.6</span> Modeling a quantity kind<a href="#modeling-a-quantity-kind" class="self-link"></a></h3>
<p>In the physical units library, we also need an abstraction describing
an entire family of quantities of the same kind. Such quantities have
not only the same dimension but also can be expressed in the same
units.</p>
<p>To annotate a quantity to represent its kind (and not just a
hierarchy tree’s root quantity), we introduced a <code class="sourceCode cpp">kind_of<span class="op">&lt;&gt;</span></code>
specifier. For example, to express any quantity of <em>length</em>, we
need to specify <code class="sourceCode cpp">kind_of<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">&gt;</span></code>.
That entity behaves as any quantity of its kind. This means that it is
implicitly convertible to any quantity in a tree:</p>
<div class="sourceCode" id="cb87"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb87-1"><a href="#cb87-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(!</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>length, isq<span class="op">::</span>height<span class="op">))</span>;</span>
<span id="cb87-2"><a href="#cb87-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>implicitly_convertible<span class="op">(</span>kind_of<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">&gt;</span>, isq<span class="op">::</span>height<span class="op">))</span>;</span></code></pre></div>
<p>Additionally, the result of operations on quantity kinds is also a
quantity kind:</p>
<div class="sourceCode" id="cb88"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb88-1"><a href="#cb88-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>same_type<span class="op">&lt;</span>kind_of<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">&gt;</span> <span class="op">/</span> kind_of<span class="op">&lt;</span>isq<span class="op">::</span>time<span class="op">&gt;</span>, kind_of<span class="op">&lt;</span>isq<span class="op">::</span>length <span class="op">/</span> isq<span class="op">::</span>time<span class="op">&gt;&gt;)</span>;</span></code></pre></div>
<p>However, if at least one equation’s operand is not a quantity kind,
the result becomes a “strong” quantity where all the kinds are converted
to the hierarchy tree’s root quantities:</p>
<div class="sourceCode" id="cb89"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb89-1"><a href="#cb89-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(!</span>same_type<span class="op">&lt;</span>kind_of<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">&gt;</span> <span class="op">/</span> isq<span class="op">::</span>time, kind_of<span class="op">&lt;</span>isq<span class="op">::</span>length <span class="op">/</span> isq<span class="op">::</span>time<span class="op">&gt;&gt;)</span>;</span>
<span id="cb89-2"><a href="#cb89-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>same_type<span class="op">&lt;</span>kind_of<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">&gt;</span> <span class="op">/</span> isq<span class="op">::</span>time, isq<span class="op">::</span>length <span class="op">/</span> isq<span class="op">::</span>time<span class="op">&gt;)</span>;</span></code></pre></div>
<p>Please note that only a root quantity from the hierarchy tree or the
one marked with <code class="sourceCode cpp">is_kind</code> specifier in
the <code class="sourceCode cpp">quantity_spec</code> definition can be
put as a template parameter to the
<code class="sourceCode cpp">kind_of</code> specifier. For example,
<code class="sourceCode cpp">kind_of<span class="op">&lt;</span>isq<span class="op">::</span>width<span class="op">&gt;</span></code>
will fail to compile. However, we can call <code class="sourceCode cpp">get_kind<span class="op">(</span>q<span class="op">)</span></code>
to obtain a kind of any quantity:</p>
<div class="sourceCode" id="cb90"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb90-1"><a href="#cb90-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>get_kind<span class="op">(</span>isq<span class="op">::</span>width<span class="op">)</span> <span class="op">==</span> kind_of<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">&gt;)</span>;</span></code></pre></div>
<h2 data-number="14.2" id="systems-of-units"><span class="header-section-number">14.2</span> Systems of units<a href="#systems-of-units" class="self-link"></a></h2>
<p>Modeling a system of units is the most important feature and a
selling point of every physical units library. Thanks to that, the
library can protect users from performing invalid operations on
quantities and provide automated conversion factors between various
compatible units.</p>
<p>Probably all the libraries in the wild model the <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span> or at least most of it (refer to <a href="#si-units-of-quantities-of-the-same-dimension-but-different-kinds">SI
units of quantities of the same dimension but different kinds</a> for
more details) and many of them provide support for additional units
belonging to various other systems (e.g., imperial).</p>
<h3 data-number="14.2.1" id="systems-of-units-are-based-on-systems-of-quantities"><span class="header-section-number">14.2.1</span> Systems of units are based
on systems of quantities<a href="#systems-of-units-are-based-on-systems-of-quantities" class="self-link"></a></h3>
<p>Systems of quantities specify a set of quantities and equations
relating to those quantities. Those equations do not take any unit or a
numerical representation into account at all. In order to create a
quantity, we need to add those missing pieces of information. This is
where a system of units kicks in.</p>
<p>The <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span> is explicitly stated to be based on
the ISQ. Among others, it defines seven base units, one for each base
quantity. In the library, this is expressed by associating a quantity
kind to a unit being defined:</p>
<div class="sourceCode" id="cb91"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb91-1"><a href="#cb91-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> metre <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;m&quot;</span>, kind_of<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">&gt;&gt;</span> <span class="op">{}</span> metre;</span></code></pre></div>
<p>The <code class="sourceCode cpp">kind_of<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">&gt;</span></code>
above states explicitly that this unit has an associated quantity kind.
In other words,
<code class="sourceCode cpp">si<span class="op">::</span>metre</code>
(and scaled units based on it) can be used to express the amount of any
quantity of kind <em>length</em>.</p>
<p>Associated units are so useful and common in the library that they
got their own <a href="#AssociatedUnit-concept"><code class="sourceCode cpp">AssociatedUnit<span class="op">&lt;</span>T<span class="op">&gt;</span></code></a>
concept to improve the interfaces.</p>
<p>Please note that for some systems of units (e.g., natural units), a
unit may not have an associated quantity type. For example, if we define
the speed of light constant as <code class="sourceCode cpp">c <span class="op">=</span> <span class="dv">1</span></code>,
we can define a system where both <em>length</em> and <em>time</em> will
be measured in seconds, and <em>speed</em> will be a quantity measured
with the unit <code class="sourceCode cpp">one</code>. In such case, the
definition will look as follows:</p>
<div class="sourceCode" id="cb92"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb92-1"><a href="#cb92-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> second <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;s&quot;</span><span class="op">&gt;</span> <span class="op">{}</span> second;</span></code></pre></div>
<h3 data-number="14.2.2" id="units-compose"><span class="header-section-number">14.2.2</span> Units compose<a href="#units-compose" class="self-link"></a></h3>
<p>One of the strongest points of the <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span> system is that its units compose.
This allows providing thousands of different units for hundreds of
various quantities with a really small set of predefined units and
prefixes. For example, one can write:</p>
<div class="sourceCode" id="cb93"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb93-1"><a href="#cb93-1" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>si<span class="op">::</span>metre <span class="op">/</span> si<span class="op">::</span>second<span class="op">&gt;</span> q;</span></code></pre></div>
<p>to express a quantity of speed. The resulting quantity type is
implicitly inferred from the unit equation by repeating exactly the same
operations on the associated quantity kinds.</p>
<p>As units are regular values, we can easily provide a helper ad-hoc
unit with:</p>
<div class="sourceCode" id="cb94"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb94-1"><a href="#cb94-1" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="kw">auto</span> mps <span class="op">=</span> si<span class="op">::</span>metre <span class="op">/</span> si<span class="op">::</span>second;</span>
<span id="cb94-2"><a href="#cb94-2" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>mps<span class="op">&gt;</span> q;</span></code></pre></div>
<h3 data-number="14.2.3" id="many-shades-of-the-same-unit"><span class="header-section-number">14.2.3</span> Many shades of the same
unit<a href="#many-shades-of-the-same-unit" class="self-link"></a></h3>
<p>The <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span> provides the names for 22 common
coherent units of 22 derived quantities.</p>
<p>Each such named derived unit is a result of a specific predefined
unit equation. For example, a unit of power quantity is defined as:</p>
<div class="sourceCode" id="cb95"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb95-1"><a href="#cb95-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> watt <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;W&quot;</span>, joule <span class="op">/</span> second<span class="op">&gt;</span> <span class="op">{}</span> watt;</span></code></pre></div>
<p>However, a power quantity can be expressed in other units as well.
For example, the following:</p>
<div class="sourceCode" id="cb96"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb96-1"><a href="#cb96-1" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> q1 <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> W;</span>
<span id="cb96-2"><a href="#cb96-2" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> q1 <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb96-3"><a href="#cb96-3" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> q1<span class="op">.</span>in<span class="op">(</span>J <span class="op">/</span> s<span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb96-4"><a href="#cb96-4" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> q1<span class="op">.</span>in<span class="op">(</span>N <span class="op">*</span> m <span class="op">/</span> s<span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb96-5"><a href="#cb96-5" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> q1<span class="op">.</span>in<span class="op">(</span>kg <span class="op">*</span> m2 <span class="op">/</span> s3<span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span></code></pre></div>
<p>prints:</p>
<pre class="text"><code>42 W
42 J/s
42 N m/s
42 kg m²/s³</code></pre>
<p>All of the above quantities are equivalent and mean exactly the
same.</p>
<h3 data-number="14.2.4" id="constraining-a-derived-unit-to-work-only-with-a-specific-derived-quantity"><span class="header-section-number">14.2.4</span> Constraining a derived unit
to work only with a specific derived quantity<a href="#constraining-a-derived-unit-to-work-only-with-a-specific-derived-quantity" class="self-link"></a></h3>
<p>Some derived units are valid only for specific derived quantities.
For example, <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span> specifies both hertz and becquerel
derived units with the same unit equation <span class="math inline">\(s^{-1}\)</span>. However, it also explicitly
states:</p>
<blockquote>
<p>The hertz shall only be used for periodic phenomena and the becquerel
shall only be used for stochastic processes in activity referred to a
radionuclide.</p>
</blockquote>
<p>This is why it is important for the library to allow constraining
such units to be used only with a specific quantity kind:</p>
<div class="sourceCode" id="cb97"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb97-1"><a href="#cb97-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> hertz <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;Hz&quot;</span>, one <span class="op">/</span> second, kind_of<span class="op">&lt;</span>isq<span class="op">::</span>frequency<span class="op">&gt;&gt;</span> <span class="op">{}</span> hertz;</span>
<span id="cb97-2"><a href="#cb97-2" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> becquerel <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;Bq&quot;</span>, one <span class="op">/</span> second, kind_of<span class="op">&lt;</span>isq<span class="op">::</span>activity<span class="op">&gt;&gt;</span> <span class="op">{}</span> becquerel;</span></code></pre></div>
<p>With the above, <code class="sourceCode cpp">hertz</code> can only be
used for <em>frequencies</em>, while
<code class="sourceCode cpp">becquerel</code> should only be used for
quantities of <em>activity</em>. This means that the following equation
will not compile, improving the type-safety of the library:</p>
<div class="sourceCode" id="cb98"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb98-1"><a href="#cb98-1" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> q <span class="op">=</span> <span class="dv">1</span> <span class="op">*</span> Hz <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> Bq;   <span class="co">// Fails to compile</span></span></code></pre></div>
<h3 data-number="14.2.5" id="prefixed-units"><span class="header-section-number">14.2.5</span> Prefixed units<a href="#prefixed-units" class="self-link"></a></h3>
<p>Besides named units, the <a href="../../appendix/glossary.md#si">SI</a> specifies also 24 prefixes
(all being a power of
<code class="sourceCode cpp"><span class="dv">10</span></code>) that can
be prepended to all named units to obtain various scaled versions of
them.</p>
<p>Implementation of
<code class="sourceCode cpp">std<span class="op">::</span>ratio</code>
provided by all major compilers is able to express only 16 of them. This
is why, we had to find an alternative way to represent a unit’s
magnitude in a more flexible way.</p>
<p>Each prefix is implemented as:</p>
<div class="sourceCode" id="cb99"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb99-1"><a href="#cb99-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>PrefixableUnit U<span class="op">&gt;</span> <span class="kw">struct</span> quecto_ <span class="op">:</span> prefixed_unit<span class="op">&lt;</span><span class="st">&quot;q&quot;</span>, mag_power<span class="op">&lt;</span><span class="dv">10</span>, <span class="op">-</span><span class="dv">30</span><span class="op">&gt;</span>, U<span class="op">{}&gt;</span> <span class="op">{}</span>;</span>
<span id="cb99-2"><a href="#cb99-2" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>PrefixableUnit <span class="kw">auto</span> U<span class="op">&gt;</span> <span class="kw">constexpr</span> quecto_<span class="op">&lt;</span><span class="kw">decltype</span><span class="op">(</span>U<span class="op">)&gt;</span> quecto;</span></code></pre></div>
<p>and then a unit can be prefixed in the following way:</p>
<div class="sourceCode" id="cb100"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb100-1"><a href="#cb100-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> qm <span class="op">=</span> quecto<span class="op">&lt;</span>metre<span class="op">&gt;</span>;</span></code></pre></div>
<p>The usage of <code class="sourceCode cpp">mag_power</code> not only
enables providing support for SI prefixes, but it can also efficiently
represent any rational magnitude. For example, <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> (part 13) prefixes used
in the IT industry can be implemented as:</p>
<div class="sourceCode" id="cb101"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb101-1"><a href="#cb101-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>PrefixableUnit U<span class="op">&gt;</span> <span class="kw">struct</span> yobi_ <span class="op">:</span> prefixed_unit<span class="op">&lt;</span><span class="st">&quot;Yi&quot;</span>, mag_power<span class="op">&lt;</span><span class="dv">2</span>, <span class="dv">80</span><span class="op">&gt;</span>, U<span class="op">{}&gt;</span> <span class="op">{}</span>;</span>
<span id="cb101-2"><a href="#cb101-2" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>PrefixableUnit <span class="kw">auto</span> U<span class="op">&gt;</span> <span class="kw">constexpr</span> yobi_<span class="op">&lt;</span><span class="kw">decltype</span><span class="op">(</span>U<span class="op">)&gt;</span> yobi;</span></code></pre></div>
<p><em>Please note that to improve the readability of generated types
that are exposed in compiler errors and debugger, the variable template
takes an NTTP and converts it to its type before passing the argument to
the associated class template.</em></p>
<h3 data-number="14.2.6" id="scaled-units"><span class="header-section-number">14.2.6</span> Scaled units<a href="#scaled-units" class="self-link"></a></h3>
<p>In the <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span>, all units are either base or
derived units or prefixed versions of those. However, those are not the
only options possible.</p>
<p>For example, there is a list of off-system units accepted for use
with <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span>. All of those are scaled versions of
the <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span> units with ratios that can’t be
explicitly expressed with predefined SI prefixes. Those include units
like minute, hour, or electronvolt:</p>
<div class="sourceCode" id="cb102"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb102-1"><a href="#cb102-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> minute <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;min&quot;</span>, mag<span class="op">&lt;</span><span class="dv">60</span><span class="op">&gt;</span> <span class="op">*</span> si<span class="op">::</span>second<span class="op">&gt;</span> <span class="op">{}</span> minute;</span>
<span id="cb102-2"><a href="#cb102-2" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> hour <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;h&quot;</span>, mag<span class="op">&lt;</span><span class="dv">60</span><span class="op">&gt;</span> <span class="op">*</span> minute<span class="op">&gt;</span> <span class="op">{}</span> hour;</span>
<span id="cb102-3"><a href="#cb102-3" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> electronvolt <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;eV&quot;</span>,</span>
<span id="cb102-4"><a href="#cb102-4" aria-hidden="true" tabindex="-1"></a>    mag_ratio<span class="op">&lt;</span><span class="dv">1&#39;602&#39;176&#39;634</span>, <span class="dv">1&#39;000&#39;000&#39;000</span><span class="op">&gt;</span> <span class="op">*</span> mag_power<span class="op">&lt;</span><span class="dv">10</span>, <span class="op">-</span><span class="dv">19</span><span class="op">&gt;</span> <span class="op">*</span> si<span class="op">::</span>joule<span class="op">&gt;</span> <span class="op">{}</span> electronvolt;</span></code></pre></div>
<p>Also, units of other systems of units are often defined in terms of
scaled versions of other (often SI) units. For example, the
international yard is defined as:</p>
<div class="sourceCode" id="cb103"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb103-1"><a href="#cb103-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> yard <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;yd&quot;</span>, mag_ratio<span class="op">&lt;</span><span class="dv">9&#39;144</span>, <span class="dv">10&#39;000</span><span class="op">&gt;</span> <span class="op">*</span> si<span class="op">::</span>metre<span class="op">&gt;</span> <span class="op">{}</span> yard;</span></code></pre></div>
<p>and then a <code class="sourceCode cpp">foot</code> can be defined
as:</p>
<div class="sourceCode" id="cb104"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb104-1"><a href="#cb104-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> foot <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;ft&quot;</span>, mag_ratio<span class="op">&lt;</span><span class="dv">1</span>, <span class="dv">3</span><span class="op">&gt;</span> <span class="op">*</span> yard<span class="op">&gt;</span> <span class="op">{}</span> foot;</span></code></pre></div>
<p>For some units, a magnitude might also be irrational. The best
example here is a <code class="sourceCode cpp">degree</code> which is
defined using a floating-point magnitude having a factor of the number π
(Pi):</p>
<div class="sourceCode" id="cb105"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb105-1"><a href="#cb105-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> pi <span class="kw">final</span> <span class="op">:</span></span>
<span id="cb105-2"><a href="#cb105-2" aria-hidden="true" tabindex="-1"></a>  mag_constant<span class="op">&lt;</span>symbol_text<span class="op">{</span><span class="st">u8&quot;π&quot;</span> <span class="co">/* U+03C0 GREEK SMALL LETTER PI */</span>, <span class="st">&quot;pi&quot;</span><span class="op">}</span>, std<span class="op">::</span>numbers<span class="op">::</span>pi_v<span class="op">&lt;</span><span class="dt">long</span> <span class="dt">double</span><span class="op">&gt;&gt;</span> <span class="op">{}</span> pi;</span>
<span id="cb105-3"><a href="#cb105-3" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> π <span class="co">/* U+03C0 GREEK SMALL LETTER PI */</span> <span class="op">=</span> pi;</span></code></pre></div>
<div class="sourceCode" id="cb106"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb106-1"><a href="#cb106-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> degree <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;{</span><span class="st">u8&quot;°&quot;</span>, <span class="st">&quot;deg&quot;</span><span class="op">}</span>, mag<span class="op">&lt;</span>π<span class="op">&gt;</span> <span class="op">/</span> mag<span class="op">&lt;</span><span class="dv">180</span><span class="op">&gt;</span> <span class="op">*</span> si<span class="op">::</span>radian<span class="op">&gt;</span> <span class="op">{}</span> degree;</span></code></pre></div>
<h3 data-number="14.2.7" id="common-units"><span class="header-section-number">14.2.7</span> Common units<a href="#common-units" class="self-link"></a></h3>
<p>Adding, subtracting, or comparing two quantities of different units
will force the library to find a common unit for those. This is to
prevent data truncation. For the cases when one of the units is an
integral multiple of the other, the resulting quantity will use a
“smaller” one in its result. For example:</p>
<div class="sourceCode" id="cb107"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb107-1"><a href="#cb107-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">((</span><span class="dv">1</span> <span class="op">*</span> kg <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> g<span class="op">).</span>unit <span class="op">==</span> g<span class="op">)</span>;</span>
<span id="cb107-2"><a href="#cb107-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">((</span><span class="dv">1</span> <span class="op">*</span> km <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> mm<span class="op">).</span>unit <span class="op">==</span> mm<span class="op">)</span>;</span>
<span id="cb107-3"><a href="#cb107-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">((</span><span class="dv">1</span> <span class="op">*</span> yd <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> mi<span class="op">).</span>unit <span class="op">==</span> yd<span class="op">)</span>;</span></code></pre></div>
<p>However, in many cases an arithmetic operation on quantities of
different units will result in a yet another unit. This happens when
none of the source units is an integral multiple of another. In such
cases, the library returns a special type that denotes that we are
dealing with a common unit of such an equation:</p>
<div class="sourceCode" id="cb108"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb108-1"><a href="#cb108-1" aria-hidden="true" tabindex="-1"></a>quantity q1 <span class="op">=</span> <span class="dv">1</span> <span class="op">*</span> km <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> mi; <span class="co">// quantity&lt;common_unit&lt;international::mile, si::kilo_&lt;si::metre&gt;&gt;{}, int&gt;</span></span>
<span id="cb108-2"><a href="#cb108-2" aria-hidden="true" tabindex="-1"></a>quantity q2 <span class="op">=</span> <span class="fl">1.</span> <span class="op">*</span> rad <span class="op">+</span> <span class="fl">1.</span> <span class="op">*</span> deg; <span class="co">// quantity&lt;common_unit&lt;si::degree, si::radian&gt;{}, double&gt;</span></span></code></pre></div>
<p>The above is to not privilege any unit in the library:</p>
<ul>
<li>we shouldn’t introduce an unmentioned unit into computations (e.g.,
converting a <code class="sourceCode cpp"><span class="dv">1</span> <span class="op">*</span> mi <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> nmi</code>
computation to <code class="sourceCode cpp">m</code> because
<code class="sourceCode cpp">m</code> could be the privileged SI base
unit),</li>
<li>we shouldn’t go looking for specific units (e.g., converting a <code class="sourceCode cpp"><span class="dv">1</span> <span class="op">*</span> m <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> cm</code>
computation to   <code class="sourceCode cpp">m</code> because
<code class="sourceCode cpp">m</code> is the privileged SI base
unit).</li>
</ul>
<p>Please note, that a user should never explicitly instantiate a
<code class="sourceCode cpp">common_unit</code> class template. The
library’s framework will do it based on the provided quantity
equation.</p>
<h3 data-number="14.2.8" id="unit-symbols"><span class="header-section-number">14.2.8</span> Unit symbols<a href="#unit-symbols" class="self-link"></a></h3>
<p>Units are available via their full names or through their short
symbols. To use a long version, it is enough to type:</p>
<div class="sourceCode" id="cb109"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb109-1"><a href="#cb109-1" aria-hidden="true" tabindex="-1"></a>quantity q1 <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> si<span class="op">::</span>metre <span class="op">/</span> si<span class="op">::</span>second;</span>
<span id="cb109-2"><a href="#cb109-2" aria-hidden="true" tabindex="-1"></a>quantity q2 <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> si<span class="op">::</span>kilo<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">&gt;</span> <span class="op">/</span> si<span class="op">::</span>hour;</span></code></pre></div>
<p>To simplify how we spell it a short, user-friendly symbols are
provided in a dedicated subnamespace in systems definitions:</p>
<div class="sourceCode" id="cb110"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb110-1"><a href="#cb110-1" aria-hidden="true" tabindex="-1"></a><span class="kw">namespace</span> si<span class="op">::</span>unit_symbols <span class="op">{</span></span>
<span id="cb110-2"><a href="#cb110-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb110-3"><a href="#cb110-3" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="kw">auto</span> m <span class="op">=</span> si<span class="op">::</span>metre;</span>
<span id="cb110-4"><a href="#cb110-4" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="kw">auto</span> km <span class="op">=</span> si<span class="op">::</span>kilo<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">&gt;</span>;</span>
<span id="cb110-5"><a href="#cb110-5" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="kw">auto</span> s <span class="op">=</span> si<span class="op">::</span>second;</span>
<span id="cb110-6"><a href="#cb110-6" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="kw">auto</span> h <span class="op">=</span> si<span class="op">::</span>hour;</span>
<span id="cb110-7"><a href="#cb110-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb110-8"><a href="#cb110-8" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>Unit symbols introduce a lot of short identifiers into the current
namespace. This is why they are opt-in. A user has to explicitly
“import” them from a dedicated
<code class="sourceCode cpp">unit_symbols</code> namespace:</p>
<div class="sourceCode" id="cb111"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb111-1"><a href="#cb111-1" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> <span class="kw">namespace</span> si<span class="op">::</span>unit_symbols;</span>
<span id="cb111-2"><a href="#cb111-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb111-3"><a href="#cb111-3" aria-hidden="true" tabindex="-1"></a>quantity q1 <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> m <span class="op">/</span> s;</span>
<span id="cb111-4"><a href="#cb111-4" aria-hidden="true" tabindex="-1"></a>quantity q2 <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> km <span class="op">/</span> h;</span></code></pre></div>
<p>or:</p>
<div class="sourceCode" id="cb112"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb112-1"><a href="#cb112-1" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> si<span class="op">::</span>unit_symbols<span class="op">::</span>m;</span>
<span id="cb112-2"><a href="#cb112-2" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> si<span class="op">::</span>unit_symbols<span class="op">::</span>km;</span>
<span id="cb112-3"><a href="#cb112-3" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> si<span class="op">::</span>unit_symbols<span class="op">::</span>s;</span>
<span id="cb112-4"><a href="#cb112-4" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> si<span class="op">::</span>unit_symbols<span class="op">::</span>h;</span>
<span id="cb112-5"><a href="#cb112-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb112-6"><a href="#cb112-6" aria-hidden="true" tabindex="-1"></a>quantity q1 <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> m <span class="op">/</span> s;</span>
<span id="cb112-7"><a href="#cb112-7" aria-hidden="true" tabindex="-1"></a>quantity q2 <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> km <span class="op">/</span> h;</span></code></pre></div>
<p>Thanks to <span class="citation" data-cites="P1949R7">[<a href="https://wg21.link/p1949r7" role="doc-biblioref">P1949R7</a>]</span> we also provide alternative
object identifiers using Unicode characters in their names for most unit
symbols. The code using Unicode looks nicer, but it is harder to type on
the keyboard. This is why we provide both versions of identifiers for
such units.</p>
<table>
<thead>
<tr class="header">
<th><div style="text-align:center">
<strong>Portable only</strong>
</div></th>
<th><div style="text-align:center">
<strong>With Unicode characters</strong>
</div></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><div>

<div class="sourceCode" id="cb113"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb113-1"><a href="#cb113-1" aria-hidden="true" tabindex="-1"></a>quantity resistance <span class="op">=</span> <span class="dv">60</span> <span class="op">*</span> kohm;</span>
<span id="cb113-2"><a href="#cb113-2" aria-hidden="true" tabindex="-1"></a>quantity capacitance <span class="op">=</span> <span class="dv">100</span> <span class="op">*</span> uF;</span></code></pre></div>

</div></td>
<td><div>

<div class="sourceCode" id="cb114"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb114-1"><a href="#cb114-1" aria-hidden="true" tabindex="-1"></a>quantity resistance <span class="op">=</span> <span class="dv">60</span> <span class="op">*</span> kΩ;</span>
<span id="cb114-2"><a href="#cb114-2" aria-hidden="true" tabindex="-1"></a>quantity capacitance <span class="op">=</span> <span class="dv">100</span> <span class="op">*</span> µF;</span></code></pre></div>

</div></td>
</tr>
</tbody>
</table>
<p>It is worth noting that not all such units may get Unicode
identifiers. Some of them do not have the XID_Start property. For
example:</p>
<ul>
<li>℃ (degree Celsius),</li>
<li>° (degree)</li>
<li>′ (minute)</li>
<li>″ (second)</li>
</ul>
<h1 data-number="15" id="text-output"><span class="header-section-number">15</span> Text output<a href="#text-output" class="self-link"></a></h1>
<p>A quantity value contains a numerical value and a unit. Both of them
may have various text representations. Not only numbers but also units
can be formatted in many different ways. Additionally, every dimension
can be represented as a text as well.</p>
<p>This chapter will discuss the different options we have here.</p>
<p><em>Note: For now, there is no standardized way to handle formatted
text input in the C++ standard library, so this paper does not propose
any approach to convert text to quantities. If <span class="citation" data-cites="P1729R3">[<a href="https://wg21.link/p1729r3" role="doc-biblioref">P1729R3</a>]</span> will be accepted by the LEWG,
then we will add a proper “Text input” chapter as well.</em></p>
<h2 data-number="15.1" id="symbols"><span class="header-section-number">15.1</span> Symbols<a href="#symbols" class="self-link"></a></h2>
<p>The definitions of dimensions, units, prefixes, and constants require
unique text symbols to be assigned for each entity. Those symbols can be
composed to express dimensions and units of base and derived
quantities.</p>
<h3 data-number="15.1.1" id="symbol-definition-examples"><span class="header-section-number">15.1.1</span> Symbol definition examples<a href="#symbol-definition-examples" class="self-link"></a></h3>
<p><em>Note: The below code examples are based on the latest version of
the <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> library and might not be the
final version proposed for standardization.</em></p>
<p>Dimensions:</p>
<div class="sourceCode" id="cb115"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb115-1"><a href="#cb115-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> dim_length <span class="kw">final</span> <span class="op">:</span> base_dimension<span class="op">&lt;</span><span class="st">&quot;L&quot;</span><span class="op">&gt;</span> <span class="op">{}</span> dim_length;</span>
<span id="cb115-2"><a href="#cb115-2" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> dim_mass <span class="kw">final</span> <span class="op">:</span> base_dimension<span class="op">&lt;</span><span class="st">&quot;M&quot;</span><span class="op">&gt;</span> <span class="op">{}</span> dim_mass;</span>
<span id="cb115-3"><a href="#cb115-3" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> dim_time <span class="kw">final</span> <span class="op">:</span> base_dimension<span class="op">&lt;</span><span class="st">&quot;T&quot;</span><span class="op">&gt;</span> <span class="op">{}</span> dim_time;</span>
<span id="cb115-4"><a href="#cb115-4" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> dim_electric_current <span class="kw">final</span> <span class="op">:</span> base_dimension<span class="op">&lt;</span><span class="st">&quot;I&quot;</span><span class="op">&gt;</span> <span class="op">{}</span> dim_electric_current;</span>
<span id="cb115-5"><a href="#cb115-5" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> dim_thermodynamic_temperature <span class="kw">final</span> <span class="op">:</span> base_dimension<span class="op">&lt;{</span><span class="st">u8&quot;Θ&quot;</span>, <span class="st">&quot;O&quot;</span><span class="op">}&gt;</span> <span class="op">{}</span> dim_thermodynamic_temperature;</span>
<span id="cb115-6"><a href="#cb115-6" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> dim_amount_of_substance <span class="kw">final</span> <span class="op">:</span> base_dimension<span class="op">&lt;</span><span class="st">&quot;N&quot;</span><span class="op">&gt;</span> <span class="op">{}</span> dim_amount_of_substance;</span>
<span id="cb115-7"><a href="#cb115-7" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> dim_luminous_intensity <span class="kw">final</span> <span class="op">:</span> base_dimension<span class="op">&lt;</span><span class="st">&quot;J&quot;</span><span class="op">&gt;</span> <span class="op">{}</span> dim_luminous_intensity;</span></code></pre></div>
<p>Units:</p>
<div class="sourceCode" id="cb116"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb116-1"><a href="#cb116-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> second <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;s&quot;</span>, kind_of<span class="op">&lt;</span>isq<span class="op">::</span>time<span class="op">&gt;&gt;</span> <span class="op">{}</span> second;</span>
<span id="cb116-2"><a href="#cb116-2" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> metre <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;m&quot;</span>, kind_of<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">&gt;&gt;</span> <span class="op">{}</span> metre;</span>
<span id="cb116-3"><a href="#cb116-3" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> gram <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;g&quot;</span>, kind_of<span class="op">&lt;</span>isq<span class="op">::</span>mass<span class="op">&gt;&gt;</span> <span class="op">{}</span> gram;</span>
<span id="cb116-4"><a href="#cb116-4" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> kilogram <span class="op">=</span> kilo<span class="op">&lt;</span>gram<span class="op">&gt;</span>;</span>
<span id="cb116-5"><a href="#cb116-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb116-6"><a href="#cb116-6" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> newton <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;N&quot;</span>, kilogram <span class="op">*</span> metre <span class="op">/</span> square<span class="op">(</span>second<span class="op">)&gt;</span> <span class="op">{}</span> newton;</span>
<span id="cb116-7"><a href="#cb116-7" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> joule <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;J&quot;</span>, newton <span class="op">*</span> metre<span class="op">&gt;</span> <span class="op">{}</span> joule;</span>
<span id="cb116-8"><a href="#cb116-8" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> watt <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;W&quot;</span>, joule <span class="op">/</span> second<span class="op">&gt;</span> <span class="op">{}</span> watt;</span>
<span id="cb116-9"><a href="#cb116-9" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> coulomb <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;C&quot;</span>, ampere <span class="op">*</span> second<span class="op">&gt;</span> <span class="op">{}</span> coulomb;</span>
<span id="cb116-10"><a href="#cb116-10" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> volt <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;V&quot;</span>, watt <span class="op">/</span> ampere<span class="op">&gt;</span> <span class="op">{}</span> volt;</span>
<span id="cb116-11"><a href="#cb116-11" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> farad <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;F&quot;</span>, coulomb <span class="op">/</span> volt<span class="op">&gt;</span> <span class="op">{}</span> farad;</span>
<span id="cb116-12"><a href="#cb116-12" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> ohm <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;{</span><span class="st">u8&quot;Ω&quot;</span>, <span class="st">&quot;ohm&quot;</span><span class="op">}</span>, volt <span class="op">/</span> ampere<span class="op">&gt;</span> <span class="op">{}</span> ohm;</span></code></pre></div>
<p>Prefixes:</p>
<div class="sourceCode" id="cb117"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb117-1"><a href="#cb117-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>PrefixableUnit U<span class="op">&gt;</span> <span class="kw">struct</span> micro_ <span class="op">:</span> prefixed_unit<span class="op">&lt;{</span><span class="st">u8&quot;µ&quot;</span>, <span class="st">&quot;u&quot;</span><span class="op">}</span>, mag_power<span class="op">&lt;</span><span class="dv">10</span>, <span class="op">-</span><span class="dv">6</span><span class="op">&gt;</span>, U<span class="op">{}&gt;</span> <span class="op">{}</span>;</span>
<span id="cb117-2"><a href="#cb117-2" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>PrefixableUnit U<span class="op">&gt;</span> <span class="kw">struct</span> milli_ <span class="op">:</span> prefixed_unit<span class="op">&lt;</span><span class="st">&quot;m&quot;</span>, mag_power<span class="op">&lt;</span><span class="dv">10</span>, <span class="op">-</span><span class="dv">3</span><span class="op">&gt;</span>, U<span class="op">{}&gt;</span> <span class="op">{}</span>;</span>
<span id="cb117-3"><a href="#cb117-3" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>PrefixableUnit U<span class="op">&gt;</span> <span class="kw">struct</span> centi_ <span class="op">:</span> prefixed_unit<span class="op">&lt;</span><span class="st">&quot;c&quot;</span>, mag_power<span class="op">&lt;</span><span class="dv">10</span>, <span class="op">-</span><span class="dv">2</span><span class="op">&gt;</span>, U<span class="op">{}&gt;</span> <span class="op">{}</span>;</span>
<span id="cb117-4"><a href="#cb117-4" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>PrefixableUnit U<span class="op">&gt;</span> <span class="kw">struct</span> deci_  <span class="op">:</span> prefixed_unit<span class="op">&lt;</span><span class="st">&quot;d&quot;</span>, mag_power<span class="op">&lt;</span><span class="dv">10</span>, <span class="op">-</span><span class="dv">1</span><span class="op">&gt;</span>, U<span class="op">{}&gt;</span> <span class="op">{}</span>;</span>
<span id="cb117-5"><a href="#cb117-5" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>PrefixableUnit U<span class="op">&gt;</span> <span class="kw">struct</span> deca_  <span class="op">:</span> prefixed_unit<span class="op">&lt;</span><span class="st">&quot;da&quot;</span>, mag_power<span class="op">&lt;</span><span class="dv">10</span>, <span class="dv">1</span><span class="op">&gt;</span>, U<span class="op">{}&gt;</span> <span class="op">{}</span>;</span>
<span id="cb117-6"><a href="#cb117-6" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>PrefixableUnit U<span class="op">&gt;</span> <span class="kw">struct</span> hecto_ <span class="op">:</span> prefixed_unit<span class="op">&lt;</span><span class="st">&quot;h&quot;</span>, mag_power<span class="op">&lt;</span><span class="dv">10</span>, <span class="dv">2</span><span class="op">&gt;</span>, U<span class="op">{}&gt;</span> <span class="op">{}</span>;</span>
<span id="cb117-7"><a href="#cb117-7" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>PrefixableUnit U<span class="op">&gt;</span> <span class="kw">struct</span> kilo_  <span class="op">:</span> prefixed_unit<span class="op">&lt;</span><span class="st">&quot;k&quot;</span>, mag_power<span class="op">&lt;</span><span class="dv">10</span>, <span class="dv">3</span><span class="op">&gt;</span>, U<span class="op">{}&gt;</span> <span class="op">{}</span>;</span>
<span id="cb117-8"><a href="#cb117-8" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>PrefixableUnit U<span class="op">&gt;</span> <span class="kw">struct</span> mega_  <span class="op">:</span> prefixed_unit<span class="op">&lt;</span><span class="st">&quot;M&quot;</span>, mag_power<span class="op">&lt;</span><span class="dv">10</span>, <span class="dv">6</span><span class="op">&gt;</span>, U<span class="op">{}&gt;</span> <span class="op">{}</span>;</span></code></pre></div>
<p>Constants:</p>
<div class="sourceCode" id="cb118"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb118-1"><a href="#cb118-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> hyperfine_structure_transition_frequency_of_cs <span class="kw">final</span> <span class="op">:</span></span>
<span id="cb118-2"><a href="#cb118-2" aria-hidden="true" tabindex="-1"></a>  named_unit<span class="op">&lt;{</span><span class="st">u8&quot;Δν_Cs&quot;</span>, <span class="st">&quot;dv_Cs&quot;</span><span class="op">}</span>, mag<span class="op">&lt;</span><span class="dv">9&#39;192&#39;631&#39;770</span><span class="op">&gt;</span> <span class="op">*</span> hertz<span class="op">&gt;</span> <span class="op">{}</span> hyperfine_structure_transition_frequency_of_cs;</span>
<span id="cb118-3"><a href="#cb118-3" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> speed_of_light_in_vacuum <span class="kw">final</span> <span class="op">:</span></span>
<span id="cb118-4"><a href="#cb118-4" aria-hidden="true" tabindex="-1"></a>  named_unit<span class="op">&lt;</span><span class="st">&quot;c&quot;</span>, mag<span class="op">&lt;</span><span class="dv">299&#39;792&#39;458</span><span class="op">&gt;</span> <span class="op">*</span> metre <span class="op">/</span> second<span class="op">&gt;</span> <span class="op">{}</span> speed_of_light_in_vacuum;</span>
<span id="cb118-5"><a href="#cb118-5" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> planck_constant <span class="kw">final</span> <span class="op">:</span></span>
<span id="cb118-6"><a href="#cb118-6" aria-hidden="true" tabindex="-1"></a>  named_unit<span class="op">&lt;</span><span class="st">&quot;h&quot;</span>, mag_ratio<span class="op">&lt;</span><span class="dv">662&#39;607&#39;015</span>, <span class="dv">100&#39;000&#39;000</span><span class="op">&gt;</span> <span class="op">*</span> mag_power<span class="op">&lt;</span><span class="dv">10</span>, <span class="op">-</span><span class="dv">34</span><span class="op">&gt;</span> <span class="op">*</span> joule <span class="op">*</span> second<span class="op">&gt;</span> <span class="op">{}</span> planck_constant;</span>
<span id="cb118-7"><a href="#cb118-7" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> elementary_charge <span class="kw">final</span> <span class="op">:</span></span>
<span id="cb118-8"><a href="#cb118-8" aria-hidden="true" tabindex="-1"></a>  named_unit<span class="op">&lt;</span><span class="st">&quot;e&quot;</span>, mag_ratio<span class="op">&lt;</span><span class="dv">1&#39;602&#39;176&#39;634</span>, <span class="dv">1&#39;000&#39;000&#39;000</span><span class="op">&gt;</span> <span class="op">*</span> mag_power<span class="op">&lt;</span><span class="dv">10</span>, <span class="op">-</span><span class="dv">19</span><span class="op">&gt;</span> <span class="op">*</span> coulomb<span class="op">&gt;</span> <span class="op">{}</span> elementary_charge;</span>
<span id="cb118-9"><a href="#cb118-9" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> boltzmann_constant <span class="kw">final</span> <span class="op">:</span></span>
<span id="cb118-10"><a href="#cb118-10" aria-hidden="true" tabindex="-1"></a>  named_unit<span class="op">&lt;</span><span class="st">&quot;k&quot;</span>, mag_ratio<span class="op">&lt;</span><span class="dv">1&#39;380&#39;649</span>, <span class="dv">1&#39;000&#39;000</span><span class="op">&gt;</span> <span class="op">*</span> mag_power<span class="op">&lt;</span><span class="dv">10</span>, <span class="op">-</span><span class="dv">23</span><span class="op">&gt;</span> <span class="op">*</span> joule <span class="op">/</span> kelvin<span class="op">&gt;</span> <span class="op">{}</span> boltzmann_constant;</span>
<span id="cb118-11"><a href="#cb118-11" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> avogadro_constant <span class="kw">final</span> <span class="op">:</span></span>
<span id="cb118-12"><a href="#cb118-12" aria-hidden="true" tabindex="-1"></a>  named_unit<span class="op">&lt;</span><span class="st">&quot;N_A&quot;</span>, mag_ratio<span class="op">&lt;</span><span class="dv">602&#39;214&#39;076</span>, <span class="dv">100&#39;000&#39;000</span><span class="op">&gt;</span> <span class="op">*</span> mag_power<span class="op">&lt;</span><span class="dv">10</span>, <span class="dv">23</span><span class="op">&gt;</span> <span class="op">/</span> mole<span class="op">&gt;</span> <span class="op">{}</span> avogadro_constant;</span>
<span id="cb118-13"><a href="#cb118-13" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> luminous_efficacy <span class="kw">final</span> <span class="op">:</span></span>
<span id="cb118-14"><a href="#cb118-14" aria-hidden="true" tabindex="-1"></a>  named_unit<span class="op">&lt;</span><span class="st">&quot;K_cd&quot;</span>, mag<span class="op">&lt;</span><span class="dv">683</span><span class="op">&gt;</span> <span class="op">*</span> lumen <span class="op">/</span> watt<span class="op">&gt;</span> <span class="op">{}</span> luminous_efficacy;</span></code></pre></div>
<p><em>Note: Two symbols always have to be provided if the primary
symbol contains characters outside of the <a href="https://en.cppreference.com/w/cpp/language/charset">basic literal
character set</a>. The first must be provided as a UTF-8 literal and may
contain any Unicode characters. The second one must provide an
alternative spelling and only use characters from within of <a href="https://en.cppreference.com/w/cpp/language/charset">basic literal
character set</a>.</em></p>
<h3 data-number="15.1.2" id="lack-of-unicode-subscript-characters"><span class="header-section-number">15.1.2</span> Lack of Unicode subscript
characters<a href="#lack-of-unicode-subscript-characters" class="self-link"></a></h3>
<p>Unicode provides only a minimal set of characters available as
subscripts, which are often used to differentiate various constants and
quantities of the same kind. To workaround this issue, <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> uses ’_’ character to specify
that the following characters should be considered a subscript of the
symbol.</p>
<h3 data-number="15.1.3" id="symbols-for-quantity-types"><span class="header-section-number">15.1.3</span> Symbols for quantity types<a href="#symbols-for-quantity-types" class="self-link"></a></h3>
<p>Although the ISQ defined in <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> provides symbols for each
quantity type, there is little use for them in the C++ code. In the
<span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> project, we never had a
request to provide such symbol definitions. Even though having them for
completeness could be nice, they seem to not be required by the domain
experts for their daily jobs. Also, it is worth noting that providing
those raises some additional standardization and implementation
challenges.</p>
<p>If we decide to provide symbols, the rest of this chapter provides
the domain information to assess the complexity and potential issues
with standardization and implementation of those.</p>
<p>All ISQ quantities have an official symbol assigned in their
definitions, and how those should be printed is exactly specified. <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> explicitly states:</p>
<blockquote>
<p>The quantity symbols shall be written in italic (sloping) type,
irrespective of the type used in the rest of the text.</p>
</blockquote>
<p>Additionally, <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> provides additional
requirements for printing quantities of vector and tensor
characters:</p>
<ul>
<li>vectors should be printed with a boldface type or have a right arrow
above the letter symbol (e.g., <strong><em>a</em></strong> or <span class="math inline">\(\mathit{\overrightarrow{a}}\)</span>),</li>
<li>tensors should use either boldface sans serif type or have two
arrows above the letter symbol (e.g., <strong><em>T</em></strong> or
<span class="math inline">\(\overrightarrow{\overrightarrow{T}}\)</span>).</li>
</ul>
<p><em>Note: In the above examples, the second symbol with arrows above
should also use letters written in italics. The author could not find a
way to format it properly in this document.</em></p>
<p>There are also a few requirements for printing subscripts of quantity
types. <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> states:</p>
<blockquote>
<p>The following principles for the printing of subscripts apply:</p>
<ul>
<li>A subscript that represents a physical quantity or a mathematical
variable, such as a running number, is printed in italic (sloping)
type.</li>
<li>Other subscripts, such as those representing words or fixed numbers,
are printed in roman (upright) type.</li>
</ul>
</blockquote>
<p>It is worth noting that only a limited set of Unicode characters are
available as subscripts. Those are often used to differentiate various
quantities of the same kind.</p>
<p>For example, it is impossible to encode the symbols of the following
quantities:</p>
<ul>
<li><em>c</em><sub>sat</sub> - <em>specific heat capacity at saturated
vapour pressure</em>,</li>
<li><em>μ</em><sub>JT</sub> - <em>Joule-Thomson coefficient</em>,</li>
<li><em>w</em><sub>H<sub>2</sub>O</sub> - <em>mass fraction of
water</em>,</li>
<li><em>σ</em><sub>Ω,E</sub> - <em>direction and energy distribution of
cross section</em>,</li>
<li><em>d</em><sub>1/2</sub> - <em>half-value thickness</em>,</li>
<li><em>Φ</em><sub>e,λ</sub> - <em>spectral radiant flux</em>.</li>
</ul>
<p>It is important to state that the same issues are related to constant
definitions. For them, in the <a href="#symbol-definition-examples">Symbol definition examples</a>
chapter, we proposed to use the ’_’ character instead, as stated in <a href="#lack-of-unicode-subscript-characters">Lack of Unicode subscript
characters</a>. We could use the same practice here.</p>
<p>Another challenge here might be related to the fact that <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> often provides more than
one symbol for the same quantity. For example:</p>
<ul>
<li><em>frequency</em> can use <em>f</em> or <em>ν</em>,</li>
<li><em>time constant</em> can use <em>τ</em> or <em>T</em> (<em>T</em>
is also the only symbol provided for the <em>period duration</em>
quantity),</li>
<li><em>thickness</em> can use <em>d</em> or <em>δ</em>,</li>
<li><em>diameter</em> can use <em>d</em> or <em>D</em> (which again
conflicts with the <em>diameter</em> symbol).</li>
</ul>
<p>Last but not least, it is worth noting that symbols of ISQ base
quantities are not necessary the same as official dimension symbols of
those quantities:</p>
<table>
<colgroup>
<col style="width: 40%" />
<col style="width: 33%" />
<col style="width: 25%" />
</colgroup>
<thead>
<tr class="header">
<th><div style="text-align:center">
<strong>Quantity type</strong>
</div></th>
<th style="text-align: center;"><div style="text-align:center">
<strong>Quantity type symbol</strong>
</div></th>
<th style="text-align: center;"><div style="text-align:center">
<strong>Dimension symbol</strong>
</div></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><em>length</em></td>
<td style="text-align: center;"><em>l</em>, <em>L</em></td>
<td style="text-align: center;">L</td>
</tr>
<tr class="even">
<td><em>mass</em></td>
<td style="text-align: center;"><em>m</em></td>
<td style="text-align: center;">M</td>
</tr>
<tr class="odd">
<td><em>time</em></td>
<td style="text-align: center;"><em>t</em></td>
<td style="text-align: center;">T</td>
</tr>
<tr class="even">
<td><em>electric current</em></td>
<td style="text-align: center;"><em>I</em>, <em>i</em></td>
<td style="text-align: center;">I</td>
</tr>
<tr class="odd">
<td><em>thermodynamic temperature</em></td>
<td style="text-align: center;"><em>T</em>, <em>Θ</em></td>
<td style="text-align: center;">Θ</td>
</tr>
<tr class="even">
<td><em>amount of substance</em></td>
<td style="text-align: center;"><em>n</em>(X)</td>
<td style="text-align: center;">N</td>
</tr>
<tr class="odd">
<td><em>luminous intensity</em></td>
<td style="text-align: center;"><em>I</em><sub>v</sub>,
(<em>I</em>)</td>
<td style="text-align: center;">J</td>
</tr>
</tbody>
</table>
<p>Founding a way to define, use, and print named quantity types is not
enough. What should also be covered here is the text output of derived
quantities. There are plenty of operations that one might do on scalar,
vector, and tensor quantities, and all of them result in another
quantity type, which should also be able to be printed in the console
text output.</p>
<p>Taking all the challenges and issues mentioned above, we do not
propose providing quantity type symbols in their definitions and any
text input/output support for those.</p>
<h3 data-number="15.1.4" id="fixed_string"><span class="header-section-number">15.1.4</span>
<code class="sourceCode cpp">fixed_string</code><a href="#fixed_string" class="self-link"></a></h3>
<p>As shown above, symbols are provided as class NTTPs in the library.
This means that the string type used for such a purpose has to satisfy
the structural type requirements of the C++ language. One of such
requirements is to expose all the data members publicly. So far, none of
the existing string types in the C++ standard library satisfies such
requirements. This is why we need to introduce a new type.</p>
<p>Such type should:</p>
<ul>
<li>satisfy structural type requirements,</li>
<li>be equality comparable and potentially totally ordered,</li>
<li>store and provide concatenation support for zero-ended strings,</li>
<li>provide storage that, if set at compile time, would also be
available for read-only access at runtime,</li>
<li>provide at least read-only access to the contained storage.</li>
</ul>
<p>Such a type does not need to expose a string-like interface. In case
its interface is immutable, we can easily wrap it with <code class="sourceCode cpp">std<span class="op">::</span>string_view</code>
to get such an interface for free.</p>
<p>This type is being proposed separately in <span class="citation" data-cites="P3094R0">[<a href="https://wg21.link/p3094r0" role="doc-biblioref">P3094R0</a>]</span>.</p>
<h3 data-number="15.1.5" id="symbol_text"><span class="header-section-number">15.1.5</span>
<code class="sourceCode cpp">symbol_text</code><a href="#symbol_text" class="self-link"></a></h3>
<p>Many symbols of units, prefixes, and constants require using a
Unicode character set. For example:</p>
<ul>
<li>Θ - thermodynamic temperature dimension</li>
<li>µ - micro</li>
<li>Ω - ohm</li>
<li>℃ - degree Celsius</li>
<li>℉ - degree Fahrenheit</li>
<li>° - degree</li>
<li>′ - arcminute</li>
<li>″ - arcsecond</li>
<li>ᵍ - gradian</li>
<li>Å - angstrom</li>
<li>M_☉ - solar mass</li>
<li>Δν_Cs - hyperfine structure transition frequency of Cs</li>
<li>g₀ - standard gravity</li>
<li>μ₀ - magnetic constant</li>
<li>c₀ - speed of light</li>
<li>H₀ - hubble constant</li>
</ul>
<p>The library should provide such Unicode output by default to be
consistent with official systems’ specifications.</p>
<p>On the other hand, plenty of terminals do not support Unicode
characters. Also, general engineering experience shows that people often
prefer to work with a basic literal character set. This is why all such
entities should provide an alternative spelling in their
definitions.</p>
<p>This is where <code class="sourceCode cpp">symbol_text</code> comes
into play. It is a simple wrapper over the two
<code class="sourceCode cpp">fixed_string</code> objects:</p>
<div class="sourceCode" id="cb119"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb119-1"><a href="#cb119-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>std<span class="op">::</span><span class="dt">size_t</span> N, std<span class="op">::</span><span class="dt">size_t</span> M<span class="op">&gt;</span></span>
<span id="cb119-2"><a href="#cb119-2" aria-hidden="true" tabindex="-1"></a><span class="kw">class</span> symbol_text <span class="op">{</span></span>
<span id="cb119-3"><a href="#cb119-3" aria-hidden="true" tabindex="-1"></a><span class="kw">public</span><span class="op">:</span></span>
<span id="cb119-4"><a href="#cb119-4" aria-hidden="true" tabindex="-1"></a>  fixed_u8string<span class="op">&lt;</span>N<span class="op">&gt;</span> utf8_;  <span class="co">// exposition only</span></span>
<span id="cb119-5"><a href="#cb119-5" aria-hidden="true" tabindex="-1"></a>  fixed_string<span class="op">&lt;</span>M<span class="op">&gt;</span> portable;      <span class="co">// exposition only</span></span>
<span id="cb119-6"><a href="#cb119-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb119-7"><a href="#cb119-7" aria-hidden="true" tabindex="-1"></a>  <span class="kw">constexpr</span> <span class="kw">explicit</span><span class="op">(</span><span class="kw">false</span><span class="op">)</span> symbol_text<span class="op">(</span><span class="dt">char</span> ch<span class="op">)</span>;</span>
<span id="cb119-8"><a href="#cb119-8" aria-hidden="true" tabindex="-1"></a>  <span class="kw">consteval</span> <span class="kw">explicit</span><span class="op">(</span><span class="kw">false</span><span class="op">)</span> symbol_text<span class="op">(</span><span class="kw">const</span> <span class="dt">char</span> <span class="op">(&amp;</span>txt<span class="op">)[</span>N <span class="op">+</span> <span class="dv">1</span><span class="op">])</span>;</span>
<span id="cb119-9"><a href="#cb119-9" aria-hidden="true" tabindex="-1"></a>  <span class="kw">constexpr</span> <span class="kw">explicit</span><span class="op">(</span><span class="kw">false</span><span class="op">)</span> symbol_text<span class="op">(</span><span class="kw">const</span> fixed_string<span class="op">&lt;</span>N<span class="op">&gt;&amp;</span> txt<span class="op">)</span>;</span>
<span id="cb119-10"><a href="#cb119-10" aria-hidden="true" tabindex="-1"></a>  <span class="kw">consteval</span> symbol_text<span class="op">(</span><span class="kw">const</span> <span class="dt">char8_t</span> <span class="op">(&amp;</span>u<span class="op">)[</span>N <span class="op">+</span> <span class="dv">1</span><span class="op">]</span>, <span class="kw">const</span> <span class="dt">char</span> <span class="op">(&amp;</span>a<span class="op">)[</span>M <span class="op">+</span> <span class="dv">1</span><span class="op">])</span>;</span>
<span id="cb119-11"><a href="#cb119-11" aria-hidden="true" tabindex="-1"></a>  <span class="kw">constexpr</span> symbol_text<span class="op">(</span><span class="kw">const</span> fixed_u8string<span class="op">&lt;</span>N<span class="op">&gt;&amp;</span> u, <span class="kw">const</span> fixed_string<span class="op">&lt;</span>M<span class="op">&gt;&amp;</span> a<span class="op">)</span>;</span>
<span id="cb119-12"><a href="#cb119-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb119-13"><a href="#cb119-13" aria-hidden="true" tabindex="-1"></a>  <span class="kw">constexpr</span> <span class="kw">const</span> <span class="kw">auto</span><span class="op">&amp;</span> utf8<span class="op">()</span> <span class="kw">const</span>;</span>
<span id="cb119-14"><a href="#cb119-14" aria-hidden="true" tabindex="-1"></a>  <span class="kw">constexpr</span> <span class="kw">const</span> <span class="kw">auto</span><span class="op">&amp;</span> portable<span class="op">()</span> <span class="kw">const</span>;</span>
<span id="cb119-15"><a href="#cb119-15" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb119-16"><a href="#cb119-16" aria-hidden="true" tabindex="-1"></a>  <span class="kw">constexpr</span> <span class="dt">bool</span> empty<span class="op">()</span> <span class="kw">const</span>;</span>
<span id="cb119-17"><a href="#cb119-17" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb119-18"><a href="#cb119-18" aria-hidden="true" tabindex="-1"></a>  <span class="kw">template</span><span class="op">&lt;</span>std<span class="op">::</span><span class="dt">size_t</span> N2, std<span class="op">::</span><span class="dt">size_t</span> M2<span class="op">&gt;</span></span>
<span id="cb119-19"><a href="#cb119-19" aria-hidden="true" tabindex="-1"></a>  <span class="kw">constexpr</span> <span class="kw">friend</span> symbol_text<span class="op">&lt;</span>N <span class="op">+</span> N2, M <span class="op">+</span> M2<span class="op">&gt;</span> <span class="kw">operator</span><span class="op">+(</span><span class="kw">const</span> symbol_text<span class="op">&amp;</span> lhs, <span class="kw">const</span> symbol_text<span class="op">&lt;</span>N2, M2<span class="op">&gt;&amp;</span> rhs<span class="op">)</span>;</span>
<span id="cb119-20"><a href="#cb119-20" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb119-21"><a href="#cb119-21" aria-hidden="true" tabindex="-1"></a>  <span class="kw">template</span><span class="op">&lt;</span>std<span class="op">::</span><span class="dt">size_t</span> N2, std<span class="op">::</span><span class="dt">size_t</span> M2<span class="op">&gt;</span></span>
<span id="cb119-22"><a href="#cb119-22" aria-hidden="true" tabindex="-1"></a>  <span class="kw">friend</span> <span class="kw">constexpr</span> <span class="kw">auto</span> <span class="kw">operator</span><span class="op">&lt;=&gt;(</span><span class="kw">const</span> symbol_text<span class="op">&amp;</span> lhs, <span class="kw">const</span> symbol_text<span class="op">&lt;</span>N2, M2<span class="op">&gt;&amp;</span> rhs<span class="op">)</span> <span class="kw">noexcept</span>;</span>
<span id="cb119-23"><a href="#cb119-23" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb119-24"><a href="#cb119-24" aria-hidden="true" tabindex="-1"></a>  <span class="kw">template</span><span class="op">&lt;</span>std<span class="op">::</span><span class="dt">size_t</span> N2, std<span class="op">::</span><span class="dt">size_t</span> M2<span class="op">&gt;</span></span>
<span id="cb119-25"><a href="#cb119-25" aria-hidden="true" tabindex="-1"></a>  <span class="kw">friend</span> <span class="kw">constexpr</span> <span class="dt">bool</span> <span class="kw">operator</span><span class="op">==(</span><span class="kw">const</span> symbol_text<span class="op">&amp;</span> lhs, <span class="kw">const</span> symbol_text<span class="op">&lt;</span>N2, M2<span class="op">&gt;&amp;</span> rhs<span class="op">)</span> <span class="kw">noexcept</span>;</span>
<span id="cb119-26"><a href="#cb119-26" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span>
<span id="cb119-27"><a href="#cb119-27" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb119-28"><a href="#cb119-28" aria-hidden="true" tabindex="-1"></a>symbol_text<span class="op">(</span><span class="dt">char</span><span class="op">)</span> <span class="op">-&gt;</span> symbol_text<span class="op">&lt;</span><span class="dv">1</span>, <span class="dv">1</span><span class="op">&gt;</span>;</span>
<span id="cb119-29"><a href="#cb119-29" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb119-30"><a href="#cb119-30" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>std<span class="op">::</span><span class="dt">size_t</span> N<span class="op">&gt;</span></span>
<span id="cb119-31"><a href="#cb119-31" aria-hidden="true" tabindex="-1"></a>symbol_text<span class="op">(</span><span class="kw">const</span> <span class="dt">char</span> <span class="op">(&amp;)[</span>N<span class="op">])</span> <span class="op">-&gt;</span> symbol_text<span class="op">&lt;</span>N <span class="op">-</span> <span class="dv">1</span>, N <span class="op">-</span> <span class="dv">1</span><span class="op">&gt;</span>;</span>
<span id="cb119-32"><a href="#cb119-32" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb119-33"><a href="#cb119-33" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>std<span class="op">::</span><span class="dt">size_t</span> N<span class="op">&gt;</span></span>
<span id="cb119-34"><a href="#cb119-34" aria-hidden="true" tabindex="-1"></a>symbol_text<span class="op">(</span><span class="kw">const</span> fixed_string<span class="op">&lt;</span>N<span class="op">&gt;&amp;)</span> <span class="op">-&gt;</span> symbol_text<span class="op">&lt;</span>N, N<span class="op">&gt;</span>;</span>
<span id="cb119-35"><a href="#cb119-35" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb119-36"><a href="#cb119-36" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>std<span class="op">::</span><span class="dt">size_t</span> N, std<span class="op">::</span><span class="dt">size_t</span> M<span class="op">&gt;</span></span>
<span id="cb119-37"><a href="#cb119-37" aria-hidden="true" tabindex="-1"></a>symbol_text<span class="op">(</span><span class="kw">const</span> <span class="dt">char8_t</span> <span class="op">(&amp;)[</span>N<span class="op">]</span>, <span class="kw">const</span> <span class="dt">char</span> <span class="op">(&amp;)[</span>M<span class="op">])</span> <span class="op">-&gt;</span> symbol_text<span class="op">&lt;</span>N <span class="op">-</span> <span class="dv">1</span>, M <span class="op">-</span> <span class="dv">1</span><span class="op">&gt;</span>;</span>
<span id="cb119-38"><a href="#cb119-38" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb119-39"><a href="#cb119-39" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>std<span class="op">::</span><span class="dt">size_t</span> N, std<span class="op">::</span><span class="dt">size_t</span> M<span class="op">&gt;</span></span>
<span id="cb119-40"><a href="#cb119-40" aria-hidden="true" tabindex="-1"></a>symbol_text<span class="op">(</span><span class="kw">const</span> fixed_u8string<span class="op">&lt;</span>N<span class="op">&gt;&amp;</span>, <span class="kw">const</span> fixed_string<span class="op">&lt;</span>M<span class="op">&gt;&amp;)</span> <span class="op">-&gt;</span> symbol_text<span class="op">&lt;</span>N, M<span class="op">&gt;</span>;</span></code></pre></div>
<h3 data-number="15.1.6" id="symbols-for-derived-entities"><span class="header-section-number">15.1.6</span> Symbols for derived
entities<a href="#symbols-for-derived-entities" class="self-link"></a></h3>
<h4 data-number="15.1.6.1" id="text_encoding"><span class="header-section-number">15.1.6.1</span>
<code class="sourceCode cpp">text_encoding</code><a href="#text_encoding" class="self-link"></a></h4>
<p>ISQ and <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span> standards always specify symbols
using Unicode encoding. This is why it is a default and primary target
for text output. However, in some applications or environments, a
standard portable text output using only the characters from the <a href="https://en.cppreference.com/w/cpp/language/charset">basic literal
character set</a> can be preferred by users.</p>
<p>This is why the library provides an option to change the default
encoding to the portable one with:</p>
<div class="sourceCode" id="cb120"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb120-1"><a href="#cb120-1" aria-hidden="true" tabindex="-1"></a><span class="kw">enum</span> <span class="kw">class</span> text_encoding <span class="op">:</span> std<span class="op">::</span><span class="dt">int8_t</span> <span class="op">{</span></span>
<span id="cb120-2"><a href="#cb120-2" aria-hidden="true" tabindex="-1"></a>  utf8,        <span class="co">// µs; m³;  L²MT⁻³</span></span>
<span id="cb120-3"><a href="#cb120-3" aria-hidden="true" tabindex="-1"></a>  portable,    <span class="co">// us; m^3; L^2MT^-3</span></span>
<span id="cb120-4"><a href="#cb120-4" aria-hidden="true" tabindex="-1"></a>  default_encoding <span class="op">=</span> utf8</span>
<span id="cb120-5"><a href="#cb120-5" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span></code></pre></div>
<h4 data-number="15.1.6.2" id="symbols-of-derived-dimensions"><span class="header-section-number">15.1.6.2</span> Symbols of derived
dimensions<a href="#symbols-of-derived-dimensions" class="self-link"></a></h4>
<h5 data-number="15.1.6.2.1" id="dimension_symbol_formatting"><span class="header-section-number">15.1.6.2.1</span>
<code class="sourceCode cpp">dimension_symbol_formatting</code><a href="#dimension_symbol_formatting" class="self-link"></a></h5>
<p><code class="sourceCode cpp">dimension_symbol_formatting</code> is a
data type describing the configuration of the symbol generation
algorithm.</p>
<div class="sourceCode" id="cb121"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb121-1"><a href="#cb121-1" aria-hidden="true" tabindex="-1"></a><span class="kw">struct</span> dimension_symbol_formatting <span class="op">{</span></span>
<span id="cb121-2"><a href="#cb121-2" aria-hidden="true" tabindex="-1"></a>  text_encoding encoding <span class="op">=</span> text_encoding<span class="op">::</span>default_encoding;</span>
<span id="cb121-3"><a href="#cb121-3" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span></code></pre></div>
<h5 data-number="15.1.6.2.2" id="dimension_symbol"><span class="header-section-number">15.1.6.2.2</span> <code class="sourceCode cpp">dimension_symbol<span class="op">()</span></code><a href="#dimension_symbol" class="self-link"></a></h5>
<p>Returns a <code class="sourceCode cpp">std<span class="op">::</span>string_view</code>
with the symbol of a dimension for the provided configuration:</p>
<div class="sourceCode" id="cb122"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb122-1"><a href="#cb122-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>dimension_symbol_formatting fmt <span class="op">=</span> dimension_symbol_formatting<span class="op">{}</span>, <span class="kw">typename</span> CharT <span class="op">=</span> <span class="dt">char</span>, Dimension D<span class="op">&gt;</span></span>
<span id="cb122-2"><a href="#cb122-2" aria-hidden="true" tabindex="-1"></a><span class="kw">consteval</span> std<span class="op">::</span>string_view dimension_symbol<span class="op">(</span>D<span class="op">)</span>;</span></code></pre></div>
<p><em>Note: It could be refactored to <code class="sourceCode cpp">dimension_symbol<span class="op">(</span>D, fmt<span class="op">)</span></code>
when <span class="citation" data-cites="P1045R1">[<a href="https://wg21.link/p1045r1" role="doc-biblioref">P1045R1</a>]</span> is available.</em></p>
<p>For example:</p>
<div class="sourceCode" id="cb123"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb123-1"><a href="#cb123-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>dimension_symbol<span class="op">&lt;{.</span>encoding <span class="op">=</span> text_encoding<span class="op">::</span>portable<span class="op">}&gt;(</span>isq<span class="op">::</span>power<span class="op">.</span>dimension<span class="op">)</span> <span class="op">==</span> <span class="st">&quot;L^2MT^-3&quot;</span><span class="op">)</span>;</span></code></pre></div>
<h5 data-number="15.1.6.2.3" id="dimension_symbol_to"><span class="header-section-number">15.1.6.2.3</span> <code class="sourceCode cpp">dimension_symbol_to<span class="op">()</span></code><a href="#dimension_symbol_to" class="self-link"></a></h5>
<p>Inserts the generated dimension symbol into the output text iterator
at runtime.</p>
<div class="sourceCode" id="cb124"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb124-1"><a href="#cb124-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span><span class="kw">typename</span> CharT <span class="op">=</span> <span class="dt">char</span>, std<span class="op">::</span>output_iterator<span class="op">&lt;</span>CharT<span class="op">&gt;</span> Out, Dimension D<span class="op">&gt;</span></span>
<span id="cb124-2"><a href="#cb124-2" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> Out dimension_symbol_to<span class="op">(</span>Out out, D d, dimension_symbol_formatting fmt <span class="op">=</span> dimension_symbol_formatting<span class="op">{})</span>;</span></code></pre></div>
<p>For example:</p>
<div class="sourceCode" id="cb125"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb125-1"><a href="#cb125-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>string txt;</span>
<span id="cb125-2"><a href="#cb125-2" aria-hidden="true" tabindex="-1"></a>dimension_symbol_to<span class="op">(</span>std<span class="op">::</span>back_inserter<span class="op">(</span>txt<span class="op">)</span>, isq<span class="op">::</span>power<span class="op">.</span>dimension, <span class="op">{.</span>encoding <span class="op">=</span> text_encoding<span class="op">::</span>portable<span class="op">})</span>;</span>
<span id="cb125-3"><a href="#cb125-3" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> txt <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span></code></pre></div>
<p>The above prints:</p>
<pre class="text"><code>L^2MT^-3</code></pre>
<h4 data-number="15.1.6.3" id="symbols-of-derived-units"><span class="header-section-number">15.1.6.3</span> Symbols of derived units<a href="#symbols-of-derived-units" class="self-link"></a></h4>
<h5 data-number="15.1.6.3.1" id="unit_symbol_formatting"><span class="header-section-number">15.1.6.3.1</span>
<code class="sourceCode cpp">unit_symbol_formatting</code><a href="#unit_symbol_formatting" class="self-link"></a></h5>
<p><code class="sourceCode cpp">unit_symbol_formatting</code> is a data
type describing the configuration of the symbol generation algorithm. It
contains three orthogonal fields, each with a default value.</p>
<div class="sourceCode" id="cb126"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb126-1"><a href="#cb126-1" aria-hidden="true" tabindex="-1"></a><span class="kw">enum</span> <span class="kw">class</span> unit_symbol_solidus <span class="op">:</span> std<span class="op">::</span><span class="dt">int8_t</span> <span class="op">{</span></span>
<span id="cb126-2"><a href="#cb126-2" aria-hidden="true" tabindex="-1"></a>  one_denominator,  <span class="co">// m/s;   kg m⁻¹ s⁻¹</span></span>
<span id="cb126-3"><a href="#cb126-3" aria-hidden="true" tabindex="-1"></a>  always,           <span class="co">// m/s;   kg/(m s)</span></span>
<span id="cb126-4"><a href="#cb126-4" aria-hidden="true" tabindex="-1"></a>  never,            <span class="co">// m s⁻¹; kg m⁻¹ s⁻¹</span></span>
<span id="cb126-5"><a href="#cb126-5" aria-hidden="true" tabindex="-1"></a>  default_denominator <span class="op">=</span> one_denominator</span>
<span id="cb126-6"><a href="#cb126-6" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span>
<span id="cb126-7"><a href="#cb126-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb126-8"><a href="#cb126-8" aria-hidden="true" tabindex="-1"></a><span class="kw">enum</span> <span class="kw">class</span> unit_symbol_separator <span class="op">:</span> std<span class="op">::</span><span class="dt">int8_t</span> <span class="op">{</span></span>
<span id="cb126-9"><a href="#cb126-9" aria-hidden="true" tabindex="-1"></a>  space,          <span class="co">// kg m²/s²</span></span>
<span id="cb126-10"><a href="#cb126-10" aria-hidden="true" tabindex="-1"></a>  half_high_dot,  <span class="co">// kg⋅m²/s²  (valid only for Unicode encoding)</span></span>
<span id="cb126-11"><a href="#cb126-11" aria-hidden="true" tabindex="-1"></a>  default_separator <span class="op">=</span> space</span>
<span id="cb126-12"><a href="#cb126-12" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span>
<span id="cb126-13"><a href="#cb126-13" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb126-14"><a href="#cb126-14" aria-hidden="true" tabindex="-1"></a><span class="kw">struct</span> unit_symbol_formatting <span class="op">{</span></span>
<span id="cb126-15"><a href="#cb126-15" aria-hidden="true" tabindex="-1"></a>  text_encoding encoding <span class="op">=</span> text_encoding<span class="op">::</span>default_encoding;</span>
<span id="cb126-16"><a href="#cb126-16" aria-hidden="true" tabindex="-1"></a>  unit_symbol_solidus solidus <span class="op">=</span> unit_symbol_solidus<span class="op">::</span>default_denominator;</span>
<span id="cb126-17"><a href="#cb126-17" aria-hidden="true" tabindex="-1"></a>  unit_symbol_separator separator <span class="op">=</span> unit_symbol_separator<span class="op">::</span>default_separator;</span>
<span id="cb126-18"><a href="#cb126-18" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span></code></pre></div>
<p><code class="sourceCode cpp">unit_symbol_solidus</code> impacts how
the division of unit symbols is being presented in the text output. By
default, the ‘/’ will be printed if only one unit component is in the
denominator. Otherwise, the exponent syntax will be used.</p>
<p><code class="sourceCode cpp">unit_symbol_separator</code> specifies
how multiple multiplied units should be separated from each other. By
default, the space (’ ’) will be used as a separator.</p>
<h5 data-number="15.1.6.3.2" id="unit_symbol"><span class="header-section-number">15.1.6.3.2</span> <code class="sourceCode cpp">unit_symbol<span class="op">()</span></code><a href="#unit_symbol" class="self-link"></a></h5>
<p>Returns a <code class="sourceCode cpp">std<span class="op">::</span>string_view</code>
with the symbol of a unit for the provided configuration:</p>
<div class="sourceCode" id="cb127"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb127-1"><a href="#cb127-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>unit_symbol_formatting fmt <span class="op">=</span> unit_symbol_formatting<span class="op">{}</span>, <span class="kw">typename</span> CharT <span class="op">=</span> <span class="dt">char</span>, Unit U<span class="op">&gt;</span></span>
<span id="cb127-2"><a href="#cb127-2" aria-hidden="true" tabindex="-1"></a><span class="kw">consteval</span> std<span class="op">::</span>string_view unit_symbol<span class="op">(</span>U<span class="op">)</span>;</span></code></pre></div>
<p><em>Note: It could be refactored to <code class="sourceCode cpp">unit_symbol<span class="op">(</span>U, fmt<span class="op">)</span></code>
when <span class="citation" data-cites="P1045R1">[<a href="https://wg21.link/p1045r1" role="doc-biblioref">P1045R1</a>]</span> is available.</em></p>
<p>For example:</p>
<div class="sourceCode" id="cb128"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb128-1"><a href="#cb128-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>unit_symbol<span class="op">&lt;{.</span>solidus <span class="op">=</span> unit_symbol_solidus<span class="op">::</span>never,</span>
<span id="cb128-2"><a href="#cb128-2" aria-hidden="true" tabindex="-1"></a>                           <span class="op">.</span>separator <span class="op">=</span> unit_symbol_separator<span class="op">::</span>half_high_dot<span class="op">}&gt;(</span>kg <span class="op">*</span> m <span class="op">/</span> s2<span class="op">)</span> <span class="op">==</span> <span class="st">&quot;kg⋅m⋅s⁻²&quot;</span><span class="op">)</span>;</span></code></pre></div>
<h5 data-number="15.1.6.3.3" id="unit_symbol_to"><span class="header-section-number">15.1.6.3.3</span> <code class="sourceCode cpp">unit_symbol_to<span class="op">()</span></code><a href="#unit_symbol_to" class="self-link"></a></h5>
<p>Inserts the generated unit symbol into the output text iterator at
runtime.</p>
<div class="sourceCode" id="cb129"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb129-1"><a href="#cb129-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span><span class="kw">typename</span> CharT <span class="op">=</span> <span class="dt">char</span>, std<span class="op">::</span>output_iterator<span class="op">&lt;</span>CharT<span class="op">&gt;</span> Out, Unit U<span class="op">&gt;</span></span>
<span id="cb129-2"><a href="#cb129-2" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> Out unit_symbol_to<span class="op">(</span>Out out, U u, unit_symbol_formatting fmt <span class="op">=</span> unit_symbol_formatting<span class="op">{})</span>;</span></code></pre></div>
<p>For example:</p>
<div class="sourceCode" id="cb130"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb130-1"><a href="#cb130-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>string txt;</span>
<span id="cb130-2"><a href="#cb130-2" aria-hidden="true" tabindex="-1"></a>unit_symbol_to<span class="op">(</span>std<span class="op">::</span>back_inserter<span class="op">(</span>txt<span class="op">)</span>, kg <span class="op">*</span> m <span class="op">/</span> s2,</span>
<span id="cb130-3"><a href="#cb130-3" aria-hidden="true" tabindex="-1"></a>               <span class="op">{.</span>solidus <span class="op">=</span> unit_symbol_solidus<span class="op">::</span>never, <span class="op">.</span>separator <span class="op">=</span> unit_symbol_separator<span class="op">::</span>half_high_dot<span class="op">})</span>;</span>
<span id="cb130-4"><a href="#cb130-4" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> txt <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span></code></pre></div>
<p>The above prints:</p>
<pre class="text"><code>kg⋅m⋅s⁻²</code></pre>
<h3 data-number="15.1.7" id="symbols-of-scaled-units"><span class="header-section-number">15.1.7</span> Symbols of scaled units<a href="#symbols-of-scaled-units" class="self-link"></a></h3>
<p>In most cases scaled units are hidden behind named units. However,
there are a few real-life where a user directly faces a scaled unit. For
example:</p>
<div class="sourceCode" id="cb131"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb131-1"><a href="#cb131-1" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> Unit <span class="kw">auto</span> L_per_100km <span class="op">=</span> L <span class="op">/</span> <span class="op">(</span>mag<span class="op">&lt;</span><span class="dv">100</span><span class="op">&gt;</span> <span class="op">*</span> km<span class="op">)</span>;</span></code></pre></div>
<p>The above is a derived unit of litre divided by a scaled unit of 100
kilometers. As we can see a scaled unit has a magnitude and a reference
unit. To denote the scope of such a unit, we enclose it in
<code class="sourceCode cpp"><span class="op">[...]</span></code>. For
example, the following:</p>
<div class="sourceCode" id="cb132"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb132-1"><a href="#cb132-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="fl">6.7</span> <span class="op">*</span> L_per_100km <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span></code></pre></div>
<p>prints:</p>
<pre class="text"><code>6.7 L/[100 km]</code></pre>
<h3 data-number="15.1.8" id="symbols-of-common-units"><span class="header-section-number">15.1.8</span> Symbols of common units<a href="#symbols-of-common-units" class="self-link"></a></h3>
<p>Some common units expressed with a specialization of the
<code class="sourceCode cpp">common_unit</code> class template need
special printing rules for their symbols. As they represent a minimum
set of equivalent common units resulting from the addition or
subtraction of multiple quantities, we print all of them as a scaled
version of the source unit. For example, the following:</p>
<div class="sourceCode" id="cb133"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb133-1"><a href="#cb133-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="dv">1</span> <span class="op">*</span> km <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> mi <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb133-2"><a href="#cb133-2" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="dv">1</span> <span class="op">*</span> nmi <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> mi <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb133-3"><a href="#cb133-3" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="dv">1</span> <span class="op">*</span> km <span class="op">/</span> h <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> m <span class="op">/</span> s <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb133-4"><a href="#cb133-4" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="dv">1</span> <span class="op">*</span> rad <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> deg <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span></code></pre></div>
<p>prints:</p>
<pre class="text"><code>40771 EQUIV{[1/25146 mi], [1/15625 km]}
108167 EQUIV{[1/50292 mi], [1/57875 nmi]}
23 EQUIV{[1/5 km/h], [1/18 m/s]}
183.142 EQUIV{[1/π°], [1/180 rad]}</code></pre>
<p>Thanks to the above, it might be easier for the user to reason about
the magnitude of the resulting unit and its impact on the value stored
in the quantity.</p>
<h3 data-number="15.1.9" id="unicode-characters-and-their-portable-replacements"><span class="header-section-number">15.1.9</span> Unicode characters and their
portable replacements<a href="#unicode-characters-and-their-portable-replacements" class="self-link"></a></h3>
<p>Library’s framework requires some Unicode characters for text output.
The below table lists all of them together with the recommended portable
replacements:</p>
<table>
<thead>
<tr class="header">
<th><div style="text-align:center">
<strong>Name</strong>
</div></th>
<th style="text-align: center;"><div style="text-align:center">
<strong>Symbol</strong>
</div></th>
<th style="text-align: center;"><div style="text-align:center">
<strong>C++ code</strong>
</div></th>
<th style="text-align: center;"><div style="text-align:center">
<strong>Portable alternative</strong>
</div></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>SUPERSCRIPT ZERO</td>
<td style="text-align: center;">⁰</td>
<td style="text-align: center;">u8”070”</td>
<td style="text-align: center;">“0”</td>
</tr>
<tr class="even">
<td>SUPERSCRIPT ONE</td>
<td style="text-align: center;">¹</td>
<td style="text-align: center;">u8”0b9”</td>
<td style="text-align: center;">“1”</td>
</tr>
<tr class="odd">
<td>SUPERSCRIPT TWO</td>
<td style="text-align: center;">²</td>
<td style="text-align: center;">u8”0b2”</td>
<td style="text-align: center;">“2”</td>
</tr>
<tr class="even">
<td>SUPERSCRIPT THREE</td>
<td style="text-align: center;">³</td>
<td style="text-align: center;">u8”0b3”</td>
<td style="text-align: center;">“3”</td>
</tr>
<tr class="odd">
<td>SUPERSCRIPT FOUR</td>
<td style="text-align: center;">⁴</td>
<td style="text-align: center;">u8”074”</td>
<td style="text-align: center;">“4”</td>
</tr>
<tr class="even">
<td>SUPERSCRIPT FIVE</td>
<td style="text-align: center;">⁵</td>
<td style="text-align: center;">u8”075”</td>
<td style="text-align: center;">“5”</td>
</tr>
<tr class="odd">
<td>SUPERSCRIPT SIX</td>
<td style="text-align: center;">⁶</td>
<td style="text-align: center;">u8”076”</td>
<td style="text-align: center;">“6”</td>
</tr>
<tr class="even">
<td>SUPERSCRIPT SEVEN</td>
<td style="text-align: center;">⁷</td>
<td style="text-align: center;">u8”077”</td>
<td style="text-align: center;">“7”</td>
</tr>
<tr class="odd">
<td>SUPERSCRIPT EIGHT</td>
<td style="text-align: center;">⁸</td>
<td style="text-align: center;">u8”078”</td>
<td style="text-align: center;">“8”</td>
</tr>
<tr class="even">
<td>SUPERSCRIPT NINE</td>
<td style="text-align: center;">⁹</td>
<td style="text-align: center;">u8”079”</td>
<td style="text-align: center;">“9”</td>
</tr>
<tr class="odd">
<td>SUPERSCRIPT MINUS</td>
<td style="text-align: center;">⁻</td>
<td style="text-align: center;">u8”07b”</td>
<td style="text-align: center;">“-”</td>
</tr>
<tr class="even">
<td>MULTIPLICATION SIGN</td>
<td style="text-align: center;">×</td>
<td style="text-align: center;">u8”0d7”</td>
<td style="text-align: center;">“x”</td>
</tr>
<tr class="odd">
<td>GREEK SMALL LETTER PI</td>
<td style="text-align: center;">π</td>
<td style="text-align: center;">u8”3c0”</td>
<td style="text-align: center;">“pi”</td>
</tr>
<tr class="even">
<td>DOT OPERATOR</td>
<td style="text-align: center;">⋅</td>
<td style="text-align: center;">u8”2C5”</td>
<td style="text-align: center;"><code class="sourceCode cpp"><span class="op">&lt;</span>none<span class="op">&gt;</span></code>*</td>
</tr>
</tbody>
</table>
<p>(*) Users should not select <code class="sourceCode cpp">unit_symbol_separator<span class="op">::</span>half_high_dot</code>
and <code class="sourceCode cpp">text_encoding<span class="op">::</span>portable</code>
at the same time. This symbol is valid only for UTF-8 encoding.
Otherwise, we propose to throw an exception during the unit symbol
string processing.</p>
<p>Here is an example of how the above are being used in a code:</p>
<div class="sourceCode" id="cb134"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb134-1"><a href="#cb134-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>unit_symbol<span class="op">(</span>kilogram <span class="op">*</span> metre <span class="op">/</span> square<span class="op">(</span>second<span class="op">))</span> <span class="op">==</span> <span class="st">&quot;kg m/s²&quot;</span><span class="op">)</span>;</span>
<span id="cb134-2"><a href="#cb134-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>unit_symbol<span class="op">&lt;</span>usf<span class="op">{.</span>separator <span class="op">=</span> half_high_dot<span class="op">}&gt;(</span>kilogram <span class="op">*</span> metre <span class="op">/</span> square<span class="op">(</span>second<span class="op">))</span> <span class="op">==</span> <span class="st">&quot;kg⋅m/s²&quot;</span><span class="op">)</span>;</span>
<span id="cb134-3"><a href="#cb134-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>unit_symbol<span class="op">&lt;</span>usf<span class="op">{.</span>encoding <span class="op">=</span> portable<span class="op">}&gt;(</span>kilogram <span class="op">*</span> metre <span class="op">/</span> square<span class="op">(</span>second<span class="op">))</span> <span class="op">==</span> <span class="st">&quot;kg m/s^2&quot;</span><span class="op">)</span>;</span>
<span id="cb134-4"><a href="#cb134-4" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>unit_symbol<span class="op">&lt;</span>usf<span class="op">{.</span>solidus <span class="op">=</span> never<span class="op">}&gt;(</span>kilogram <span class="op">*</span> metre <span class="op">/</span> square<span class="op">(</span>second<span class="op">))</span> <span class="op">==</span> <span class="st">&quot;kg m s⁻²&quot;</span><span class="op">)</span>;</span>
<span id="cb134-5"><a href="#cb134-5" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>unit_symbol<span class="op">&lt;</span>usf<span class="op">{.</span>encoding <span class="op">=</span> portable, <span class="op">.</span>solidus <span class="op">=</span> never<span class="op">}&gt;(</span>kilogram <span class="op">*</span> metre <span class="op">/</span> square<span class="op">(</span>second<span class="op">))</span> <span class="op">==</span> <span class="st">&quot;kg m s^-2&quot;</span><span class="op">)</span>;</span>
<span id="cb134-6"><a href="#cb134-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb134-7"><a href="#cb134-7" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>unit_symbol<span class="op">(</span>mag_ratio<span class="op">&lt;</span><span class="dv">1</span>, <span class="dv">18000</span><span class="op">&gt;</span> <span class="op">*</span> metre <span class="op">/</span> second<span class="op">)</span> <span class="op">==</span> <span class="st">&quot;[1/18 × 10⁻³ m]/s&quot;</span><span class="op">)</span>;</span>
<span id="cb134-8"><a href="#cb134-8" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>unit_symbol<span class="op">&lt;</span>usf<span class="op">{.</span>encoding <span class="op">=</span> portable<span class="op">}&gt;(</span>mag_ratio<span class="op">&lt;</span><span class="dv">1</span>, <span class="dv">18000</span><span class="op">&gt;</span> <span class="op">*</span> metre <span class="op">/</span> second<span class="op">)</span> <span class="op">==</span> <span class="st">&quot;[1/18 x 10^-3 m]/s&quot;</span><span class="op">)</span>;</span>
<span id="cb134-9"><a href="#cb134-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb134-10"><a href="#cb134-10" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>unit_symbol<span class="op">(</span>mag<span class="op">&lt;</span><span class="dv">1</span><span class="op">&gt;</span> <span class="op">/</span> <span class="op">(</span>mag<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;</span> <span class="op">*</span> mag<span class="op">&lt;</span>π<span class="op">&gt;)*</span>metre<span class="op">)</span> <span class="op">==</span> <span class="st">&quot;[2⁻¹ π⁻¹ m]&quot;</span><span class="op">)</span>;</span>
<span id="cb134-11"><a href="#cb134-11" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>unit_symbol<span class="op">&lt;</span>usf<span class="op">{.</span>solidus <span class="op">=</span> always<span class="op">}&gt;(</span>mag<span class="op">&lt;</span><span class="dv">1</span><span class="op">&gt;</span> <span class="op">/</span> <span class="op">(</span>mag<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;</span> <span class="op">*</span> mag<span class="op">&lt;</span>π<span class="op">&gt;)*</span>metre<span class="op">)</span> <span class="op">==</span> <span class="st">&quot;[1/(2 π) m]&quot;</span><span class="op">)</span>;</span>
<span id="cb134-12"><a href="#cb134-12" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>unit_symbol<span class="op">&lt;</span>usf<span class="op">{.</span>encoding <span class="op">=</span> portable, <span class="op">.</span>solidus <span class="op">=</span> always<span class="op">}&gt;(</span>mag<span class="op">&lt;</span><span class="dv">1</span><span class="op">&gt;</span> <span class="op">/</span> <span class="op">(</span>mag<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;</span> <span class="op">*</span> mag<span class="op">&lt;</span>π<span class="op">&gt;)*</span>metre<span class="op">)</span> <span class="op">==</span> <span class="st">&quot;[1/(2 pi) m]&quot;</span><span class="op">)</span>;</span></code></pre></div>
<p>Additionally, if we decide to provide
<code class="sourceCode cpp">per_mille</code> unit together with the
framework (next to <code class="sourceCode cpp">one</code>,
<code class="sourceCode cpp">percent</code>, and
<code class="sourceCode cpp">parts_per_million</code>) we will need a
symbol for it as well:</p>
<table>
<thead>
<tr class="header">
<th><div style="text-align:center">
<strong>Name</strong>
</div></th>
<th style="text-align: center;"><div style="text-align:center">
<strong>Symbol</strong>
</div></th>
<th style="text-align: center;"><div style="text-align:center">
<strong>C++ code</strong>
</div></th>
<th style="text-align: center;"><div style="text-align:center">
<strong>Portable alternative</strong>
</div></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>PER MILLE SIGN</td>
<td style="text-align: center;">‰</td>
<td style="text-align: center;">u8”030”</td>
<td style="text-align: center;">???</td>
</tr>
</tbody>
</table>
<p>There is no good choice for a portable replacement here. We may try
to be brief and use “%o” (<a href="https://en.wikipedia.org/wiki/Per_mille">Wikipedia uses this
symbol as a redirect for per mille</a>) or provide a longer textual
string. The problem is that there is more than one option to chose from
here (<a href="https://en.wikipedia.org/wiki/Per_mille">names mentioned
in Wikipedia</a>):</p>
<ul>
<li>“per mille” (even though it is consistent with the official name it
is not a good option here as it looks like multiplication of two
symbols),</li>
<li>“per mil” and “per mill” (same as above),</li>
<li>“permil”, “permill”, and “permille” (how to spell it
correctly?).</li>
</ul>
<h2 data-number="15.2" id="space_before_unit_symbol-customization-point"><span class="header-section-number">15.2</span>
<code class="sourceCode cpp">space_before_unit_symbol</code>
customization point<a href="#space_before_unit_symbol-customization-point" class="self-link"></a></h2>
<p>The <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span> says:</p>
<blockquote>
<p>The numerical value always precedes the unit and a space is always
used to separate the unit from the number. … The only exceptions to this
rule are for the unit symbols for degree, minute and second for plane
angle, <code class="sourceCode cpp">°</code>,
<code class="sourceCode cpp">′</code> and
<code class="sourceCode cpp">″</code>, respectively, for which no space
is left between the numerical value and the unit symbol.</p>
</blockquote>
<p>There are more units with such properties. For example, per
mille(<code class="sourceCode cpp">‰</code>).</p>
<p>To support the above, the library exposes
<code class="sourceCode cpp">space_before_unit_symbol</code>
customization point. By default, its value is
<code class="sourceCode cpp"><span class="kw">true</span></code> for all
the units. This means that a number and a unit will be separated by the
space in the output text. To change this behavior, a user should provide
a partial specialization for a specific unit:</p>
<div class="sourceCode" id="cb135"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb135-1"><a href="#cb135-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;&gt;</span></span>
<span id="cb135-2"><a href="#cb135-2" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="dt">bool</span> space_before_unit_symbol<span class="op">&lt;</span>non_si<span class="op">::</span>degree<span class="op">&gt;</span> <span class="op">=</span> <span class="kw">false</span>;</span></code></pre></div>
<p>The above works only for the default formatting or for the format
strings that use
<code class="sourceCode cpp"><span class="op">%?</span></code> placement
field (<code class="sourceCode cpp">std<span class="op">::</span>format<span class="op">(</span><span class="st">&quot;{}&quot;</span>, q<span class="op">)</span></code>
is equivalent to <code class="sourceCode cpp">std<span class="op">::</span>format<span class="op">(</span><span class="st">&quot;{:%N%?%U}&quot;</span>, q<span class="op">)</span></code>).</p>
<p>In case a user provides custom format specification (e.g., <code class="sourceCode cpp">std<span class="op">::</span>format<span class="op">(</span><span class="st">&quot;{:%N %U}&quot;</span>, q<span class="op">)</span></code>),
the library will always obey this specification for all the units (no
matter what the actual value of the
<code class="sourceCode cpp">space_before_unit_symbol</code>
customization point is) and the separating space will always be used in
this case.</p>
<h2 data-number="15.3" id="output-streams"><span class="header-section-number">15.3</span> Output streams<a href="#output-streams" class="self-link"></a></h2>
<p>The easiest way to print a dimension, unit, or quantity is to provide
its object to the output stream:</p>
<div class="sourceCode" id="cb136"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb136-1"><a href="#cb136-1" aria-hidden="true" tabindex="-1"></a><span class="kw">const</span> quantity v1 <span class="op">=</span> avg_speed<span class="op">(</span><span class="fl">220.</span> <span class="op">*</span> km, <span class="dv">2</span> <span class="op">*</span> h<span class="op">)</span>;</span>
<span id="cb136-2"><a href="#cb136-2" aria-hidden="true" tabindex="-1"></a><span class="kw">const</span> quantity v2 <span class="op">=</span> avg_speed<span class="op">(</span><span class="fl">140.</span> <span class="op">*</span> mi, <span class="dv">2</span> <span class="op">*</span> h<span class="op">)</span>;</span>
<span id="cb136-3"><a href="#cb136-3" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> v1 <span class="op">&lt;&lt;</span> <span class="ch">&#39;</span><span class="sc">\n</span><span class="ch">&#39;</span>;            <span class="co">// 110 km/h</span></span>
<span id="cb136-4"><a href="#cb136-4" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> v2 <span class="op">&lt;&lt;</span> <span class="ch">&#39;</span><span class="sc">\n</span><span class="ch">&#39;</span>;            <span class="co">// 70 mi/h</span></span>
<span id="cb136-5"><a href="#cb136-5" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> v2<span class="op">.</span>unit <span class="op">&lt;&lt;</span> <span class="ch">&#39;</span><span class="sc">\n</span><span class="ch">&#39;</span>;       <span class="co">// mi/h</span></span>
<span id="cb136-6"><a href="#cb136-6" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> v2<span class="op">.</span>dimension <span class="op">&lt;&lt;</span> <span class="ch">&#39;</span><span class="sc">\n</span><span class="ch">&#39;</span>;  <span class="co">// LT⁻¹</span></span></code></pre></div>
<p>The text output will always print the value using the default
formatting for this entity.</p>
<h3 data-number="15.3.1" id="output-stream-formatting"><span class="header-section-number">15.3.1</span> Output stream formatting<a href="#output-stream-formatting" class="self-link"></a></h3>
<p>Only basic formatting can be applied for output streams. It includes
control over width, fill, and alignment.</p>
<p>The numerical value of the quantity will be printed according to the
current stream state and standard manipulators may be used to customize
that (assuming that the underlying representation type respects
them).</p>
<div class="sourceCode" id="cb137"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb137-1"><a href="#cb137-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="st">&quot;|&quot;</span> <span class="op">&lt;&lt;</span> std<span class="op">::</span>setw<span class="op">(</span><span class="dv">10</span><span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="dv">123</span> <span class="op">*</span> m <span class="op">&lt;&lt;</span> <span class="st">&quot;|</span><span class="sc">\n</span><span class="st">&quot;</span>;                       <span class="co">// |     123 m|</span></span>
<span id="cb137-2"><a href="#cb137-2" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="st">&quot;|&quot;</span> <span class="op">&lt;&lt;</span> std<span class="op">::</span>setw<span class="op">(</span><span class="dv">10</span><span class="op">)</span> <span class="op">&lt;&lt;</span> std<span class="op">::</span>left <span class="op">&lt;&lt;</span> <span class="dv">123</span> <span class="op">*</span> m <span class="op">&lt;&lt;</span> <span class="st">&quot;|</span><span class="sc">\n</span><span class="st">&quot;</span>;          <span class="co">// |123 m     |</span></span>
<span id="cb137-3"><a href="#cb137-3" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="st">&quot;|&quot;</span> <span class="op">&lt;&lt;</span> std<span class="op">::</span>setw<span class="op">(</span><span class="dv">10</span><span class="op">)</span> <span class="op">&lt;&lt;</span> std<span class="op">::</span>setfill<span class="op">(</span><span class="ch">&#39;*&#39;</span><span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="dv">123</span> <span class="op">*</span> m <span class="op">&lt;&lt;</span> <span class="st">&quot;|</span><span class="sc">\n</span><span class="st">&quot;</span>;  <span class="co">// |123 m*****|</span></span></code></pre></div>
<p>Detailed formatting of any entity may be obtained with <code class="sourceCode cpp">std<span class="op">::</span>format<span class="op">()</span></code>
usage and then provided to the stream output if needed.</p>
<p><em>Note: Custom stream manipulators may be provided to control a
dimension and unit symbol output if requested by WG21.</em></p>
<h2 data-number="15.4" id="text-formatting"><span class="header-section-number">15.4</span> Text formatting<a href="#text-formatting" class="self-link"></a></h2>
<p>The library provides custom formatters for
<code class="sourceCode cpp">std<span class="op">::</span>format</code>
facility, which allows fine-grained control over what and how it is
being printed in the text output.</p>
<h3 data-number="15.4.1" id="controlling-width-fill-and-alignment"><span class="header-section-number">15.4.1</span> Controlling width, fill, and
alignment<a href="#controlling-width-fill-and-alignment" class="self-link"></a></h3>
<p>Formatting grammar for all the entities provides control over width,
fill, and alignment. The C++ standard grammar tokens <code class="sourceCode cpp">fill<span class="op">-</span><span class="kw">and</span><span class="op">-</span>align</code>
and <code class="sourceCode cpp">width</code> are being used. They treat
the entity as a contiguous text to be aligned. For example, here are a
few examples of the quantity numerical value and symbol formatting:</p>
<div class="sourceCode" id="cb138"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb138-1"><a href="#cb138-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;|{:0}|&quot;</span>, <span class="dv">123</span> <span class="op">*</span> m<span class="op">)</span>;     <span class="co">// |123 m|</span></span>
<span id="cb138-2"><a href="#cb138-2" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;|{:10}|&quot;</span>, <span class="dv">123</span> <span class="op">*</span> m<span class="op">)</span>;    <span class="co">// |     123 m|</span></span>
<span id="cb138-3"><a href="#cb138-3" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;|{:&lt;10}|&quot;</span>, <span class="dv">123</span> <span class="op">*</span> m<span class="op">)</span>;   <span class="co">// |123 m     |</span></span>
<span id="cb138-4"><a href="#cb138-4" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;|{:&gt;10}|&quot;</span>, <span class="dv">123</span> <span class="op">*</span> m<span class="op">)</span>;   <span class="co">// |     123 m|</span></span>
<span id="cb138-5"><a href="#cb138-5" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;|{:^10}|&quot;</span>, <span class="dv">123</span> <span class="op">*</span> m<span class="op">)</span>;   <span class="co">// |  123 m   |</span></span>
<span id="cb138-6"><a href="#cb138-6" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;|{:*&lt;10}|&quot;</span>, <span class="dv">123</span> <span class="op">*</span> m<span class="op">)</span>;  <span class="co">// |123 m*****|</span></span>
<span id="cb138-7"><a href="#cb138-7" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;|{:*&gt;10}|&quot;</span>, <span class="dv">123</span> <span class="op">*</span> m<span class="op">)</span>;  <span class="co">// |*****123 m|</span></span>
<span id="cb138-8"><a href="#cb138-8" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;|{:*^10}|&quot;</span>, <span class="dv">123</span> <span class="op">*</span> m<span class="op">)</span>;  <span class="co">// |**123 m***|</span></span></code></pre></div>
<p>It is important to note that in the second line above, the quantity
text is aligned to the right by default, which is consistent with the
formatting of numeric types. Units and dimensions behave as text and,
thus, are aligned to the left by default.</p>
<h3 data-number="15.4.2" id="dimension-formatting"><span class="header-section-number">15.4.2</span> Dimension formatting<a href="#dimension-formatting" class="self-link"></a></h3>
<pre class="ebnf"><code>dimension-format-spec = [fill-and-align], [width], [dimension-spec];
dimension-spec        = [text-encoding];
text-encoding         = &#39;U&#39; | &#39;P&#39;;</code></pre>
<p>In the above grammar:</p>
<ul>
<li><code class="sourceCode cpp">fill<span class="op">-</span><span class="kw">and</span><span class="op">-</span>align</code>
and <code class="sourceCode cpp">width</code> tokens are defined in the
<span>28.5.2.2
<a href="https://wg21.link/format.string.std">[format.string.std]</a></span>
chapter of the C++ standard specification,</li>
<li><code class="sourceCode cpp">text<span class="op">-</span>encoding</code>
token specifies the symbol text encoding:
<ul>
<li><code class="sourceCode cpp">U</code> (default) uses the
<strong>UTF-8</strong> symbols defined by <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> (e.g.,
<code class="sourceCode cpp">LT⁻²</code>),</li>
<li><code class="sourceCode cpp">P</code> forces non-standard
<strong>portable</strong> output (e.g., <code class="sourceCode cpp">LT<span class="op">^-</span><span class="dv">2</span></code>).</li>
</ul></li>
</ul>
<p>Dimension symbols of some quantities are specified to use Unicode
signs by the ISQ (e.g., <code class="sourceCode cpp">Θ</code> symbol for
the <em>thermodynamic temperature</em> dimension). The library follows
this by default. From the engineering point of view, sometimes Unicode
text might not be the best solution as terminals of many (especially
embedded) devices can output only letters from the basic literal
character set only. In such a case, the dimension symbol can be forced
to be printed using such characters thanks to <code class="sourceCode cpp">text<span class="op">-</span>encoding</code>
token:</p>
<div class="sourceCode" id="cb139"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb139-1"><a href="#cb139-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{}&quot;</span>, isq<span class="op">::</span>dim_thermodynamic_temperature<span class="op">)</span>;   <span class="co">// Θ</span></span>
<span id="cb139-2"><a href="#cb139-2" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{:P}&quot;</span>, isq<span class="op">::</span>dim_thermodynamic_temperature<span class="op">)</span>; <span class="co">// O</span></span>
<span id="cb139-3"><a href="#cb139-3" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{}&quot;</span>, isq<span class="op">::</span>power<span class="op">.</span>dimension<span class="op">)</span>;                 <span class="co">// L²MT⁻³</span></span>
<span id="cb139-4"><a href="#cb139-4" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{:P}&quot;</span>, isq<span class="op">::</span>power<span class="op">.</span>dimension<span class="op">)</span>;               <span class="co">// L^2MT^-3</span></span></code></pre></div>
<h3 data-number="15.4.3" id="unit-formatting"><span class="header-section-number">15.4.3</span> Unit formatting<a href="#unit-formatting" class="self-link"></a></h3>
<pre class="ebnf"><code>unit-format-spec      = [fill-and-align], [width], [unit-spec];
unit-spec             = [text-encoding], [unit-symbol-solidus], [unit-symbol-separator], [L]
                      | [text-encoding], [unit-symbol-separator], [unit-symbol-solidus], [L]
                      | [unit-symbol-solidus], [text-encoding], [unit-symbol-separator], [L]
                      | [unit-symbol-solidus], [unit-symbol-separator], [text-encoding], [L]
                      | [unit-symbol-separator], [text-encoding], [unit-symbol-solidus], [L]
                      | [unit-symbol-separator], [unit-symbol-solidus], [text-encoding], [L];
unit-symbol-solidus   = &#39;1&#39; | &#39;a&#39; | &#39;n&#39;;
unit-symbol-separator = &#39;s&#39; | &#39;d&#39;;</code></pre>
<p>In the above grammar:</p>
<ul>
<li><code class="sourceCode cpp">fill<span class="op">-</span><span class="kw">and</span><span class="op">-</span>align</code>
and <code class="sourceCode cpp">width</code> tokens are defined in the
<span>28.5.2.2
<a href="https://wg21.link/format.string.std">[format.string.std]</a></span>
chapter of the C++ standard specification,</li>
<li><code class="sourceCode cpp">unit<span class="op">-</span>symbol<span class="op">-</span>solidus</code>
token specifies how the division of units should look like:
<ul>
<li>‘1’ (default) outputs
<code class="sourceCode cpp"><span class="op">/</span></code> only when
there is only <strong>one</strong> unit in the denominator, otherwise
negative exponents are printed (e.g.,
<code class="sourceCode cpp">m<span class="op">/</span>s</code>,
<code class="sourceCode cpp">kg m⁻¹ s⁻¹</code>)</li>
<li>‘a’ <strong>always</strong> uses solidus (e.g.,
<code class="sourceCode cpp">m<span class="op">/</span>s</code>, <code class="sourceCode cpp">kg<span class="op">/(</span>m s<span class="op">)</span></code>)</li>
<li>‘n’ <strong>never</strong> prints solidus, which means that negative
exponents are always used (e.g.,
<code class="sourceCode cpp">m s⁻¹</code>,
<code class="sourceCode cpp">kg m⁻¹ s⁻¹</code>)</li>
</ul></li>
<li><code class="sourceCode cpp">unit<span class="op">-</span>symbol<span class="op">-</span>separator</code>
token specifies how multiplied unit symbols should be separated:
<ul>
<li>‘s’ (default) uses <strong>space</strong> as a separator (e.g.,
<code class="sourceCode cpp">kg m²<span class="op">/</span>s²</code>)</li>
<li>‘d’ uses half-high <strong>dot</strong>
(<code class="sourceCode cpp">⋅</code>) as a separator (e.g.,
<code class="sourceCode cpp">kg⋅m²<span class="op">/</span>s²</code>)
(requires the UTF-8 encoding)</li>
</ul></li>
<li>‘L’ is reserved for possible future localization use in case C++
standard library gets access to the ICU-like database.</li>
</ul>
<p><em>Note: The intent of the above grammar was that the elements of
<code class="sourceCode cpp">unit<span class="op">-</span>spec</code>
can appear in any order as they have unique characters. Users shouldn’t
have to remember the order of those tokens to control the formatting of
a unit symbol.</em></p>
<p>Unit symbols of some quantities are specified to use Unicode signs by
the <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span> (e.g.,
<code class="sourceCode cpp">Ω</code> symbol for the <em>resistance</em>
quantity). The library follows this by default. From the engineering
point of view, sometimes Unicode text might not be the best solution as
terminals of many (especially embedded) devices can output only letters
from the basic literal character set only. In such a case, the unit
symbol can be forced to be printed using such characters thanks to <code class="sourceCode cpp">text<span class="op">-</span>encoding</code>
token:</p>
<div class="sourceCode" id="cb140"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb140-1"><a href="#cb140-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{}&quot;</span>, si<span class="op">::</span>ohm<span class="op">)</span>;      <span class="co">// Ω</span></span>
<span id="cb140-2"><a href="#cb140-2" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{:P}&quot;</span>, si<span class="op">::</span>ohm<span class="op">)</span>;    <span class="co">// ohm</span></span>
<span id="cb140-3"><a href="#cb140-3" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{}&quot;</span>, us<span class="op">)</span>;           <span class="co">// µs</span></span>
<span id="cb140-4"><a href="#cb140-4" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{:P}&quot;</span>, us<span class="op">)</span>;         <span class="co">// us</span></span>
<span id="cb140-5"><a href="#cb140-5" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{}&quot;</span>, m <span class="op">/</span> s2<span class="op">)</span>;       <span class="co">// m/s²</span></span>
<span id="cb140-6"><a href="#cb140-6" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{:P}&quot;</span>, m <span class="op">/</span> s2<span class="op">)</span>;     <span class="co">// m/s^2</span></span></code></pre></div>
<p>Additionally, both <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> and <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span> leave some freedom on how to print
unit symbols. This is why two additional tokens were introduced.</p>
<p><code class="sourceCode cpp">unit<span class="op">-</span>symbol<span class="op">-</span>solidus</code>
specifies how the division of units should look like. By default,
<code class="sourceCode cpp"><span class="op">/</span></code> will be
used only when the denominator contains only one unit. However, with the
‘a’ or ‘n’ options, we can force the facility to print the
<code class="sourceCode cpp"><span class="op">/</span></code> character
always (even when there are more units in the denominator), or never, in
which case a parenthesis will be added to enclose all denominator
units.</p>
<div class="sourceCode" id="cb141"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb141-1"><a href="#cb141-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{}&quot;</span>, m <span class="op">/</span> s<span class="op">)</span>;          <span class="co">// m/s</span></span>
<span id="cb141-2"><a href="#cb141-2" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{}&quot;</span>, kg <span class="op">/</span> m <span class="op">/</span> s2<span class="op">)</span>;    <span class="co">// kg m⁻¹ s⁻²</span></span>
<span id="cb141-3"><a href="#cb141-3" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{:a}&quot;</span>, m <span class="op">/</span> s<span class="op">)</span>;        <span class="co">// m/s</span></span>
<span id="cb141-4"><a href="#cb141-4" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{:a}&quot;</span>, kg <span class="op">/</span> m <span class="op">/</span> s2<span class="op">)</span>;  <span class="co">// kg/(m s²)</span></span>
<span id="cb141-5"><a href="#cb141-5" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{:n}&quot;</span>, m <span class="op">/</span> s<span class="op">)</span>;        <span class="co">// m s⁻¹</span></span>
<span id="cb141-6"><a href="#cb141-6" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{:n}&quot;</span>, kg <span class="op">/</span> m <span class="op">/</span> s2<span class="op">)</span>;  <span class="co">// kg m⁻¹ s⁻²</span></span></code></pre></div>
<p>Also, there are a few options to separate the units being multiplied.
<span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> (part 1) says:</p>
<blockquote>
<p>When symbols for quantities are combined in a product of two or more
quantities, this combination is indicated in one of the following ways:
<code class="sourceCode cpp">ab</code>,
<code class="sourceCode cpp">a b</code>,
<code class="sourceCode cpp">a · b</code>,
<code class="sourceCode cpp">a × b</code></p>
<p><em>NOTE 1</em> In some fields, e.g., vector algebra, distinction is
made between <code class="sourceCode cpp">a ∙ b</code> and
<code class="sourceCode cpp">a × b</code>.</p>
</blockquote>
<p>The library supports <code class="sourceCode cpp">a b</code> and
<code class="sourceCode cpp">a · b</code> only. Additionally, we decided
that the extraneous space in the latter case makes the result too
verbose, so we decided just to use the
<code class="sourceCode cpp">·</code> symbol as a separator.</p>
<p>The <code class="sourceCode cpp">unit<span class="op">-</span>symbol<span class="op">-</span>separator</code>
token allows us to obtain the following outputs:</p>
<div class="sourceCode" id="cb142"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb142-1"><a href="#cb142-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{}&quot;</span>, kg <span class="op">*</span> m2 <span class="op">/</span> s2<span class="op">)</span>;    <span class="co">// kg m²/s²</span></span>
<span id="cb142-2"><a href="#cb142-2" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{:d}&quot;</span>, kg <span class="op">*</span> m2 <span class="op">/</span> s2<span class="op">)</span>;  <span class="co">// kg⋅m²/s²</span></span></code></pre></div>
<p><em>Note: ‘d’ requires the UTF-8 encoding to be set.</em></p>
<h3 data-number="15.4.4" id="quantity-formatting"><span class="header-section-number">15.4.4</span> Quantity formatting<a href="#quantity-formatting" class="self-link"></a></h3>
<pre class="ebnf"><code>quantity-format-spec        = [fill-and-align], [widt4h], [quantity-specs], [defaults-specs];
quantity-specs              = conversion-spec;
                            | quantity-specs, conversion-spec;
                            | quantity-specs, literal-char;
literal-char                = ? any character other than &#39;{&#39;, &#39;}&#39;, or &#39;%&#39; ?;
conversion-spec             = &#39;%&#39;, placement-type;
placement-type              = subentity-id | &#39;?&#39; | &#39;%&#39;;
defaults-specs              = &#39;:&#39;, default-spec-list;
default-spec-list           = default-spec;
                            | default-spec-list, default-spec;
default-spec                = subentity-id, &#39;[&#39; format-spec &#39;]&#39;;
subentity-id                = &#39;N&#39; | &#39;U&#39; | &#39;D&#39;;
format-spec                 = ? as specified by the formatter for the argument type ?;</code></pre>
<p>In the above grammar:</p>
<ul>
<li><code class="sourceCode cpp">fill<span class="op">-</span><span class="kw">and</span><span class="op">-</span>align</code>
and <code class="sourceCode cpp">width</code> tokens are defined in the
<span>28.5.2.2
<a href="https://wg21.link/format.string.std">[format.string.std]</a></span>
chapter of the C++ standard specification,</li>
<li><code class="sourceCode cpp">placement<span class="op">-</span>type</code>
token specifies which entity should be put and where:
<ul>
<li>‘N’ inserts a default-formatted numerical value of the
quantity,</li>
<li>‘U’ inserts a default-formatted unit of the quantity,</li>
<li>‘D’ inserts a default-formatted dimension of the quantity,</li>
<li>‘?’ inserts an optional separator between the number and a unit
based on the value of
<code class="sourceCode cpp">space_before_unit_symbol</code> for this
unit,</li>
<li>‘%’ just inserts ‘%’ character.</li>
</ul></li>
<li><code class="sourceCode cpp">defaults<span class="op">-</span>specs</code>
token allows overwriting defaults for the underlying formatters with the
custom format string. Each override starts with a subentity identifier
(‘N’, ‘U’, or ‘D’) followed by the format string enclosed in square
brackets.</li>
</ul>
<h4 data-number="15.4.4.1" id="default-formatting"><span class="header-section-number">15.4.4.1</span> Default formatting<a href="#default-formatting" class="self-link"></a></h4>
<p>To format <code class="sourceCode cpp">quantity</code> values, the
formatting facility uses <code class="sourceCode cpp">quantity<span class="op">-</span>format<span class="op">-</span>spec</code>.
If left empty, the default formatting is applied. The same default
formatting is also applied to the output streams. This is why the
following code lines produce the same output:</p>
<div class="sourceCode" id="cb143"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb143-1"><a href="#cb143-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="st">&quot;Distance: &quot;</span> <span class="op">&lt;&lt;</span> <span class="dv">123</span> <span class="op">*</span> km <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb143-2"><a href="#cb143-2" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> std<span class="op">::</span>format<span class="op">(</span><span class="st">&quot;Distance: {}</span><span class="sc">\n</span><span class="st">&quot;</span>, <span class="dv">123</span> <span class="op">*</span> km<span class="op">)</span>;</span>
<span id="cb143-3"><a href="#cb143-3" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> std<span class="op">::</span>format<span class="op">(</span><span class="st">&quot;Distance: {:%N%?%U}</span><span class="sc">\n</span><span class="st">&quot;</span>, <span class="dv">123</span> <span class="op">*</span> km<span class="op">)</span>;</span></code></pre></div>
<p>Please note that for some quantities the <code class="sourceCode cpp"><span class="op">{:%</span>N <span class="op">%</span>U<span class="op">}</span></code>
format may provide a different output than the default one, as some
units have <code class="sourceCode cpp">space_before_unit_symbol</code>
customization point explicitly set to
<code class="sourceCode cpp"><span class="kw">false</span></code> (e.g.,
<code class="sourceCode cpp"><span class="op">%</span></code> and
<code class="sourceCode cpp">°</code>).</p>
<h4 data-number="15.4.4.2" id="quantity-numerical-value-unit-symbol-or-both"><span class="header-section-number">15.4.4.2</span> Quantity numerical value,
unit symbol, or both?<a href="#quantity-numerical-value-unit-symbol-or-both" class="self-link"></a></h4>
<p>Thanks to the grammar provided above, the user can easily decide to
either:</p>
<ul>
<li><p>print a whole quantity:</p>
<div class="sourceCode" id="cb144"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb144-1"><a href="#cb144-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Speed: {}&quot;</span>, <span class="dv">120</span> <span class="op">*</span> km <span class="op">/</span> h<span class="op">)</span>;</span></code></pre></div>
<pre class="text"><code>Speed: 120 km/h</code></pre></li>
<li><p>provide custom quantity formatting:</p>
<div class="sourceCode" id="cb145"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb145-1"><a href="#cb145-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Speed: {:%N in %U}&quot;</span>, <span class="dv">120</span> <span class="op">*</span> km <span class="op">/</span> h<span class="op">)</span>;</span></code></pre></div>
<pre class="text"><code>Speed: 120 in km/h</code></pre></li>
<li><p>provide custom formatting for components:</p>
<div class="sourceCode" id="cb146"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb146-1"><a href="#cb146-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Speed: {::N[.2f]U[n]}&quot;</span>, <span class="fl">100.</span> <span class="op">*</span> km <span class="op">/</span> <span class="op">(</span><span class="dv">3</span> <span class="op">*</span> h<span class="op">))</span>;</span></code></pre></div>
<pre class="text"><code>Speed: 33.33 km h⁻¹</code></pre></li>
<li><p>print only specific components (numerical value, unit, or
dimension):</p>
<div class="sourceCode" id="cb147"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb147-1"><a href="#cb147-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Speed:</span><span class="sc">\n</span><span class="st">- number: {0:%N}</span><span class="sc">\n</span><span class="st">- unit: {0:%U}</span><span class="sc">\n</span><span class="st">- dimension: {0:%D}&quot;</span>, <span class="dv">120</span> <span class="op">*</span> km <span class="op">/</span> h<span class="op">)</span>;</span></code></pre></div>
<pre class="text"><code>Speed:
- number: 120
- unit: km/h
- dimension: LT⁻¹</code></pre></li>
</ul>
<p><code class="sourceCode cpp">placement<span class="op">-</span>type</code>
greatly simplify element access to the elements of the quantity. Without
them the second case above would require the following:</p>
<div class="sourceCode" id="cb148"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb148-1"><a href="#cb148-1" aria-hidden="true" tabindex="-1"></a><span class="kw">const</span> <span class="kw">auto</span> q <span class="op">=</span> <span class="dv">120</span> <span class="op">*</span> km <span class="op">/</span> h;</span>
<span id="cb148-2"><a href="#cb148-2" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Speed:</span><span class="sc">\n</span><span class="st">- number: {}</span><span class="sc">\n</span><span class="st">- unit: {}</span><span class="sc">\n</span><span class="st">- dimension: {}&quot;</span>,</span>
<span id="cb148-3"><a href="#cb148-3" aria-hidden="true" tabindex="-1"></a>             q<span class="op">.</span>numerical_value_ref_in<span class="op">(</span>q<span class="op">.</span>unit<span class="op">)</span>, q<span class="op">.</span>unit, q<span class="op">.</span>dimension<span class="op">)</span>;</span></code></pre></div>
<p><code class="sourceCode cpp"><span class="cf">default</span><span class="op">-</span>spec</code>
is crutial to provide formatting of user-defined representation types.
Initially, <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> library was providing
numerical value modifiers inplace of its format specification similarly
to <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration</code>
formatter. However, it:</p>
<ul>
<li>worked only with fundamental arithmetic types and was not able to
adjust to different format specifications of custom representation
types,</li>
<li>was quite hard to parse and format everything in a 100% compatible
way with the formatting specified in the C++ standard and already
implemented in the underlying standard library.</li>
</ul>
<h4 data-number="15.4.4.3" id="formatting-of-the-quantity-numerical-value"><span class="header-section-number">15.4.4.3</span> Formatting of the quantity
numerical value<a href="#formatting-of-the-quantity-numerical-value" class="self-link"></a></h4>
<p>The representation type used as a numerical value of a quantity must
provide its own formatter specialization. It will be called by the
quantity formatter with the format-spec provided by the user in the
<code class="sourceCode cpp">N</code> defaults specification.</p>
<p>In case we use C++ fundamental arithmetic types with our quantities
the standard formatter specified in <a href="https://wg21.link/format.string.std">format.string.std</a> will be
used. The rest of this chapter assumes that it is the case and provides
some usage examples.</p>
<p><code class="sourceCode cpp">sign</code> token allows us to specify
how the value’s sign is being printed:</p>
<div class="sourceCode" id="cb149"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb149-1"><a href="#cb149-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{0},{0::N[+]},{0::N[-]},{0::N[ ]}&quot;</span>, <span class="dv">1</span> <span class="op">*</span> m<span class="op">)</span>;   <span class="co">// 1 m,+1 m,1 m, 1 m</span></span>
<span id="cb149-2"><a href="#cb149-2" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{0},{0::N[+]},{0::N[-]},{0::N[ ]}&quot;</span>, <span class="op">-</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">)</span>;  <span class="co">// -1 m,-1 m,-1 m,-1 m</span></span></code></pre></div>
<p>where:</p>
<ul>
<li><code class="sourceCode cpp"><span class="op">+</span></code>
indicates that a sign should be used for both non-negative and negative
numbers,</li>
<li><code class="sourceCode cpp"><span class="op">-</span></code>
indicates that a sign should be used for negative numbers and negative
zero only (this is the default behavior),</li>
<li><code class="sourceCode cpp"><span class="op">&lt;</span>space<span class="op">&gt;</span></code>
indicates that a leading space should be used for non-negative numbers
other than negative zero, and a minus sign for negative numbers and
negative zero.</li>
</ul>
<p><code class="sourceCode cpp">precision</code> token is allowed only
for floating-point representation types:</p>
<div class="sourceCode" id="cb150"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb150-1"><a href="#cb150-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[.0]}&quot;</span>, <span class="fl">1.2345</span> <span class="op">*</span> m<span class="op">)</span>;   <span class="co">// 1 m</span></span>
<span id="cb150-2"><a href="#cb150-2" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[.1]}&quot;</span>, <span class="fl">1.2345</span> <span class="op">*</span> m<span class="op">)</span>;   <span class="co">// 1 m</span></span>
<span id="cb150-3"><a href="#cb150-3" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[.2]}&quot;</span>, <span class="fl">1.2345</span> <span class="op">*</span> m<span class="op">)</span>;   <span class="co">// 1.2 m</span></span>
<span id="cb150-4"><a href="#cb150-4" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[.3]}&quot;</span>, <span class="fl">1.2345</span> <span class="op">*</span> m<span class="op">)</span>;   <span class="co">// 1.23 m</span></span>
<span id="cb150-5"><a href="#cb150-5" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[.0f]}&quot;</span>, <span class="fl">1.2345</span> <span class="op">*</span> m<span class="op">)</span>;  <span class="co">// 1 m</span></span>
<span id="cb150-6"><a href="#cb150-6" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[.1f]}&quot;</span>, <span class="fl">1.2345</span> <span class="op">*</span> m<span class="op">)</span>;  <span class="co">// 1.2 m</span></span>
<span id="cb150-7"><a href="#cb150-7" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[.2f]}&quot;</span>, <span class="fl">1.2345</span> <span class="op">*</span> m<span class="op">)</span>;  <span class="co">// 1.23 m</span></span></code></pre></div>
<p><code class="sourceCode cpp">type</code> specifies how a value of the
representation type is being printed. For integral types:</p>
<div class="sourceCode" id="cb151"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb151-1"><a href="#cb151-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[b]}&quot;</span>, <span class="dv">42</span> <span class="op">*</span> m<span class="op">)</span>;    <span class="co">// 101010 m</span></span>
<span id="cb151-2"><a href="#cb151-2" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[B]}&quot;</span>, <span class="dv">42</span> <span class="op">*</span> m<span class="op">)</span>;    <span class="co">// 101010 m</span></span>
<span id="cb151-3"><a href="#cb151-3" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[d]}&quot;</span>, <span class="dv">42</span> <span class="op">*</span> m<span class="op">)</span>;    <span class="co">// 42 m</span></span>
<span id="cb151-4"><a href="#cb151-4" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[o]}&quot;</span>, <span class="dv">42</span> <span class="op">*</span> m<span class="op">)</span>;    <span class="co">// 52 m</span></span>
<span id="cb151-5"><a href="#cb151-5" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[x]}&quot;</span>, <span class="dv">42</span> <span class="op">*</span> m<span class="op">)</span>;    <span class="co">// 2a m</span></span>
<span id="cb151-6"><a href="#cb151-6" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[X]}&quot;</span>, <span class="dv">42</span> <span class="op">*</span> m<span class="op">)</span>;    <span class="co">// 2A m</span></span></code></pre></div>
<p>The above can be printed in an alternate version thanks to the
<code class="sourceCode cpp"><span class="er">#</span></code> token:</p>
<div class="sourceCode" id="cb152"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb152-1"><a href="#cb152-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[#b]}&quot;</span>, <span class="dv">42</span> <span class="op">*</span> m<span class="op">)</span>;   <span class="co">// 0b101010 m</span></span>
<span id="cb152-2"><a href="#cb152-2" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[#B]}&quot;</span>, <span class="dv">42</span> <span class="op">*</span> m<span class="op">)</span>;   <span class="co">// 0B101010 m</span></span>
<span id="cb152-3"><a href="#cb152-3" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[#o]}&quot;</span>, <span class="dv">42</span> <span class="op">*</span> m<span class="op">)</span>;   <span class="co">// 052 m</span></span>
<span id="cb152-4"><a href="#cb152-4" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[#x]}&quot;</span>, <span class="dv">42</span> <span class="op">*</span> m<span class="op">)</span>;   <span class="co">// 0x2a m</span></span>
<span id="cb152-5"><a href="#cb152-5" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[#X]}&quot;</span>, <span class="dv">42</span> <span class="op">*</span> m<span class="op">)</span>;   <span class="co">// 0X2A m</span></span></code></pre></div>
<p>For floating-point values, the
<code class="sourceCode cpp">type</code> token works as follows:</p>
<div class="sourceCode" id="cb153"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb153-1"><a href="#cb153-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[a]}&quot;</span>,   <span class="fl">1.2345678</span> <span class="op">*</span> m<span class="op">)</span>;      <span class="co">// 1.3c0ca2a5b1d5dp+0 m</span></span>
<span id="cb153-2"><a href="#cb153-2" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[.3a]}&quot;</span>, <span class="fl">1.2345678</span> <span class="op">*</span> m<span class="op">)</span>;      <span class="co">// 1.3c1p+0 m</span></span>
<span id="cb153-3"><a href="#cb153-3" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[A]}&quot;</span>,   <span class="fl">1.2345678</span> <span class="op">*</span> m<span class="op">)</span>;      <span class="co">// 1.3C0CA2A5B1D5DP+0 m</span></span>
<span id="cb153-4"><a href="#cb153-4" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[.3A]}&quot;</span>, <span class="fl">1.2345678</span> <span class="op">*</span> m<span class="op">)</span>;      <span class="co">// 1.3C1P+0 m</span></span>
<span id="cb153-5"><a href="#cb153-5" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[e]}&quot;</span>,   <span class="fl">1.2345678</span> <span class="op">*</span> m<span class="op">)</span>;      <span class="co">// 1.234568e+00 m</span></span>
<span id="cb153-6"><a href="#cb153-6" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[.3e]}&quot;</span>, <span class="fl">1.2345678</span> <span class="op">*</span> m<span class="op">)</span>;      <span class="co">// 1.235e+00 m</span></span>
<span id="cb153-7"><a href="#cb153-7" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[E]}&quot;</span>,   <span class="fl">1.2345678</span> <span class="op">*</span> m<span class="op">)</span>;      <span class="co">// 1.234568E+00 m</span></span>
<span id="cb153-8"><a href="#cb153-8" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[.3E]}&quot;</span>, <span class="fl">1.2345678</span> <span class="op">*</span> m<span class="op">)</span>;      <span class="co">// 1.235E+00 m</span></span>
<span id="cb153-9"><a href="#cb153-9" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[g]}&quot;</span>,   <span class="fl">1.2345678</span> <span class="op">*</span> m<span class="op">)</span>;      <span class="co">// 1.23457 m</span></span>
<span id="cb153-10"><a href="#cb153-10" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[g]}&quot;</span>,   <span class="fl">1.2345678e8</span> <span class="op">*</span> m<span class="op">)</span>;    <span class="co">// 1.23457e+08 m</span></span>
<span id="cb153-11"><a href="#cb153-11" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[.3g]}&quot;</span>, <span class="fl">1.2345678</span> <span class="op">*</span> m<span class="op">)</span>;      <span class="co">// 1.23 m</span></span>
<span id="cb153-12"><a href="#cb153-12" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[.3g]}&quot;</span>, <span class="fl">1.2345678e8</span> <span class="op">*</span> m<span class="op">)</span>;    <span class="co">// 1.23e+08 m</span></span>
<span id="cb153-13"><a href="#cb153-13" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[G]}&quot;</span>,   <span class="fl">1.2345678</span> <span class="op">*</span> m<span class="op">)</span>;      <span class="co">// 1.23457 m</span></span>
<span id="cb153-14"><a href="#cb153-14" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[G]}&quot;</span>,   <span class="fl">1.2345678e8</span> <span class="op">*</span> m<span class="op">)</span>;    <span class="co">// 1.23457E+08 m</span></span>
<span id="cb153-15"><a href="#cb153-15" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[.3G]}&quot;</span>, <span class="fl">1.2345678</span> <span class="op">*</span> m<span class="op">)</span>;      <span class="co">// 1.23 m</span></span>
<span id="cb153-16"><a href="#cb153-16" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;{::N[.3G]}&quot;</span>, <span class="fl">1.2345678e8</span> <span class="op">*</span> m<span class="op">)</span>;    <span class="co">// 1.23E+08 m</span></span></code></pre></div>
<h2 data-number="15.5" id="quantity-point-text-output"><span class="header-section-number">15.5</span> Quantity point text output<a href="#quantity-point-text-output" class="self-link"></a></h2>
<p>The library does not provide a text output for quantity points. The
quantity stored inside is just an implementation detail of this type. It
is a vector from a specific origin. Without the knowledge of the origin,
the vector by itself is useless as we can’t determine which point it
describes.</p>
<p>In the current library design, point origin does not provide any text
in its definition. Even if we could add such information to the point’s
definition, we would not know how to output it in the text. There may be
many ways to do it. For example, should we prepend or append the origin
part to the quantity text?</p>
<p>For example, the text output of
<code class="sourceCode cpp"><span class="dv">42</span> m</code> for a
quantity point may mean many things. It may be an offset from the
mountain top, sea level, or maybe the center of Mars. Printing
<code class="sourceCode cpp"><span class="dv">42</span> m AMSL</code>
for altitudes above mean sea level is a much better solution, but the
library does not have enough information to print it that way by
itself.</p>
<h2 data-number="15.6" id="text-output-open-questions"><span class="header-section-number">15.6</span> Text output open questions<a href="#text-output-open-questions" class="self-link"></a></h2>
<ol type="1">
<li><p>Should we somehow provide text support for quantity points? What
about temperatures?</p></li>
<li><p>How to name a non-Unicode accessor member function (e.g., <code class="sourceCode cpp"><span class="op">.</span>portable<span class="op">()</span></code>)?
The same name should consistently be used in
<code class="sourceCode cpp">text_encoding</code> and in the formatting
grammar.</p></li>
<li><p>What about the localization for units? Will we get something like
ICU in the C++ standard?</p></li>
<li><p>Do we care about ostreams enough to introduce custom manipulators
to format dimensions and units?</p></li>
<li><p><code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration</code>
uses ‘Q’ and ‘q’ for a number and a unit. In the grammar above, we
proposed using ‘N’ and ‘U’ for them, respectively. We also introduced
‘D’ for dimensions. Are we OK with this?</p></li>
<li><p>Are we OK with the usage of ’_’ for denoting a subscript
identifier? Should we use it everywhere (consistency) or only where
there is no dedicated Unicode subscript character?</p></li>
<li><p>Are we OK with using Unicode characters for unit symbols in the
code:</p>
<div class="sourceCode" id="cb154"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb154-1"><a href="#cb154-1" aria-hidden="true" tabindex="-1"></a>quantity resistance <span class="op">=</span> <span class="dv">60</span> <span class="op">*</span> kΩ;</span>
<span id="cb154-2"><a href="#cb154-2" aria-hidden="true" tabindex="-1"></a>quantity capacitance <span class="op">=</span> <span class="dv">100</span> <span class="op">*</span> µF;</span></code></pre></div></li>
</ol>
<h1 data-number="16" id="minimal-viable-product-mvp-scope"><span class="header-section-number">16</span> Minimal Viable Product (MVP)
scope<a href="#minimal-viable-product-mvp-scope" class="self-link"></a></h1>
<p>After a rough introduction of most of the features and abstractions
in the library, it might be good to discuss the scope for the Minimal
Viable Product (MVP).</p>
<p>We have several significant features to consider here:</p>
<ul>
<li><strong>Core library</strong>:
<code class="sourceCode cpp">quantity</code>, expression templates,
dimensions, units, references, and concepts for them,</li>
<li><strong>Quantity kinds</strong>: support quantities of the same
dimension that should be distinct, e.g., <em>frequency</em>,
<em>activity</em>, and <em>modulation_rate</em>, or <em>energy</em> and
<em>moment_of_force</em></li>
<li><strong>Various quantities of the same kind</strong>: support
quantities of the same kind that should be distinct, e.g.,
<em>width</em>, <em>height</em>, <em>wavelength</em> (all of the kind
<em>length</em>),</li>
<li><strong>The affine space</strong>:
<code class="sourceCode cpp">quantity_point</code>, point origins, and
concepts for them,</li>
<li><strong>Text output</strong>: for
<code class="sourceCode cpp">quantity</code>, units, and
dimensions,</li>
</ul>
<p>Please note that the above only lists the features present in this
proposal. Additional features, like definitions of specific systems of
quantities and units, math utilities, and other extensions, will be
provided in the follow-up papers. We chose not to include those features
here because they can be separately added later. This also means that we
believe that all of the features listed above should be provided in the
first release of the library.</p>
<p>To prove that, let’s try to identify possible problems if a specific
feature is excluded from the MVP scope:</p>
<ol type="1">
<li><p><strong>Core library</strong></p>
<p>It just has to be there with all of the components listed. Otherwise,
nothing works.</p></li>
<li><p><strong>Quantity kinds</strong></p>
<p>If we remove this feature, we would not be able to make a distinction
between <code class="sourceCode cpp">Hz</code>,
<code class="sourceCode cpp">Bq</code>, and
<code class="sourceCode cpp">Bd</code>, or
<code class="sourceCode cpp">rad</code>,
<code class="sourceCode cpp">sr</code> and
<code class="sourceCode cpp">bit</code>, or
<code class="sourceCode cpp">Gy</code> and
<code class="sourceCode cpp">Sv</code> as the quantities associated with
those units have the same dimensions. It is not only about units. It
also means that we will be able to pass a quantity of <em>solid angular
measure</em> to a function that takes
<code class="sourceCode cpp">angular measure</code>. Users will also not
be able to model their own distinct abstractions like we showed in the
case of the audio example (samples, beats, etc.). We also need to note
that we need that feature to be able to model the International System
of Quantities (ISQ). Skipping it is a serious usability and safety issue
that we should prevent.</p>
<p>Deciding to postpone this feature will block us from providing proper
SI definitions, as the units of this system should be properly
constrained for specific quantity kinds (possibly of the same
dimension).</p></li>
<li><p><strong>Various quantities of the same kind</strong></p>
<p>This might look like a less important use case. However, we already
have feedback from production that it is a groundbreaking feature that
prevents many bugs in the production software. Just consider a warehouse
robot that will misinterpret the dimensions of the box or a flight
computer that will pass <em>forward velocity</em> to a function getting
<em>sink rate</em>. Being able to pass a <em>kinetic energy</em> to a
function that expects a <em>potential energy</em> can also have fatal
consequences.</p>
<p>It is not only about the convertibility of the quantities themselves
but also about the construction of derived quantities from their
components. Without this feature, we will not be able to say that the
<em>kinetic energy</em> should not be implicitly convertible from the
<code class="sourceCode cpp">m g h</code> quantity equation (recipe for
the <em>gravitational potential energy</em>).</p>
<p>Also, deciding to skip this feature will prevent us from modeling the
International System of Quantities (ISQ) in the future.</p>
<p>Again, if we decide to postpone this feature, then it will affect how
the SI system is modeled. If we provide a collection of the SI units
without this feature, then it will never be possible to improve them
later.</p></li>
<li><p><strong>The affine space</strong></p>
<p>This looks like a feature that can be added later, and it is
partially true. However, the lack of this feature will prevent us from
modeling temperatures correctly, which means that we will have big
problems defining SI units as the degree Celsius unit needs an offset to
kelvin. If we postpone and release SI first, then we will not be able to
improve the degree Celsius definition later on.</p>
<p>Skipping this feature also means that we will lack very important
building block in modeling many problems in engineering. Those
abstractions are considered so important that the BSI (British Standards
Institution) already voted that they would strongly oppose a library not
having this feature.</p>
<p>Also, without it, we will not be able to provide proper
<code class="sourceCode cpp">std<span class="op">::</span>chrono</code>
compatibility.</p></li>
<li><p><strong>Text output</strong></p>
<p>Again, this looks like a purely additive feature, but if we never
decide to standardize it, then all the symbols provided in unit and
dimension definitions will be useless. If we do not intend to have text
output, we should remove symbol text from the core framework class
templates. This is why we should take that decision now.</p></li>
</ol>
<p>Some pople may consider the above a lot already. However, it is
important to realize that besides the most critical framework features
described in this proposal, there is much more to consider for
standardization. Here are the features that should/can be added later
and which are not a part of the MVP as of today:</p>
<ul>
<li>The minimal SI definition</li>
<li>ISQ: Space and time</li>
<li>ISQ: Mechanics</li>
<li>ISQ: Thermodynamics</li>
<li>ISQ: Electromagnetism</li>
<li>ISQ: Light and radiation</li>
<li>ISQ: Acoustics</li>
<li>ISQ: Physical chemistry and molecular physics</li>
<li>ISQ: Atomic and nuclear physics</li>
<li>ISQ: Characteristic numbers</li>
<li>ISQ: Condensed matter physics</li>
<li>ISQ: Information science and technology</li>
<li>ISQ: Logarithmic and related quantities</li>
<li>International yard and pound units</li>
<li>Imperial Units</li>
<li>U.S. customary units</li>
<li>IEC units</li>
<li>CGS units</li>
<li>Polymorphic unit</li>
<li>Polymorphic quantity</li>
<li>Math utilities for quantities</li>
<li>Random number generators for quantities</li>
</ul>
<p>All of the above features can be added later on top of the framework
facilities described in this document. Some of them probably should land
in the first iteration, but others can wait for the next one.</p>
<h1 data-number="17" id="safety-1"><span class="header-section-number">17</span> Safety<a href="#safety-1" class="self-link"></a></h1>
<h2 data-number="17.1" id="safety-features"><span class="header-section-number">17.1</span> Safety features<a href="#safety-features" class="self-link"></a></h2>
<p>This chapter describes the features that enforce safety in our code
bases. It starts with obvious things, but then it moves to probably less
known benefits of using physical quantities and units libraries. This
chapter also serves as a proof that it is not easy to implement such a
library correctly, and that there are many cases where the lack of
experience or time for the development of such a utility may easily lead
to safety issues as well.</p>
<p>Before we go through all the features, it is essential to note that
they do not introduce any runtime overhead over the raw unsafe code
doing the same thing. This is a massive benefit of C++ compared to other
programming languages (e.g., Python, Java, etc.).</p>
<h3 data-number="17.1.1" id="safe-unit-conversions"><span class="header-section-number">17.1.1</span> Safe unit conversions<a href="#safe-unit-conversions" class="self-link"></a></h3>
<p>The first thing that comes to our mind when discussing the safety of
such libraries is automated unit conversions between values of the same
physical quantity. This is probably the most important subject here. We
learned about its huge benefits long ago thanks to the <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration</code>
that made conversions of time durations error-proof.</p>
<p>Unit conversions are typically performed either via a converting
constructor or a dedicated conversion function:</p>
<div class="sourceCode" id="cb155"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb155-1"><a href="#cb155-1" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> q1 <span class="op">=</span> <span class="dv">5</span> <span class="op">*</span> km;</span>
<span id="cb155-2"><a href="#cb155-2" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> q1<span class="op">.</span>in<span class="op">(</span>m<span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="ch">&#39;</span><span class="sc">\n</span><span class="ch">&#39;</span>;</span>
<span id="cb155-3"><a href="#cb155-3" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>si<span class="op">::</span>metre, <span class="dt">int</span><span class="op">&gt;</span> q2 <span class="op">=</span> q1;</span></code></pre></div>
<p>Such a feature benefits from the fact that the library knows about
the magnitudes of the source and destination units at compile-time, and
may use that information to calculate and apply a conversion factor
automatically for the user.</p>
<p>In <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration</code>,
the magnitude of a unit is always expressed with
<code class="sourceCode cpp">std<span class="op">::</span>ratio</code>.
This is not enough for a general-purpose physical units library. Some of
the derived units have huge or tiny ratios. The difference from the base
units is so huge that it cannot be expressed with
<code class="sourceCode cpp">std<span class="op">::</span>ratio</code>,
which is implemented in terms of <code class="sourceCode cpp">std<span class="op">::</span><span class="dt">intmax_t</span></code>.
This makes it impossible to define units like electronvolt (eV), where 1
eV = 1.602176634×10<sup>−19</sup> J, or Dalton (Da), where 1 Da =
1.660539040(20)×10<sup>−27</sup> kg. Moreover, some conversions, such as
radian to a degree, require a conversion factor based on an irrational
number like pi.</p>
<h3 data-number="17.1.2" id="preventing-truncation-of-data"><span class="header-section-number">17.1.2</span> Preventing truncation of
data<a href="#preventing-truncation-of-data" class="self-link"></a></h3>
<p>The second safety feature of such libraries is preventing accidental
truncation of a quantity value. If we try the operations above with
swapped units, both conversions should fail to compile:</p>
<div class="sourceCode" id="cb156"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb156-1"><a href="#cb156-1" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> q1 <span class="op">=</span> <span class="dv">5</span> <span class="op">*</span> m;</span>
<span id="cb156-2"><a href="#cb156-2" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> q1<span class="op">.</span>in<span class="op">(</span>km<span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="ch">&#39;</span><span class="sc">\n</span><span class="ch">&#39;</span>;              <span class="co">// Compile-time error</span></span>
<span id="cb156-3"><a href="#cb156-3" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>si<span class="op">::</span>kilo<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">&gt;</span>, <span class="dt">int</span><span class="op">&gt;</span> q2 <span class="op">=</span> q1;  <span class="co">// Compile-time error</span></span></code></pre></div>
<p>We can’t preserve the value of a source quantity when we convert it
to one with a unit of a lower resolution while dealing with an integral
representation type for a quantity. In the example above, converting
<code class="sourceCode cpp"><span class="dv">5</span></code> meters
would result in
<code class="sourceCode cpp"><span class="dv">0</span></code> kilometers
if internal conversion is performed using regular integer
arithmetic.</p>
<p>While this could be a valid behavior, the problem arises when the
user expects to be able to convert the quantity back to the original
unit without loss of information. So the library should prevent such
conversions from happening implicitly. This is why it offers the named
cast <code class="sourceCode cpp">value_cast</code> for these
conversions marked as unsafe.</p>
<p>To make the above conversions compile, we could use a floating-point
representation type:</p>
<div class="sourceCode" id="cb157"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb157-1"><a href="#cb157-1" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> q1 <span class="op">=</span> <span class="fl">5.</span> <span class="op">*</span> m;    <span class="co">// source quantity uses `double` as a representation type</span></span>
<span id="cb157-2"><a href="#cb157-2" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> q1<span class="op">.</span>in<span class="op">(</span>km<span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="ch">&#39;</span><span class="sc">\n</span><span class="ch">&#39;</span>;</span>
<span id="cb157-3"><a href="#cb157-3" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>si<span class="op">::</span>kilo<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">&gt;&gt;</span> q2 <span class="op">=</span> q1;</span></code></pre></div>
<p>or:</p>
<div class="sourceCode" id="cb158"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb158-1"><a href="#cb158-1" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> q1 <span class="op">=</span> <span class="dv">5</span> <span class="op">*</span> m;     <span class="co">// source quantity uses `int` as a representation type</span></span>
<span id="cb158-2"><a href="#cb158-2" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> value_cast<span class="op">&lt;</span><span class="dt">double</span><span class="op">&gt;(</span>q1<span class="op">).</span>in<span class="op">(</span>km<span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="ch">&#39;</span><span class="sc">\n</span><span class="ch">&#39;</span>;</span>
<span id="cb158-3"><a href="#cb158-3" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>si<span class="op">::</span>kilo<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">&gt;&gt;</span> q2 <span class="op">=</span> q1;  <span class="co">// `double` by default</span></span></code></pre></div>
<p>Another possibility would be to force such a truncating conversion
explicitly from the code:</p>
<div class="sourceCode" id="cb159"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb159-1"><a href="#cb159-1" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> q1 <span class="op">=</span> <span class="dv">5</span> <span class="op">*</span> m;     <span class="co">// source quantity uses `int` as a representation type</span></span>
<span id="cb159-2"><a href="#cb159-2" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> q1<span class="op">.</span>force_in<span class="op">(</span>km<span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="ch">&#39;</span><span class="sc">\n</span><span class="ch">&#39;</span>;</span>
<span id="cb159-3"><a href="#cb159-3" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>si<span class="op">::</span>kilo<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">&gt;</span>, <span class="dt">int</span><span class="op">&gt;</span> q2 <span class="op">=</span> value_cast<span class="op">&lt;</span>km<span class="op">&gt;(</span>q1<span class="op">)</span>;</span></code></pre></div>
<p>The code above makes it clear that “something bad” may happen here if
we are not extra careful.</p>
<p>Another case for truncation happens when we assign a quantity with a
floating-point representation type to the one using an integral
representation type for its value:</p>
<div class="sourceCode" id="cb160"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb160-1"><a href="#cb160-1" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> q1 <span class="op">=</span> <span class="fl">2.5</span> <span class="op">*</span> m;</span>
<span id="cb160-2"><a href="#cb160-2" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>si<span class="op">::</span>metre, <span class="dt">int</span><span class="op">&gt;</span> q2 <span class="op">=</span> q1;  <span class="co">// Compile-time error</span></span></code></pre></div>
<p>Such an operation should fail to compile as well. Again, to force
such a truncation, we have to be explicit in the code:</p>
<div class="sourceCode" id="cb161"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb161-1"><a href="#cb161-1" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> q1 <span class="op">=</span> <span class="fl">2.5</span> <span class="op">*</span> m;</span>
<span id="cb161-2"><a href="#cb161-2" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>si<span class="op">::</span>metre, <span class="dt">int</span><span class="op">&gt;</span> q2 <span class="op">=</span> value_cast<span class="op">&lt;</span><span class="dt">int</span><span class="op">&gt;(</span>q1<span class="op">)</span>;</span></code></pre></div>
<p>As we can see, it is essential not to allow such truncating
conversions to happen implicitly, and a good physical quantities and
units library should fail at compile-time in case an user makes such a
mistake.</p>
<p>The same conversion utilities are also available for quantity points
described in the next chapter.</p>
<p>In some cases there is also a need to change both a unit and a
representation type in one step. This is why the library also exposes
the following functions:</p>
<ul>
<li><code class="sourceCode cpp">value_cast<span class="op">&lt;</span>Unit, Representation<span class="op">&gt;(</span>Quantity<span class="op">)</span></code>,</li>
<li><code class="sourceCode cpp">value_cast<span class="op">&lt;</span>Unit, Representation<span class="op">&gt;(</span>QuantityPoint<span class="op">)</span></code>.</li>
</ul>
<p>Exposing such functions:</p>
<ul>
<li>makes the code easier to write, understand, and maintain compared to
nesting two independent function calls,</li>
<li>allows the library to try to order those operations in the best way
to prevent data truncation or overflow.</li>
</ul>
<p>Additionally, in cases where users have typedefs for their quantity
or quantity point types, the following two functions are provided to
save unnecessary typing to obtain the contents of respective types:</p>
<ul>
<li><code class="sourceCode cpp">value_cast<span class="op">&lt;</span>Quantity<span class="op">&gt;(</span>Quantity<span class="op">)</span></code>,</li>
<li><code class="sourceCode cpp">value_cast<span class="op">&lt;</span>QuantityPoint<span class="op">&gt;(</span>QuantityPoint<span class="op">)</span></code>.</li>
</ul>
<p>The above functions are constrained to accept destination types that
have exactly the same quantity specification as the source function
argument. This means that in case quantity specifications do not match,
explicit <code class="sourceCode cpp">quantity_cast</code> should be
used first.</p>
<h3 data-number="17.1.3" id="safety-introduced-by-the-affine-space-abstractions"><span class="header-section-number">17.1.3</span> Safety introduced by the
affine space abstractions<a href="#safety-introduced-by-the-affine-space-abstractions" class="self-link"></a></h3>
<p>The affine space has two types of entities:</p>
<ul>
<li>point - a position specified with coordinate values (e.g.,
<em>location</em>, <em>address</em>, etc.)</li>
<li>vector - the difference between two points (e.g., <em>shift</em>,
<em>offset</em>, <em>displacement</em>, <em>duration</em>, etc.)</li>
</ul>
<p>One can do a limited set of operations in affine space on points and
vectors. This greatly helps to prevent quantity equations that do not
have physical sense.</p>
<p>People often think that affine space is needed only to model
<em>temperatures</em> and maybe <em>time</em> points (following the <a href="https://en.cppreference.com/w/cpp/chrono/time_point"><code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>time_point</code></a>
example). Still, the applicability of this concept is much wider.</p>
<p>For example, if we would like to model a Mount Everest climbing
expedition, we would deal with two kinds of altitude-related entities.
The first would be absolute <em>altitudes above the mean sea level</em>
(points) like <em>base camp altitude</em>, <em>mount peak altitude</em>,
etc. The second one would be the <em>heights of daily climbs</em>
(vectors). Although it makes physical sense to add <em>heights of daily
climbs</em>, there is no sense in adding <em>altitudes</em>. What does
adding the <em>altitude</em> of a base camp and the mountain peak mean
after all?</p>
<p>Modeling such affine space entities with the
<code class="sourceCode cpp">quantity</code> (vector) and
<code class="sourceCode cpp">quantity_point</code> (point) class
templates improves the overall project’s safety by only providing the
operators defined by the concepts.</p>
<p>The following operations are not allowed in the affine space:</p>
<ul>
<li><strong>adding</strong> two
<code class="sourceCode cpp">quantity_point</code> objects
<ul>
<li>It is physically impossible to add the positions of home and Denver
airport.</li>
</ul></li>
<li><strong>subtracting</strong> a
<code class="sourceCode cpp">quantity_point</code> from a
<code class="sourceCode cpp">quantity</code>
<ul>
<li>What would it mean to subtract the DEN airport location from a
distance?</li>
</ul></li>
<li><strong>multiplying/dividing</strong> a
<code class="sourceCode cpp">quantity_point</code> with a scalar
<ul>
<li>What is the position of <code class="sourceCode cpp"><span class="dv">2</span> <span class="op">*</span></code>
DEN airport location?</li>
</ul></li>
<li><strong>multiplying/dividing</strong> a
<code class="sourceCode cpp">quantity_point</code> with a quantity
<ul>
<li>What would multiplying a distance with the DEN airport location
mean?</li>
</ul></li>
<li><strong>multiplying/dividing</strong> two
<code class="sourceCode cpp">quantity_point</code> objects
<ul>
<li>What would multiplying the home and DEN airport location mean?</li>
</ul></li>
<li><strong>mixing</strong>
<code class="sourceCode cpp">quantity_points</code> of different
quantity kinds
<ul>
<li>It is physically impossible to subtract ISQ time from ISQ
length.</li>
</ul></li>
<li><strong>mixing</strong>
<code class="sourceCode cpp">quantity_points</code> of inconvertible
quantities
<ul>
<li>What does it mean to subtract a distance point to DEN airport from
the Mount Everest base camp altitude?</li>
</ul></li>
<li><strong>mixing</strong>
<code class="sourceCode cpp">quantity_points</code> of convertible
quantities but with unrelated origins
<ul>
<li>How to subtract a point on our trip to CppCon measured relatively to
our home location from a point measured relative to the center of the
Solar System?</li>
</ul></li>
</ul>
<p>The usage of <code class="sourceCode cpp">quantity_point</code>, and
affine space types in general, improves expressiveness and type-safety
of the code we write.</p>
<h3 data-number="17.1.4" id="explicit-is-not-explicit-enough"><span class="header-section-number">17.1.4</span>
<code class="sourceCode cpp"><span class="kw">explicit</span></code> is
not explicit enough<a href="#explicit-is-not-explicit-enough" class="self-link"></a></h3>
<p>Consider the following structure and a code using it:</p>
<div class="sourceCode" id="cb162"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb162-1"><a href="#cb162-1" aria-hidden="true" tabindex="-1"></a><span class="kw">struct</span> X <span class="op">{</span></span>
<span id="cb162-2"><a href="#cb162-2" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>vector<span class="op">&lt;</span>std<span class="op">::</span>chrono<span class="op">::</span>milliseconds<span class="op">&gt;</span> vec;</span>
<span id="cb162-3"><a href="#cb162-3" aria-hidden="true" tabindex="-1"></a>  <span class="co">// ...</span></span>
<span id="cb162-4"><a href="#cb162-4" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span></code></pre></div>
<div class="sourceCode" id="cb163"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb163-1"><a href="#cb163-1" aria-hidden="true" tabindex="-1"></a>X x;</span>
<span id="cb163-2"><a href="#cb163-2" aria-hidden="true" tabindex="-1"></a>x<span class="op">.</span>vec<span class="op">.</span>emplace_back<span class="op">(</span><span class="dv">42</span><span class="op">)</span>;</span></code></pre></div>
<p>Everything works fine for years until, at some point, someone changes
the structure to:</p>
<div class="sourceCode" id="cb164"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb164-1"><a href="#cb164-1" aria-hidden="true" tabindex="-1"></a><span class="kw">struct</span> X <span class="op">{</span></span>
<span id="cb164-2"><a href="#cb164-2" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>vector<span class="op">&lt;</span>std<span class="op">::</span>chrono<span class="op">::</span>microseconds<span class="op">&gt;</span> vec;</span>
<span id="cb164-3"><a href="#cb164-3" aria-hidden="true" tabindex="-1"></a>  <span class="co">// ...</span></span>
<span id="cb164-4"><a href="#cb164-4" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span></code></pre></div>
<p>The code continues to compile fine, but all the calculations are now
off by orders of magnitude. This is why a good quantities and units
library should not provide an explicit quantity constructor taking a raw
value.</p>
<p>To solve this issue, a quantity always requires information about
both a number and a unit during construction:</p>
<div class="sourceCode" id="cb165"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb165-1"><a href="#cb165-1" aria-hidden="true" tabindex="-1"></a><span class="kw">struct</span> X <span class="op">{</span></span>
<span id="cb165-2"><a href="#cb165-2" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>vector<span class="op">&lt;</span>quantity<span class="op">&lt;</span>si<span class="op">::</span>milli<span class="op">&lt;</span>si<span class="op">::</span>second<span class="op">&gt;&gt;&gt;</span> vec;</span>
<span id="cb165-3"><a href="#cb165-3" aria-hidden="true" tabindex="-1"></a>  <span class="co">// ...</span></span>
<span id="cb165-4"><a href="#cb165-4" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span></code></pre></div>
<div class="sourceCode" id="cb166"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb166-1"><a href="#cb166-1" aria-hidden="true" tabindex="-1"></a>X x;</span>
<span id="cb166-2"><a href="#cb166-2" aria-hidden="true" tabindex="-1"></a>x<span class="op">.</span>vec<span class="op">.</span>emplace_back<span class="op">(</span><span class="dv">42</span><span class="op">)</span>;       <span class="co">// Compile-time error</span></span>
<span id="cb166-3"><a href="#cb166-3" aria-hidden="true" tabindex="-1"></a>x<span class="op">.</span>vec<span class="op">.</span>emplace_back<span class="op">(</span><span class="dv">42</span> <span class="op">*</span> ms<span class="op">)</span>;  <span class="co">// OK</span></span></code></pre></div>
<p>For consistency and to prevent similar safety issues, the
<code class="sourceCode cpp">quantity_point</code> using explicit point
origins can’t be created from a standalone value of a
<code class="sourceCode cpp">quantity</code> (contrary to the <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>time_point</code>
design). Such a point has to always be associated with an explicit
origin:</p>
<div class="sourceCode" id="cb167"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb167-1"><a href="#cb167-1" aria-hidden="true" tabindex="-1"></a>quantity_point qp1 <span class="op">=</span> mean_sea_level <span class="op">+</span> <span class="dv">42</span> <span class="op">*</span> m;</span>
<span id="cb167-2"><a href="#cb167-2" aria-hidden="true" tabindex="-1"></a>quantity_point qp2 <span class="op">=</span> default_ac_temperature <span class="op">+</span> <span class="dv">2</span> <span class="op">*</span> delta<span class="op">&lt;</span>deg_C<span class="op">&gt;</span>;</span></code></pre></div>
<h3 data-number="17.1.5" id="safe-quantity-numerical-value-getters"><span class="header-section-number">17.1.5</span> Safe quantity numerical
value getters<a href="#safe-quantity-numerical-value-getters" class="self-link"></a></h3>
<p>Continuing our previous example, let’s assume that we have an
underlying “legacy” API that requires us to pass a raw numerical value
of a quantity and that we do the following to use it:</p>
<div class="sourceCode" id="cb168"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb168-1"><a href="#cb168-1" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> legacy_func<span class="op">(</span>std<span class="op">::</span><span class="dt">int64_t</span> seconds<span class="op">)</span>;</span></code></pre></div>
<div class="sourceCode" id="cb169"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb169-1"><a href="#cb169-1" aria-hidden="true" tabindex="-1"></a>X x;</span>
<span id="cb169-2"><a href="#cb169-2" aria-hidden="true" tabindex="-1"></a>x<span class="op">.</span>vec<span class="op">.</span>emplace_back<span class="op">(</span><span class="dv">42</span><span class="bu">s</span><span class="op">)</span>;</span>
<span id="cb169-3"><a href="#cb169-3" aria-hidden="true" tabindex="-1"></a>legacy_func<span class="op">(</span>x<span class="op">.</span>vec<span class="op">[</span><span class="dv">0</span><span class="op">].</span>count<span class="op">())</span>;</span></code></pre></div>
<p>The preceding code is incorrect. Even though the duration stores a
quantity equal to 42 s, it is not stored in seconds (it’s either
microseconds or milliseconds, depending on which of the interfaces from
the previous chapter is the current one). Such issues can be prevented
with the usage of <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration_cast</code>:</p>
<div class="sourceCode" id="cb170"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb170-1"><a href="#cb170-1" aria-hidden="true" tabindex="-1"></a>legacy_func<span class="op">(</span>duration_cast<span class="op">&lt;</span>seconds<span class="op">&gt;(</span>x<span class="op">.</span>vec<span class="op">[</span><span class="dv">0</span><span class="op">]).</span>count<span class="op">())</span>;</span></code></pre></div>
<p>However, users often forget about this step, especially when, at the
moment of writing such code, the duration stores the underlying raw
value in the expected unit. But as we know, the interface can be
refactored at any point to use a different unit, and the code using an
underlying numerical value without the usage of an explicit cast will
become incorrect.</p>
<p>To prevent such safety issues, the library exposes only the interface
that returns a quantity numerical value in the required unit to ensure
that no data truncation happens:</p>
<div class="sourceCode" id="cb171"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb171-1"><a href="#cb171-1" aria-hidden="true" tabindex="-1"></a>X x;</span>
<span id="cb171-2"><a href="#cb171-2" aria-hidden="true" tabindex="-1"></a>x<span class="op">.</span>vec<span class="op">.</span>emplace_back<span class="op">(</span><span class="dv">42</span> <span class="op">*</span> s<span class="op">)</span>;</span>
<span id="cb171-3"><a href="#cb171-3" aria-hidden="true" tabindex="-1"></a>legacy_func<span class="op">(</span>x<span class="op">.</span>vec<span class="op">[</span><span class="dv">0</span><span class="op">].</span>numerical_value_in<span class="op">(</span>si<span class="op">::</span>second<span class="op">))</span>;</span></code></pre></div>
<p>or in case we are fine with data truncation:</p>
<div class="sourceCode" id="cb172"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb172-1"><a href="#cb172-1" aria-hidden="true" tabindex="-1"></a>X x;</span>
<span id="cb172-2"><a href="#cb172-2" aria-hidden="true" tabindex="-1"></a>x<span class="op">.</span>vec<span class="op">.</span>emplace_back<span class="op">(</span><span class="dv">42</span> <span class="op">*</span> s<span class="op">)</span>;</span>
<span id="cb172-3"><a href="#cb172-3" aria-hidden="true" tabindex="-1"></a>legacy_func<span class="op">(</span>x<span class="op">.</span>vec<span class="op">[</span><span class="dv">0</span><span class="op">].</span>force_numerical_value_in<span class="op">(</span>si<span class="op">::</span>second<span class="op">))</span>;</span></code></pre></div>
<p>As the above member functions may need to do a conversion to provide
a value in the expected unit, their results are prvalues.</p>
<h3 data-number="17.1.6" id="preventing-dangling-references"><span class="header-section-number">17.1.6</span> Preventing dangling
references<a href="#preventing-dangling-references" class="self-link"></a></h3>
<p>Besides returning prvalues, sometimes users need to get an actual
reference to the underlying numerical value stored in a
<code class="sourceCode cpp">quantity</code>. For those cases, the
library exposes <code class="sourceCode cpp">quantity<span class="op">::</span>numerical_value_ref_in<span class="op">(</span>Unit<span class="op">)</span></code>
that participates in overload resolution only:</p>
<ul>
<li>for lvalues (rvalue reference qualified overload is explicitly
deleted),</li>
<li>when the provided <code class="sourceCode cpp">Unit</code> has the
same magnitude as the one currently used by the quantity.</li>
</ul>
<p>The first condition above aims to limit the possibility of dangling
references. We want to increase the chances that the reference/pointer
provided to an underlying API remains valid for the time of its usage.
(We’re much less concerned about performance aspects for a
<code class="sourceCode cpp">quantity</code> here, as we expect the
majority (if not all) of representation types to be cheap to copy.)</p>
<p>That said, we acknowledge that this approach to preventing dangling
references conflates value category with lifetime. While it may prevent
the majority of dangling references, it also admits both false positives
and false negatives, as explained in <span class="citation" data-cites="VCINL">[<a href="https://quuxplusone.github.io/blog/2019/03/11/value-category-is-not-lifetime/" role="doc-biblioref">Value Category Is Not Lifetime</a>]</span>. We want
to highlight this dilemma for the committee’s consideration.</p>
<p>In case we do decide to keep this policy of deleting rvalue
overloads, here’s an example of code that it would prevent from
compiling.</p>
<div class="sourceCode" id="cb173"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb173-1"><a href="#cb173-1" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> legacy_func<span class="op">(</span><span class="kw">const</span> <span class="dt">int</span><span class="op">&amp;</span> seconds<span class="op">)</span>;</span></code></pre></div>
<div class="sourceCode" id="cb174"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb174-1"><a href="#cb174-1" aria-hidden="true" tabindex="-1"></a>legacy_func<span class="op">((</span><span class="dv">4</span> <span class="op">*</span> s <span class="op">+</span> <span class="dv">2</span> <span class="op">*</span> s<span class="op">).</span>numerical_value_ref_in<span class="op">(</span>si<span class="op">::</span>second<span class="op">))</span>;  <span class="co">// Compile-time error</span></span></code></pre></div>
<p>The library also goes one step further, by implementing all compound
assignments, pre-increment, and pre-decrement operators as non-member
functions that preserve the initial value category. Thanks to that, the
following will also not compile:</p>
<div class="sourceCode" id="cb175"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb175-1"><a href="#cb175-1" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>si<span class="op">::</span>second, <span class="dt">int</span><span class="op">&gt;</span> get_duration<span class="op">()</span>;</span></code></pre></div>
<div class="sourceCode" id="cb176"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb176-1"><a href="#cb176-1" aria-hidden="true" tabindex="-1"></a>legacy_func<span class="op">((</span><span class="dv">4</span> <span class="op">*</span> s <span class="op">+=</span> <span class="dv">2</span> <span class="op">*</span> s<span class="op">).</span>numerical_value_ref_in<span class="op">(</span>si<span class="op">::</span>second<span class="op">))</span>;    <span class="co">// Compile-time error</span></span>
<span id="cb176-2"><a href="#cb176-2" aria-hidden="true" tabindex="-1"></a>legacy_func<span class="op">((++</span>get_duration<span class="op">()).</span>numerical_value_ref_in<span class="op">(</span>si<span class="op">::</span>second<span class="op">))</span>;  <span class="co">// Compile-time error</span></span></code></pre></div>
<p>The second condition above enables the usage of various equivalent
units. For example, <code class="sourceCode cpp">J</code> is equivalent
to <code class="sourceCode cpp">N <span class="op">*</span> m</code>,
and <code class="sourceCode cpp">kg <span class="op">*</span> m2 <span class="op">/</span> s2</code>.
As those have the same magnitude, it does not matter exactly which one
is being used here, as the same numerical value should be returned for
all of them.</p>
<div class="sourceCode" id="cb177"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb177-1"><a href="#cb177-1" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> legacy_func<span class="op">(</span><span class="kw">const</span> <span class="dt">int</span><span class="op">&amp;</span> joules<span class="op">)</span>;</span></code></pre></div>
<div class="sourceCode" id="cb178"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb178-1"><a href="#cb178-1" aria-hidden="true" tabindex="-1"></a>quantity q1 <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> J;</span>
<span id="cb178-2"><a href="#cb178-2" aria-hidden="true" tabindex="-1"></a>quantity q2 <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> N <span class="op">*</span> <span class="op">(</span><span class="dv">2</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb178-3"><a href="#cb178-3" aria-hidden="true" tabindex="-1"></a>quantity q3 <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> kJ;</span>
<span id="cb178-4"><a href="#cb178-4" aria-hidden="true" tabindex="-1"></a>legacy_func<span class="op">(</span>q1<span class="op">.</span>numerical_value_ref_in<span class="op">(</span>si<span class="op">::</span>joule<span class="op">))</span>; <span class="co">// OK</span></span>
<span id="cb178-5"><a href="#cb178-5" aria-hidden="true" tabindex="-1"></a>legacy_func<span class="op">(</span>q2<span class="op">.</span>numerical_value_ref_in<span class="op">(</span>si<span class="op">::</span>joule<span class="op">))</span>; <span class="co">// OK</span></span>
<span id="cb178-6"><a href="#cb178-6" aria-hidden="true" tabindex="-1"></a>legacy_func<span class="op">(</span>q3<span class="op">.</span>numerical_value_ref_in<span class="op">(</span>si<span class="op">::</span>joule<span class="op">))</span>; <span class="co">// Compile-time error</span></span></code></pre></div>
<h3 data-number="17.1.7" id="quantity-kinds-improve-safety"><span class="header-section-number">17.1.7</span> Quantity kinds improve
safety<a href="#quantity-kinds-improve-safety" class="self-link"></a></h3>
<p>What should be the result of the following quantity equation?</p>
<div class="sourceCode" id="cb179"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb179-1"><a href="#cb179-1" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> res <span class="op">=</span> <span class="dv">1</span> <span class="op">*</span> Hz <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> Bq <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> Bd;</span></code></pre></div>
<p>We have checked a few leading libraries on the market, and here are
the results:</p>
<ul>
<li><span class="citation" data-cites="BOOST-UNITS">[<a href="https://www.boost.org/doc/libs/1_83_0/doc/html/boost_units.html" role="doc-biblioref">Boost.Units</a>]</span> claims the answer to be 2
Hz (bauds are not supported by it, so we removed it from the
equation),</li>
<li><span class="citation" data-cites="NHOLTHAUS-UNITS">[<a href="https://github.com/nholthaus/units" role="doc-biblioref">nholthaus/units</a>]</span> claims it is 2
s<sup>-1</sup> (no support for bauds as well),</li>
<li><span class="citation" data-cites="PINT">[<a href="https://pint.readthedocs.io/en/stable/index.html" role="doc-biblioref">Pint</a>]</span> library in Python claims that the
result is 3.0 Hz,</li>
<li><span class="citation" data-cites="JSR-385">[<a href="https://unitsofmeasurement.github.io/indriya" role="doc-biblioref">JSR 385</a>]</span> library in Java throws an
exception saying that we can’t add those quantities.</li>
</ul>
<p>Now let’s check what <span class="citation" data-cites="ISO-GUIDE">[<a href="https://www.iso.org/obp/ui#iso:std:iso-iec:guide:99" role="doc-biblioref">ISO/IEC Guide 99</a>]</span> says about quantity
kinds:</p>
<ul>
<li>Quantities may be grouped together into categories of quantities
that are <strong>mutually comparable</strong></li>
<li>Mutually comparable quantities are called <strong>quantities of the
same kind</strong></li>
<li>Two or more quantities <strong>cannot be added or subtracted unless
they belong to the same category of mutually comparable
quantities</strong></li>
<li>Quantities of the <strong>same kind</strong> within a given system
of quantities <strong>have the same quantity dimension</strong></li>
<li>Quantities of the <strong>same dimension are not necessarily of the
same kind</strong></li>
</ul>
<p><span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> also explicitly
notes:</p>
<blockquote>
<p><strong>Measurement units of quantities of the same quantity
dimension may be designated by the same name and symbol even when the
quantities are not of the same kind</strong>. For example, joule per
kelvin and J/K are respectively the name and symbol of both a
measurement unit of heat capacity and a measurement unit of entropy,
which are generally not considered to be quantities of the same kind.
<strong>However, in some cases special measurement unit names are
restricted to be used with quantities of specific kind only</strong>.
For example, the measurement unit ‘second to the power minus one’ (1/s)
is called hertz (Hz) when used for frequencies and becquerel (Bq) when
used for activities of radionuclides. As another example, the joule (J)
is used as a unit of energy, but never as a unit of moment of force,
i.e. the newton metre (N · m).</p>
</blockquote>
<p>To summarize the above, <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> explicitly states that
<em>frequency</em> is measured in Hz and <em>activity</em> is measured
in Bq, which are quantities of different kinds. As such, they should not
be able to be compared, added, or subtracted. So, the only library from
the above that was correct was <span class="citation" data-cites="JSR-385">[<a href="https://unitsofmeasurement.github.io/indriya" role="doc-biblioref">JSR 385</a>]</span>. The rest of them are wrong to
allow such operations. Doing so may lead to vulnerable safety issues
when two unrelated quantities of the same dimension are accidentally
added or assigned to each other.</p>
<p>The reason for most of the libraries on the market to be wrong in
this field is the fact that their quantities are implemented only in
terms of the concept of dimension. However, we’ve learned that a
dimension is not enough to describe a quantity.</p>
<p>The library goes beyond that and properly models quantity kinds. We
believe that it is a significant feature that improves the safety of the
library.</p>
<h3 data-number="17.1.8" id="additional-safety-introduced-by-modeling-various-quantities-of-the-same-kind"><span class="header-section-number">17.1.8</span> Additional safety introduced
by modeling various quantities of the same kind<a href="#additional-safety-introduced-by-modeling-various-quantities-of-the-same-kind" class="self-link"></a></h3>
<p>Proper modeling of distinct kinds for quantities of the same
dimension is often not enough from the safety point of view. Most of the
libraries allow us to write the following code in the type-safe way:</p>
<div class="sourceCode" id="cb180"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb180-1"><a href="#cb180-1" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>isq<span class="op">::</span>speed<span class="op">[</span>m<span class="op">/</span>s<span class="op">]&gt;</span> avg_speed<span class="op">(</span>quantity<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">[</span>m<span class="op">]&gt;</span> l, quantity<span class="op">&lt;</span>isq<span class="op">::</span>time<span class="op">[</span>s<span class="op">]&gt;</span> t<span class="op">)</span></span>
<span id="cb180-2"><a href="#cb180-2" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb180-3"><a href="#cb180-3" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> l <span class="op">/</span> t;</span>
<span id="cb180-4"><a href="#cb180-4" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>However, they fail when we need to model an abstraction using more
than one quantity of the same kind:</p>
<div class="sourceCode" id="cb181"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb181-1"><a href="#cb181-1" aria-hidden="true" tabindex="-1"></a><span class="kw">class</span> Box <span class="op">{</span></span>
<span id="cb181-2"><a href="#cb181-2" aria-hidden="true" tabindex="-1"></a>  quantity<span class="op">&lt;</span>isq<span class="op">::</span>area<span class="op">[</span>m2<span class="op">]&gt;</span> base_;</span>
<span id="cb181-3"><a href="#cb181-3" aria-hidden="true" tabindex="-1"></a>  quantity<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">[</span>m<span class="op">]&gt;</span> height_;</span>
<span id="cb181-4"><a href="#cb181-4" aria-hidden="true" tabindex="-1"></a><span class="kw">public</span><span class="op">:</span></span>
<span id="cb181-5"><a href="#cb181-5" aria-hidden="true" tabindex="-1"></a>  Box<span class="op">(</span>quantity<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">[</span>m<span class="op">]&gt;</span> l, quantity<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">[</span>m<span class="op">]&gt;</span> w, quantity<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">[</span>m<span class="op">]&gt;</span> h<span class="op">)</span></span>
<span id="cb181-6"><a href="#cb181-6" aria-hidden="true" tabindex="-1"></a>    <span class="op">:</span> base_<span class="op">(</span>l <span class="op">*</span> w<span class="op">)</span>, height_<span class="op">(</span>h<span class="op">)</span></span>
<span id="cb181-7"><a href="#cb181-7" aria-hidden="true" tabindex="-1"></a>  <span class="op">{}</span></span>
<span id="cb181-8"><a href="#cb181-8" aria-hidden="true" tabindex="-1"></a>  <span class="co">// ...</span></span>
<span id="cb181-9"><a href="#cb181-9" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span></code></pre></div>
<p>This does not provide strongly typed interfaces anymore.</p>
<p>Again, it turns out that <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> has an answer. This
specification standardizes hundreds of quantities, many of which are of
the same kind. Various quantities of the same kind are not a flat set.
They form a hierarchy tree which influences:</p>
<ul>
<li>conversion rules,</li>
<li>the quantity type being the result of adding or subtracting
different quantities of the same kind.</li>
</ul>
<p>More information on this subject can be found in the <a href="#systems-of-quantities">Systems of quantities</a> chapter.</p>
<h3 data-number="17.1.9" id="non-negative-quantities"><span class="header-section-number">17.1.9</span> Non-negative quantities<a href="#non-negative-quantities" class="self-link"></a></h3>
<!-- TODO refactor this to state that we can benefit for points -->
<p>Some quantity types are defined by <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> as explicitly
non-negative. Those include quantities like width, thickness, diameter,
and radius. However, it turns out that it is possible to have negative
values of quantities defined as non-negative. For example, <code class="sourceCode cpp"><span class="op">-</span><span class="dv">1</span> <span class="op">*</span> isq<span class="op">::</span>diameter<span class="op">[</span>mm<span class="op">]</span></code>
could represent a change in the diameter of some object. Also, a
subtraction <code class="sourceCode cpp"><span class="dv">4</span> <span class="op">*</span> width<span class="op">[</span>mm<span class="op">]</span> <span class="op">-</span> <span class="dv">6</span> <span class="op">*</span> width<span class="op">[</span>mm<span class="op">]</span></code>
results in a negative value as the width of the second argument is
larger than the first one.</p>
<p>Non-negative quantities are not limited to those explicitly stated as
being non-negative in <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span>. Some quantities are
implicitly non-negative from their definition. The most obvious example
here might be scalar quantities specified as magnitudes of a vector
quantity. For example, speed is defined as the magnitude of velocity.
Again, <code class="sourceCode cpp"><span class="op">-</span><span class="dv">1</span> <span class="op">*</span> speed<span class="op">[</span>m<span class="op">/</span>s<span class="op">]</span></code>
could represent a change in average speed between two measurements.</p>
<p>This means that enforcing such constraints for quantity types might
be impossible as those typically are used to represent a difference
between two states or measurements. However, we could apply such
constraints to quantity points, which, by definition, describe the
absolute quantity values. For example, when height is the measure of an
object, a negative value is physically meaningless.</p>
<p>Such logic errors could be detected at runtime with contracts or some
other preconditions or invariants checks.</p>
<!-- Lots of exciting discussion at https://github.com/mpusz/mp-units/issues/468 -->
<h3 data-number="17.1.10" id="safe-operations-of-vector-and-tensor-quantities"><span class="header-section-number">17.1.10</span> Safe operations of vector
and tensor quantities<a href="#safe-operations-of-vector-and-tensor-quantities" class="self-link"></a></h3>
<!-- TODO revise after POC is done -->
<p>While talking about quantities and units libraries, everyone expects
that the library will protect (preferably at compile-time) from
accidentally replacing multiplication with division operations or vice
versa. Everyone knows and expects that the multiplication of
<em>length</em> and <em>time</em> should not result in <em>speed</em>.
It does not mean that such a quantity equation is invalid. It just
results in a quantity of a different type.</p>
<p>If we expect the above protection for scalar quantities, we should
also strive to provide similar guarantees for vector and tensor
quantities. First, the multiplication or division of two vectors or
tensors is not even mathematically defined. Such operations should be
impossible on quantities using vector or tensor representation
types.</p>
<p>What multiplication and division are for scalars, the dot and cross
products are for vector quantities. The result of the first one is a
scalar. The second one results in a vector perpendicular to both vectors
passed as arguments. A good quantities and units library should protect
the user from making such an error of accidentally replacing those
operations.</p>
<p>Vector and tensor quantities can be implemented in two ways:</p>
<ol type="1">
<li><p>Encapsulating multiple quantities into a homogeneous vector or
tensor representation type</p>
<p>This solution is the most common in the C++ market. It requires the
quantities library to provide only basic arithmetic operations
(addition, subtraction, multiplication, and division) which are being
used to calculate the result of linear algebra math. However, this
solution can’t provide any compile-time safety described above, and will
also crash when someone passes a proper vector and tensor representation
type to a quantity, expecting it to work.</p></li>
<li><p>Encapsulating a vector or tensor as a representation type of a
quantity</p>
<p>This provides all the required type safety, but requires the library
to implement more operations on quantities and properly constrain them
so they are selectively enabled when needed. Besides <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span>, the only library that
supports such an approach is <span class="citation" data-cites="PINT">[<a href="https://pint.readthedocs.io/en/stable/index.html" role="doc-biblioref">Pint</a>]</span>. Such a solution requires the
following operations to be exposed for quantity types (note that
character refers to the algebraic structure of either scalar, vector and
tensor):</p>
<ul>
<li><code class="sourceCode cpp">a <span class="op">+</span> b</code> -
addition where both arguments should be of the same quantity kind and
character</li>
<li><code class="sourceCode cpp">a <span class="op">-</span> b</code> -
subtraction where both arguments should be of the same quantity kind and
character</li>
<li><code class="sourceCode cpp">a <span class="op">%</span> b</code> -
modulo where both arguments should be of the same quantity kind and
character</li>
<li><code class="sourceCode cpp">a <span class="op">*</span> b</code> -
multiplication where one of the arguments has to be a scalar</li>
<li><code class="sourceCode cpp">a <span class="op">/</span> b</code> -
division where the divisor has to be scalar</li>
<li><code class="sourceCode cpp">a ⋅ b</code> - dot product of two
vectors</li>
<li><code class="sourceCode cpp">a × b</code> - cross product of two
vectors</li>
<li><code class="sourceCode cpp"><span class="op">|</span>a<span class="op">|</span></code>
- magnitude of a vector</li>
<li><code class="sourceCode cpp">a ⊗ b</code> - tensor product of two
vectors or tensors</li>
<li><code class="sourceCode cpp">a ⋅ b</code> - inner product of two
tensors</li>
<li><code class="sourceCode cpp">a ⋅ b</code> - inner product of tensor
and vector</li>
<li><code class="sourceCode cpp">a <span class="op">:</span> b</code> -
scalar product of two tensors</li>
</ul></li>
</ol>
<p>Additionally, the library knows the expected quantity character,
which is provided (implicitly or explicitly) in the definition of each
quantity type. Thanks to that, it prevents the user, for example, from
providing a scalar representation type for <em>force</em> or a vector
representation for <em>power</em> quantities.</p>
<div class="sourceCode" id="cb182"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb182-1"><a href="#cb182-1" aria-hidden="true" tabindex="-1"></a>QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>velocity<span class="op">&gt;</span> q1 <span class="op">=</span> <span class="dv">60</span> <span class="op">*</span> km <span class="op">/</span> h;                             <span class="co">// Compile-time error</span></span>
<span id="cb182-2"><a href="#cb182-2" aria-hidden="true" tabindex="-1"></a>QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>velocity<span class="op">&gt;</span> q2 <span class="op">=</span> la_vector<span class="op">{</span><span class="dv">0</span>, <span class="dv">0</span>, <span class="op">-</span><span class="dv">60</span><span class="op">}</span> <span class="op">*</span> km <span class="op">/</span> h;           <span class="co">// OK</span></span>
<span id="cb182-3"><a href="#cb182-3" aria-hidden="true" tabindex="-1"></a>QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>force<span class="op">&gt;</span> q3 <span class="op">=</span> <span class="dv">80</span> <span class="op">*</span> kg <span class="op">*</span> <span class="op">(</span><span class="dv">10</span> <span class="op">*</span> m <span class="op">/</span> s2<span class="op">)</span>;                    <span class="co">// Compile-time error</span></span>
<span id="cb182-4"><a href="#cb182-4" aria-hidden="true" tabindex="-1"></a>QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>force<span class="op">&gt;</span> q4 <span class="op">=</span> <span class="dv">80</span> <span class="op">*</span> kg <span class="op">*</span> <span class="op">(</span>la_vector<span class="op">{</span><span class="dv">0</span>, <span class="dv">0</span>, <span class="op">-</span><span class="dv">10</span><span class="op">}</span> <span class="op">*</span> m <span class="op">/</span> s2<span class="op">)</span>;  <span class="co">// OK</span></span>
<span id="cb182-5"><a href="#cb182-5" aria-hidden="true" tabindex="-1"></a>QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>power<span class="op">&gt;</span> q5 <span class="op">=</span> q2 <span class="op">*</span> q4;                                    <span class="co">// Compile-time error</span></span>
<span id="cb182-6"><a href="#cb182-6" aria-hidden="true" tabindex="-1"></a>QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>power<span class="op">&gt;</span> q5 <span class="op">=</span> dot<span class="op">(</span>q2, q4<span class="op">)</span>;                                <span class="co">// OK</span></span></code></pre></div>
<p><em>Note: <code class="sourceCode cpp">q1</code> and
<code class="sourceCode cpp">q3</code> can be permitted to compile by
explicitly specializing the <code class="sourceCode cpp">is_vector<span class="op">&lt;</span>T<span class="op">&gt;</span></code>
trait for the representation type.</em></p>
<p>As we can see above, such features additionally improves the
compile-time safety of the library by ensuring that quantities are
created with proper quantity equations and are using correct
representation types.</p>
<h2 data-number="17.2" id="safety-pitfalls"><span class="header-section-number">17.2</span> Safety pitfalls<a href="#safety-pitfalls" class="self-link"></a></h2>
<h3 data-number="17.2.1" id="integer-division"><span class="header-section-number">17.2.1</span> Integer division<a href="#integer-division" class="self-link"></a></h3>
<p>The physical units library can’t do any runtime branching logic for
the division operator. All logic has to be done at compile-time when the
actual values are not known, and the quantity types can’t change at
runtime.</p>
<p>If we expect <code class="sourceCode cpp"><span class="dv">120</span> <span class="op">*</span> km <span class="op">/</span> <span class="op">(</span><span class="dv">2</span> <span class="op">*</span> h<span class="op">)</span></code>
to return <code class="sourceCode cpp"><span class="dv">60</span> km <span class="op">/</span> h</code>,
we have to agree with the fact that <code class="sourceCode cpp"><span class="dv">5</span> <span class="op">*</span> km <span class="op">/</span> <span class="op">(</span><span class="dv">24</span> <span class="op">*</span> h<span class="op">)</span></code>
returns <code class="sourceCode cpp"><span class="dv">0</span> km<span class="op">/</span>h</code>.
We can’t do a range check at runtime to dynamically adjust scales and
types based on the values of provided function arguments.</p>
<p>The same applies to:</p>
<div class="sourceCode" id="cb183"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb183-1"><a href="#cb183-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">5</span> <span class="op">*</span> h <span class="op">/</span> <span class="op">(</span><span class="dv">120</span> <span class="op">*</span> min<span class="op">)</span> <span class="op">==</span> <span class="dv">0</span> <span class="op">*</span> one<span class="op">)</span>;</span></code></pre></div>
<p>This is why floating-point representation types are recommended as a
default to store the numerical value of a quantity. Some popular
physical units libraries even <a href="https://aurora-opensource.github.io/au/main/troubleshooting/#integer-division-forbidden">forbid
integer division at all</a>.</p>
<p>The problem is similar to the one described in the section about
accidental truncation of values through conversion. While the consequent
use of floating-point representation types may be a good idea, it is not
always possible. Especially in close-to-the-metal applications and small
embedded systems, the use of floating-point types is sometimes not an
option, either for performance reasons or lack of hardware support.
Having different operators for safe floating-point operations and unsafe
integer operations would hurt generic programming. As such, users should
instead use safer representation types.</p>
<h3 data-number="17.2.2" id="lack-of-safe-numeric-types"><span class="header-section-number">17.2.2</span> Lack of safe numeric types<a href="#lack-of-safe-numeric-types" class="self-link"></a></h3>
<p>Integers can overflow on arithmetics. This has already caused some
expensive failures in engineering <span class="citation" data-cites="ARIANE">[<a href="https://en.wikipedia.org/wiki/Ariane_flight_V88" role="doc-biblioref">Ariane flight V88</a>]</span>.</p>
<p>Integers can also be truncated during assignment to a narrower
type.</p>
<p>Floating-point types may lose precision during assignment to a
narrower type. Conversion from <code class="sourceCode cpp">std<span class="op">::</span><span class="dt">int64_t</span></code>
to <code class="sourceCode cpp"><span class="dt">double</span></code>
may also lose precision.</p>
<p>If we had safe numeric types in the C++ standard library, they could
easily be used as a <code class="sourceCode cpp">quantity</code>
representation type in the physical quantities and units library, which
would address these safety concerns.</p>
<p>Also, having a type trait informing if a conversion from one type to
another is value-preserving would help to address some of the issues
mentioned above.</p>
<h3 data-number="17.2.3" id="potential-surprises-during-units-composition"><span class="header-section-number">17.2.3</span> Potential surprises during
units composition<a href="#potential-surprises-during-units-composition" class="self-link"></a></h3>
<p>One of the most essential requirements for a good physical quantities
and units library is to implement units in such a way that they compose.
With that, one can easily create any derived unit using a simple unit
equation on other base or derived units. For example:</p>
<div class="sourceCode" id="cb184"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb184-1"><a href="#cb184-1" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> Unit <span class="kw">auto</span> kmph <span class="op">=</span> km <span class="op">/</span> h;</span></code></pre></div>
<p>We can also easily obtain a quantity with:</p>
<div class="sourceCode" id="cb185"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb185-1"><a href="#cb185-1" aria-hidden="true" tabindex="-1"></a>quantity q <span class="op">=</span> <span class="dv">60</span> <span class="op">*</span> km <span class="op">/</span> h;</span></code></pre></div>
<p>Such a solution is an industry standard and is implemented not only
in this library, but also is available for many years now in both <span class="citation" data-cites="BOOST-UNITS">[<a href="https://www.boost.org/doc/libs/1_83_0/doc/html/boost_units.html" role="doc-biblioref">Boost.Units</a>]</span> and <span class="citation" data-cites="PINT">[<a href="https://pint.readthedocs.io/en/stable/index.html" role="doc-biblioref">Pint</a>]</span>.</p>
<p>We believe that is the correct thing to do. However, we want to make
it straight in this paper that some potential issues are associated with
such a syntax. Inexperienced users are often surprised by the results of
the following expression:</p>
<div class="sourceCode" id="cb186"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb186-1"><a href="#cb186-1" aria-hidden="true" tabindex="-1"></a>quantity q <span class="op">=</span> <span class="dv">60</span> <span class="op">*</span> km <span class="op">/</span> <span class="dv">2</span> <span class="op">*</span> h;</span></code></pre></div>
<p>This looks like like <code class="sourceCode cpp"><span class="dv">30</span> km<span class="op">/</span>h</code>,
right? But it is not. Thanks to the order of operations, it results in
<code class="sourceCode cpp"><span class="dv">30</span> km⋅h</code>. In
case we want to divide
<code class="sourceCode cpp"><span class="dv">60</span> km</code> by
<code class="sourceCode cpp"><span class="dv">2</span> h</code>,
parentheses are needed:</p>
<div class="sourceCode" id="cb187"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb187-1"><a href="#cb187-1" aria-hidden="true" tabindex="-1"></a>quantity q <span class="op">=</span> <span class="dv">60</span> <span class="op">*</span> km <span class="op">/</span> <span class="op">(</span><span class="dv">2</span> <span class="op">*</span> h<span class="op">)</span>;</span></code></pre></div>
<p>Another surprising issue may result from the following code:</p>
<div class="sourceCode" id="cb188"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb188-1"><a href="#cb188-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span><span class="kw">typename</span> T<span class="op">&gt;</span></span>
<span id="cb188-2"><a href="#cb188-2" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> make_length<span class="op">(</span>T v<span class="op">)</span> <span class="op">{</span> <span class="cf">return</span> v <span class="op">*</span> si<span class="op">::</span>metre; <span class="op">}</span></span>
<span id="cb188-3"><a href="#cb188-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb188-4"><a href="#cb188-4" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> v <span class="op">=</span> <span class="dv">42</span>;</span>
<span id="cb188-5"><a href="#cb188-5" aria-hidden="true" tabindex="-1"></a>quantity q <span class="op">=</span> make_length<span class="op">(</span>v<span class="op">)</span>;</span></code></pre></div>
<p>This might look like a good idea, but let’s consider what would
happen if the user provided a quantity as input:</p>
<div class="sourceCode" id="cb189"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb189-1"><a href="#cb189-1" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> v <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> m;</span>
<span id="cb189-2"><a href="#cb189-2" aria-hidden="true" tabindex="-1"></a>quantity q <span class="op">=</span> make_length<span class="op">(</span>v<span class="op">)</span>;</span></code></pre></div>
<p>The above function call will result in a quantity of <em>area</em>
instead of the expected quantity of <em>length</em>.</p>
<p>The issues mentioned above could be turned into compilation errors by
disallowing multiplying or dividing a quantity by a unit. The <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> library initially provided
such an approach, but with time, we decided this to not be
user-friendly. Forcing the user to put the parenthesis around all
derived units in quantity equations like the one below, was too verbose
and confusing:</p>
<div class="sourceCode" id="cb190"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb190-1"><a href="#cb190-1" aria-hidden="true" tabindex="-1"></a>quantity q <span class="op">=</span> <span class="dv">60</span> <span class="op">*</span> <span class="op">(</span>km <span class="op">/</span> h<span class="op">)</span>;</span></code></pre></div>
<p>It is important to notice that the problems mentioned above will
always surface with a compile-time error at some point in the user’s
code when they assign the resulting quantity to one with an explicitly
provided quantity type.</p>
<p>Below, we provide a few examples that correctly detect such issues at
compile-time:</p>
<div class="sourceCode" id="cb191"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb191-1"><a href="#cb191-1" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>si<span class="op">::</span>kilo<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">&gt;</span> <span class="op">/</span> non_si<span class="op">::</span>hour, <span class="dt">int</span><span class="op">&gt;</span> q1 <span class="op">=</span> <span class="dv">60</span> <span class="op">*</span> km <span class="op">/</span> <span class="dv">2</span> <span class="op">*</span> h;             <span class="co">// Compile-time error</span></span>
<span id="cb191-2"><a href="#cb191-2" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>isq<span class="op">::</span>speed<span class="op">[</span>si<span class="op">::</span>kilo<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">&gt;</span> <span class="op">/</span> non_si<span class="op">::</span>hour<span class="op">]</span>, <span class="dt">int</span><span class="op">&gt;</span> q2 <span class="op">=</span> <span class="dv">60</span> <span class="op">*</span> km <span class="op">/</span> <span class="dv">2</span> <span class="op">*</span> h; <span class="co">// Compile-time error</span></span>
<span id="cb191-3"><a href="#cb191-3" aria-hidden="true" tabindex="-1"></a>QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>speed<span class="op">&gt;</span> <span class="kw">auto</span> q3 <span class="op">=</span> <span class="dv">60</span> <span class="op">*</span> km <span class="op">/</span> <span class="dv">2</span> <span class="op">*</span> h;                                   <span class="co">// Compile-time error</span></span></code></pre></div>
<div class="sourceCode" id="cb192"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb192-1"><a href="#cb192-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span><span class="kw">typename</span> T<span class="op">&gt;</span></span>
<span id="cb192-2"><a href="#cb192-2" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> make_length<span class="op">(</span>T v<span class="op">)</span> <span class="op">{</span> <span class="cf">return</span> v <span class="op">*</span> si<span class="op">::</span>metre; <span class="op">}</span></span>
<span id="cb192-3"><a href="#cb192-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb192-4"><a href="#cb192-4" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> v <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> m;</span>
<span id="cb192-5"><a href="#cb192-5" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>si<span class="op">::</span>metre, <span class="dt">int</span><span class="op">&gt;</span> q1 <span class="op">=</span> make_length<span class="op">(</span>v<span class="op">)</span>;           <span class="co">// Compile-time error</span></span>
<span id="cb192-6"><a href="#cb192-6" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">[</span>si<span class="op">::</span>metre<span class="op">]&gt;</span> q2 <span class="op">=</span> make_length<span class="op">(</span>v<span class="op">)</span>;   <span class="co">// Compile-time error</span></span>
<span id="cb192-7"><a href="#cb192-7" aria-hidden="true" tabindex="-1"></a>QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">&gt;</span> q3 <span class="op">=</span> make_length<span class="op">(</span>v<span class="op">)</span>;            <span class="co">// Compile-time error</span></span></code></pre></div>
<div class="sourceCode" id="cb193"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb193-1"><a href="#cb193-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span><span class="kw">typename</span> T<span class="op">&gt;</span></span>
<span id="cb193-2"><a href="#cb193-2" aria-hidden="true" tabindex="-1"></a>QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">&gt;</span> <span class="kw">auto</span> make_length<span class="op">(</span>T v<span class="op">)</span> <span class="op">{</span> <span class="cf">return</span> v <span class="op">*</span> si<span class="op">::</span>metre; <span class="op">}</span></span>
<span id="cb193-3"><a href="#cb193-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb193-4"><a href="#cb193-4" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> v <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> m;</span>
<span id="cb193-5"><a href="#cb193-5" aria-hidden="true" tabindex="-1"></a>quantity q <span class="op">=</span> make_length<span class="op">(</span>v<span class="op">)</span>;  <span class="co">// Compile-time error</span></span></code></pre></div>
<div class="sourceCode" id="cb194"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb194-1"><a href="#cb194-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>Representation T<span class="op">&gt;</span></span>
<span id="cb194-2"><a href="#cb194-2" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> make_length<span class="op">(</span>T v<span class="op">)</span> <span class="op">{</span> <span class="cf">return</span> v <span class="op">*</span> si<span class="op">::</span>metre; <span class="op">}</span></span>
<span id="cb194-3"><a href="#cb194-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb194-4"><a href="#cb194-4" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> v <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> m;</span>
<span id="cb194-5"><a href="#cb194-5" aria-hidden="true" tabindex="-1"></a>quantity q <span class="op">=</span> make_length<span class="op">(</span>v<span class="op">)</span>;  <span class="co">// Compile-time error</span></span></code></pre></div>
<h3 data-number="17.2.4" id="limitations-of-systems-of-quantities"><span class="header-section-number">17.2.4</span> Limitations of systems of
quantities<a href="#limitations-of-systems-of-quantities" class="self-link"></a></h3>
<p>As stated before, modeling systems of quantities and various
quantities of the same kind significantly improves the safety of the
project. However, it is essential to mention here that such modeling is
not ideal and there might be some pitfalls and surprises associated with
some corner cases.</p>
<h4 data-number="17.2.4.1" id="allowing-irrational-quantity-combinations"><span class="header-section-number">17.2.4.1</span> Allowing irrational
quantity combinations<a href="#allowing-irrational-quantity-combinations" class="self-link"></a></h4>
<p>Everyone probably agrees that multiplying two <em>lengths</em> is an
<em>area</em>, and that area should be implicitly convertible to the
result of such a multiplication:</p>
<div class="sourceCode" id="cb195"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb195-1"><a href="#cb195-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>length <span class="op">*</span> isq<span class="op">::</span>length, isq<span class="op">::</span>area<span class="op">))</span>;</span>
<span id="cb195-2"><a href="#cb195-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>area, isq<span class="op">::</span>length <span class="op">*</span> isq<span class="op">::</span>length<span class="op">))</span>;</span></code></pre></div>
<p>Also, probably no one would be surprised by the fact that the
multiplication of <em>width</em> and <em>height</em> is also convertible
to <em>area</em>. Still, the reverse operation is not valid in this
case. Not every <em>area</em> is an <em>area</em> over <em>width</em>
and <em>height</em>, so we need an explicit cast to force such a
conversion:</p>
<div class="sourceCode" id="cb196"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb196-1"><a href="#cb196-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>width <span class="op">*</span> isq<span class="op">::</span>height, isq<span class="op">::</span>area<span class="op">))</span>;</span>
<span id="cb196-2"><a href="#cb196-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(!</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>area, isq<span class="op">::</span>width <span class="op">*</span> isq<span class="op">::</span>height<span class="op">))</span>;</span>
<span id="cb196-3"><a href="#cb196-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>explicitly_convertible<span class="op">(</span>isq<span class="op">::</span>area, isq<span class="op">::</span>width <span class="op">*</span> isq<span class="op">::</span>height<span class="op">))</span>;</span></code></pre></div>
<p>However, it might be surprising to some that the similar behavior
will also be observed for the product of two <em>heights</em>:</p>
<div class="sourceCode" id="cb197"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb197-1"><a href="#cb197-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>height <span class="op">*</span> isq<span class="op">::</span>height, isq<span class="op">::</span>area<span class="op">))</span>;</span>
<span id="cb197-2"><a href="#cb197-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(!</span>implicitly_convertible<span class="op">(</span>isq<span class="op">::</span>area, isq<span class="op">::</span>height <span class="op">*</span> isq<span class="op">::</span>height<span class="op">))</span>;</span>
<span id="cb197-3"><a href="#cb197-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>explicitly_convertible<span class="op">(</span>isq<span class="op">::</span>area, isq<span class="op">::</span>height <span class="op">*</span> isq<span class="op">::</span>height<span class="op">))</span>;</span></code></pre></div>
<p>For humans, it is hard to imagine how two <em>heights</em> form an
<em>area</em>, but the library’s logic has no way to prevent such
operations.</p>
<h4 data-number="17.2.4.2" id="arithmetic-and-compatibility-of-quantities-of-dimension-one"><span class="header-section-number">17.2.4.2</span> Arithmetic and
compatibility of quantities of dimension one<a href="#arithmetic-and-compatibility-of-quantities-of-dimension-one" class="self-link"></a></h4>
<p>Some pitfalls might also arise when dealing with quantities of
dimension one (also known as dimensionless quantities).</p>
<p>If we divide two quantities of the same kind, we end up with a
quantity of dimension one. For example, we can divide two
<em>lengths</em> to get a <em>slope of the ramp</em> or two
<em>durations</em> to get the <em>clock accuracy</em>. Those ratios mean
something fundamentally different, but from the dimensional analysis
standpoint, they are mutually comparable.</p>
<p>The above means that the following code is valid:</p>
<div class="sourceCode" id="cb198"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb198-1"><a href="#cb198-1" aria-hidden="true" tabindex="-1"></a>quantity q1 <span class="op">=</span> <span class="dv">1</span> <span class="op">*</span> m <span class="op">/</span> <span class="op">(</span><span class="dv">10</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> us <span class="op">/</span> <span class="op">(</span><span class="dv">1</span> <span class="op">*</span> h<span class="op">)</span>;</span>
<span id="cb198-2"><a href="#cb198-2" aria-hidden="true" tabindex="-1"></a>quantity q2 <span class="op">=</span> isq<span class="op">::</span>length<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">/</span> isq<span class="op">::</span>length<span class="op">(</span><span class="dv">10</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">+</span> isq<span class="op">::</span>time<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> us<span class="op">)</span> <span class="op">/</span> isq<span class="op">::</span>time<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> h<span class="op">)</span>;</span>
<span id="cb198-3"><a href="#cb198-3" aria-hidden="true" tabindex="-1"></a>quantity q3 <span class="op">=</span> isq<span class="op">::</span>height<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">/</span> isq<span class="op">::</span>length<span class="op">(</span><span class="dv">10</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">+</span> isq<span class="op">::</span>time<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> us<span class="op">)</span> <span class="op">/</span> isq<span class="op">::</span>time<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> h<span class="op">)</span>;</span></code></pre></div>
<p>The fact that the above code compiles fine might again be surprising
to some users of such a library. The result of all such quantity
equations is a <code class="sourceCode cpp">dimensionless</code>
quantity as it is the root of this hierarchy tree.</p>
<p>Now, let’s try to convert such results to some quantities of
dimension one. The <code class="sourceCode cpp">q1</code> was obtained
from the expression that only used units in the equation, which means
that the actual result of it is a quantity of <code class="sourceCode cpp">kind_of<span class="op">&lt;</span>dimensionless<span class="op">&gt;</span></code>,
which behaves like any quantity from the tree. Because of it, all of the
below will compile for <code class="sourceCode cpp">q1</code>:</p>
<div class="sourceCode" id="cb199"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb199-1"><a href="#cb199-1" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>si<span class="op">::</span>metre <span class="op">/</span> si<span class="op">::</span>metre<span class="op">&gt;</span> ok1 <span class="op">=</span> q1;</span>
<span id="cb199-2"><a href="#cb199-2" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;(</span>isq<span class="op">::</span>length <span class="op">/</span> isq<span class="op">::</span>length<span class="op">)[</span>m <span class="op">/</span> m<span class="op">]&gt;</span> ok2 <span class="op">=</span> q1;</span>
<span id="cb199-3"><a href="#cb199-3" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;(</span>isq<span class="op">::</span>height <span class="op">/</span> isq<span class="op">::</span>length<span class="op">)[</span>m <span class="op">/</span> m<span class="op">]&gt;</span> ok3 <span class="op">=</span> q1;</span></code></pre></div>
<p>For <code class="sourceCode cpp">q2</code> and
<code class="sourceCode cpp">q3</code>, the two first conversions also
succeed. The first one passes because all quantities of a kind are
convertible to such kind. The type of the second quantity is <code class="sourceCode cpp">quantity<span class="op">&lt;</span>dimensionless<span class="op">[</span>one<span class="op">]&gt;</span></code>
in disguise. Such a quantity is a root of the kind tree, so again, all
the quantities from such a tree are convertible to it.</p>
<p>The third conversion fails in both cases, though. Not every
dimensionless quantity is a result of dividing height and length, so an
explicit conversion would be needed to force it to work.</p>
<div class="sourceCode" id="cb200"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb200-1"><a href="#cb200-1" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>si<span class="op">::</span>metre <span class="op">/</span> si<span class="op">::</span>metre<span class="op">&gt;</span> ok4 <span class="op">=</span> q2;</span>
<span id="cb200-2"><a href="#cb200-2" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;(</span>isq<span class="op">::</span>length <span class="op">/</span> isq<span class="op">::</span>length<span class="op">)[</span>m <span class="op">/</span> m<span class="op">]&gt;</span> ok5 <span class="op">=</span> q2;</span>
<span id="cb200-3"><a href="#cb200-3" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;(</span>isq<span class="op">::</span>height <span class="op">/</span> isq<span class="op">::</span>length<span class="op">)[</span>m <span class="op">/</span> m<span class="op">]&gt;</span> bad1 <span class="op">=</span> q2;  <span class="co">// Compile-time error</span></span>
<span id="cb200-4"><a href="#cb200-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb200-5"><a href="#cb200-5" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>si<span class="op">::</span>metre <span class="op">/</span> si<span class="op">::</span>metre<span class="op">&gt;</span> ok6 <span class="op">=</span> q3;</span>
<span id="cb200-6"><a href="#cb200-6" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;(</span>isq<span class="op">::</span>length <span class="op">/</span> isq<span class="op">::</span>length<span class="op">)[</span>m <span class="op">/</span> m<span class="op">]&gt;</span> ok7 <span class="op">=</span> q3;</span>
<span id="cb200-7"><a href="#cb200-7" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;(</span>isq<span class="op">::</span>height <span class="op">/</span> isq<span class="op">::</span>length<span class="op">)[</span>m <span class="op">/</span> m<span class="op">]&gt;</span> bad2 <span class="op">=</span> q3;  <span class="co">// Compile-time error</span></span></code></pre></div>
<h3 data-number="17.2.5" id="potential-surprises-while-working-with-temperatures"><span class="header-section-number">17.2.5</span> Potential surprises while
working with temperatures<a href="#potential-surprises-while-working-with-temperatures" class="self-link"></a></h3>
<p><em>Temperature</em> support is one the most challenging parts of any
physical quantities and units library design. This is why it is probably
reasonable to dedicate a chapter to this subject to describe how they
are intended to work and what are the potential pitfalls or
surprises.</p>
<p>First, let’s run the following code:</p>
<div class="sourceCode" id="cb201"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb201-1"><a href="#cb201-1" aria-hidden="true" tabindex="-1"></a>quantity q1 <span class="op">=</span> delta<span class="op">&lt;</span>isq<span class="op">::</span>thermodynamic_temperature<span class="op">[</span>K<span class="op">]&gt;(</span><span class="fl">30.</span><span class="op">)</span>;</span>
<span id="cb201-2"><a href="#cb201-2" aria-hidden="true" tabindex="-1"></a>quantity q2 <span class="op">=</span> delta<span class="op">&lt;</span>isq<span class="op">::</span>Celsius_temperature<span class="op">[</span>deg_C<span class="op">]&gt;(</span><span class="fl">30.</span><span class="op">)</span>;</span>
<span id="cb201-3"><a href="#cb201-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb201-4"><a href="#cb201-4" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;q1: {}, {}, {}&quot;</span>, q1, q1<span class="op">.</span>in<span class="op">(</span>deg_C<span class="op">)</span>, q1<span class="op">.</span>in<span class="op">(</span>deg_F<span class="op">))</span>;</span>
<span id="cb201-5"><a href="#cb201-5" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;q2: {}, {}, {}&quot;</span>, q2<span class="op">.</span>in<span class="op">(</span>K<span class="op">)</span>, q2, q2<span class="op">.</span>in<span class="op">(</span>deg_F<span class="op">))</span>;</span></code></pre></div>
<p>This outputs:</p>
<pre class="text"><code>q1: 30 K, 30 ℃, 54 ℉
q2: 30 K, 30 ℃, 54 ℉</code></pre>
<p>Also doing the following:</p>
<div class="sourceCode" id="cb202"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb202-1"><a href="#cb202-1" aria-hidden="true" tabindex="-1"></a>quantity q3 <span class="op">=</span> isq<span class="op">::</span>Celsius_temperature<span class="op">(</span>q1<span class="op">)</span>;</span>
<span id="cb202-2"><a href="#cb202-2" aria-hidden="true" tabindex="-1"></a>quantity q4 <span class="op">=</span> isq<span class="op">::</span>thermodynamic_temperature<span class="op">(</span>q2<span class="op">)</span>;</span></code></pre></div>
<p>outputs:</p>
<pre class="text"><code>q3: 30 K
q4: 30 ℃</code></pre>
<p>Even though <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> provides dedicated
quantity types for <em>thermodynamic temperature</em> and <em>Celsius
temperature</em>, it explicitly states in the description of the first
one:</p>
<blockquote>
<p>Differences of thermodynamic temperatures or changes may be expressed
either in kelvin, symbol K, or in degrees Celsius, symbol °C</p>
</blockquote>
<p>In the description of the second quantity type, we can read:</p>
<blockquote>
<p>The unit degree Celsius is a special name for the kelvin for use in
stating values of Celsius temperature. The unit degree Celsius is by
definition equal in magnitude to the kelvin. A difference or interval of
temperature may be expressed in kelvin or in degrees Celsius.</p>
</blockquote>
<p>As the <code class="sourceCode cpp">quantity</code> is a differential
quantity type, it is okay to use any <em>temperature</em> unit for
those, and the results should differ only by the conversion factor. No
offset should be applied here to convert between the origins of
different unit scales.</p>
<p>It is important to mention here that the existence of <em>Celsius
temperature</em> quantity type in <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> is controversial.</p>
<p><span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> (part 1) says:</p>
<blockquote>
<p>The system of quantities presented in this document is named the
International System of Quantities (ISQ), in all languages. This name
was not used in ISO 31 series, from which the present harmonized series
has evolved. However, the ISQ does appear in ISO/IEC Guide 99 and is the
system of quantities underlying the International System of Units,
denoted “SI”, in all languages according to the SI Brochure.</p>
</blockquote>
<p>According to the <span class="citation" data-cites="ISO-GUIDE">[<a href="https://www.iso.org/obp/ui#iso:std:iso-iec:guide:99" role="doc-biblioref">ISO/IEC Guide 99</a>]</span>, a system of
quantities is a “set of quantities together with a set of
non-contradictory equations relating those quantities”. It also defines
the system of units as “set of base units and derived units, together
with their multiples and submultiples, defined in accordance with given
rules, for a given system of quantities”.</p>
<p>To say it explicitly, the system of quantities should not assume or
use any specific units in its definitions. It is essential as various
systems of units can be defined on top of it, and none of those should
be favored.</p>
<p>However, the <em>Celsius temperature</em> quantity type is defined in
<span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> (part 5) as:</p>
<blockquote>
<p>temperature difference from the thermodynamic temperature of the ice
point is called the Celsius temperature <span class="math inline">\(t\)</span>, which is defined by the quantity
equation:</p>
<p><span class="math inline">\(t = T − T_0\)</span></p>
<p>where <span class="math inline">\(T\)</span> is thermodynamic
temperature (item 5-1) and <span class="math inline">\(T_0 =
273,15\:K\)</span></p>
</blockquote>
<p><em>Celsius temperature</em> is an exceptional quantity in the ISQ as
it uses specific SI units in its definition. This breaks the direction
of dependencies between systems of quantities and units and imposes
significant implementation issues.</p>
<p>As <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> implementation clearly
distinguishes between systems of quantities and units and assumes that
the latter directly depends on the former, this quantity definition does
not enforce any units or offsets. It is defined as just a more
specialized quantity of the kind of <em>thermodynamic temperature</em>.
We have added the Celsius temperature quantity type for completeness and
to gain more experience with it. Still, maybe a good decision would be
to skip it in the standardization process to not confuse users.</p>
<p>After quoting the official definitions and terms and presenting how
quantities work, let’s discuss quantity points. Those describe specific
points and are measured relative to a provided origin:</p>
<div class="sourceCode" id="cb203"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb203-1"><a href="#cb203-1" aria-hidden="true" tabindex="-1"></a>quantity_point qp1 <span class="op">=</span> si<span class="op">::</span>zeroth_kelvin <span class="op">+</span> delta<span class="op">&lt;</span>isq<span class="op">::</span>thermodynamic_temperature<span class="op">[</span>K<span class="op">]&gt;(</span><span class="fl">300.</span><span class="op">)</span>;</span>
<span id="cb203-2"><a href="#cb203-2" aria-hidden="true" tabindex="-1"></a>quantity_point qp2 <span class="op">=</span> si<span class="op">::</span>zeroth_degree_Celsius <span class="op">+</span> delta<span class="op">&lt;</span>isq<span class="op">::</span>Celsius_temperature<span class="op">[</span>deg_C<span class="op">]&gt;(</span><span class="fl">30.</span><span class="op">)</span>;</span></code></pre></div>
<p>The above provides two different temperature points. The first one is
measured as a relative quantity to the absolute zero
(<code class="sourceCode cpp"><span class="dv">0</span> K</code>), and
the second one stores the value relative to the ice point being the
beginning of the degree Celsius scale.</p>
<p>Thanks to the
<code class="sourceCode cpp">default_point_origin</code> used in the
<code class="sourceCode cpp">quantity_point</code> class template
definition, and benefiting from the fact that units of temperature have
point origins provided in their definitions, we can obtain exactly the
same quantity points with the following:</p>
<div class="sourceCode" id="cb204"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb204-1"><a href="#cb204-1" aria-hidden="true" tabindex="-1"></a>quantity_point qp3 <span class="op">=</span> absolute<span class="op">&lt;</span>isq<span class="op">::</span>thermodynamic_temperature<span class="op">[</span>K<span class="op">]&gt;(</span><span class="fl">300.</span><span class="op">)</span>;</span>
<span id="cb204-2"><a href="#cb204-2" aria-hidden="true" tabindex="-1"></a>quantity_point qp4 <span class="op">=</span> absolute<span class="op">&lt;</span>isq<span class="op">::</span>Celsius_temperature<span class="op">[</span>deg_C<span class="op">]&gt;(</span><span class="fl">30.</span><span class="op">)</span>;</span></code></pre></div>
<p>It is essential to understand that the origins of quantity points
will not change if we convert their units:</p>
<div class="sourceCode" id="cb205"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb205-1"><a href="#cb205-1" aria-hidden="true" tabindex="-1"></a>quantity_point qp3 <span class="op">=</span> qp1<span class="op">.</span>in<span class="op">(</span>deg_C<span class="op">)</span>;</span>
<span id="cb205-2"><a href="#cb205-2" aria-hidden="true" tabindex="-1"></a>quantity_point qp4 <span class="op">=</span> qp2<span class="op">.</span>in<span class="op">(</span>K<span class="op">)</span>;</span>
<span id="cb205-3"><a href="#cb205-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb205-4"><a href="#cb205-4" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>std<span class="op">::</span>is_same_v<span class="op">&lt;</span><span class="kw">decltype</span><span class="op">(</span>qp3<span class="op">.</span>point_origin<span class="op">)</span>, <span class="kw">decltype</span><span class="op">(</span>si<span class="op">::</span>absolute_zero<span class="op">)&gt;)</span>;</span>
<span id="cb205-5"><a href="#cb205-5" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>std<span class="op">::</span>is_same_v<span class="op">&lt;</span><span class="kw">decltype</span><span class="op">(</span>qp4<span class="op">.</span>point_origin<span class="op">)</span>, <span class="kw">decltype</span><span class="op">(</span>si<span class="op">::</span>ice_point<span class="op">)&gt;)</span>;</span></code></pre></div>
<p>If we want to obtain the values of quantities in specific units
relative to the origins of their scales, we have to be explicit. We can
do it in several ways:</p>
<ol type="1">
<li><p>Subtracting points to obtain the quantity:</p>
<div class="sourceCode" id="cb206"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb206-1"><a href="#cb206-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;qp1: {}, {}, {}&quot;</span>,</span>
<span id="cb206-2"><a href="#cb206-2" aria-hidden="true" tabindex="-1"></a>            qp1 <span class="op">-</span> si<span class="op">::</span>zeroth_kelvin,</span>
<span id="cb206-3"><a href="#cb206-3" aria-hidden="true" tabindex="-1"></a>            <span class="op">(</span>qp1 <span class="op">-</span> si<span class="op">::</span>zeroth_degree_Celsius<span class="op">).</span>in<span class="op">(</span>deg_C<span class="op">)</span>,</span>
<span id="cb206-4"><a href="#cb206-4" aria-hidden="true" tabindex="-1"></a>            <span class="op">(</span>qp1 <span class="op">-</span> usc<span class="op">::</span>zeroth_degree_Fahrenheit<span class="op">).</span>in<span class="op">(</span>deg_F<span class="op">))</span>;</span>
<span id="cb206-5"><a href="#cb206-5" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;qp2: {::N[.2f]}, {}, {}&quot;</span>,</span>
<span id="cb206-6"><a href="#cb206-6" aria-hidden="true" tabindex="-1"></a>            <span class="op">(</span>qp2 <span class="op">-</span> si<span class="op">::</span>zeroth_kelvin<span class="op">).</span>in<span class="op">(</span>K<span class="op">)</span>,</span>
<span id="cb206-7"><a href="#cb206-7" aria-hidden="true" tabindex="-1"></a>            qp2 <span class="op">-</span> si<span class="op">::</span>zeroth_degree_Celsius,</span>
<span id="cb206-8"><a href="#cb206-8" aria-hidden="true" tabindex="-1"></a>            <span class="op">(</span>qp2 <span class="op">-</span> usc<span class="op">::</span>zeroth_degree_Fahrenheit<span class="op">).</span>in<span class="op">(</span>deg_F<span class="op">))</span>;</span></code></pre></div></li>
<li><p>Using <code class="sourceCode cpp">quantity_from<span class="op">(</span>PointOrigin<span class="op">)</span></code>
member function:</p>
<div class="sourceCode" id="cb207"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb207-1"><a href="#cb207-1" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;qp1: {}, {}, {}&quot;</span>,</span>
<span id="cb207-2"><a href="#cb207-2" aria-hidden="true" tabindex="-1"></a>            qp1<span class="op">.</span>quantity_from<span class="op">(</span>si<span class="op">::</span>zeroth_kelvin<span class="op">)</span>,</span>
<span id="cb207-3"><a href="#cb207-3" aria-hidden="true" tabindex="-1"></a>            qp1<span class="op">.</span>quantity_from<span class="op">(</span>si<span class="op">::</span>zeroth_degree_Celsius<span class="op">).</span>in<span class="op">(</span>deg_C<span class="op">)</span>,</span>
<span id="cb207-4"><a href="#cb207-4" aria-hidden="true" tabindex="-1"></a>            qp1<span class="op">.</span>quantity_from<span class="op">(</span>usc<span class="op">::</span>zeroth_degree_Fahrenheit<span class="op">).</span>in<span class="op">(</span>deg_F<span class="op">))</span>;</span>
<span id="cb207-5"><a href="#cb207-5" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;qp2: {::N[:.2f]}, {}, {}&quot;</span>,</span>
<span id="cb207-6"><a href="#cb207-6" aria-hidden="true" tabindex="-1"></a>            qp2<span class="op">.</span>quantity_from<span class="op">(</span>si<span class="op">::</span>zeroth_kelvin<span class="op">).</span>in<span class="op">(</span>K<span class="op">)</span>,</span>
<span id="cb207-7"><a href="#cb207-7" aria-hidden="true" tabindex="-1"></a>            qp2<span class="op">.</span>quantity_from<span class="op">(</span>si<span class="op">::</span>zeroth_degree_Celsius<span class="op">)</span>,</span>
<span id="cb207-8"><a href="#cb207-8" aria-hidden="true" tabindex="-1"></a>            qp2<span class="op">.</span>quantity_from<span class="op">(</span>usc<span class="op">::</span>zeroth_degree_Fahrenheit<span class="op">).</span>in<span class="op">(</span>deg_F<span class="op">))</span>;</span></code></pre></div></li>
<li><p>Using <code class="sourceCode cpp">quantity_from_zero<span class="op">()</span></code>
member function that will use the point origin defined for the current
unit:</p>
<div class="sourceCode" id="cb208"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb208-1"><a href="#cb208-1" aria-hidden="true" tabindex="-1"></a>fmt<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;qp1: {}, {}, {}&quot;</span>,</span>
<span id="cb208-2"><a href="#cb208-2" aria-hidden="true" tabindex="-1"></a>            qp1<span class="op">.</span>quantity_from_zero<span class="op">()</span>,</span>
<span id="cb208-3"><a href="#cb208-3" aria-hidden="true" tabindex="-1"></a>            qp1<span class="op">.</span>in<span class="op">(</span>deg_C<span class="op">).</span>quantity_from_zero<span class="op">()</span>,</span>
<span id="cb208-4"><a href="#cb208-4" aria-hidden="true" tabindex="-1"></a>            qp1<span class="op">.</span>in<span class="op">(</span>deg_F<span class="op">).</span>quantity_from_zero<span class="op">())</span>;</span>
<span id="cb208-5"><a href="#cb208-5" aria-hidden="true" tabindex="-1"></a>fmt<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;qp2: {::N[.2f]}, {}, {}&quot;</span>,</span>
<span id="cb208-6"><a href="#cb208-6" aria-hidden="true" tabindex="-1"></a>            qp2<span class="op">.</span>in<span class="op">(</span>K<span class="op">).</span>quantity_from_zero<span class="op">()</span>,</span>
<span id="cb208-7"><a href="#cb208-7" aria-hidden="true" tabindex="-1"></a>            qp2<span class="op">.</span>quantity_from_zero<span class="op">()</span>,</span>
<span id="cb208-8"><a href="#cb208-8" aria-hidden="true" tabindex="-1"></a>            qp2<span class="op">.</span>in<span class="op">(</span>deg_F<span class="op">).</span>quantity_from_zero<span class="op">())</span>;</span></code></pre></div></li>
</ol>
<p>All of the cases above will provide the same output:</p>
<pre class="text"><code>qp1: 300 K, 26.85 ℃, 80.33 ℉
qp2: 303.15 K, 30 ℃, 86 ℉</code></pre>
<p>Of course, all other combinations are also possible. For example,
nothing should prevent us from checking how many degrees of Celsius are
there starting from the
<code class="sourceCode cpp">zeroth_degree_Fahrenheit</code> for a
quantity point using kelvins with the
<code class="sourceCode cpp">zeroth_kelvin</code> origin:</p>
<div class="sourceCode" id="cb209"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb209-1"><a href="#cb209-1" aria-hidden="true" tabindex="-1"></a>quantity q <span class="op">=</span> qp1<span class="op">.</span>quantity_from<span class="op">(</span>usc<span class="op">::</span>zeroth_degree_Fahrenheit<span class="op">).</span>in<span class="op">(</span>deg_C<span class="op">)</span>;</span></code></pre></div>
<h3 data-number="17.2.6" id="structural-types"><span class="header-section-number">17.2.6</span> Structural types<a href="#structural-types" class="self-link"></a></h3>
<p>The <code class="sourceCode cpp">quantity</code> and
<code class="sourceCode cpp">quantity_point</code> class templates are
structural types to allow them to be passed as template arguments. For
example, we can write the following:</p>
<div class="sourceCode" id="cb210"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb210-1"><a href="#cb210-1" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="kw">struct</span> amsterdam_sea_level <span class="kw">final</span> <span class="op">:</span> absolute_point_origin<span class="op">&lt;</span>isq<span class="op">::</span>altitude<span class="op">&gt;</span> <span class="op">{</span></span>
<span id="cb210-2"><a href="#cb210-2" aria-hidden="true" tabindex="-1"></a><span class="op">}</span> amsterdam_sea_level;</span>
<span id="cb210-3"><a href="#cb210-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb210-4"><a href="#cb210-4" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="kw">struct</span> mediterranean_sea_level <span class="kw">final</span> <span class="op">:</span> relative_point_origin<span class="op">&lt;</span>amsterdam_sea_level <span class="op">+</span> isq<span class="op">::</span>altitude<span class="op">(-</span><span class="dv">27</span> <span class="op">*</span> cm<span class="op">)&gt;</span> <span class="op">{</span></span>
<span id="cb210-5"><a href="#cb210-5" aria-hidden="true" tabindex="-1"></a><span class="op">}</span> mediterranean_sea_level;</span>
<span id="cb210-6"><a href="#cb210-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb210-7"><a href="#cb210-7" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> altitude_DE <span class="op">=</span> quantity_point<span class="op">&lt;</span>isq<span class="op">::</span>altitude<span class="op">[</span>m<span class="op">]</span>, amsterdam_sea_level<span class="op">&gt;</span>;</span>
<span id="cb210-8"><a href="#cb210-8" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> altitude_CH <span class="op">=</span> quantity_point<span class="op">&lt;</span>isq<span class="op">::</span>altitude<span class="op">[</span>m<span class="op">]</span>, mediterranean_sea_level<span class="op">&gt;</span>;</span></code></pre></div>
<p>Unfortunately, current language rules require that all member data of
a structural type are public. This could be considered a safety issue.
We try really hard to provide unit-safe interfaces, but at the same time
expose the public “naked” data member that can be freely read or
manipulated by anyone.</p>
<p>Hopefully, this requirement on structural types will be relaxed
before the library gets standardized.</p>
<h1 data-number="18" id="design-details-and-rationale"><span class="header-section-number">18</span> Design details and rationale<a href="#design-details-and-rationale" class="self-link"></a></h1>
<p><em>Note: This chapter provides more design details and rationale for
them. It tries to not repeat information already provided in the
previous chapters so a reader is expected to be familar with them
already.</em></p>
<h2 data-number="18.1" id="conventions"><span class="header-section-number">18.1</span> Conventions<a href="#conventions" class="self-link"></a></h2>
<h3 data-number="18.1.1" id="new-style-of-definitions"><span class="header-section-number">18.1.1</span> New style of definitions<a href="#new-style-of-definitions" class="self-link"></a></h3>
<p>Before we dig into details, it is worth reminding that compile-time
errors generation is the most important feature of the library. If we
did not make errors in our code and could handle quantities and write
all the conversions correctly by hand, such a library would be of little
use. We are humans and make mistakes.</p>
<p>Also, the library is about to be used by many engineers who use C++
as a tool to get their work done and are not C++ template
metaprogramming experts. This is why the compilation errors generated by
this library should be as easy to understand as possible. Users should
be able to quickly identify the cause of the issue and understand how to
fix it.</p>
<p>With the above in mind, the <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> library decided to use a
rather unusual pattern to define entities, but it proved really
successful, and we have received great feedback from users.</p>
<p>To improve the readability of compiler errors and types presented in
a debugger, and to make it easier to correlate them with a user’s
written code, a new idiom in the library is to use the same identifier
for a tag type and its instance.</p>
<p>Here is how we define <code class="sourceCode cpp">metre</code> and
<code class="sourceCode cpp">second</code> <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span> base units:</p>
<div class="sourceCode" id="cb211"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb211-1"><a href="#cb211-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> metre <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;m&quot;</span>, kind_of<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">&gt;&gt;</span> <span class="op">{}</span> metre;</span>
<span id="cb211-2"><a href="#cb211-2" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> second <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;s&quot;</span>, kind_of<span class="op">&lt;</span>isq<span class="op">::</span>time<span class="op">&gt;&gt;</span> <span class="op">{}</span> second;</span></code></pre></div>
<p>Please note that the above reuses the same identifier for a type and
its value. The rationale behind this is that:</p>
<ul>
<li>Users always work with values and never have to spell the name of
such a type.</li>
<li>The types appear in the compilation errors and during
debugging.</li>
</ul>
<p>Ordinary users don’t care about what is a type and what is a value in
the error message. They want to be able to easily read and analyze the
error message and understand where in the code they made the calculation
error.</p>
<p>Unfortunately, we can’t be consistent here. The C++ language rules do
not allow to use the same identifier for a template and the object
resulting from its instantiation. For such cases, we decided to postfix
the template identifier with <code class="sourceCode cpp">_</code>.</p>
<p>Let’s compare the readability of the current practices with an
alternative and popular usage of <code class="sourceCode cpp">_t</code>
postfixes for type identifiers (after removing the project namespace
prefix):</p>
<p>Current practice:</p>
<table>
<colgroup>
<col style="width: 20%" />
<col style="width: 80%" />
</colgroup>
<thead>
<tr class="header">
<th><div style="text-align:center">
<strong>User’s code</strong>
</div></th>
<th><div style="text-align:center">
<strong>Resulting type</strong>
</div></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><code class="sourceCode cpp">quantity<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">&gt;</span></code></td>
<td><code class="sourceCode cpp">quantity<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">{}</span>, <span class="dt">double</span><span class="op">&gt;</span></code></td>
</tr>
<tr class="even">
<td><code class="sourceCode cpp">quantity<span class="op">&lt;</span>si<span class="op">::</span>metre <span class="op">/</span> si<span class="op">::</span>second<span class="op">&gt;</span></code></td>
<td><code class="sourceCode cpp">quantity<span class="op">&lt;</span>derived_unit<span class="op">&lt;</span>si<span class="op">::</span>metre, per<span class="op">&lt;</span>si<span class="op">::</span>second<span class="op">&gt;&gt;{}</span>, <span class="dt">double</span><span class="op">&gt;</span></code></td>
</tr>
<tr class="odd">
<td><code class="sourceCode cpp">isq<span class="op">::</span>speed<span class="op">(</span><span class="dv">50</span> <span class="op">*</span> km <span class="op">/</span> h<span class="op">)</span> <span class="op">/</span> <span class="op">(</span><span class="dv">5</span> <span class="op">*</span> s<span class="op">)</span></code></td>
<td><code class="sourceCode cpp">quantity<span class="op">&lt;</span>reference<span class="op">&lt;</span>derived_quantity_spec<span class="op">&lt;</span>isq<span class="op">::</span>speed, per<span class="op">&lt;</span>isq<span class="op">::</span>time<span class="op">&gt;&gt;</span>, derived_unit<span class="op">&lt;</span>si<span class="op">::</span>kilo_<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">&gt;</span>, per<span class="op">&lt;</span>non_si<span class="op">::</span>hour, si<span class="op">::</span>second<span class="op">&gt;&gt;&gt;{}</span>, <span class="dt">int</span><span class="op">&gt;</span></code></td>
</tr>
</tbody>
</table>
<p>With <code class="sourceCode cpp">_t</code> postfixes:</p>
<table>
<colgroup>
<col style="width: 18%" />
<col style="width: 81%" />
</colgroup>
<thead>
<tr class="header">
<th><div style="text-align:center">
<strong>User’s code</strong>
</div></th>
<th><div style="text-align:center">
<strong>Resulting type</strong>
</div></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><code class="sourceCode cpp">quantity<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">&gt;</span></code></td>
<td><code class="sourceCode cpp">quantity<span class="op">&lt;</span>si<span class="op">::</span>metre_t<span class="op">{}</span>, <span class="dt">double</span><span class="op">&gt;</span></code></td>
</tr>
<tr class="even">
<td><code class="sourceCode cpp">quantity<span class="op">&lt;</span>si<span class="op">::</span>metre <span class="op">/</span> si<span class="op">::</span>second<span class="op">&gt;</span></code></td>
<td><code class="sourceCode cpp">quantity<span class="op">&lt;</span>derived_unit<span class="op">&lt;</span>si<span class="op">::</span>metre_t, per<span class="op">&lt;</span>si<span class="op">::</span>second_t<span class="op">&gt;&gt;{}</span>, <span class="dt">double</span><span class="op">&gt;</span></code></td>
</tr>
<tr class="odd">
<td><code class="sourceCode cpp">isq<span class="op">::</span>speed<span class="op">(</span><span class="dv">50</span> <span class="op">*</span> km <span class="op">/</span> h<span class="op">)</span> <span class="op">/</span> <span class="op">(</span><span class="dv">5</span> <span class="op">*</span> s<span class="op">)</span></code></td>
<td><code class="sourceCode cpp">quantity<span class="op">&lt;</span>reference<span class="op">&lt;</span>derived_quantity_spec<span class="op">&lt;</span>isq<span class="op">::</span>speed_t, per<span class="op">&lt;</span>isq<span class="op">::</span><span class="dt">time_t</span><span class="op">&gt;&gt;</span>, derived_unit<span class="op">&lt;</span>si<span class="op">::</span>kilo_t<span class="op">&lt;</span>si<span class="op">::</span>metre_t<span class="op">&gt;</span>, per<span class="op">&lt;</span>non_si<span class="op">::</span>hour_t, si<span class="op">::</span>second_t<span class="op">&gt;&gt;&gt;{}</span>, <span class="dt">int</span><span class="op">&gt;</span></code></td>
</tr>
</tbody>
</table>
<p>To improve the types readability we also prefer to use type
identifiers for template parameters (if possible) rather than NTTPs
directly. Without it, the last type would look as follows:</p>
<table>
<colgroup>
<col style="width: 17%" />
<col style="width: 82%" />
</colgroup>
<thead>
<tr class="header">
<th><div style="text-align:center">
<strong>User’s code</strong>
</div></th>
<th><div style="text-align:center">
<strong>Resulting type</strong>
</div></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><code class="sourceCode cpp">isq<span class="op">::</span>speed<span class="op">(</span><span class="dv">50</span> <span class="op">*</span> km <span class="op">/</span> h<span class="op">)</span> <span class="op">/</span> <span class="op">(</span><span class="dv">5</span> <span class="op">*</span> s<span class="op">)</span></code></td>
<td><code class="sourceCode cpp">quantity<span class="op">&lt;</span>reference<span class="op">&lt;</span>derived_quantity_spec<span class="op">&lt;</span>isq<span class="op">::</span>speed_t<span class="op">{}</span>, per<span class="op">&lt;</span>isq<span class="op">::</span><span class="dt">time_t</span><span class="op">{}&gt;&gt;{}</span>, derived_unit<span class="op">&lt;</span>si<span class="op">::</span>kilo_t<span class="op">&lt;</span>si<span class="op">::</span>metre_t<span class="op">{}&gt;{}</span>, per<span class="op">&lt;</span>non_si<span class="op">::</span>hour_t<span class="op">{}</span>, si<span class="op">::</span>second_t<span class="op">{}&gt;&gt;{}&gt;{}</span>, <span class="dt">int</span><span class="op">&gt;</span></code></td>
</tr>
</tbody>
</table>
<p>Moreover, to prevent possible issues in the library’s framework
compile-time logic, all of the library’s entities must be marked
<code class="sourceCode cpp"><span class="kw">final</span></code>. This
prevents the users from deriving their own strong types from them, which
would prevent expression template simplification of equivalent entities.
This constraint is enforced by the concepts in the library.</p>
<h3 data-number="18.1.2" id="strong-types-instead-of-aliases"><span class="header-section-number">18.1.2</span> Strong types instead of
aliases<a href="#strong-types-instead-of-aliases" class="self-link"></a></h3>
<p>Let’s look again at the above units definitions. Another essential
point to notice is that all the types describing entities in the library
are short, nicely named identifiers that derive from longer, more
verbose class template instantiations. This is really important to
improve the user experience while debugging the program or analyzing the
compilation error.</p>
<p><em>Note: Such a practice is rare in the industry. Some popular C++
physical units libraries generate enormously long error
messages.</em></p>
<h3 data-number="18.1.3" id="entities-composability"><span class="header-section-number">18.1.3</span> Entities composability<a href="#entities-composability" class="self-link"></a></h3>
<p>Many physical units libraries (in C++ or any other programming
language) assign strong types to library entities (e.g., derived units).
While <code class="sourceCode cpp">metre_per_second</code> as a type may
not look too scary, consider, for example, units of angular momentum. If
we followed this path, its coherent unit would look like
<code class="sourceCode cpp">kilogram_metre_sq_per_second</code>. Now,
consider how many scaled versions of this unit you would predefine in
the library to ensure that all users are happy with your choice? How
expensive would it be from the implementation point of view? How
expensive would it be to standardize?</p>
<p>This is why, in this library, we put a strong requirement to make
everything as composable as possible. For example, to create a quantity
with a unit of <em>speed</em>, one may write:</p>
<div class="sourceCode" id="cb212"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb212-1"><a href="#cb212-1" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>si<span class="op">::</span>metre <span class="op">/</span> si<span class="op">::</span>second<span class="op">&gt;</span> q;</span></code></pre></div>
<p>In case we use such a unit often and would prefer to have a handy
helper for it, we can always do something like this:</p>
<div class="sourceCode" id="cb213"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb213-1"><a href="#cb213-1" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="kw">auto</span> metre_per_second <span class="op">=</span> si<span class="op">::</span>metre <span class="op">/</span> si<span class="op">::</span>second;</span>
<span id="cb213-2"><a href="#cb213-2" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>metre_per_second<span class="op">&gt;</span> q;</span></code></pre></div>
<p>or choose any shorter identifier of our choice.</p>
<p>The unit composition works not only on the “unit-level”. We can
multiply or divide a quantity to get another type of quantity expressed
in a composed unit:</p>
<div class="sourceCode" id="cb214"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb214-1"><a href="#cb214-1" aria-hidden="true" tabindex="-1"></a>quantity pace <span class="op">=</span> <span class="op">(</span><span class="fl">4.</span> <span class="op">*</span> min <span class="op">+</span> <span class="fl">40.</span> <span class="op">*</span> s<span class="op">)</span> <span class="op">/</span> km;</span></code></pre></div>
<p>Coming back to the angular momentum case, thanks to the composability
of units, a user can create such a quantity in the following way:</p>
<div class="sourceCode" id="cb215"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb215-1"><a href="#cb215-1" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> <span class="kw">namespace</span> mp_units<span class="op">::</span>si<span class="op">::</span>unit_symbols;</span>
<span id="cb215-2"><a href="#cb215-2" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> q <span class="op">=</span> la_vector<span class="op">{</span><span class="dv">1</span>, <span class="dv">2</span>, <span class="dv">3</span><span class="op">}</span> <span class="op">*</span> isq<span class="op">::</span>angular_momentum<span class="op">[</span>kg <span class="op">*</span> m2 <span class="op">/</span> s<span class="op">]</span>;</span></code></pre></div>
<p>It is a much better solution. It is terse and easy to understand.
Please also notice how easy it is to obtain any scaled version of such a
unit (e.g., <code class="sourceCode cpp">mg <span class="op">*</span> square<span class="op">(</span>mm<span class="op">)</span> <span class="op">/</span> min</code>)
without having to introduce hundreds of types to predefine them.</p>
<h3 data-number="18.1.4" id="value-based-equations"><span class="header-section-number">18.1.4</span> Value-based equations<a href="#value-based-equations" class="self-link"></a></h3>
<p>This library is based on C++20, significantly improving user
experience. One such improvement is the usage of value-based
equations.</p>
<p>As we have learned above, the entities are being used as values in
the code, and they compose. Moreover, derived entities can be defined in
the library using such value-based equations. This is a considerable
improvement compared to what we can find in other physical units
libraries or what we have to deal with when we want to write some
equations for
<code class="sourceCode cpp">std<span class="op">::</span>ratio</code>.</p>
<p>For example, below are a few definitions of the <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span> derived units showing the power of
C++20 extensions to Non-Type Template Parameters, which allow us to
directly pass a result of the value-based unit equation to a class
template definition:</p>
<div class="sourceCode" id="cb216"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb216-1"><a href="#cb216-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> newton <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;N&quot;</span>, kilogram <span class="op">*</span> metre <span class="op">/</span> square<span class="op">(</span>second<span class="op">)&gt;</span> <span class="op">{}</span> newton;</span>
<span id="cb216-2"><a href="#cb216-2" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> pascal <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;Pa&quot;</span>, newton <span class="op">/</span> square<span class="op">(</span>metre<span class="op">)&gt;</span> <span class="op">{}</span> pascal;</span>
<span id="cb216-3"><a href="#cb216-3" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> joule <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;J&quot;</span>, newton <span class="op">*</span> metre<span class="op">&gt;</span> <span class="op">{}</span> joule;</span></code></pre></div>
<h3 data-number="18.1.5" id="framework-only-class-templates"><span class="header-section-number">18.1.5</span> Framework-only class
templates<a href="#framework-only-class-templates" class="self-link"></a></h3>
<p>Several proposed class templates like:</p>
<ul>
<li><code class="sourceCode cpp">derived_unit</code>,
<code class="sourceCode cpp">derived_dimension</code>,
<code class="sourceCode cpp">derived_quantity_spec</code>,</li>
<li><code class="sourceCode cpp">per</code>,
<code class="sourceCode cpp">power</code>,</li>
<li><code class="sourceCode cpp">kilo_</code> and other prefixes,</li>
<li><code class="sourceCode cpp">magnitude</code>,</li>
</ul>
<p>should not be explicitly instantiated by the user.</p>
<p>Those types are the results of running operators on objects and have
strict requirements on how the template arguments are provided. The
library instantiates such class templates in a particular way (i.e., the
arguments must be provided in the correct order). This logic might be
partially implementation-defined (e.g., the order of elements in a
numerator or denominator is sorted by type-id (whatever it means)). The
important part here is to keep the ordering rules consistent within a
specific implementation. Otherwise, the library cannot do its job
properly (e.g., units simplification will not work).</p>
<p>Here are some examples:</p>
<div class="sourceCode" id="cb217"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb217-1"><a href="#cb217-1" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="kw">auto</span> u1 <span class="op">=</span> kg <span class="op">*</span> m <span class="op">/</span> s2;</span>
<span id="cb217-2"><a href="#cb217-2" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="kw">auto</span> u2 <span class="op">=</span> kg <span class="op">*</span> <span class="op">(</span>m <span class="op">/</span> s2<span class="op">)</span>;</span>
<span id="cb217-3"><a href="#cb217-3" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="kw">auto</span> u3 <span class="op">=</span> kg <span class="op">/</span> s2 <span class="op">*</span> m;</span></code></pre></div>
<p>All of the above yield the same instantiation of the <code class="sourceCode cpp">derived_unit<span class="op">&lt;</span>si<span class="op">::</span>kilo_<span class="op">&lt;</span>si<span class="op">::</span>gram<span class="op">&gt;</span>, si<span class="op">::</span>metre, per<span class="op">&lt;</span>power<span class="op">&lt;</span>si<span class="op">::</span>second, <span class="dv">2</span><span class="op">&gt;&gt;&gt;</span></code>.</p>
<p>The user never needs to instantiate the class templates explicitly.
Allowing this can cause problems, as the user can make ordering errors.
Of course, we can constrain the class template to require arguments in a
particular order, but it will only slow down the compile times for every
instantiation by the library’s engine.</p>
<p>Please note that a user in this library always works with values of
tag types (e.g., unit), but the
<code class="sourceCode cpp">derived_unit</code> class template takes
those tag types as type parameters. This yields more readable types and
prevents users from instantiating the template by themselves.</p>
<p>Here is how units are defined:</p>
<div class="sourceCode" id="cb218"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb218-1"><a href="#cb218-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> second <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;s&quot;</span>, kind_of<span class="op">&lt;</span>isq<span class="op">::</span>time<span class="op">&gt;&gt;</span> <span class="op">{}</span> second;</span>
<span id="cb218-2"><a href="#cb218-2" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> metre <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;m&quot;</span>, kind_of<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">&gt;&gt;</span> <span class="op">{}</span> metre;</span>
<span id="cb218-3"><a href="#cb218-3" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> gram <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;g&quot;</span>, kind_of<span class="op">&lt;</span>isq<span class="op">::</span>mass<span class="op">&gt;&gt;</span> <span class="op">{}</span> gram;</span>
<span id="cb218-4"><a href="#cb218-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb218-5"><a href="#cb218-5" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> m <span class="op">=</span> metre;</span>
<span id="cb218-6"><a href="#cb218-6" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> s <span class="op">=</span> second;</span>
<span id="cb218-7"><a href="#cb218-7" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> g <span class="op">=</span> gram;</span>
<span id="cb218-8"><a href="#cb218-8" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> s2 <span class="op">=</span> square<span class="op">(</span>second<span class="op">)</span>;</span></code></pre></div>
<p>Because of the above, to explicitly instantiate a class template, a
user would need to type the following:</p>
<div class="sourceCode" id="cb219"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb219-1"><a href="#cb219-1" aria-hidden="true" tabindex="-1"></a>derived_unit<span class="op">&lt;</span>si<span class="op">::</span>kilo_<span class="op">&lt;</span><span class="kw">struct</span> si<span class="op">::</span>gram<span class="op">&gt;</span>, per<span class="op">&lt;</span>power<span class="op">&lt;</span><span class="kw">struct</span> si<span class="op">::</span>second, <span class="dv">2</span><span class="op">&gt;&gt;&gt;</span> u4;</span></code></pre></div>
<p>The usage of the explicit
<code class="sourceCode cpp"><span class="kw">struct</span></code>
keyword might be surprising to many users.</p>
<p>Also, when dealing with quantities, a user does need to spell a
unit’s type:</p>
<div class="sourceCode" id="cb220"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb220-1"><a href="#cb220-1" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> foo<span class="op">(</span>quantity<span class="op">&lt;</span>si<span class="op">::</span>kilo<span class="op">&lt;</span>si<span class="op">::</span>gram<span class="op">&gt;</span> <span class="op">*</span> si<span class="op">::</span>metre <span class="op">/</span> square<span class="op">(</span>si<span class="op">::</span>second<span class="op">)&gt;)</span> <span class="op">{}</span></span>
<span id="cb220-2"><a href="#cb220-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb220-3"><a href="#cb220-3" aria-hidden="true" tabindex="-1"></a>foo<span class="op">(</span><span class="fl">42.</span> <span class="op">*</span> kg <span class="op">*</span> m <span class="op">/</span> s2<span class="op">)</span>;</span></code></pre></div>
<p>The above instantiates a <code class="sourceCode cpp">quantity<span class="op">&lt;</span>derived_unit<span class="op">&lt;</span>si<span class="op">::</span>kilo_<span class="op">&lt;</span>si<span class="op">::</span>gram<span class="op">&gt;</span>, si<span class="op">::</span>metre, per<span class="op">&lt;</span>power<span class="op">&lt;</span>si<span class="op">::</span>second, <span class="dv">2</span><span class="op">&gt;&gt;&gt;{}</span>, <span class="dt">double</span><span class="op">&gt;</span></code>
behind the scenes.</p>
<p>Please note that in the above examples, all the class templates
<code class="sourceCode cpp">derived_unit</code>,
<code class="sourceCode cpp">per</code>,
<code class="sourceCode cpp">power</code>, and
<code class="sourceCode cpp">kilo_</code> have the same property. They
are well-defined identifiers that users expect to see in types presented
in the debugger or compilation errors. This is why they should not be
exposition-only and be regular members of the
<code class="sourceCode cpp">std</code> namespace. Every implementation
has to spell and use them in the same way.</p>
<p><span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> library decided to define
those class templates in the
<code class="sourceCode cpp">mp_units</code> namespace, but not export
them from the <code class="sourceCode cpp">mp_units<span class="op">.</span>core</code>
module. With this, users will have no way to instantiate those templates
by themselves, which is the exact intent of this library. Initially, we
wanted to propose something similar for the Standard Library, but <a href="https://lists.isocpp.org/lib/2024/10/29544.php">the LWG did not
like the idea</a>.</p>
<p>An alternative might be to state that it is IFNDR or UB to
instantiate those by the user. It does not technically prevent users
from doing so, but if they do it, they are on their own.</p>
<p>Last but not least, we can allow such instantiations and add
restrictive constraints to verify template arguments.</p>
<h2 data-number="18.2" id="framework-entities"><span class="header-section-number">18.2</span> Framework entities<a href="#framework-entities" class="self-link"></a></h2>
<p>The below graph presents the most important entities of the library’s
framework and how they relate to each other.</p>
<p><img src="data:image/svg+xml;base64,PHN2ZyBhcmlhLXJvbGVkZXNjcmlwdGlvbj0iZmxvd2NoYXJ0LXYyIiByb2xlPSJncmFwaGljcy1kb2N1bWVudCBkb2N1bWVudCIgdmlld0JveD0iLTggLTggNDUxLjQxNzk2ODc1IDQxMSIgc3R5bGU9Im1heC13aWR0aDogMTAwJTsiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGlkPSJncmFwaC1kaXYiIGhlaWdodD0iMTAwJSIgeG1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; margin-left: auto; margin-right: auto; width: 60%;" /></p>
<p>Some of the entities were already introduced in the <a href="#quick-domain-introduction">Quick domain introduction</a> chapter.
Below we describe the remaining ones.</p>
<h3 data-number="18.2.1" id="quantity-character"><span class="header-section-number">18.2.1</span> Quantity character<a href="#quantity-character" class="self-link"></a></h3>
<p><span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> explicitly states that
quantities (even of the same kind) may have different characters:</p>
<ul>
<li>scalar,</li>
<li>vector,</li>
<li>tensor.</li>
</ul>
<p>The quantity character in the library is implemented with the
<code class="sourceCode cpp">quantity_character</code> enumeration:</p>
<div class="sourceCode" id="cb221"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb221-1"><a href="#cb221-1" aria-hidden="true" tabindex="-1"></a><span class="kw">enum</span> <span class="kw">class</span> quantity_character <span class="op">{</span> scalar, vector, tensor <span class="op">}</span>;</span></code></pre></div>
<p>More information on quantity characters can be found in the
[Character of a quantity] chapter.</p>
<h3 data-number="18.2.2" id="quantity-specification"><span class="header-section-number">18.2.2</span> Quantity specification<a href="#quantity-specification" class="self-link"></a></h3>
<p>Dimension is not enough to describe a quantity. This is why <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> provides hundreds of
named quantity types. It turns out that there are many more quantity
types in the ISQ than the named units in the <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span>.</p>
<p>This is why the library introduces a quantity specification entity
that stores:</p>
<ul>
<li><a href="#dimension">Dimension</a>,</li>
<li><a href="#quantity-type">Quantity type</a>,</li>
<li><a href="#quantity-character">Quantity character</a>,</li>
<li>the quantity equation being the recipe to create this quantity (only
for derived quantities that specify such a recipe).</li>
</ul>
<p>For example:</p>
<ul>
<li><code class="sourceCode cpp">isq<span class="op">::</span>length</code>,
<code class="sourceCode cpp">isq<span class="op">::</span>mass</code>,
<code class="sourceCode cpp">isq<span class="op">::</span>time</code>,
<code class="sourceCode cpp">isq<span class="op">::</span>electric_current</code>,
<code class="sourceCode cpp">isq<span class="op">::</span>thermodynamic_temperature</code>,
<code class="sourceCode cpp">isq<span class="op">::</span>amount_of_substance</code>,
and <code class="sourceCode cpp">isq<span class="op">::</span>luminous_intensity</code>
are the specifications of base quantities in the ISQ.</li>
<li><code class="sourceCode cpp">isq<span class="op">::</span>width</code>,
<code class="sourceCode cpp">isq<span class="op">::</span>height</code>,
<code class="sourceCode cpp">isq<span class="op">::</span>radius</code>,
and <code class="sourceCode cpp">isq<span class="op">::</span>position_vector</code>
are only a few of many quantities of a kind length specified in the
ISQ.</li>
<li><code class="sourceCode cpp">isq<span class="op">::</span>area</code>,
<code class="sourceCode cpp">isq<span class="op">::</span>speed</code>,
<code class="sourceCode cpp">isq<span class="op">::</span>moment_of_force</code>
are only a few of many derived quantities provided in the ISQ.</li>
</ul>
<h3 data-number="18.2.3" id="unit"><span class="header-section-number">18.2.3</span> Unit<a href="#unit" class="self-link"></a></h3>
<p>A unit is a concrete amount of a quantity that allows us to measure
the values of quantities of the same kind and represent the result as a
number being the ratio of the two quantities.</p>
<p>For example:</p>
<ul>
<li><code class="sourceCode cpp">si<span class="op">::</span>second</code>,
<code class="sourceCode cpp">si<span class="op">::</span>metre</code>,
<code class="sourceCode cpp">si<span class="op">::</span>kilogram</code>,
<code class="sourceCode cpp">si<span class="op">::</span>ampere</code>,
<code class="sourceCode cpp">si<span class="op">::</span>kelvin</code>,
<code class="sourceCode cpp">si<span class="op">::</span>mole</code>,
and
<code class="sourceCode cpp">si<span class="op">::</span>candela</code>
are the base units of the <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span>.</li>
<li><code class="sourceCode cpp">si<span class="op">::</span>kilo<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">&gt;</span></code>
is a prefixed unit of length.</li>
<li><code class="sourceCode cpp">si<span class="op">::</span>radian</code>,
<code class="sourceCode cpp">si<span class="op">::</span>newton</code>,
and <code class="sourceCode cpp">si<span class="op">::</span>watt</code>
are examples of named derived units within the <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span>.</li>
<li><code class="sourceCode cpp">non_si<span class="op">::</span>minute</code> is
an example of a scaled unit of time.</li>
<li><code class="sourceCode cpp">si<span class="op">::</span>si2019<span class="op">::</span>speed_of_light_in_vacuum</code>
is a physical constant standardized by the SI in 2019.</li>
</ul>
<p><em>Note: In this library, physical constants are also implemented as
units.</em></p>
<h3 data-number="18.2.4" id="quantity-representation"><span class="header-section-number">18.2.4</span> Quantity representation<a href="#quantity-representation" class="self-link"></a></h3>
<p>Quantity representation defines the type used to store the numerical
value of a quantity. Such a type should be of a specific quantity
character provided in the quantity specification.</p>
<p><em>Note: By default, all floating-point and integral (besides
<code class="sourceCode cpp"><span class="dt">bool</span></code>) types
are treated as scalars.</em></p>
<h3 data-number="18.2.5" id="point-origin"><span class="header-section-number">18.2.5</span> Point origin<a href="#point-origin" class="self-link"></a></h3>
<p>In the affine space theory, the point origin specifies where the
“zero” of our measurement’s scale is.</p>
<p>In this library, we have two types of point origins:</p>
<ul>
<li>absolute - defines an absolute “zero” for our point,</li>
<li>relative - defines an origin that has some “offset” relative to an
absolute point.</li>
</ul>
<p><em>Note: More information on this subject can be found in <a href="#the-affine-space">The affine space</a> chapter.</em></p>
<h3 data-number="18.2.6" id="quantity-point"><span class="header-section-number">18.2.6</span> Quantity point<a href="#quantity-point" class="self-link"></a></h3>
<p>Quantity point implements a point in the affine space theory. Its
value can be easily created by adding/subtracting the quantity with a
point origin.</p>
<p><em>Note: More information on this subject can be found in <a href="#the-affine-space">The affine space</a> chapter.</em></p>
<h2 data-number="18.3" id="library-namespace"><span class="header-section-number">18.3</span> Library namespace<a href="#library-namespace" class="self-link"></a></h2>
<p>The number of types we propose with this library is not that large.
They provide long-awaited strong types support not only to model
physical quantities and units but also to improve safety of everything
that can be counted or resembles mathematical numbers in some ways
(e.g., longitude and latitude, pixel coordinates, prices, etc.). This
library also provides the affine space abstraction that has a broad
usage by itself.</p>
<p>This is why we propose to put all the framework entities directly in
the namespace <code class="sourceCode cpp">std</code>. This also makes
error messages terser, thus easier to read and understand, which is the
primary goal of this library.</p>
<p>Of course, some entities would have to be renamed (e.g.,
<code class="sourceCode cpp">reference</code>) not to be ambiguous with
other domains and already existing identifiers.</p>
<p>Besides the framework entities, we also have systems definitions.
Provided quantity types and units would land in their own subnamespace
in the namespace <code class="sourceCode cpp">std</code>.</p>
<p>For example, a user could write the following code:</p>
<div class="sourceCode" id="cb222"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb222-1"><a href="#cb222-1" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> <span class="kw">namespace</span> std<span class="op">::</span>si<span class="op">::</span>unit_symbols;</span>
<span id="cb222-2"><a href="#cb222-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb222-3"><a href="#cb222-3" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>quantity<span class="op">&lt;</span>std<span class="op">::</span>si<span class="op">::</span>metre<span class="op">&gt;</span> q <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> m;</span></code></pre></div>
<h2 data-number="18.4" id="concepts"><span class="header-section-number">18.4</span> Concepts<a href="#concepts" class="self-link"></a></h2>
<p>This chapter enumerates all the user-facing concepts in the
library.</p>
<p><em>Note: Initially, C++20 was meant to use
<code class="sourceCode cpp">CamelCase</code> for all the concept
identifiers. Frustratingly,
<code class="sourceCode cpp">CamelCase</code> concepts got dropped from
the C++ standard at the last moment before releasing C++20. Now, we are
facing the predictable consequences of running out of names. As long as
some concepts in the library could be easily named with a
<code class="sourceCode cpp">standard_case</code> there are some that
are hard to distinguish from the corresponding type names, such as
<code class="sourceCode cpp">Quantity</code>,
<code class="sourceCode cpp">QuantityPoint</code>,
<code class="sourceCode cpp">QuantitySpec</code>, or
<code class="sourceCode cpp">Reference</code>. This is why we decided to
use <code class="sourceCode cpp">CamelCase</code> consistently for all
the concept identifiers to make it clear when we are talking about a
type or concept identifier. However, we are aware that this might be a
temporary solution. In case the library gets standardized, we can expect
the LEWG to bikeshed/rename all of the concept identifiers to a
<code class="sourceCode cpp">standard_case</code>, even if it will
result in a harder to understand code.</em></p>
<h3 data-number="18.4.1" id="Dimension-concept"><span class="header-section-number">18.4.1</span> <code class="sourceCode cpp">Dimension<span class="op">&lt;</span>T<span class="op">&gt;</span> <span class="kw">concept</span></code><a href="#Dimension-concept" class="self-link"></a></h3>
<p><code class="sourceCode cpp">Dimension</code> concept matches a
dimension of either a base or derived quantity:</p>
<ul>
<li>Base dimensions are explicitly defined by the user by inheriting
from the instantiation of a
<code class="sourceCode cpp">base_dimension</code> class template. It
should be instantiated with a unique symbol identifier describing this
dimension in a specific system of quantities.</li>
<li>Derived dimensions are implicitly created by the library’s framework
based on the quantity equation provided in the quantity
specification.</li>
</ul>
<h4 data-number="18.4.1.1" id="DimensionOf-concept"><span class="header-section-number">18.4.1.1</span> <code class="sourceCode cpp">DimensionOf<span class="op">&lt;</span>T, V<span class="op">&gt;</span></code>
concept<a href="#DimensionOf-concept" class="self-link"></a></h4>
<p><code class="sourceCode cpp">DimensionOf</code> concept is satisfied
when both arguments satisfy a <a href="#Dimension-concept"><code class="sourceCode cpp">Dimension</code></a>
concept and when they compare equal.</p>
<h3 data-number="18.4.2" id="QuantitySpec-concept"><span class="header-section-number">18.4.2</span> <code class="sourceCode cpp">QuantitySpec<span class="op">&lt;</span>T<span class="op">&gt;</span> <span class="kw">concept</span></code><a href="#QuantitySpec-concept" class="self-link"></a></h3>
<p><code class="sourceCode cpp">QuantitySpec</code> concept matches all
the quantity specifications including:</p>
<ul>
<li>Base quantities defined by a user by inheriting from the
<code class="sourceCode cpp">quantity_spec</code> class template
instantiated with a base dimension argument.</li>
<li>Derived named quantities defined by a user by inheriting from the
<code class="sourceCode cpp">quantity_spec</code> class template
instantiated with a result of a quantity equation passed as an
argument.</li>
<li>Other named quantities forming a hierarchy of quantities of the same
kind defined by a user by inheriting from the
<code class="sourceCode cpp">quantity_spec</code> class template
instantiated with another “parent” quantity specification passed as an
argument.</li>
<li>Quantity kinds describing a family of mutually comparable
quantities.</li>
<li>Intermediate derived quantity specifications being a result of a
quantity equations on other specifications.</li>
</ul>
<h4 data-number="18.4.2.1" id="QuantitySpecOf-concept"><span class="header-section-number">18.4.2.1</span> <code class="sourceCode cpp">QuantitySpecOf<span class="op">&lt;</span>T, V<span class="op">&gt;</span></code>
concept<a href="#QuantitySpecOf-concept" class="self-link"></a></h4>
<p><code class="sourceCode cpp">QuantitySpecOf</code> concept is
satisfied when both arguments satisfy a <a href="#QuantitySpec-concept"><code class="sourceCode cpp">QuantitySpec</code></a>
concept and when <code class="sourceCode cpp">T</code> is implicitly
convertible to <code class="sourceCode cpp">V</code>.</p>
<p>Additionally:</p>
<ul>
<li><code class="sourceCode cpp">T</code> should not be a nested
quantity specification of <code class="sourceCode cpp">V</code></li>
<li>either <code class="sourceCode cpp">T</code> is quantity kind or
<code class="sourceCode cpp">V</code> should not be a nested quantity
specification of <code class="sourceCode cpp">T</code></li>
</ul>
<p>Those additional conditions are required to make the following
work:</p>
<div class="sourceCode" id="cb223"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb223-1"><a href="#cb223-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>ReferenceOf<span class="op">&lt;</span>si<span class="op">::</span>radian, isq<span class="op">::</span>angular_measure<span class="op">&gt;)</span>;</span>
<span id="cb223-2"><a href="#cb223-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(!</span>ReferenceOf<span class="op">&lt;</span>si<span class="op">::</span>radian, dimensionless<span class="op">&gt;)</span>;</span>
<span id="cb223-3"><a href="#cb223-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(!</span>ReferenceOf<span class="op">&lt;</span>isq<span class="op">::</span>angular_measure<span class="op">[</span>si<span class="op">::</span>radian<span class="op">]</span>, dimensionless<span class="op">&gt;)</span>;</span>
<span id="cb223-4"><a href="#cb223-4" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>ReferenceOf<span class="op">&lt;</span>one, isq<span class="op">::</span>angular_measure<span class="op">&gt;)</span>;</span>
<span id="cb223-5"><a href="#cb223-5" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(!</span>ReferenceOf<span class="op">&lt;</span>dimensionless<span class="op">[</span>one<span class="op">]</span>, isq<span class="op">::</span>angular_measure<span class="op">&gt;)</span>;</span></code></pre></div>
<h3 data-number="18.4.3" id="Unit-concept"><span class="header-section-number">18.4.3</span> <code class="sourceCode cpp">Unit<span class="op">&lt;</span>T<span class="op">&gt;</span></code>
concept<a href="#Unit-concept" class="self-link"></a></h3>
<p><code class="sourceCode cpp">Unit</code> concept matches all the
units in the library including:</p>
<ul>
<li>Base units defined by a user by inheriting from the
<code class="sourceCode cpp">named_unit</code> class template
instantiated with a unique symbol identifier describing this unit in a
specific system of units.</li>
<li>Named scaled units defined by a user by inheriting from the
<code class="sourceCode cpp">named_unit</code> class template
instantiated with a unique symbol identifier and a product of
multiplying another unit with some magnitude.</li>
<li>Prefixed units defined by a user by inheriting from the
<code class="sourceCode cpp">prefixed_unit</code> class template
instantiated with a prefix symbol, a magnitude, and a unit to be
prefixed.</li>
<li>Derived named units defined by a user by inheriting from the
<code class="sourceCode cpp">named_unit</code> class template
instantiated with a unique symbol identifier and a result of unit
equation passed as an argument.</li>
<li>Derived unnamed units being a result of a unit equations on other
units.</li>
</ul>
<p><em>Note: Physical constants are also implemented as units.</em></p>
<h4 data-number="18.4.3.1" id="AssociatedUnit-concept"><span class="header-section-number">18.4.3.1</span> <code class="sourceCode cpp">AssociatedUnit<span class="op">&lt;</span>T<span class="op">&gt;</span></code>
concept<a href="#AssociatedUnit-concept" class="self-link"></a></h4>
<p><code class="sourceCode cpp">AssociatedUnit</code> concept describes
a unit with an associated quantity and is satisfied by:</p>
<ul>
<li>All units derived from a
<code class="sourceCode cpp">named_unit</code> class template
instantiated with a unique symbol identifier and a <a href="#QuantitySpec-concept"><code class="sourceCode cpp">QuantitySpec</code></a>
of a quantity kind.</li>
<li>All units being a result of unit equations on other associated
units.</li>
</ul>
<p>All units in the <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span> have associated quantities. For
example,
<code class="sourceCode cpp">si<span class="op">::</span>second</code>
is specified to measure
<code class="sourceCode cpp">isq<span class="op">::</span>time</code>.</p>
<p>Natural units typically do not have an associated quantity. For
example, if we assume <code class="sourceCode cpp">c <span class="op">=</span> <span class="dv">1</span></code>,
a <code class="sourceCode cpp">natural<span class="op">::</span>second</code>
unit can be used to measure both
<code class="sourceCode cpp">time</code> and
<code class="sourceCode cpp">length</code>. In such case,
<code class="sourceCode cpp">speed</code> would have a unit of
<code class="sourceCode cpp">one</code>.</p>
<h4 data-number="18.4.3.2" id="PrefixableUnit-concept"><span class="header-section-number">18.4.3.2</span> <code class="sourceCode cpp">PrefixableUnit<span class="op">&lt;</span>T<span class="op">&gt;</span></code>
concept<a href="#PrefixableUnit-concept" class="self-link"></a></h4>
<p><code class="sourceCode cpp">PrefixableUnit</code> concept is
satisfied by all units derived from a
<code class="sourceCode cpp">named_unit</code> class template. Such
units can be passed as an argument to a
<code class="sourceCode cpp">prefixed_unit</code> class template.</p>
<h4 data-number="18.4.3.3" id="UnitOf-concept"><span class="header-section-number">18.4.3.3</span> <code class="sourceCode cpp">UnitOf<span class="op">&lt;</span>T, V<span class="op">&gt;</span></code>
concept<a href="#UnitOf-concept" class="self-link"></a></h4>
<p><code class="sourceCode cpp">UnitOf</code> concept is satisfied for
all units <code class="sourceCode cpp">T</code> matching an <a href="#AssociatedUnit-concept"><code class="sourceCode cpp">AssociatedUnit</code></a>
concept with an associated quantity type implicitly convertible to
<code class="sourceCode cpp">V</code>.</p>
<p>Additionally, the kind of <code class="sourceCode cpp">V</code> and
the kind of quantity type associated with
<code class="sourceCode cpp">T</code> must be the same, or the quantity
type associated with <code class="sourceCode cpp">T</code> may not be
derived from the kind of <code class="sourceCode cpp">V</code>.</p>
<p>This condition is required to make <code class="sourceCode cpp">dimensionless<span class="op">[</span>si<span class="op">::</span>radian<span class="op">]</span></code>
invalid as
<code class="sourceCode cpp">si<span class="op">::</span>radian</code>
should be only used for <code class="sourceCode cpp">isq<span class="op">::</span>angular_measure</code>,
which is a nested quantity kind within the dimensionless quantities
tree.</p>
<h4 data-number="18.4.3.4" id="UnitCompatibleWith-concept"><span class="header-section-number">18.4.3.4</span> <code class="sourceCode cpp">UnitCompatibleWith<span class="op">&lt;</span>T, V1, V2<span class="op">&gt;</span></code>
concept<a href="#UnitCompatibleWith-concept" class="self-link"></a></h4>
<p><code class="sourceCode cpp">UnitCompatibleWith</code> concept is
satisfied for all units <code class="sourceCode cpp">T</code> when:</p>
<ul>
<li><code class="sourceCode cpp">V1</code> is a <a href="#Unit-concept"><code class="sourceCode cpp">Unit</code></a>,</li>
<li><code class="sourceCode cpp">V2</code> is a <a href="#QuantitySpec-concept"><code class="sourceCode cpp">QuantitySpec</code></a>,</li>
<li><code class="sourceCode cpp">T</code> and
<code class="sourceCode cpp">V1</code> are defined in terms of the same
reference unit,</li>
<li>if <code class="sourceCode cpp">T</code> is an <a href="#AssociatedUnit-concept"><code class="sourceCode cpp">AssociatedUnit</code></a>
it should satisfy <a href="#UnitOf-concept"><code class="sourceCode cpp">UnitOf<span class="op">&lt;</span>V2<span class="op">&gt;</span></code></a>.</li>
</ul>
<h3 data-number="18.4.4" id="Reference-concept"><span class="header-section-number">18.4.4</span> <code class="sourceCode cpp">Reference<span class="op">&lt;</span>T<span class="op">&gt;</span></code>
concept<a href="#Reference-concept" class="self-link"></a></h3>
<p><code class="sourceCode cpp">Reference</code> concept is satisfied by
all quantity reference types. Such types provide all the
meta-information required to create a <a href="#Quantity-concept"><code class="sourceCode cpp">Quantity</code></a>.</p>
<p>A <code class="sourceCode cpp">Reference</code> can either be:</p>
<ul>
<li>An <a href="#AssociatedUnit-concept"><code class="sourceCode cpp">AssociatedUnit</code></a>.</li>
<li>The instantiation of a <code class="sourceCode cpp">reference</code>
class template with a <a href="#QuantitySpec-concept"><code class="sourceCode cpp">QuantitySpec</code></a>
passed as the first template argument and a <a href="#Unit-concept"><code class="sourceCode cpp">Unit</code></a> passed
as the second one.</li>
</ul>
<h4 data-number="18.4.4.1" id="ReferenceOf-concept"><span class="header-section-number">18.4.4.1</span> <code class="sourceCode cpp">ReferenceOf<span class="op">&lt;</span>T, V<span class="op">&gt;</span></code>
concept<a href="#ReferenceOf-concept" class="self-link"></a></h4>
<p><code class="sourceCode cpp">ReferenceOf</code> concept is satisfied
by references <code class="sourceCode cpp">T</code> which have a
quantity specification that satisfies <a href="#QuantitySpecOf-concept"><code class="sourceCode cpp">QuantitySpecOf<span class="op">&lt;</span>V<span class="op">&gt;</span></code></a>
concept. |</p>
<h3 data-number="18.4.5" id="Representation-concept"><span class="header-section-number">18.4.5</span> <code class="sourceCode cpp">Representation<span class="op">&lt;</span>T<span class="op">&gt;</span></code>
concept<a href="#Representation-concept" class="self-link"></a></h3>
<p><code class="sourceCode cpp">Representation</code> concept
constraints a type of a number that stores the value of a quantity.</p>
<h4 data-number="18.4.5.1" id="RepresentationOf-concept"><span class="header-section-number">18.4.5.1</span> <code class="sourceCode cpp">RepresentationOf<span class="op">&lt;</span>T, Ch<span class="op">&gt;</span></code>
concept<a href="#RepresentationOf-concept" class="self-link"></a></h4>
<p><code class="sourceCode cpp">RepresentationOf</code> concept is
satisfied:</p>
<ul>
<li><p>if the type of <code class="sourceCode cpp">V</code> satisfies <a href="#QuantitySpec-concept"><code class="sourceCode cpp">QuantitySpec</code></a>:</p>
<ul>
<li>by all <a href="#Representation-concept"><code class="sourceCode cpp">Representation</code></a>
types when <code class="sourceCode cpp">V</code> describes a quantity
kind,</li>
<li>otherwise, by <a href="#Representation-concept"><code class="sourceCode cpp">Representation</code></a>
types that are of a quantity character associated with a provided
quantity specification <code class="sourceCode cpp">V</code>.</li>
</ul></li>
<li><p>if <code class="sourceCode cpp">V</code> is of
<code class="sourceCode cpp">quantity_character</code> type:</p>
<ul>
<li>by <a href="#Representation-concept"><code class="sourceCode cpp">Representation</code></a>
types that are of a provided quantity character.</li>
</ul></li>
</ul>
<p>A user can declare a custom representation type to be of a specific
character by providing the specialization with
<code class="sourceCode cpp"><span class="kw">true</span></code> for one
or more of the following variable templates:</p>
<ul>
<li><code class="sourceCode cpp">is_scalar<span class="op">&lt;</span>T<span class="op">&gt;</span></code>,</li>
<li><code class="sourceCode cpp">is_complex<span class="op">&lt;</span>T<span class="op">&gt;</span></code>,</li>
<li><code class="sourceCode cpp">is_vector<span class="op">&lt;</span>T<span class="op">&gt;</span></code>,</li>
<li><code class="sourceCode cpp">is_tensor<span class="op">&lt;</span>T<span class="op">&gt;</span></code>.</li>
</ul>
<p>If we want to use scalar types to also express vector quantities
(e.g., ignoring the “direction” of the vector) the following definition
can be provided to enable such a behavior:</p>
<div class="sourceCode" id="cb224"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb224-1"><a href="#cb224-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span><span class="kw">class</span> T<span class="op">&gt;</span></span>
<span id="cb224-2"><a href="#cb224-2" aria-hidden="true" tabindex="-1"></a>  <span class="kw">requires</span> is_scalar<span class="op">&lt;</span>T<span class="op">&gt;</span></span>
<span id="cb224-3"><a href="#cb224-3" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="dt">bool</span> is_vector<span class="op">&lt;</span>T<span class="op">&gt;</span> <span class="op">=</span> <span class="kw">true</span>;</span></code></pre></div>
<h3 data-number="18.4.6" id="Quantity-concept"><span class="header-section-number">18.4.6</span> <code class="sourceCode cpp">Quantity<span class="op">&lt;</span>T<span class="op">&gt;</span></code>
concept<a href="#Quantity-concept" class="self-link"></a></h3>
<p><code class="sourceCode cpp">Quantity</code> concept matches every
quantity in the library and is satisfied by all types being or deriving
from an instantiation of a <code class="sourceCode cpp">quantity</code>
class template.</p>
<h4 data-number="18.4.6.1" id="QuantityOf-concept"><span class="header-section-number">18.4.6.1</span> <code class="sourceCode cpp">QuantityOf<span class="op">&lt;</span>T, V<span class="op">&gt;</span></code>
concept<a href="#QuantityOf-concept" class="self-link"></a></h4>
<p><code class="sourceCode cpp">QuantityOf</code> concept is satisfied
by all the quantities for which a <a href="#QuantitySpecOf-concept"><code class="sourceCode cpp">QuantitySpecOf<span class="op">&lt;</span>V<span class="op">&gt;</span></code></a>
is <code class="sourceCode cpp"><span class="kw">true</span></code>.</p>
<h3 data-number="18.4.7" id="PointOrigin-concept"><span class="header-section-number">18.4.7</span> <code class="sourceCode cpp">PointOrigin<span class="op">&lt;</span>T<span class="op">&gt;</span></code>
concept<a href="#PointOrigin-concept" class="self-link"></a></h3>
<p><code class="sourceCode cpp">PointOrigin</code> concept matches all
quantity point origins in the library. It is satisfied by either:</p>
<ul>
<li>All types derived from an
<code class="sourceCode cpp">absolute_point_origin</code> class
template.</li>
<li>All types derived from a
<code class="sourceCode cpp">relative_point_origin</code> class
template.</li>
</ul>
<h4 data-number="18.4.7.1" id="PointOriginFor-concept"><span class="header-section-number">18.4.7.1</span> <code class="sourceCode cpp">PointOriginFor<span class="op">&lt;</span>T, V<span class="op">&gt;</span></code>
concept<a href="#PointOriginFor-concept" class="self-link"></a></h4>
<p><code class="sourceCode cpp">PointOriginFor</code> concept is
satisfied by all <a href="#PointOrigin-concept"><code class="sourceCode cpp">PointOrigin</code></a>
types that have quantity type implicitly convertible from quantity
specification <code class="sourceCode cpp">V</code>, which means that
<code class="sourceCode cpp">V</code> must satisfy <a href="#QuantitySpecOf-concept"><code class="sourceCode cpp">QuantitySpecOf<span class="op">&lt;</span>T<span class="op">::</span>quantity_spec<span class="op">&gt;</span></code></a>.</p>
<p>For example, <code class="sourceCode cpp">si<span class="op">::</span>ice_point</code> can
serve as a point origin for <em>points</em> of <code class="sourceCode cpp">isq<span class="op">::</span>Celsius_temperature</code>
because this quantity type implicitly converts to <code class="sourceCode cpp">isq<span class="op">::</span>thermodynamic_temperature</code>.</p>
<p>However, if we define
<code class="sourceCode cpp">mean_sea_level</code> in the following
way:</p>
<div class="sourceCode" id="cb225"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb225-1"><a href="#cb225-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> mean_sea_level <span class="kw">final</span> <span class="op">:</span> absolute_point_origin<span class="op">&lt;</span>isq<span class="op">::</span>altitude<span class="op">&gt;</span> <span class="op">{}</span> mean_sea_level;</span></code></pre></div>
<p>then it can’t be used as a point origin for <em>points</em> of
<code class="sourceCode cpp">isq<span class="op">::</span>length</code>
or
<code class="sourceCode cpp">isq<span class="op">::</span>width</code>
as none of them is implicitly convertible to <code class="sourceCode cpp">isq<span class="op">::</span>altitude</code>:</p>
<ul>
<li>not every <em>length</em> is an <em>altitude</em>,</li>
<li><em>width</em> is not compatible with <em>altitude</em>.</li>
</ul>
<h3 data-number="18.4.8" id="QuantityPoint-concept"><span class="header-section-number">18.4.8</span> <code class="sourceCode cpp">QuantityPoint<span class="op">&lt;</span>T<span class="op">&gt;</span></code>
concept<a href="#QuantityPoint-concept" class="self-link"></a></h3>
<p><code class="sourceCode cpp">QuantityPoint</code> concept is
satisfied by all types being either a specialization or derived from
<code class="sourceCode cpp">quantity_point</code> class template.</p>
<h4 data-number="18.4.8.1" id="QuantityPointOf-concept"><span class="header-section-number">18.4.8.1</span> <code class="sourceCode cpp">QuantityPointOf<span class="op">&lt;</span>T, V<span class="op">&gt;</span></code>
concept<a href="#QuantityPointOf-concept" class="self-link"></a></h4>
<p><code class="sourceCode cpp">QuantityPointOf</code> concept is
satisfied by all the quantity points
<code class="sourceCode cpp">T</code> that match the following value
<code class="sourceCode cpp">V</code>:</p>
<table>
<colgroup>
<col style="width: 12%" />
<col style="width: 87%" />
</colgroup>
<thead>
<tr class="header">
<th><div style="text-align:center">
<strong><code class="sourceCode cpp">V</code></strong>
</div></th>
<th><div style="text-align:center">
<strong>Condition</strong>
</div></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><code class="sourceCode cpp">QuantitySpec</code></td>
<td>The quantity point quantity specification satisfies <a href="#QuantitySpecOf-concept"><code class="sourceCode cpp">QuantitySpecOf<span class="op">&lt;</span>V<span class="op">&gt;</span></code></a>
concept.</td>
</tr>
<tr class="even">
<td><code class="sourceCode cpp">PointOrigin</code></td>
<td>The <em>point</em> and <code class="sourceCode cpp">V</code> have
the same absolute point origin.</td>
</tr>
</tbody>
</table>
<h3 data-number="18.4.9" id="QuantityLike-concept"><span class="header-section-number">18.4.9</span> <code class="sourceCode cpp">QuantityLike<span class="op">&lt;</span>T<span class="op">&gt;</span></code>
concept<a href="#QuantityLike-concept" class="self-link"></a></h3>
<p><code class="sourceCode cpp">QuantityLike</code> concept provides
interoperability with other libraries and is satisfied by a type
<code class="sourceCode cpp">T</code> for which an instantiation of
<code class="sourceCode cpp">quantity_like_traits</code> type trait
yields a valid type that provides:</p>
<ul>
<li><code class="sourceCode cpp">reference</code> static data member
that matches the <a href="#Reference-concept"><code class="sourceCode cpp">Reference</code></a>
concept,</li>
<li><code class="sourceCode cpp">rep</code> type that matches <a href="#RepresentationOf-concept"><code class="sourceCode cpp">RepresentationOf</code></a>
concept with the character provided in
<code class="sourceCode cpp">reference</code>.</li>
<li><code class="sourceCode cpp">explicit_import</code> static data
member convertible to
<code class="sourceCode cpp"><span class="dt">bool</span></code> that
specifies that the conversion from <code class="sourceCode cpp">T</code>
to a <code class="sourceCode cpp">quantity</code> type should happen
explicitly (if
<code class="sourceCode cpp"><span class="kw">true</span></code>),</li>
<li><code class="sourceCode cpp">explicit_export</code> static data
member convertible to
<code class="sourceCode cpp"><span class="dt">bool</span></code> that
specifies that the conversion from a
<code class="sourceCode cpp">quantity</code> type to
<code class="sourceCode cpp">T</code> should happen explicitly (if
<code class="sourceCode cpp"><span class="kw">true</span></code>),</li>
<li><code class="sourceCode cpp">to_numerical_value<span class="op">(</span>T<span class="op">)</span></code>
static member function returning a raw value of the quantity,</li>
<li><code class="sourceCode cpp">from_numerical_value<span class="op">(</span>rep<span class="op">)</span></code>
static member function returning
<code class="sourceCode cpp">T</code>.</li>
</ul>
<p>For example, this is how support for <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>seconds</code>
can be provided:</p>
<div class="sourceCode" id="cb226"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb226-1"><a href="#cb226-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;&gt;</span></span>
<span id="cb226-2"><a href="#cb226-2" aria-hidden="true" tabindex="-1"></a><span class="kw">struct</span> quantity_like_traits<span class="op">&lt;</span>std<span class="op">::</span>chrono<span class="op">::</span>seconds<span class="op">&gt;</span> <span class="op">{</span></span>
<span id="cb226-3"><a href="#cb226-3" aria-hidden="true" tabindex="-1"></a>  <span class="kw">static</span> <span class="kw">constexpr</span> <span class="kw">auto</span> reference <span class="op">=</span> detail<span class="op">::</span>time_unit_from_chrono_period<span class="op">&lt;</span>Period<span class="op">&gt;()</span>;</span>
<span id="cb226-4"><a href="#cb226-4" aria-hidden="true" tabindex="-1"></a>  <span class="kw">static</span> <span class="kw">constexpr</span> <span class="dt">bool</span> explicit_import <span class="op">=</span> <span class="kw">false</span>;</span>
<span id="cb226-5"><a href="#cb226-5" aria-hidden="true" tabindex="-1"></a>  <span class="kw">static</span> <span class="kw">constexpr</span> <span class="dt">bool</span> explicit_export <span class="op">=</span> <span class="kw">false</span>;</span>
<span id="cb226-6"><a href="#cb226-6" aria-hidden="true" tabindex="-1"></a>  <span class="kw">using</span> rep <span class="op">=</span> Rep;</span>
<span id="cb226-7"><a href="#cb226-7" aria-hidden="true" tabindex="-1"></a>  <span class="kw">using</span> T <span class="op">=</span> std<span class="op">::</span>chrono<span class="op">::</span>duration<span class="op">&lt;</span>Rep, Period<span class="op">&gt;</span>;</span>
<span id="cb226-8"><a href="#cb226-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb226-9"><a href="#cb226-9" aria-hidden="true" tabindex="-1"></a>  <span class="op">[[</span><span class="at">nodiscard</span><span class="op">]]</span> <span class="kw">static</span> <span class="kw">constexpr</span> rep to_numerical_value<span class="op">(</span><span class="kw">const</span> T<span class="op">&amp;</span> q<span class="op">)</span> <span class="kw">noexcept</span><span class="op">(</span></span>
<span id="cb226-10"><a href="#cb226-10" aria-hidden="true" tabindex="-1"></a>    std<span class="op">::</span>is_nothrow_copy_constructible_v<span class="op">&lt;</span>rep<span class="op">&gt;)</span></span>
<span id="cb226-11"><a href="#cb226-11" aria-hidden="true" tabindex="-1"></a>  <span class="op">{</span></span>
<span id="cb226-12"><a href="#cb226-12" aria-hidden="true" tabindex="-1"></a>    <span class="cf">return</span> q<span class="op">.</span>count<span class="op">()</span>;</span>
<span id="cb226-13"><a href="#cb226-13" aria-hidden="true" tabindex="-1"></a>  <span class="op">}</span></span>
<span id="cb226-14"><a href="#cb226-14" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb226-15"><a href="#cb226-15" aria-hidden="true" tabindex="-1"></a>  <span class="op">[[</span><span class="at">nodiscard</span><span class="op">]]</span> <span class="kw">static</span> <span class="kw">constexpr</span> T from_numerical_value<span class="op">(</span><span class="kw">const</span> rep<span class="op">&amp;</span> v<span class="op">)</span> <span class="kw">noexcept</span><span class="op">(</span></span>
<span id="cb226-16"><a href="#cb226-16" aria-hidden="true" tabindex="-1"></a>    std<span class="op">::</span>is_nothrow_copy_constructible_v<span class="op">&lt;</span>rep<span class="op">&gt;)</span></span>
<span id="cb226-17"><a href="#cb226-17" aria-hidden="true" tabindex="-1"></a>  <span class="op">{</span></span>
<span id="cb226-18"><a href="#cb226-18" aria-hidden="true" tabindex="-1"></a>    <span class="cf">return</span> T<span class="op">(</span>v<span class="op">)</span>;</span>
<span id="cb226-19"><a href="#cb226-19" aria-hidden="true" tabindex="-1"></a>  <span class="op">}</span></span>
<span id="cb226-20"><a href="#cb226-20" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span>
<span id="cb226-21"><a href="#cb226-21" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb226-22"><a href="#cb226-22" aria-hidden="true" tabindex="-1"></a>quantity q <span class="op">=</span> <span class="dv">42</span><span class="bu">s</span>;</span>
<span id="cb226-23"><a href="#cb226-23" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>chrono<span class="op">::</span>seconds dur <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> s;</span></code></pre></div>
<h3 data-number="18.4.10" id="QuantityPointLike-concept"><span class="header-section-number">18.4.10</span> <code class="sourceCode cpp">QuantityPointLike<span class="op">&lt;</span>T<span class="op">&gt;</span></code>
concept<a href="#QuantityPointLike-concept" class="self-link"></a></h3>
<p><code class="sourceCode cpp">QuantityPointLike</code> concept
provides interoperability with other libraries and is satisfied by a
type <code class="sourceCode cpp">T</code> for which an instantiation of
<code class="sourceCode cpp">quantity_point_like_traits</code> type
trait yields a valid type that provides:</p>
<ul>
<li><code class="sourceCode cpp">reference</code> static data member
that matches the <a href="#Reference-concept"><code class="sourceCode cpp">Reference</code></a>
concept.</li>
<li><code class="sourceCode cpp">point_origin</code> static data member
that matches the <a href="#PointOrigin-concept"><code class="sourceCode cpp">PointOrigin</code></a>
concept.</li>
<li><code class="sourceCode cpp">rep</code> type that matches <a href="#RepresentationOf-concept"><code class="sourceCode cpp">RepresentationOf</code></a>
concept with the character provided in
<code class="sourceCode cpp">reference</code>.</li>
<li><code class="sourceCode cpp">explicit_import</code> static data
member convertible to
<code class="sourceCode cpp"><span class="dt">bool</span></code> that
specifies that the conversion from <code class="sourceCode cpp">T</code>
to a <code class="sourceCode cpp">quantity_point</code> type should
happen explicitly (if
<code class="sourceCode cpp"><span class="kw">true</span></code>),</li>
<li><code class="sourceCode cpp">explicit_export</code> static data
member convertible to
<code class="sourceCode cpp"><span class="dt">bool</span></code> that
specifies that the conversion from a
<code class="sourceCode cpp">quantity_point</code> type to
<code class="sourceCode cpp">T</code> should happen explicitly (if
<code class="sourceCode cpp"><span class="kw">true</span></code>),</li>
<li><code class="sourceCode cpp">to_numerical_value<span class="op">(</span>T<span class="op">)</span></code>
static member function returning a raw value of the quantity being the
offset of the point from the origin,</li>
<li><code class="sourceCode cpp">from_numerical_value<span class="op">(</span>rep<span class="op">)</span></code>
static member function returning
<code class="sourceCode cpp">T</code>.</li>
</ul>
<p>For example, this is how support for a <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>time_point</code>
of <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>seconds</code>
can be provided:</p>
<div class="sourceCode" id="cb227"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb227-1"><a href="#cb227-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span><span class="kw">typename</span> C<span class="op">&gt;</span></span>
<span id="cb227-2"><a href="#cb227-2" aria-hidden="true" tabindex="-1"></a><span class="kw">struct</span> quantity_point_like_traits<span class="op">&lt;</span>std<span class="op">::</span>chrono<span class="op">::</span>time_point<span class="op">&lt;</span>C, std<span class="op">::</span>chrono<span class="op">::</span>seconds<span class="op">&gt;&gt;</span> <span class="op">{</span></span>
<span id="cb227-3"><a href="#cb227-3" aria-hidden="true" tabindex="-1"></a>  <span class="kw">static</span> <span class="kw">constexpr</span> <span class="kw">auto</span> reference <span class="op">=</span> detail<span class="op">::</span>time_unit_from_chrono_period<span class="op">&lt;</span>Period<span class="op">&gt;()</span>;</span>
<span id="cb227-4"><a href="#cb227-4" aria-hidden="true" tabindex="-1"></a>  <span class="kw">static</span> <span class="kw">constexpr</span> <span class="kw">auto</span> point_origin <span class="op">=</span> chrono_point_origin<span class="op">&lt;</span>C<span class="op">&gt;</span>;</span>
<span id="cb227-5"><a href="#cb227-5" aria-hidden="true" tabindex="-1"></a>  <span class="kw">static</span> <span class="kw">constexpr</span> <span class="dt">bool</span> explicit_import <span class="op">=</span> <span class="kw">false</span>;</span>
<span id="cb227-6"><a href="#cb227-6" aria-hidden="true" tabindex="-1"></a>  <span class="kw">static</span> <span class="kw">constexpr</span> <span class="dt">bool</span> explicit_export <span class="op">=</span> <span class="kw">false</span>;</span>
<span id="cb227-7"><a href="#cb227-7" aria-hidden="true" tabindex="-1"></a>  <span class="kw">using</span> rep <span class="op">=</span> Rep;</span>
<span id="cb227-8"><a href="#cb227-8" aria-hidden="true" tabindex="-1"></a>  <span class="kw">using</span> T <span class="op">=</span> std<span class="op">::</span>chrono<span class="op">::</span>time_point<span class="op">&lt;</span>C, std<span class="op">::</span>chrono<span class="op">::</span>duration<span class="op">&lt;</span>Rep, Period<span class="op">&gt;&gt;</span>;</span>
<span id="cb227-9"><a href="#cb227-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb227-10"><a href="#cb227-10" aria-hidden="true" tabindex="-1"></a>  <span class="op">[[</span><span class="at">nodiscard</span><span class="op">]]</span> <span class="kw">static</span> <span class="kw">constexpr</span> rep to_numerical_value<span class="op">(</span><span class="kw">const</span> T<span class="op">&amp;</span> tp<span class="op">)</span> <span class="kw">noexcept</span><span class="op">(</span>std<span class="op">::</span>is_nothrow_copy_constructible_v<span class="op">&lt;</span>rep<span class="op">&gt;)</span></span>
<span id="cb227-11"><a href="#cb227-11" aria-hidden="true" tabindex="-1"></a>  <span class="op">{</span></span>
<span id="cb227-12"><a href="#cb227-12" aria-hidden="true" tabindex="-1"></a>    <span class="cf">return</span> tp<span class="op">.</span>time_since_epoch<span class="op">().</span>count<span class="op">()</span>;</span>
<span id="cb227-13"><a href="#cb227-13" aria-hidden="true" tabindex="-1"></a>  <span class="op">}</span></span>
<span id="cb227-14"><a href="#cb227-14" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb227-15"><a href="#cb227-15" aria-hidden="true" tabindex="-1"></a>  <span class="op">[[</span><span class="at">nodiscard</span><span class="op">]]</span> <span class="kw">static</span> <span class="kw">constexpr</span> T from_numerical_value<span class="op">(</span><span class="kw">const</span> rep<span class="op">&amp;</span> v<span class="op">)</span> <span class="kw">noexcept</span><span class="op">(</span></span>
<span id="cb227-16"><a href="#cb227-16" aria-hidden="true" tabindex="-1"></a>    std<span class="op">::</span>is_nothrow_copy_constructible_v<span class="op">&lt;</span>rep<span class="op">&gt;)</span></span>
<span id="cb227-17"><a href="#cb227-17" aria-hidden="true" tabindex="-1"></a>  <span class="op">{</span></span>
<span id="cb227-18"><a href="#cb227-18" aria-hidden="true" tabindex="-1"></a>    <span class="cf">return</span> T<span class="op">(</span>std<span class="op">::</span>chrono<span class="op">::</span>duration<span class="op">&lt;</span>Rep, Period<span class="op">&gt;(</span>v<span class="op">))</span>;</span>
<span id="cb227-19"><a href="#cb227-19" aria-hidden="true" tabindex="-1"></a>  <span class="op">}</span></span>
<span id="cb227-20"><a href="#cb227-20" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span>
<span id="cb227-21"><a href="#cb227-21" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb227-22"><a href="#cb227-22" aria-hidden="true" tabindex="-1"></a>quantity_point qp <span class="op">=</span> time_point_cast<span class="op">&lt;</span>std<span class="op">::</span>chrono<span class="op">::</span>seconds<span class="op">&gt;(</span>std<span class="op">::</span>chrono<span class="op">::</span>system_clock<span class="op">::</span>now<span class="op">())</span>;</span>
<span id="cb227-23"><a href="#cb227-23" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>chrono<span class="op">::</span>sys_seconds q <span class="op">=</span> qp <span class="op">+</span> <span class="dv">42</span> <span class="op">*</span> s;</span></code></pre></div>
<h2 data-number="18.5" id="expression-templates"><span class="header-section-number">18.5</span> Expression templates<a href="#expression-templates" class="self-link"></a></h2>
<p>Modern C++ physical quantities and units libraries use opaque types
to improve the user experience while analyzing compile-time errors or
inspecting types in a debugger. This is a huge usability improvement
over the older libraries that use aliases to refer to long
instantiations of class templates.</p>
<h3 data-number="18.5.1" id="derived-entities"><span class="header-section-number">18.5.1</span> Derived entities<a href="#derived-entities" class="self-link"></a></h3>
<p>Having such strong types for entities is not enough. While doing
arithmetics on them, we get derived entities, and they also should be
easy to understand and correlate with the code written by the user. This
is where expression templates come into play.</p>
<p>The library should use the same unified approach to represent the
results of arithmetics on all kinds of entities. It is worth mentioning
that a generic purpose expression templates library is not a good
solution for a physical quantities and units library.</p>
<p>Let’s assume that we want to represent the results of the following
two unit equations:</p>
<ul>
<li><code class="sourceCode cpp">metre <span class="op">/</span> second <span class="op">*</span> second</code></li>
<li><code class="sourceCode cpp">metre <span class="op">*</span> metre <span class="op">/</span> metre</code></li>
</ul>
<p>Both of them should result in a type equivalent to
<code class="sourceCode cpp">metre</code>. A general-purpose library
will probably result with the types similar to the below:</p>
<ul>
<li><code class="sourceCode cpp">mul<span class="op">&lt;</span>div<span class="op">&lt;</span>metre, second<span class="op">&gt;</span>, second<span class="op">&gt;</span></code></li>
<li><code class="sourceCode cpp">div<span class="op">&lt;</span>mul<span class="op">&lt;</span>metre, metre<span class="op">&gt;</span>, metre<span class="op">&gt;</span></code></li>
</ul>
<p>Comparing such types for equivalence would not only be very expensive
at compile-time but would also be really confusing to the users
observing them in the compilation logs. This is why we need a dedicated
solution here.</p>
<p>In a physical quantities and units library, we need expression
templates to express the results of</p>
<ul>
<li>dimension equations,</li>
<li>quantity type equations,</li>
<li>unit equations, and</li>
<li>unit magnitude equations.</li>
</ul>
<p>If the above equation results in a derived entity, we must create a
type that clearly describes what we are dealing with. We need to pack a
simplified expression template into some container for that. There are
various possibilities here. The table below presents the types generated
from unit expressions by two leading products on the market in this
subject:</p>
<!-- markdownlint-disable MD013 -->
<table style="width:100%;">
<colgroup>
<col style="width: 9%" />
<col style="width: 42%" />
<col style="width: 47%" />
</colgroup>
<thead>
<tr class="header">
<th><div style="text-align:center">
<strong>Unit</strong>
</div></th>
<th><div style="text-align:center">
<strong><span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span></strong>
</div></th>
<th><div style="text-align:center">
<strong><span class="citation" data-cites="AU">[<a href="https://aurora-opensource.github.io/au" role="doc-biblioref">Au</a>]</span></strong>
</div></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><code class="sourceCode cpp">N⋅m</code></td>
<td><code class="sourceCode cpp">derived_unit<span class="op">&lt;</span>metre, newton<span class="op">&gt;</span></code></td>
<td><code class="sourceCode cpp">UnitProduct<span class="op">&lt;</span>Meters, Newtons<span class="op">&gt;</span></code></td>
</tr>
<tr class="even">
<td><code class="sourceCode cpp"><span class="dv">1</span><span class="op">/</span>s</code></td>
<td><code class="sourceCode cpp">derived_unit<span class="op">&lt;</span>one, per<span class="op">&lt;</span>second<span class="op">&gt;&gt;</span></code></td>
<td><code class="sourceCode cpp">Pow<span class="op">&lt;</span>Seconds, <span class="op">-</span><span class="dv">1</span><span class="op">&gt;</span></code></td>
</tr>
<tr class="odd">
<td><code class="sourceCode cpp">km<span class="op">/</span>h</code></td>
<td><code class="sourceCode cpp">derived_unit<span class="op">&lt;</span>kilo_<span class="op">&lt;</span>metre<span class="op">&gt;</span>, per<span class="op">&lt;</span>hour<span class="op">&gt;&gt;</span></code></td>
<td><code class="sourceCode cpp">UnitProduct<span class="op">&lt;</span>Kilo<span class="op">&lt;</span>Meters<span class="op">&gt;</span>, Pow<span class="op">&lt;</span>Hours, <span class="op">-</span><span class="dv">1</span><span class="op">&gt;&gt;</span></code></td>
</tr>
<tr class="even">
<td><code class="sourceCode cpp">kg⋅m²<span class="op">/(</span>s³⋅K<span class="op">)</span></code></td>
<td><code class="sourceCode cpp">derived_unit<span class="op">&lt;</span>kilogram, pow<span class="op">&lt;</span>metre, <span class="dv">2</span><span class="op">&gt;</span>, per<span class="op">&lt;</span>kelvin, power<span class="op">&lt;</span>second, <span class="dv">3</span><span class="op">&gt;&gt;&gt;</span></code></td>
<td><code class="sourceCode cpp">UnitProduct<span class="op">&lt;</span>Pow<span class="op">&lt;</span>Meters, <span class="dv">2</span><span class="op">&gt;</span>, Kilo<span class="op">&lt;</span>Grams<span class="op">&gt;</span>, Pow<span class="op">&lt;</span>Seconds, <span class="op">-</span><span class="dv">3</span><span class="op">&gt;</span>, Pow<span class="op">&lt;</span>Kelvins, <span class="op">-</span><span class="dv">1</span><span class="op">&gt;&gt;</span></code></td>
</tr>
<tr class="odd">
<td><code class="sourceCode cpp">m²<span class="op">/</span>m</code></td>
<td><code class="sourceCode cpp">metre</code></td>
<td><code class="sourceCode cpp">Meters</code></td>
</tr>
<tr class="even">
<td><code class="sourceCode cpp">km<span class="op">/</span>m</code></td>
<td><code class="sourceCode cpp">derived_unit<span class="op">&lt;</span>kilo_<span class="op">&lt;</span>metre<span class="op">&gt;</span>, per<span class="op">&lt;</span>metre<span class="op">&gt;&gt;</span></code></td>
<td><code class="sourceCode cpp">UnitProduct<span class="op">&lt;</span>Pow<span class="op">&lt;</span>Meters, <span class="op">-</span><span class="dv">1</span><span class="op">&gt;</span>, Kilo<span class="op">&lt;</span>Meters<span class="op">&gt;&gt;</span></code></td>
</tr>
<tr class="odd">
<td><code class="sourceCode cpp">m<span class="op">/</span>m</code></td>
<td><code class="sourceCode cpp">one</code></td>
<td><code class="sourceCode cpp">UnitProduct<span class="op">&lt;&gt;</span></code></td>
</tr>
</tbody>
</table>
<!-- markdownlint-enable MD013 -->
<p>It is a matter of taste which solution is better. While discussing
the pros and cons here, we should remember that our users often do not
have a scientific background. This is why we recommend to use syntax
that is as similar to the correct English language as possible. It
consistently uses the <code class="sourceCode cpp">derived_</code>
prefix for types representing derived units, dimensions, and quantity
specifications. Those are instantiated first with the contents of the
numerator followed by the entities of the denominator (if present)
enclosed in the <code class="sourceCode cpp">per<span class="op">&lt;...&gt;</span></code>
expression template.</p>
<h3 data-number="18.5.2" id="identities"><span class="header-section-number">18.5.2</span> Identities<a href="#identities" class="self-link"></a></h3>
<p>The arithmetics on units, dimensions, and quantity types require a
special identity value. Such value can be returned as a result of the
division of the same entities, or using it should not modify the
expression template on multiplication.</p>
<p>We chose the following names here:</p>
<ul>
<li><code class="sourceCode cpp">one</code> in the domain of units,</li>
<li><code class="sourceCode cpp">dimension_one</code> in the domain of
dimensions,</li>
<li><code class="sourceCode cpp">dimensionless</code> in the domain of
quantity types.</li>
</ul>
<p>The above names were selected based on the following quote from <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span>:</p>
<blockquote>
<p>A quantity whose dimensional exponents are all equal to zero has the
dimensional product denoted A<sup>0</sup>B<sup>0</sup>C<sup>0</sup>… =
1, where the symbol 1 denotes the corresponding dimension. There is no
agreement on how to refer to such quantities. They have been called
<strong>dimensionless</strong> quantities (although this term should now
be avoided), quantities with <strong>dimension one</strong>, quantities
with dimension number, or quantities with the <strong>unit one</strong>.
Such quantities are dimensionally simply numbers. To avoid confusion, it
is helpful to use explicit units with these quantities where possible,
e.g., m/m, nmol/mol, rad, as specified in the SI Brochure.</p>
</blockquote>
<h3 data-number="18.5.3" id="supported-operations-and-their-results"><span class="header-section-number">18.5.3</span> Supported operations and
their results<a href="#supported-operations-and-their-results" class="self-link"></a></h3>
<p>The table below presents all the operations that can be done on
units, dimensions, and quantity types in a quantities and units library.
The right column presents corresponding expression templates being their
results:</p>
<table>
<colgroup>
<col style="width: 53%" />
<col style="width: 46%" />
</colgroup>
<thead>
<tr class="header">
<th style="text-align: center;"><div style="text-align:center">
<strong>Operation</strong>
</div></th>
<th style="text-align: center;"><div style="text-align:center">
<strong>Resulting template expression arguments</strong>
</div></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: center;"><code class="sourceCode cpp">A <span class="op">*</span> B</code></td>
<td style="text-align: center;"><code class="sourceCode cpp">A, B</code></td>
</tr>
<tr class="even">
<td style="text-align: center;"><code class="sourceCode cpp">B <span class="op">*</span> A</code></td>
<td style="text-align: center;"><code class="sourceCode cpp">A, B</code></td>
</tr>
<tr class="odd">
<td style="text-align: center;"><code class="sourceCode cpp">A <span class="op">*</span> A</code></td>
<td style="text-align: center;"><code class="sourceCode cpp">power<span class="op">&lt;</span>A, <span class="dv">2</span><span class="op">&gt;</span></code></td>
</tr>
<tr class="even">
<td style="text-align: center;"><code class="sourceCode cpp"><span class="op">{</span>identity<span class="op">}</span> <span class="op">*</span> A</code></td>
<td style="text-align: center;"><code class="sourceCode cpp">A</code></td>
</tr>
<tr class="odd">
<td style="text-align: center;"><code class="sourceCode cpp">A <span class="op">*</span> <span class="op">{</span>identity<span class="op">}</span></code></td>
<td style="text-align: center;"><code class="sourceCode cpp">A</code></td>
</tr>
<tr class="even">
<td style="text-align: center;"><code class="sourceCode cpp">A <span class="op">/</span> B</code></td>
<td style="text-align: center;"><code class="sourceCode cpp">A, per<span class="op">&lt;</span>B<span class="op">&gt;</span></code></td>
</tr>
<tr class="odd">
<td style="text-align: center;"><code class="sourceCode cpp">A <span class="op">/</span> A</code></td>
<td style="text-align: center;"><code class="sourceCode cpp"><span class="op">{</span>identity<span class="op">}</span></code></td>
</tr>
<tr class="even">
<td style="text-align: center;"><code class="sourceCode cpp">A <span class="op">/</span> <span class="op">{</span>identity<span class="op">}</span></code></td>
<td style="text-align: center;"><code class="sourceCode cpp">A</code></td>
</tr>
<tr class="odd">
<td style="text-align: center;"><code class="sourceCode cpp"><span class="op">{</span>identity<span class="op">}</span> <span class="op">/</span> A</code></td>
<td style="text-align: center;"><code class="sourceCode cpp"><span class="op">{</span>identity<span class="op">}</span>, per<span class="op">&lt;</span>A<span class="op">&gt;</span></code></td>
</tr>
<tr class="even">
<td style="text-align: center;"><code class="sourceCode cpp">pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>A<span class="op">)</span></code></td>
<td style="text-align: center;"><code class="sourceCode cpp">power<span class="op">&lt;</span>A, <span class="dv">2</span><span class="op">&gt;</span></code></td>
</tr>
<tr class="odd">
<td style="text-align: center;"><code class="sourceCode cpp">pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;({</span>identity<span class="op">})</span></code></td>
<td style="text-align: center;"><code class="sourceCode cpp"><span class="op">{</span>identity<span class="op">}</span></code></td>
</tr>
<tr class="even">
<td style="text-align: center;"><code class="sourceCode cpp">sqrt<span class="op">(</span>A<span class="op">)</span></code>
or <code class="sourceCode cpp">pow<span class="op">&lt;</span><span class="dv">1</span>, <span class="dv">2</span><span class="op">&gt;(</span>A<span class="op">)</span></code></td>
<td style="text-align: center;"><code class="sourceCode cpp">power<span class="op">&lt;</span>A, <span class="dv">1</span>, <span class="dv">2</span><span class="op">&gt;</span></code></td>
</tr>
<tr class="odd">
<td style="text-align: center;"><code class="sourceCode cpp">sqrt<span class="op">({</span>identity<span class="op">})</span></code>
or <code class="sourceCode cpp">pow<span class="op">&lt;</span><span class="dv">1</span>, <span class="dv">2</span><span class="op">&gt;({</span>identity<span class="op">})</span></code></td>
<td style="text-align: center;"><code class="sourceCode cpp"><span class="op">{</span>identity<span class="op">}</span></code></td>
</tr>
</tbody>
</table>
<h3 data-number="18.5.4" id="simplifying-the-resulting-expression-templates"><span class="header-section-number">18.5.4</span> Simplifying the resulting
expression templates<a href="#simplifying-the-resulting-expression-templates" class="self-link"></a></h3>
<p>To limit the length and improve the readability of generated types,
there are many rules to simplify the resulting expression template.</p>
<ol type="1">
<li><p><strong>Ordering</strong></p>
<p>The resulting comma-separated arguments of multiplication are always
sorted according to a specific predicate. This is why:</p>
<div class="sourceCode" id="cb228"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb228-1"><a href="#cb228-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>A <span class="op">*</span> B <span class="op">==</span> B <span class="op">*</span> A<span class="op">)</span>;</span>
<span id="cb228-2"><a href="#cb228-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>std<span class="op">::</span>is_same_v<span class="op">&lt;</span><span class="kw">decltype</span><span class="op">(</span>A <span class="op">*</span> B<span class="op">)</span>, <span class="kw">decltype</span><span class="op">(</span>B <span class="op">*</span> A<span class="op">)&gt;)</span>;</span></code></pre></div>
<p>This is probably the most important of all the steps, as it allows
comparing types and enables the rest of the simplification rules.</p>
<p>Units and dimensions have unique symbols, but ordering quantity types
might not be that trivial. Although the ISQ defined in <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> provides symbols for each
quantity, there is little use for them in the C++ code. This is caused
by the fact that such symbols use a lot of characters that are not
available with the Unicode encoding. Most of the limitations correspond
to Unicode providing only a minimal set of characters available as
subscripts, which are often used to differentiate various quantities of
the same kind. For example, it is impossible to encode the symbols of
the following quantities:</p>
<ul>
<li><em>c</em><sub>sat</sub> - <em>specific heat capacity at saturated
vapour pressure</em>,</li>
<li><em>μ</em><sub>JT</sub> - <em>Joule-Thomson coefficient</em>,</li>
<li><em>w</em><sub>H<sub>2</sub>O</sub> - <em>mass fraction of
water</em>,</li>
<li><em>σ</em><sub>Ω,E</sub> - <em>direction and energy distribution of
cross section</em>,</li>
<li><em>d</em><sub>1/2</sub> - <em>half-value thickness</em>,</li>
<li><em>Φ</em><sub>e,λ</sub> - <em>spectral radiant flux</em>.</li>
</ul>
<p>This is why the library chose to use type name identifiers in such
cases.</p></li>
<li><p><strong>Aggregation</strong></p>
<p>In case two of the same type identifiers are found next to each other
on the argument list, they will be aggregated in one entry:</p>
<table>
<thead>
<tr class="header">
<th style="text-align: center;"><div style="text-align:center">
<strong>Before</strong>
</div></th>
<th style="text-align: center;"><div style="text-align:center">
<strong>After</strong>
</div></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: center;"><code class="sourceCode cpp">A, A</code></td>
<td style="text-align: center;"><code class="sourceCode cpp">power<span class="op">&lt;</span>A, <span class="dv">2</span><span class="op">&gt;</span></code></td>
</tr>
<tr class="even">
<td style="text-align: center;"><code class="sourceCode cpp">A, power<span class="op">&lt;</span>A, <span class="dv">2</span><span class="op">&gt;</span></code></td>
<td style="text-align: center;"><code class="sourceCode cpp">power<span class="op">&lt;</span>A, <span class="dv">3</span><span class="op">&gt;</span></code></td>
</tr>
<tr class="odd">
<td style="text-align: center;"><code class="sourceCode cpp">power<span class="op">&lt;</span>A, <span class="dv">1</span>, <span class="dv">2</span><span class="op">&gt;</span>, power<span class="op">&lt;</span>A, <span class="dv">2</span><span class="op">&gt;</span></code></td>
<td style="text-align: center;"><code class="sourceCode cpp">power<span class="op">&lt;</span>A, <span class="dv">5</span>, <span class="dv">2</span><span class="op">&gt;</span></code></td>
</tr>
<tr class="even">
<td style="text-align: center;"><code class="sourceCode cpp">power<span class="op">&lt;</span>A, <span class="dv">1</span>, <span class="dv">2</span><span class="op">&gt;</span>, power<span class="op">&lt;</span>A, <span class="dv">1</span>, <span class="dv">2</span><span class="op">&gt;</span></code></td>
<td style="text-align: center;"><code class="sourceCode cpp">A</code></td>
</tr>
</tbody>
</table></li>
<li><p><strong>Simplification</strong></p>
<p>In case two of the same type identifiers are found in the numerator
and denominator argument lists, they are being simplified into one
entry:</p>
<table>
<thead>
<tr class="header">
<th style="text-align: center;"><div style="text-align:center">
<strong>Before</strong>
</div></th>
<th style="text-align: center;"><div style="text-align:center">
<strong>After</strong>
</div></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: center;"><code class="sourceCode cpp">A, per<span class="op">&lt;</span>A<span class="op">&gt;</span></code></td>
<td style="text-align: center;"><code class="sourceCode cpp"><span class="op">{</span>identity<span class="op">}</span></code></td>
</tr>
<tr class="even">
<td style="text-align: center;"><code class="sourceCode cpp">power<span class="op">&lt;</span>A, <span class="dv">2</span><span class="op">&gt;</span>, per<span class="op">&lt;</span>A<span class="op">&gt;</span></code></td>
<td style="text-align: center;"><code class="sourceCode cpp">A</code></td>
</tr>
<tr class="odd">
<td style="text-align: center;"><code class="sourceCode cpp">power<span class="op">&lt;</span>A, <span class="dv">3</span><span class="op">&gt;</span>, per<span class="op">&lt;</span>A<span class="op">&gt;</span></code></td>
<td style="text-align: center;"><code class="sourceCode cpp">power<span class="op">&lt;</span>A, <span class="dv">2</span><span class="op">&gt;</span></code></td>
</tr>
<tr class="even">
<td style="text-align: center;"><code class="sourceCode cpp">A, per<span class="op">&lt;</span>power<span class="op">&lt;</span>A, <span class="dv">2</span><span class="op">&gt;&gt;</span></code></td>
<td style="text-align: center;"><code class="sourceCode cpp"><span class="op">{</span>identity<span class="op">}</span>, per<span class="op">&lt;</span>A<span class="op">&gt;</span></code></td>
</tr>
</tbody>
</table>
<p>It is important to notice here that only the elements with exactly
the same type are being simplified. This means that, for example,
<code class="sourceCode cpp">m<span class="op">/</span>m</code> results
in <code class="sourceCode cpp">one</code>, but
<code class="sourceCode cpp">km<span class="op">/</span>m</code> will
not be simplified. The resulting derived unit will preserve both symbols
and their relative magnitude. This allows us to properly print symbols
of some units or constants that require such behavior. For example, the
Hubble constant is expressed in
<code class="sourceCode cpp">km⋅s⁻¹⋅Mpc⁻¹</code>, where both
<code class="sourceCode cpp">km</code> and
<code class="sourceCode cpp">Mpc</code> are units of
<em>length</em>.</p>
<p>Also, to prevent possible issues in compile-time logic, all of the
library’s entities must be marked
<code class="sourceCode cpp"><span class="kw">final</span></code>. This
prevents the users to derive own strong types from them, which would
prevent expression template simplification of equivalent entities.</p>
<p>In <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> library, we’ve tried to refine
expression templates simplification rules to preserve the information of
the origin. However, we were not satisfied with the results. The
generated types were much longer and harder to reason about, which
decreased the compile-time errors user experience. We’ve also got issues
with basic library operations (e.g., determining the best common unit).
More details can be found in <a href="https://github.com/mpusz/mp-units/discussions/582">Refining
expression templates simplification rules</a> discussion.</p></li>
<li><p><strong>Repacking</strong></p>
<p>In case an expression uses two results of some other operations, the
components of its arguments are repacked into one resulting type and
simplified there.</p>
<p>For example, assuming:</p>
<div class="sourceCode" id="cb229"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb229-1"><a href="#cb229-1" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="kw">auto</span> X <span class="op">=</span> A <span class="op">/</span> B;</span></code></pre></div>
<p>then:</p>
<table>
<thead>
<tr class="header">
<th style="text-align: center;"><div style="text-align:center">
<strong>Operation</strong>
</div></th>
<th style="text-align: center;"><div style="text-align:center">
<strong>Resulting template expression arguments</strong>
</div></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: center;"><code class="sourceCode cpp">X <span class="op">*</span> B</code></td>
<td style="text-align: center;"><code class="sourceCode cpp">A</code></td>
</tr>
<tr class="even">
<td style="text-align: center;"><code class="sourceCode cpp">X <span class="op">*</span> A</code></td>
<td style="text-align: center;"><code class="sourceCode cpp">power<span class="op">&lt;</span>A, <span class="dv">2</span><span class="op">&gt;</span>, per<span class="op">&lt;</span>B<span class="op">&gt;</span></code></td>
</tr>
<tr class="odd">
<td style="text-align: center;"><code class="sourceCode cpp">X <span class="op">*</span> X</code></td>
<td style="text-align: center;"><code class="sourceCode cpp">power<span class="op">&lt;</span>A, <span class="dv">2</span><span class="op">&gt;</span>, per<span class="op">&lt;</span>power<span class="op">&lt;</span>B, <span class="dv">2</span><span class="op">&gt;&gt;</span></code></td>
</tr>
<tr class="even">
<td style="text-align: center;"><code class="sourceCode cpp">X <span class="op">/</span> X</code></td>
<td style="text-align: center;"><code class="sourceCode cpp"><span class="op">{</span>identity<span class="op">}</span></code></td>
</tr>
<tr class="odd">
<td style="text-align: center;"><code class="sourceCode cpp">X <span class="op">/</span> A</code></td>
<td style="text-align: center;"><code class="sourceCode cpp"><span class="op">{</span>identity<span class="op">}</span>, per<span class="op">&lt;</span>B<span class="op">&gt;</span></code></td>
</tr>
<tr class="even">
<td style="text-align: center;"><code class="sourceCode cpp">X <span class="op">/</span> B</code></td>
<td style="text-align: center;"><code class="sourceCode cpp">A, per<span class="op">&lt;</span>power<span class="op">&lt;</span>B, <span class="dv">2</span><span class="op">&gt;&gt;</span></code></td>
</tr>
</tbody>
</table></li>
</ol>
<p>Please note that for as long as for the ordering step in some cases,
we use user-provided symbols, the aggregation, and the next steps do not
benefit from those. They always use type identifiers to determine
whether the operation should be performed.</p>
<p>Unit symbols are not guaranteed to be unique in the project. For
example, someone may use <code class="sourceCode cpp"><span class="st">&quot;s&quot;</span></code> as a
symbol for a count of samples, which, when used in a unit expression
with seconds, would cause fatal consequences (e.g., <code class="sourceCode cpp">sample <span class="op">*</span> second</code>
would yield <code class="sourceCode cpp">s²</code>, or <code class="sourceCode cpp">sample <span class="op">/</span> second</code>
would result in <code class="sourceCode cpp">one</code>).</p>
<p>Some units would provide worse text output if the ordering step used
type identifiers rather than unit symbols. For example, <code class="sourceCode cpp">si<span class="op">::</span>metre <span class="op">*</span> si<span class="op">::</span>second <span class="op">*</span> cgs<span class="op">::</span>second</code>
would result in <code class="sourceCode cpp">s m s</code>, or <code class="sourceCode cpp">newton <span class="op">*</span> metre</code>
would result in <code class="sourceCode cpp">m N</code>, which is not
how we typically spell this unit. However, for the sake of consistency,
we may also consider changing the algorithm used for ordering to be
based on type identifiers.</p>
<h3 data-number="18.5.5" id="expression-templates-in-action"><span class="header-section-number">18.5.5</span> Expression templates in
action<a href="#expression-templates-in-action" class="self-link"></a></h3>
<p>Thanks to all of the steps described above, a user may write the code
like this one:</p>
<div class="sourceCode" id="cb230"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb230-1"><a href="#cb230-1" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> <span class="kw">namespace</span> mp_units<span class="op">::</span>si<span class="op">::</span>unit_symbols;</span>
<span id="cb230-2"><a href="#cb230-2" aria-hidden="true" tabindex="-1"></a>quantity speed <span class="op">=</span> isq<span class="op">::</span>speed<span class="op">(</span><span class="fl">60.</span> <span class="op">*</span> km <span class="op">/</span> h<span class="op">)</span>;</span>
<span id="cb230-3"><a href="#cb230-3" aria-hidden="true" tabindex="-1"></a>quantity duration <span class="op">=</span> <span class="dv">8</span> <span class="op">*</span> s;</span>
<span id="cb230-4"><a href="#cb230-4" aria-hidden="true" tabindex="-1"></a>quantity acceleration1 <span class="op">=</span> speed <span class="op">/</span> duration;</span>
<span id="cb230-5"><a href="#cb230-5" aria-hidden="true" tabindex="-1"></a>quantity acceleration2 <span class="op">=</span> isq<span class="op">::</span>acceleration<span class="op">(</span>acceleration1<span class="op">.</span>in<span class="op">(</span>m <span class="op">/</span> s2<span class="op">))</span>;</span>
<span id="cb230-6"><a href="#cb230-6" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="st">&quot;acceleration: &quot;</span> <span class="op">&lt;&lt;</span> acceleration1 <span class="op">&lt;&lt;</span> <span class="st">&quot; (&quot;</span> <span class="op">&lt;&lt;</span> acceleration2 <span class="op">&lt;&lt;</span> <span class="st">&quot;)</span><span class="sc">\n</span><span class="st">&quot;</span>;</span></code></pre></div>
<p>the text output provides:</p>
<pre class="text"><code>acceleration: 7.5 km h⁻¹ s⁻¹ (2.08333 m/s²)</code></pre>
<p>The above program will produce the following types for
<em>acceleration</em> quantities:</p>
<ul>
<li><p><code class="sourceCode cpp">acceleration1</code></p>
<pre class="text"><code>quantity&lt;reference&lt;derived_quantity_spec&lt;isq::speed, per&lt;isq::time&gt;&gt;,
                   derived_unit&lt;si::kilo_&lt;si::metre&gt;, per&lt;non_si::hour, si::second&gt;&gt;&gt;{},
         double&gt;</code></pre></li>
<li><p><code class="sourceCode cpp">acceleration2</code></p>
<pre class="text"><code>quantity&lt;reference&lt;isq::acceleration,
                   derived_unit&lt;si::metre, per&lt;power&lt;si::second, 2&gt;&gt;&gt;&gt;{},
         double&gt;&gt;</code></pre></li>
</ul>
<h2 data-number="18.6" id="operations-on-units-dimensions-quantity-types-and-references"><span class="header-section-number">18.6</span> Operations on units,
dimensions, quantity types, and references<a href="#operations-on-units-dimensions-quantity-types-and-references" class="self-link"></a></h2>
<p>Modern C++ physical quantities and units library should expose
compile-time constants for units, dimensions, and quantity types. Each
of such constants should be of a different type. Said otherwise, every
unit, dimension, and quantity type has a unique type and a compile-time
instance. This allows us to do regular algebra on such identifiers and
get proper types as results of such operations.</p>
<p>The operations exposed by such a library should include at least:</p>
<ul>
<li>multiplication (e.g., <code class="sourceCode cpp">newton <span class="op">*</span> metre</code>),</li>
<li>division (e.g., <code class="sourceCode cpp">metre <span class="op">/</span> second</code>),</li>
<li>power (e.g., <code class="sourceCode cpp">pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>metre<span class="op">)</span></code>
or <code class="sourceCode cpp">pow<span class="op">&lt;</span><span class="dv">1</span>, <span class="dv">2</span><span class="op">&gt;(</span>metre <span class="op">*</span> metre<span class="op">)</span></code>).</li>
</ul>
<p>To improve the usability of the library, we also recommend
adding:</p>
<ul>
<li>square root (e.g., <code class="sourceCode cpp">sqrt<span class="op">(</span>metre <span class="op">*</span> metre<span class="op">)</span></code>
as equivalent to <code class="sourceCode cpp">pow<span class="op">&lt;</span><span class="dv">1</span>, <span class="dv">2</span><span class="op">&gt;(</span>metre <span class="op">*</span> metre<span class="op">)</span></code>),</li>
<li>cubic root (e.g., <code class="sourceCode cpp">cbrt<span class="op">(</span>metre <span class="op">*</span> metre <span class="op">*</span> metre<span class="op">)</span></code>
as equivalent to <code class="sourceCode cpp">pow<span class="op">&lt;</span><span class="dv">1</span>, <span class="dv">3</span><span class="op">&gt;(</span>metre <span class="op">*</span> metre <span class="op">*</span> metre<span class="op">)</span></code>),</li>
<li>inversion (e.g., <code class="sourceCode cpp">inverse<span class="op">(</span>second<span class="op">)</span></code>
as equivalent to
<code class="sourceCode cpp">one <span class="op">/</span> second</code>).</li>
</ul>
<p>Additionally, for units only, to improve the readability of the code,
it makes sense to expose the following:</p>
<ul>
<li>square power (e.g., <code class="sourceCode cpp">square<span class="op">(</span>metre<span class="op">)</span></code>
is equivalent to <code class="sourceCode cpp">pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>metre<span class="op">)</span></code>),</li>
<li>cubic power (e.g., <code class="sourceCode cpp">cubic<span class="op">(</span>metre<span class="op">)</span></code>
is equivalent to <code class="sourceCode cpp">pow<span class="op">&lt;</span><span class="dv">3</span><span class="op">&gt;(</span>metre<span class="op">)</span></code>).</li>
</ul>
<p>The above two functions could also be considered for dimensions and
quantity types. However, <code class="sourceCode cpp">cubic<span class="op">(</span>length<span class="op">)</span></code>
does not seem to make much sense, and probably <code class="sourceCode cpp">pow<span class="op">&lt;</span><span class="dv">3</span><span class="op">&gt;(</span>length<span class="op">)</span></code>
should be preferred instead.</p>
<p>Please note that we want to keep most of the unit magnitude’s
interface <em>implementation-defined</em>. This is why we provide only a
minimal mandatory interface for them. For example, we have introduced a
<code class="sourceCode cpp">mag_power<span class="op">&lt;</span>Basis, Num, Den <span class="op">=</span> <span class="dv">1</span><span class="op">&gt;</span></code>
helper to get a power of a magnitude. With that, a user should probably
never need to reach for an alternative <code class="sourceCode cpp">pow<span class="op">&lt;</span>Num, Den<span class="op">&gt;(</span>mag<span class="op">&lt;</span>Base<span class="op">&gt;)</span></code>
version. However, the latter could be considered more consistent with
the same operation done on other abstractions. Let’s compare how a unit
can be defined using both of those syntaxes:</p>
<ul>
<li>with <code class="sourceCode cpp">mag_power</code>:</li>
</ul>
<div class="sourceCode" id="cb231"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb231-1"><a href="#cb231-1" aria-hidden="true" tabindex="-1"></a> inline <span class="kw">constexpr</span> <span class="kw">struct</span> electronvolt <span class="kw">final</span> <span class="op">:</span></span>
<span id="cb231-2"><a href="#cb231-2" aria-hidden="true" tabindex="-1"></a>  named_unit<span class="op">&lt;</span><span class="st">&quot;eV&quot;</span>, mag_ratio<span class="op">&lt;</span><span class="dv">1&#39;602&#39;176&#39;634</span>, <span class="dv">1&#39;000&#39;000&#39;000</span><span class="op">&gt;</span> <span class="op">*</span> mag_power<span class="op">&lt;</span><span class="dv">10</span>, <span class="op">-</span><span class="dv">19</span><span class="op">&gt;</span> <span class="op">*</span> si<span class="op">::</span>joule<span class="op">&gt;</span> <span class="op">{}</span> electronvolt;</span></code></pre></div>
<ul>
<li>with <code class="sourceCode cpp">pow<span class="op">&lt;&gt;(</span>mag<span class="op">&lt;&gt;)</span></code>:</li>
</ul>
<div class="sourceCode" id="cb232"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb232-1"><a href="#cb232-1" aria-hidden="true" tabindex="-1"></a> inline <span class="kw">constexpr</span> <span class="kw">struct</span> electronvolt <span class="kw">final</span> <span class="op">:</span></span>
<span id="cb232-2"><a href="#cb232-2" aria-hidden="true" tabindex="-1"></a>  named_unit<span class="op">&lt;</span><span class="st">&quot;eV&quot;</span>, mag_ratio<span class="op">&lt;</span><span class="dv">1&#39;602&#39;176&#39;634</span>, <span class="dv">1&#39;000&#39;000&#39;000</span><span class="op">&gt;</span> <span class="op">*</span> pow<span class="op">&lt;-</span><span class="dv">19</span><span class="op">&gt;(</span>mag<span class="op">&lt;</span><span class="dv">10</span><span class="op">&gt;)</span> <span class="op">*</span> si<span class="op">::</span>joule<span class="op">&gt;</span> <span class="op">{}</span> electronvolt;</span></code></pre></div>
<p>Even though it might be inconsistent with operations on other
abstractions, we’ve decided to use the first one as it seems easier to
read and better resembles what we write on paper. However, we are not
married to it, and we can change it if the LEWG prefers consistency
here. Please note, that in such a case, for consistency, we probably
should also provide
<code class="sourceCode cpp">sqrt<span class="op">()</span></code> and
<code class="sourceCode cpp">cbrt<span class="op">()</span></code>
operations. However, those are really rare operations for magnitudes (we
have not found any use cases for those in <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> so far).</p>
<h3 data-number="18.6.1" id="equality-and-equivalence"><span class="header-section-number">18.6.1</span> Equality and equivalence<a href="#equality-and-equivalence" class="self-link"></a></h3>
<p>Units, their magnitudes, dimensions, quantity types, and references
can be checked for equality with <code class="sourceCode cpp"><span class="kw">operator</span><span class="op">==</span></code>.
Equality for all the tag types is a simple check if both arguments are
of the same type. For example, for dimensions, we do the following:</p>
<div class="sourceCode" id="cb233"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb233-1"><a href="#cb233-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>Dimension Lhs, Dimension Rhs<span class="op">&gt;</span></span>
<span id="cb233-2"><a href="#cb233-2" aria-hidden="true" tabindex="-1"></a><span class="kw">consteval</span> <span class="dt">bool</span> <span class="kw">operator</span><span class="op">==(</span>Lhs lhs, Rhs rhs<span class="op">)</span></span>
<span id="cb233-3"><a href="#cb233-3" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb233-4"><a href="#cb233-4" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> is_same_v<span class="op">&lt;</span>Lhs, Rhs<span class="op">&gt;</span>;</span>
<span id="cb233-5"><a href="#cb233-5" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>Equality for references is a bit more complex:</p>
<div class="sourceCode" id="cb234"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb234-1"><a href="#cb234-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span><span class="kw">typename</span> Q1, <span class="kw">typename</span> U1, <span class="kw">typename</span> Q2, <span class="kw">typename</span> U2<span class="op">&gt;</span></span>
<span id="cb234-2"><a href="#cb234-2" aria-hidden="true" tabindex="-1"></a><span class="kw">consteval</span> <span class="dt">bool</span> <span class="kw">operator</span><span class="op">==(</span>reference<span class="op">&lt;</span>Q1, U1<span class="op">&gt;</span>, reference<span class="op">&lt;</span>Q2, U2<span class="op">&gt;)</span></span>
<span id="cb234-3"><a href="#cb234-3" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb234-4"><a href="#cb234-4" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> is_same_v<span class="op">&lt;</span>reference<span class="op">&lt;</span>Q1, U1<span class="op">&gt;</span>, reference<span class="op">&lt;</span>Q2, U2<span class="op">&gt;&gt;</span>;</span>
<span id="cb234-5"><a href="#cb234-5" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<span id="cb234-6"><a href="#cb234-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb234-7"><a href="#cb234-7" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span><span class="kw">typename</span> Q1, <span class="kw">typename</span> U1, AssociatedUnit U2<span class="op">&gt;</span></span>
<span id="cb234-8"><a href="#cb234-8" aria-hidden="true" tabindex="-1"></a><span class="kw">consteval</span> <span class="dt">bool</span> <span class="kw">operator</span><span class="op">==(</span>reference<span class="op">&lt;</span>Q1, U1<span class="op">&gt;</span>, U2 u2<span class="op">)</span></span>
<span id="cb234-9"><a href="#cb234-9" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb234-10"><a href="#cb234-10" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> Q1<span class="op">{}</span> <span class="op">==</span> get_quantity_spec<span class="op">(</span>u2<span class="op">)</span> <span class="op">&amp;&amp;</span> U1<span class="op">{}</span> <span class="op">==</span> u2;</span>
<span id="cb234-11"><a href="#cb234-11" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>The second overload allows us to mix associated units and
specializations of <code class="sourceCode cpp">reference</code> class
template (both of them satisfy
<code class="sourceCode cpp">Reference</code> concept). Thanks to this,
we can check the following:</p>
<div class="sourceCode" id="cb235"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb235-1"><a href="#cb235-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>isq<span class="op">::</span>time<span class="op">[</span>second<span class="op">]</span> <span class="op">!=</span> second<span class="op">)</span>;</span>
<span id="cb235-2"><a href="#cb235-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>kind_of<span class="op">&lt;</span>isq<span class="op">::</span>time<span class="op">&gt;[</span>second<span class="op">]</span> <span class="op">==</span> second<span class="op">)</span>;</span></code></pre></div>
<p>Units may have many shades. This is why a quality check is not enough
for them. In many cases, we want to be able to check for equivalence.
Watt (<code class="sourceCode cpp">W</code>) should be equivalent to
<code class="sourceCode cpp">J<span class="op">/</span>s</code> and
<code class="sourceCode cpp">kg m²<span class="op">/</span>s³</code>.
Also, a litre (<code class="sourceCode cpp">l</code>) should be
equivalent to a cubic decimetre
(<code class="sourceCode cpp">dm³</code>).</p>
<p>To check for unit equivalence, we convert each unit to its canonical
representation (scaled unit with magnitude expressed relative to some
“blessed” implementation-specific reference unit) and then, we compare
if the reference units and the magnitudes are the same:</p>
<div class="sourceCode" id="cb236"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb236-1"><a href="#cb236-1" aria-hidden="true" tabindex="-1"></a><span class="kw">consteval</span> <span class="dt">bool</span> equivalent<span class="op">(</span>Unit <span class="kw">auto</span> lhs, Unit <span class="kw">auto</span> rhs<span class="op">)</span></span>
<span id="cb236-2"><a href="#cb236-2" aria-hidden="true" tabindex="-1"></a>  <span class="kw">requires</span><span class="op">(</span>convertible<span class="op">(</span>lhs, rhs<span class="op">))</span></span>
<span id="cb236-3"><a href="#cb236-3" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb236-4"><a href="#cb236-4" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> get_canonical_unit<span class="op">(</span>lhs<span class="op">).</span>mag <span class="op">==</span> get_canonical_unit<span class="op">(</span>rhs<span class="op">).</span>mag;</span>
<span id="cb236-5"><a href="#cb236-5" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<h3 data-number="18.6.2" id="ordering"><span class="header-section-number">18.6.2</span> Ordering<a href="#ordering" class="self-link"></a></h3>
<p>Ordering for dimensions and quantity types has no physical sense.</p>
<p>We could entertain adding ordering for units, but this would work
only for quantities having the same reference unit, which would be
inconsistent with how equality works.</p>
<p>Let’s see the following example:</p>
<div class="sourceCode" id="cb237"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb237-1"><a href="#cb237-1" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> Unit <span class="kw">auto</span> my_unit <span class="op">=</span> si<span class="op">::</span>second;</span>
<span id="cb237-2"><a href="#cb237-2" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> <span class="kw">constexpr</span> <span class="op">(</span>my_unit <span class="op">==</span> si<span class="op">::</span>metre<span class="op">)</span> <span class="op">{</span></span>
<span id="cb237-3"><a href="#cb237-3" aria-hidden="true" tabindex="-1"></a> <span class="co">// ...</span></span>
<span id="cb237-4"><a href="#cb237-4" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<span id="cb237-5"><a href="#cb237-5" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> <span class="kw">constexpr</span> <span class="op">(</span>my_unit <span class="op">&gt;</span> si<span class="op">::</span>metre<span class="op">)</span> <span class="op">{</span></span>
<span id="cb237-6"><a href="#cb237-6" aria-hidden="true" tabindex="-1"></a> <span class="co">// ...</span></span>
<span id="cb237-7"><a href="#cb237-7" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<span id="cb237-8"><a href="#cb237-8" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> <span class="kw">constexpr</span> <span class="op">(</span>my_unit <span class="op">&gt;</span> si<span class="op">::</span>nano<span class="op">(</span>si<span class="op">::</span>second<span class="op">))</span> <span class="op">{</span></span>
<span id="cb237-9"><a href="#cb237-9" aria-hidden="true" tabindex="-1"></a> <span class="co">// ...</span></span>
<span id="cb237-10"><a href="#cb237-10" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>In the above code, the first check could be useful for some use
cases. However, the second one is impossible to implement and should not
compile. The third one could be considered useful, but the current
version of <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> does not expose such an
interface to limit potential confusion. Also, it is really hard to
mathematically prove that the unit magnitude representation that we use
in the library (based on primes factorization) is greater or smaller
than the other one in some cases.</p>
<p>This is why we discourage providing ordering operations for any of
those entities.</p>
<h3 data-number="18.6.3" id="obtaininig-common-entities"><span class="header-section-number">18.6.3</span> Obtaininig common entities<a href="#obtaininig-common-entities" class="self-link"></a></h3>
<p>We could also define arithmetic <code class="sourceCode cpp"><span class="kw">operator</span><span class="op">+</span></code>
and <code class="sourceCode cpp"><span class="kw">operator</span><span class="op">-</span></code>
for such entities to resemble the operations performed on quantities.
For example:</p>
<div class="sourceCode" id="cb238"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb238-1"><a href="#cb238-1" aria-hidden="true" tabindex="-1"></a>quantity q <span class="op">=</span> isq<span class="op">::</span>radius<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">+</span> isq<span class="op">::</span>distance<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> cm<span class="op">)</span>;</span></code></pre></div>
<p>returns a <code class="sourceCode cpp">quantity<span class="op">&lt;</span>get_common_quantity_spec<span class="op">(</span>isq<span class="op">::</span>radius, isq<span class="op">::</span>distance<span class="op">)[</span>get_common_unit<span class="op">(</span>m, cm<span class="op">)]</span>, <span class="dt">int</span><span class="op">&gt;</span></code>
aka <code class="sourceCode cpp">quantity<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">[</span>cm<span class="op">]</span>, <span class="dt">int</span><span class="op">&gt;</span></code>.
For consistency, our <code class="sourceCode cpp"><span class="kw">operator</span><span class="op">+</span></code>
and <code class="sourceCode cpp"><span class="kw">operator</span><span class="op">-</span></code>
overloads could return those common entities:</p>
<div class="sourceCode" id="cb239"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb239-1"><a href="#cb239-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>m <span class="op">+</span> cm <span class="op">==</span> cm<span class="op">)</span>;</span>
<span id="cb239-2"><a href="#cb239-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>km <span class="op">+</span> mi <span class="op">==</span> get_common_unit<span class="op">(</span>km, mi<span class="op">))</span>;</span>
<span id="cb239-3"><a href="#cb239-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>isq<span class="op">::</span>radius <span class="op">+</span> isq<span class="op">::</span>distance <span class="op">==</span> isq<span class="op">::</span>length<span class="op">)</span>;</span></code></pre></div>
<p>However, we’ve decided that this is not the best idea, and the usage
of named functions
(<code class="sourceCode cpp">common_XXX<span class="op">()</span></code>)
much better expresses the intent, is less ambiguous, and does not break
dimensional analysis math rules.</p>
<h2 data-number="18.7" id="units"><span class="header-section-number">18.7</span> Units<a href="#units" class="self-link"></a></h2>
<p>ISO specifies a measurement unit as a real scalar quantity, defined
and adopted by convention, with which any other quantity of the same
kind can be compared to express the ratio of the two quantities as a
number.</p>
<p>In other words, a unit is a specific amount of a quantity. Such a
definition is impractical from the programming language point of view.
Let’s see the following hypothetical example (the below API is not a
part of this proposal):</p>
<div class="sourceCode" id="cb240"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb240-1"><a href="#cb240-1" aria-hidden="true" tabindex="-1"></a><span class="kw">namespace</span> si <span class="op">{</span></span>
<span id="cb240-2"><a href="#cb240-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb240-3"><a href="#cb240-3" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="kw">auto</span> metre <span class="op">=</span> quantity<span class="op">&lt;</span>length<span class="op">&gt;{</span><span class="dv">1</span><span class="op">}</span>;</span>
<span id="cb240-4"><a href="#cb240-4" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="kw">auto</span> kilometre <span class="op">=</span> <span class="dv">1000</span> <span class="op">*</span> metre;</span>
<span id="cb240-5"><a href="#cb240-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb240-6"><a href="#cb240-6" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<span id="cb240-7"><a href="#cb240-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb240-8"><a href="#cb240-8" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>si<span class="op">::</span>kilometre<span class="op">&gt;</span> distance <span class="op">=</span> <span class="dv">42</span> <span class="op">*</span> si<span class="op">::</span>kilometre;</span></code></pre></div>
<p>The above code would be consistent with the ISO definition however,
it imposes several issues:</p>
<ul>
<li>creates a circular dependency for a
<code class="sourceCode cpp">quantity</code> class,</li>
<li>embeds a concrete representation type in the unit,</li>
<li>loses all the benefits associated with our prime-factorized unit
magnitudes (i.e., being able to express any ratio without the overflow
of the underlying representation type),</li>
<li><code class="sourceCode cpp">quantity<span class="op">&lt;</span>length<span class="op">&gt;{</span><span class="dv">1</span><span class="op">}</span></code>
may mean different things in namespaces of different systems which makes
it much harder to provide interoperability between them,</li>
<li>does not provide an opportunity to specify the unit symbol.</li>
</ul>
<p>This is why decided to base unit definitions on tag types.</p>
<h3 data-number="18.7.1" id="space_before_unit_symbol-alternatives"><span class="header-section-number">18.7.1</span>
<code class="sourceCode cpp">space_before_unit_symbol</code>
alternatives<a href="#space_before_unit_symbol-alternatives" class="self-link"></a></h3>
<p>As described in the <a href="#space_before_unit_symbol-customization-point"><code class="sourceCode cpp">space_before_unit_symbol</code>
customization point</a> chapter, some units should not be prepended with
a space. We proposed the following customization point:</p>
<div class="sourceCode" id="cb241"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb241-1"><a href="#cb241-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>Unit <span class="kw">auto</span> U<span class="op">&gt;</span></span>
<span id="cb241-2"><a href="#cb241-2" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="dt">bool</span> space_before_unit_symbol <span class="op">=</span> <span class="kw">true</span>;</span></code></pre></div>
<p>It is important to note that the need for some customization is only
for a small fraction of all units. It works but it has some
disadvantages. First, it might be harder to reason about the units
definitions because the spacialization of this variable template may be
in a different location in the source code than the unit definition.
Also, it breaks our assumption that we can define all the properties of
the entity with a single line of a C++ code.</p>
<p>Maybe we should add an additional parameter (defaulted to
<code class="sourceCode cpp"><span class="kw">true</span></code>) to the
<code class="sourceCode cpp">named_unit</code> class template to handle
this?</p>
<h3 data-number="18.7.2" id="prefixing-units-with-prefixes"><span class="header-section-number">18.7.2</span> Prefixing units with
prefixes<a href="#prefixing-units-with-prefixes" class="self-link"></a></h3>
<p>Initially <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> library had one additional
customization point for units:</p>
<div class="sourceCode" id="cb242"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb242-1"><a href="#cb242-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>PrefixableUnit <span class="kw">auto</span> U<span class="op">&gt;</span></span>
<span id="cb242-2"><a href="#cb242-2" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="dt">bool</span> unit_can_be_prefixed <span class="op">=</span> <span class="kw">true</span>;</span></code></pre></div>
<p>The above was used to disallow prefixes for some units, such as hours
or degrees Celsius. However, after some time, we got <a href="https://github.com/mpusz/mp-units/issues/604">the issue on
GitHub</a> asking to allow prefixes for the latter.</p>
<p>It turns out that the certification organizations are not consistent
here. ISO 80000-5 says:</p>
<blockquote>
<p>Prefixes are not allowed in combination with the unit °C.</p>
</blockquote>
<p>However, <a href="https://www.nist.gov/pml/owm/writing-si-metric-system-units">NIST
states</a>:</p>
<blockquote>
<p>Prefix symbols may be used with the unit symbol ºC, and prefix names
may be used with the unit name “degree Celsius.” For example, 12 mºC (12
millidegrees Celsius) is acceptable. However, to avoid confusion, prefix
symbols (and prefix names) are not used with the time-related unit
symbols (names) min (minute), h (hour), d (day); nor with the
angle-related symbols (names) º (degree), ’ (minute), and ”
(second).</p>
</blockquote>
<p>As a result of this issue and associated discussion, we decided to
remove <code class="sourceCode cpp">unit_can_be_prefixed</code> support
from the library, and we do not propose it here either.</p>
<h2 data-number="18.8" id="unit-magnitudes"><span class="header-section-number">18.8</span> Unit magnitudes<a href="#unit-magnitudes" class="self-link"></a></h2>
<p>A very common operation is to multiply an existing unit by a factor,
creating a new, scaled unit. For example, the unit <em>foot</em> can be
multiplied by 3, producing the unit <em>yard</em>.</p>
<p>The process also works in reverse; the ratio between any two units of
the same dimension is a well-defined number. For example, the ratio
between one foot and one inch is 12.</p>
<p>In principle, this scaling factor can be any positive real number. In
<span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> and <span class="citation" data-cites="AU">[<a href="https://aurora-opensource.github.io/au" role="doc-biblioref">Au</a>]</span>, we have used the term “magnitude”
to refer to this scaling factor. (This should not be confused with other
uses of the term, such as the logarithmic “magnitude” unit commonly used
in astronomy).</p>
<p>In the library implementation, each unit is associated with a
magnitude. However, for most units, the magnitude is a fully
encapsulated implementation detail, not a user-facing value.</p>
<p>This is because the notion of “the” magnitude of a unit is not
generally meaningful: it has no physically observable consequence. What
<em>is</em> meaningful is the <em>ratio</em> of magnitudes between two
units of the same quantity kind. We could associate the <em>foot</em>,
say, with any magnitude <span class="math inline">\(m_f\)</span> that we
like — but once we make that choice, we must assign <span class="math inline">\(3m_f\)</span> to the <em>yard</em>, and <span class="math inline">\(m_f/12\)</span> to the <em>inch</em>. Separately
and independently, we can assign any magnitude <span class="math inline">\(m_s\)</span> to the second, because it’s an
independent dimension — but once we make that choice, it fixes the
magnitude for derived units, and we must assign, say, <span class="math inline">\((5280 m_f) / (3600 m_s)\)</span> to the <em>mile
per hour</em>.</p>
<p>Even when sometimes magnitudes are observable by the user, we’ve
decided to make most of their interfaces
<em>implementation-defined</em>. We expose only minimal public
interfaces for interoperability, and we leave freedom to implementers on
how they want to solve this problem in their libraries.</p>
<p>Below, we describe how magnitudes were implemented by <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> and <span class="citation" data-cites="AU">[<a href="https://aurora-opensource.github.io/au" role="doc-biblioref">Au</a>]</span>.</p>
<h3 data-number="18.8.1" id="requirements-and-representation"><span class="header-section-number">18.8.1</span> Requirements and
representation<a href="#requirements-and-representation" class="self-link"></a></h3>
<p>A magnitude is a positive real number. The best way to
<em>represent</em> it depends on how we will <em>use</em> it.</p>
<p>To derive our requirements, note that magnitudes must support every
operation which units do. Units are closed under <em>products</em> and
<em>rational powers</em>. Therefore, our magnitude representation must
support these operations natively and robustly; this is the most basic
requirement. We must also support certain <em>irrational</em> “ratios”,
such as the factor of <span class="math inline">\(\frac{\pi}{180}\)</span> between <em>degrees</em>
and <em>radians</em>.</p>
<p>The usual approach,
<code class="sourceCode cpp">std<span class="op">::</span>ratio</code>,
fails to satisfy these requirements in multiple ways.</p>
<ul>
<li>Its integral types are too small to represent eight of SI
prefixes.</li>
<li>It is not closed under rational powers (rather infamously, in the
case of 2<sup>1/2</sup>).</li>
<li>It cannot represent irrational factors such as <span class="math inline">\(\pi\)</span>.</li>
<li>It is too vulnerable to overflow when raised to powers.</li>
</ul>
<p>This motivates us to search for a better representation.</p>
<h4 data-number="18.8.1.1" id="vector-spaces-dimensions-and-prime-numbers"><span class="header-section-number">18.8.1.1</span> Vector spaces, dimensions,
and prime numbers<a href="#vector-spaces-dimensions-and-prime-numbers" class="self-link"></a></h4>
<p>The quickest way to find this better representation is via a quick
detour.</p>
<p>Consider the <em>dimensions</em> of units, such as length, or speed.
All of the above requirements apply to dimensions, too — but in this
case, we already have a very good representation. We start by singling
out a set of dimensions to act as “base” dimensions: for example, the SI
uses <em>length</em>, <em>mass</em>, <em>time</em>, <em>electric
current</em>, <em>temperature</em>, <em>amount of substance</em>, and
<em>luminous intensity</em>. Other dimensions are formed by taking
products and rational powers of these. Our choice of base dimensions
must satisfy two properties: <em>spanning</em> (i.e., every dimension
can be expressed as <em>some</em> product-of-powers of base dimensions),
and <em>independence</em> (i.e., <em>no</em> dimension can be expressed
by <em>multiple</em> products-of-powers of base dimensions).</p>
<p>We call this scheme the “vector space” representation, because it
satisfies all of the axioms of a vector space. Choosing the base
dimensions is equivalent to choosing a set of <em>basis vectors</em>.
Multiplying dimensions is equivalent to <em>vector addition</em>. And
raising dimensions to rational powers is equivalent to <em>scalar
multiplication</em>.</p>
<table>
<colgroup>
<col style="width: 48%" />
<col style="width: 51%" />
</colgroup>
<thead>
<tr class="header">
<th><div style="text-align:center">
<strong>Dimension concept</strong>
</div></th>
<th><div style="text-align:center">
<strong>Corresponding vector space concept</strong>
</div></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Base dimensions</td>
<td>Basis vectors</td>
</tr>
<tr class="even">
<td>Multiplication</td>
<td>Vector addition</td>
</tr>
<tr class="odd">
<td>Raising to rational power</td>
<td>Scalar multiplication</td>
</tr>
<tr class="even">
<td>Null dimension (“dimensionless”)</td>
<td>Zero vector</td>
</tr>
</tbody>
</table>
<p>This viewpoint lets us derive insights from our intuitions about
vectors. For example, just as we’re free to make a <em>change of
basis</em>, we could also choose a different set of <em>base
dimensions</em>: an SI-like system could treat <em>charge</em> as
fundamental rather than <em>electrical current</em>, and would still
produce all the same results.</p>
<p>Returning to our magnitude representation problem, it should be clear
that a vector space solution would meet all of our requirements —
<em>if</em> we can find a suitable choice of basis.</p>
<p>To begin our search, note that each magnitude must have a unique
representation. This means that every combination of our basis elements
must produce a unique value. Prime numbers have this property! Take any
arbitrarily large (but finite) collection of primes, raise each prime to
some chosen exponent, and compute the product: the result can’t be
expressed by any other collection of exponents.</p>
<p>Already, this lets us represent every positive real number which
<code class="sourceCode cpp">std<span class="op">::</span>ratio</code>
can represent, by breaking the numerator and denominator into their
prime factorizations. But we can go further, and handle irrational
factors such as <span class="math inline">\(\pi\)</span> by introducing
them as new basis vectors. <span class="math inline">\(\pi\)</span>
cannot be represented by the product of powers of <em>any</em> finite
collection of primes, which means that it is “linearly independent” in
the sense of our vector space representation.</p>
<p>This completes our recipe for basis construction. First, any prime
number is automatically a basis element. Next, any time we encounter a
magnitude that can’t be expressed in terms of the existing basis
elements, then it is necessarily independent, which means we can simply
add it as a <em>new</em> basis element. It’s true that, for reasons of
real analysis, this approach can’t rigorously represent every positive
real number simultaneously. However, it <em>does</em> provide an
approach that works in <em>practice</em> for the finite set of
magnitudes that we can use in real computer programs.</p>
<p>On the C++ implementation side, we use variadic templates to define
our magnitude. Each element is a basis number raised to some rational
power (which may be omitted or abbreviated as appropriate).</p>
<h3 data-number="18.8.2" id="advantages-and-disadvantages"><span class="header-section-number">18.8.2</span> Advantages and
disadvantages<a href="#advantages-and-disadvantages" class="self-link"></a></h3>
<p>This representation has tradeoffs relative to other approaches, such
as
<code class="sourceCode cpp">std<span class="op">::</span>ratio</code>
and other related types.</p>
<p>The core advantage is, of course, its ability to satisfy the
requirements. Several real-world operations that are impossible for
<code class="sourceCode cpp">std<span class="op">::</span>ratio</code>
are effortless with vector space magnitudes. Here are some examples,
using Astronomical Units (au), meters (m), degrees (deg), and radians
(rad).</p>
<!-- markdownlint-disable MD013 -->
<table>
<colgroup>
<col style="width: 23%" />
<col style="width: 15%" />
<col style="width: 61%" />
</colgroup>
<thead>
<tr class="header">
<th><div style="text-align:center">
<strong>Unit ratio</strong>
</div></th>
<th><div style="text-align:center">
<strong><code class="sourceCode cpp">std<span class="op">::</span>ratio</code>
representation</strong>
</div></th>
<th><div style="text-align:center">
<strong>vector space representation</strong>
</div></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><span class="math inline">\(\left(\frac{\text{au}}{\text{m}}\right)\)</span></td>
<td><code class="sourceCode cpp">std<span class="op">::</span>ratio<span class="op">&lt;</span><span class="dv">149&#39;597&#39;870&#39;700</span><span class="op">&gt;</span></code></td>
<td><code class="sourceCode cpp">magnitude<span class="op">&lt;</span>power_v<span class="op">&lt;</span><span class="dv">2</span>, <span class="dv">2</span><span class="op">&gt;()</span>, <span class="dv">3</span>, power_v<span class="op">&lt;</span><span class="dv">5</span>, <span class="dv">2</span><span class="op">&gt;()</span>, <span class="dv">73</span>, <span class="dv">877</span>, <span class="dv">7789</span><span class="op">&gt;</span></code></td>
</tr>
<tr class="even">
<td><span class="math inline">\(\left(\frac{\text{au}}{\text{m}}\right)^2\)</span></td>
<td>Unrepresentable (overflow)</td>
<td><code class="sourceCode cpp">magnitude<span class="op">&lt;</span>power_v<span class="op">&lt;</span><span class="dv">2</span>, <span class="dv">4</span><span class="op">&gt;()</span>, power_v<span class="op">&lt;</span><span class="dv">3</span>, <span class="dv">2</span><span class="op">&gt;()</span>, power_v<span class="op">&lt;</span><span class="dv">5</span>, <span class="dv">4</span><span class="op">&gt;()</span>, power_v<span class="op">&lt;</span><span class="dv">73</span>, <span class="dv">2</span><span class="op">&gt;()</span>, power_v<span class="op">&lt;</span><span class="dv">877</span>, <span class="dv">2</span><span class="op">&gt;()</span>, power_v<span class="op">&lt;</span><span class="dv">7789</span>, <span class="dv">2</span><span class="op">&gt;()&gt;</span></code></td>
</tr>
<tr class="odd">
<td><span class="math inline">\(\sqrt{\frac{\text{au}}{\text{m}}}\)</span></td>
<td>Unrepresentable</td>
<td><code class="sourceCode cpp">magnitude<span class="op">&lt;</span><span class="dv">2</span>, power_v<span class="op">&lt;</span><span class="dv">3</span>, <span class="dv">1</span>, <span class="dv">2</span><span class="op">&gt;()</span>, <span class="dv">5</span>, power_v<span class="op">&lt;</span><span class="dv">73</span>, <span class="dv">1</span>, <span class="dv">2</span><span class="op">&gt;()</span>, power_v<span class="op">&lt;</span><span class="dv">877</span>, <span class="dv">1</span>, <span class="dv">2</span><span class="op">&gt;()</span>, power_v<span class="op">&lt;</span><span class="dv">7789</span>, <span class="dv">1</span>, <span class="dv">2</span><span class="op">&gt;()&gt;</span></code></td>
</tr>
<tr class="even">
<td><span class="math inline">\(\left(\frac{\text{rad}}{\text{deg}}\right)\)</span></td>
<td>Unrepresentable</td>
<td><code class="sourceCode cpp">magnitude<span class="op">&lt;</span>power_v<span class="op">&lt;</span><span class="dv">2</span>, <span class="dv">2</span><span class="op">&gt;()</span>, power_v<span class="op">&lt;</span><span class="dv">3</span>, <span class="dv">2</span><span class="op">&gt;()</span>, power_v<span class="op">&lt;</span>pi<span class="op">{}</span>, <span class="op">-</span><span class="dv">1</span><span class="op">&gt;()</span>, <span class="dv">5</span><span class="op">&gt;</span></code></td>
</tr>
</tbody>
</table>
<!-- markdownlint-enable MD013 -->
<p>One disadvantage of the vector space magnitudes is that the type
names are more verbose. As seen in the table above, users would have to
perform arithmetic to decode which number is being represented. We
expect that we can mitigate this with the same strategy we used to clean
up the unit type names: hide them via opaque types with more
human-friendly names.</p>
<p>The other disadvantage is that it incurs a dependency on the ability
to compute prime factorizations at compile time, as we explore in the
next section.</p>
<h3 data-number="18.8.3" id="compile-time-factorization"><span class="header-section-number">18.8.3</span> Compile-time factorization<a href="#compile-time-factorization" class="self-link"></a></h3>
<p>End users don’t construct magnitudes directly. If they want to
implement, say, the “astronomical unit” referenced above, they would
write something like <code class="sourceCode cpp">mag<span class="op">&lt;</span><span class="dv">149&#39;597&#39;870&#39;700</span><span class="op">&gt;</span></code>.
The library would automatically expand this to <code class="sourceCode cpp">magnitude<span class="op">&lt;</span>power_v<span class="op">&lt;</span><span class="dv">2</span>, <span class="dv">2</span><span class="op">&gt;()</span>, <span class="dv">3</span>, power_v<span class="op">&lt;</span><span class="dv">5</span>, <span class="dv">2</span><span class="op">&gt;()</span>, <span class="dv">73</span>, <span class="dv">877</span>, <span class="dv">7789</span><span class="op">&gt;</span></code>.
To do so requires the ability to factor the number <code class="sourceCode cpp"><span class="dv">149&#39;597&#39;870&#39;700</span></code>
at compile time.</p>
<p>This turns out to be challenging in many practical cases. For
example, the proton mass involves a factor of <span class="math inline">\(1,672,621,923,695\)</span>, which has a large
prime factor: <span class="math inline">\(334,524,384,739\)</span>. The
usual method of factorization, trial division, requires many iterations
to discover that this factor is prime — so many, in fact, that every
major compiler will assume that it’s an infinite loop, and will
terminate the compilation!</p>
<p>One of us wrote the paper <span class="citation" data-cites="P3133R0">[<a href="https://wg21.link/p3133r0" role="doc-biblioref">P3133R0</a>]</span> to explore a possible solution
to this problem: a new standard library function, <code class="sourceCode cpp">std<span class="op">::</span>first_factor<span class="op">(</span><span class="dt">uint64_t</span><span class="op">)</span></code>.
This function would be required to return a result at compile time for
any 64-bit integer — possibly with the help of compiler built-ins, if it
could not be done any other way. The feedback to this paper showed that
this wasn’t actually a hard-blocker: it turns out that every practical
case we have could be satisfied by a fast primality checker. Still, we
plan to continue investigating this avenue, both because it would make
the standard units library implementation much easier, and because this
function would be widely useful in many other domains.</p>
<h3 data-number="18.8.4" id="common-unit-magnitude"><span class="header-section-number">18.8.4</span> Common unit magnitude<a href="#common-unit-magnitude" class="self-link"></a></h3>
<p>In our vector space representation, we can easily compute the
magnitude of the common unit by taking the smallest exponent, across all
participating magnitudes, for each individual basis vector — as long as
we remember to use the implicit “0” exponent for any basis vector that
is omitted.</p>
<p>The following example may help make this clear. If we use <span class="math inline">\(\text{COM}\left[U_1, \cdots, U_n\right]\)</span>
as notation to represent “the common unit of <span class="math inline">\(U_1, \cdots, U_n\)</span>”, and we show only the
magnitudes for simplicity, here are the steps we would follow to find
the magnitude of the common unit.</p>
<!-- markdownlint-disable MD013 -->
<p><span class="math display">\[
\begin{align}
\text{COM}\left[18, \frac{80}{3}\right] &amp;= \text{COM}\left[(2 \cdot
3^2), (2^4 \cdot 3^{-1} \cdot 5)\right] \\
&amp;= \text{COM}\left[(2^1 \cdot 3^2 \cdot 5^0), (2^4 \cdot 3^{-1}
\cdot 5^1)\right] \\
&amp;= 2^{\text{min}[1, 4]} \cdot 3^{\text{min}[2, -1]} \cdot
5^{\text{min}[0, 1]} \\
&amp;= 2^1 \cdot 3^{-1} \cdot 5^0 \\
&amp;= \frac{2}{3}
\end{align}
\]</span></p>
<!-- markdownlint-enable MD013 -->
<p>This procedure produces the unambiguous correct answer whenever it is
well defined. It also produces an answer for irrational “ratios”, where
there is no uniquely defined result. This provides the practical benefit
of making it easy to compare, say, an angle in degrees to one in
radians, as long as at least one of them is represented in a floating
point type.</p>
<h2 data-number="18.9" id="physical-constants"><span class="header-section-number">18.9</span> Physical constants<a href="#physical-constants" class="self-link"></a></h2>
<p>In most libraries, physical constants are implemented as constant
(possibly
<code class="sourceCode cpp"><span class="kw">constexpr</span></code>)
quantity values. Such an approach has some disadvantages, often
resulting in longer compilation times and a loss of precision.</p>
<h3 data-number="18.9.1" id="simplifying-constants-in-an-equation"><span class="header-section-number">18.9.1</span> Simplifying constants in an
equation<a href="#simplifying-constants-in-an-equation" class="self-link"></a></h3>
<p>When dealing with equations involving physical constants, they often
occur more than once in an expression. Such a constant may appear both
in a numerator and denominator of a quantity equation. As we know from
fundamental physics, we can simplify such an expression by simply
striking a constant out of the equation. Supporting such behavior allows
a faster runtime performance and often a better precision of the
resulting value.</p>
<h3 data-number="18.9.2" id="physical-constants-as-units"><span class="header-section-number">18.9.2</span> Physical constants as
units<a href="#physical-constants-as-units" class="self-link"></a></h3>
<p>The library allows and encourages implementing physical constants as
regular units. With that, the constant’s value is handled at
compile-time, and under favorable circumstances, it can be simplified in
the same way as all other repeated units do. If it is not simplified,
the value is stored in a type, and the expensive multiplication or
division operations can be delayed in time until a user selects a
specific unit to represent/print the data.</p>
<p>Such a feature often also allows the use of simpler or faster
representation types in the equation. For example, instead of always
multiplying a small integral value with a big floating-point constant
number, we can just use the integral type all the way. Only in case a
constant will not simplify in the equation, and the user will require a
specific unit, such a multiplication will be lazily invoked, and the
representation type will need to be expanded to facilitate that. With
that, addition, subtractions, multiplications, and divisions will always
be the fastest - compiled away or done on the fast arithmetic types or
in out-of-order execution.</p>
<p>To benefit from all of the above, constants (defined by SI or
otherwise) are implemented as units in the following way:</p>
<div class="sourceCode" id="cb243"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb243-1"><a href="#cb243-1" aria-hidden="true" tabindex="-1"></a><span class="kw">namespace</span> si <span class="op">{</span></span>
<span id="cb243-2"><a href="#cb243-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb243-3"><a href="#cb243-3" aria-hidden="true" tabindex="-1"></a><span class="kw">namespace</span> si2019 <span class="op">{</span></span>
<span id="cb243-4"><a href="#cb243-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb243-5"><a href="#cb243-5" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> speed_of_light_in_vacuum <span class="kw">final</span> <span class="op">:</span></span>
<span id="cb243-6"><a href="#cb243-6" aria-hidden="true" tabindex="-1"></a>  named_unit<span class="op">&lt;</span><span class="st">&quot;c&quot;</span>, mag<span class="op">&lt;</span><span class="dv">299&#39;792&#39;458</span><span class="op">&gt;</span> <span class="op">*</span> metre <span class="op">/</span> second<span class="op">&gt;</span> <span class="op">{}</span> speed_of_light_in_vacuum;</span>
<span id="cb243-7"><a href="#cb243-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb243-8"><a href="#cb243-8" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>  <span class="co">// namespace si2019</span></span>
<span id="cb243-9"><a href="#cb243-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb243-10"><a href="#cb243-10" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> magnetic_constant <span class="kw">final</span> <span class="op">:</span></span>
<span id="cb243-11"><a href="#cb243-11" aria-hidden="true" tabindex="-1"></a>  named_unit<span class="op">&lt;{</span><span class="st">u8&quot;μ₀&quot;</span>, <span class="st">&quot;u_0&quot;</span><span class="op">}</span>, mag<span class="op">&lt;</span><span class="dv">4</span><span class="op">&gt;</span> <span class="op">*</span> mag<span class="op">&lt;</span>π<span class="op">&gt;</span> <span class="op">*</span> mag_power<span class="op">&lt;</span><span class="dv">10</span>, <span class="op">-</span><span class="dv">7</span><span class="op">&gt;</span> <span class="op">*</span> henry <span class="op">/</span> metre<span class="op">&gt;</span> <span class="op">{}</span> magnetic_constant;</span>
<span id="cb243-12"><a href="#cb243-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb243-13"><a href="#cb243-13" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>  <span class="co">// namespace si</span></span></code></pre></div>
<h3 data-number="18.9.3" id="physical-constants-usage-examples"><span class="header-section-number">18.9.3</span> Physical constants usage
examples<a href="#physical-constants-usage-examples" class="self-link"></a></h3>
<p>With the above definitions, we can calculate vacuum permittivity
as:</p>
<div class="sourceCode" id="cb244"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb244-1"><a href="#cb244-1" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="kw">auto</span> permeability_of_vacuum <span class="op">=</span> <span class="fl">1.</span> <span class="op">*</span> si<span class="op">::</span>magnetic_constant;</span>
<span id="cb244-2"><a href="#cb244-2" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="kw">auto</span> speed_of_light_in_vacuum <span class="op">=</span> <span class="dv">1</span> <span class="op">*</span> si<span class="op">::</span>si2019<span class="op">::</span>speed_of_light_in_vacuum;</span>
<span id="cb244-3"><a href="#cb244-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb244-4"><a href="#cb244-4" aria-hidden="true" tabindex="-1"></a>QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>permittivity_of_vacuum<span class="op">&gt;</span> <span class="kw">auto</span> q <span class="op">=</span> <span class="dv">1</span> <span class="op">/</span> <span class="op">(</span>permeability_of_vacuum <span class="op">*</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>speed_of_light_in_vacuum<span class="op">))</span>;</span>
<span id="cb244-5"><a href="#cb244-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb244-6"><a href="#cb244-6" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="st">&quot;permittivity of vacuum = &quot;</span> <span class="op">&lt;&lt;</span> q <span class="op">&lt;&lt;</span> <span class="st">&quot; = &quot;</span> <span class="op">&lt;&lt;</span> q<span class="op">.</span>in<span class="op">(</span>F <span class="op">/</span> m<span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span></code></pre></div>
<p>The above first prints the following:</p>
<pre class="text"><code>permittivity of vacuum = 1  μ₀⁻¹ c⁻² = 8.85419e-12 F/m</code></pre>
<p>As we can clearly see, all the calculations above were just about
multiplying and dividing the number
<code class="sourceCode cpp"><span class="dv">1</span></code> with the
rest of the information provided as a compile-time type. Only when a
user wants a specific SI unit as a result, the unit ratios are lazily
resolved.</p>
<p>Another similar example can be an equation for total energy:</p>
<div class="sourceCode" id="cb245"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb245-1"><a href="#cb245-1" aria-hidden="true" tabindex="-1"></a>QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>mechanical_energy<span class="op">&gt;</span> <span class="kw">auto</span> total_energy<span class="op">(</span>QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>momentum<span class="op">&gt;</span> <span class="kw">auto</span> p,</span>
<span id="cb245-2"><a href="#cb245-2" aria-hidden="true" tabindex="-1"></a>                                                     QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>mass<span class="op">&gt;</span> <span class="kw">auto</span> m,</span>
<span id="cb245-3"><a href="#cb245-3" aria-hidden="true" tabindex="-1"></a>                                                     QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>speed<span class="op">&gt;</span> <span class="kw">auto</span> c<span class="op">)</span></span>
<span id="cb245-4"><a href="#cb245-4" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb245-5"><a href="#cb245-5" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> isq<span class="op">::</span>mechanical_energy<span class="op">(</span>sqrt<span class="op">(</span>pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>p <span class="op">*</span> c<span class="op">)</span> <span class="op">+</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>m <span class="op">*</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>c<span class="op">))))</span>;</span>
<span id="cb245-6"><a href="#cb245-6" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<!-- TODO refactor to the vector representation type when the design is done -->
<div class="sourceCode" id="cb246"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb246-1"><a href="#cb246-1" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> Unit <span class="kw">auto</span> GeV <span class="op">=</span> si<span class="op">::</span>giga<span class="op">&lt;</span>si<span class="op">::</span>electronvolt<span class="op">&gt;</span>;</span>
<span id="cb246-2"><a href="#cb246-2" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> quantity c <span class="op">=</span> <span class="fl">1.</span> <span class="op">*</span> si<span class="op">::</span>si2019<span class="op">::</span>speed_of_light_in_vacuum;</span>
<span id="cb246-3"><a href="#cb246-3" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> quantity c2 <span class="op">=</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>c<span class="op">)</span>;</span>
<span id="cb246-4"><a href="#cb246-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb246-5"><a href="#cb246-5" aria-hidden="true" tabindex="-1"></a><span class="kw">const</span> quantity p1 <span class="op">=</span> isq<span class="op">::</span>momentum<span class="op">(</span><span class="fl">4.</span> <span class="op">*</span> GeV <span class="op">/</span> c<span class="op">)</span>;</span>
<span id="cb246-6"><a href="#cb246-6" aria-hidden="true" tabindex="-1"></a><span class="kw">const</span> QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>mass<span class="op">&gt;</span> <span class="kw">auto</span> m1 <span class="op">=</span> <span class="fl">3.</span> <span class="op">*</span> GeV <span class="op">/</span> c2;</span>
<span id="cb246-7"><a href="#cb246-7" aria-hidden="true" tabindex="-1"></a><span class="kw">const</span> quantity E <span class="op">=</span> total_energy<span class="op">(</span>p1, m1, c<span class="op">)</span>;</span>
<span id="cb246-8"><a href="#cb246-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb246-9"><a href="#cb246-9" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="st">&quot;in `GeV` and `c`:</span><span class="sc">\n</span><span class="st">&quot;</span></span>
<span id="cb246-10"><a href="#cb246-10" aria-hidden="true" tabindex="-1"></a>          <span class="op">&lt;&lt;</span> <span class="st">&quot;p = &quot;</span> <span class="op">&lt;&lt;</span> p1 <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span></span>
<span id="cb246-11"><a href="#cb246-11" aria-hidden="true" tabindex="-1"></a>          <span class="op">&lt;&lt;</span> <span class="st">&quot;m = &quot;</span> <span class="op">&lt;&lt;</span> m1 <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span></span>
<span id="cb246-12"><a href="#cb246-12" aria-hidden="true" tabindex="-1"></a>          <span class="op">&lt;&lt;</span> <span class="st">&quot;E = &quot;</span> <span class="op">&lt;&lt;</span> E <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb246-13"><a href="#cb246-13" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb246-14"><a href="#cb246-14" aria-hidden="true" tabindex="-1"></a><span class="kw">const</span> quantity p2 <span class="op">=</span> p1<span class="op">.</span>in<span class="op">(</span>GeV <span class="op">/</span> <span class="op">(</span>m <span class="op">/</span> s<span class="op">))</span>;</span>
<span id="cb246-15"><a href="#cb246-15" aria-hidden="true" tabindex="-1"></a><span class="kw">const</span> quantity m2 <span class="op">=</span> m1<span class="op">.</span>in<span class="op">(</span>GeV <span class="op">/</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>m <span class="op">/</span> s<span class="op">))</span>;</span>
<span id="cb246-16"><a href="#cb246-16" aria-hidden="true" tabindex="-1"></a><span class="kw">const</span> quantity E2 <span class="op">=</span> total_energy<span class="op">(</span>p2, m2, c<span class="op">).</span>in<span class="op">(</span>GeV<span class="op">)</span>;</span>
<span id="cb246-17"><a href="#cb246-17" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb246-18"><a href="#cb246-18" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">in `GeV`:</span><span class="sc">\n</span><span class="st">&quot;</span></span>
<span id="cb246-19"><a href="#cb246-19" aria-hidden="true" tabindex="-1"></a>          <span class="op">&lt;&lt;</span> <span class="st">&quot;p = &quot;</span> <span class="op">&lt;&lt;</span> p2 <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span></span>
<span id="cb246-20"><a href="#cb246-20" aria-hidden="true" tabindex="-1"></a>          <span class="op">&lt;&lt;</span> <span class="st">&quot;m = &quot;</span> <span class="op">&lt;&lt;</span> m2 <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span></span>
<span id="cb246-21"><a href="#cb246-21" aria-hidden="true" tabindex="-1"></a>          <span class="op">&lt;&lt;</span> <span class="st">&quot;E = &quot;</span> <span class="op">&lt;&lt;</span> E2 <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb246-22"><a href="#cb246-22" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb246-23"><a href="#cb246-23" aria-hidden="true" tabindex="-1"></a><span class="kw">const</span> quantity p3 <span class="op">=</span> p1<span class="op">.</span>in<span class="op">(</span>kg <span class="op">*</span> m <span class="op">/</span> s<span class="op">)</span>;</span>
<span id="cb246-24"><a href="#cb246-24" aria-hidden="true" tabindex="-1"></a><span class="kw">const</span> quantity m3 <span class="op">=</span> m1<span class="op">.</span>in<span class="op">(</span>kg<span class="op">)</span>;</span>
<span id="cb246-25"><a href="#cb246-25" aria-hidden="true" tabindex="-1"></a><span class="kw">const</span> quantity E3 <span class="op">=</span> total_energy<span class="op">(</span>p3, m3, c<span class="op">).</span>in<span class="op">(</span>J<span class="op">)</span>;</span>
<span id="cb246-26"><a href="#cb246-26" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb246-27"><a href="#cb246-27" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">in SI base units:</span><span class="sc">\n</span><span class="st">&quot;</span></span>
<span id="cb246-28"><a href="#cb246-28" aria-hidden="true" tabindex="-1"></a>          <span class="op">&lt;&lt;</span> <span class="st">&quot;p = &quot;</span> <span class="op">&lt;&lt;</span> p3 <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span></span>
<span id="cb246-29"><a href="#cb246-29" aria-hidden="true" tabindex="-1"></a>          <span class="op">&lt;&lt;</span> <span class="st">&quot;m = &quot;</span> <span class="op">&lt;&lt;</span> m3 <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span></span>
<span id="cb246-30"><a href="#cb246-30" aria-hidden="true" tabindex="-1"></a>          <span class="op">&lt;&lt;</span> <span class="st">&quot;E = &quot;</span> <span class="op">&lt;&lt;</span> E3 <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span></code></pre></div>
<p>The above prints the following:</p>
<pre class="text"><code>in `GeV` and `c`:
p = 4 GeV/c
m = 3 GeV/c²
E = 5 GeV

in `GeV`:
p = 1.33426e-08 GeV s/m
m = 3.33795e-17 GeV s²/m²
E = 5 GeV

in SI base units:
p = 2.13771e-18 kg m/s
m = 5.34799e-27 kg
E = 8.01088e-10 J</code></pre>
<h2 data-number="18.10" id="quantity-specifications"><span class="header-section-number">18.10</span> Quantity specifications<a href="#quantity-specifications" class="self-link"></a></h2>
<p>Quantity specification provides all the data about the quantity type
(i.e., kind, character, recipe, relation to other quantities in the
hierarchy). It does not specify a unit, though.</p>
<h3 data-number="18.10.1" id="bikeshedding-quantity_spec"><span class="header-section-number">18.10.1</span> Bikeshedding
<code class="sourceCode cpp">quantity_spec</code><a href="#bikeshedding-quantity_spec" class="self-link"></a></h3>
<p>The “quantity specification” term is not provided in ISO or BIPM
metrology dictonaries and was invented for the need of this library.
This means that we should probably consider some other names for this
abstraction:</p>
<ul>
<li><code class="sourceCode cpp">quantity_specification</code>,</li>
<li><code class="sourceCode cpp">q_spec</code>,</li>
<li><code class="sourceCode cpp">q_specification</code>,</li>
<li><code class="sourceCode cpp">quantity_definition</code>,</li>
<li><code class="sourceCode cpp">quantity_def</code>.</li>
</ul>
<h2 data-number="18.11" id="quantity-references"><span class="header-section-number">18.11</span> Quantity references<a href="#quantity-references" class="self-link"></a></h2>
<p><em>Note: We know that probably the term “reference” will not survive
too long in the Committee, but we couldn’t find a better name for it in
the <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> library (<a href="https://github.com/mpusz/mp-units/issues/486" class="uri">https://github.com/mpusz/mp-units/issues/486</a>).</em></p>
<p><span class="citation" data-cites="ISO-GUIDE">[<a href="https://www.iso.org/obp/ui#iso:std:iso-iec:guide:99" role="doc-biblioref">ISO/IEC Guide 99</a>]</span> says:</p>
<blockquote>
<p><strong>quantity</strong> - property of a phenomenon, body, or
substance, where the property has a magnitude that can be expressed as a
number and a reference. … A reference can be a measurement unit, a
measurement procedure, a reference material, or a combination of
such.</p>
</blockquote>
<p>In the library a quantity reference represents all the
domain-specific meta-data about the quantity besides its representation
type and its value. A <a href="#Reference-concept"><code class="sourceCode cpp">Reference</code></a>
concept is satisfied by either of:</p>
<ul>
<li>an associated unit (e.g.,
<code class="sourceCode cpp">si<span class="op">::</span>metre</code>),</li>
<li>an instantiation of the <code class="sourceCode cpp">reference<span class="op">&lt;</span>QuantitySpec, Unit<span class="op">&gt;</span></code>
class template explicitly specifying the quantity type and its
unit.</li>
</ul>
<p>A reference type is implicitly created as a result of the following
expression:</p>
<div class="sourceCode" id="cb247"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb247-1"><a href="#cb247-1" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> Reference <span class="kw">auto</span> distance <span class="op">=</span> isq<span class="op">::</span>distance<span class="op">[</span>m<span class="op">]</span>;</span></code></pre></div>
<p>The above example defines a variable of type <code class="sourceCode cpp">reference<span class="op">&lt;</span>isq<span class="op">::</span>distance, si<span class="op">::</span>metre<span class="op">&gt;</span></code>.</p>
<p>The <code class="sourceCode cpp">reference</code> class template also
exposes an arithmetic interface similar to the one that we have already
discussed in case of units and quantity types. It simply forwards the
operation to its quantity type and unit members.</p>
<div class="sourceCode" id="cb248"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb248-1"><a href="#cb248-1" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> ReferenceOf<span class="op">&lt;</span>isq<span class="op">::</span>speed<span class="op">&gt;</span> <span class="kw">auto</span> speed <span class="op">=</span> distance <span class="op">/</span> si<span class="op">::</span>second;</span></code></pre></div>
<p>As a result we get a <code class="sourceCode cpp">reference<span class="op">&lt;</span>derived_quantity_spec<span class="op">&lt;</span>distance, per<span class="op">&lt;</span>time<span class="op">&gt;&gt;</span>, derived_unit<span class="op">&lt;</span>metre, per<span class="op">&lt;</span>second<span class="op">&gt;&gt;&gt;</span></code>
type.</p>
<p>Similarly to the <a href="#AssociatedUnit-concept"><code class="sourceCode cpp">AssociatedUnit</code></a>,
such a reference can be used to construct a quantity:</p>
<div class="sourceCode" id="cb249"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb249-1"><a href="#cb249-1" aria-hidden="true" tabindex="-1"></a>QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>speed<span class="op">&gt;</span> <span class="kw">auto</span> s <span class="op">=</span> <span class="dv">60</span> <span class="op">*</span> speed;</span></code></pre></div>
<h3 data-number="18.11.1" id="bikeshedding-reference"><span class="header-section-number">18.11.1</span> Bikeshedding
<code class="sourceCode cpp">reference</code><a href="#bikeshedding-reference" class="self-link"></a></h3>
<p>The term <code class="sourceCode cpp">reference</code> is highly
overloaded in the C++ domain. This is why we should probably rename the
type that was successfully used in <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span>. Here are a few proposals:</p>
<ul>
<li><code class="sourceCode cpp">quantity_reference</code></li>
<li><code class="sourceCode cpp">quantity_ref</code></li>
<li><code class="sourceCode cpp">q_reference</code></li>
<li><code class="sourceCode cpp">q_ref</code></li>
</ul>
<p>Please note that the longer the identifier we choose, the longer and
harder it will be to grasp compiler error messages. A user never types
this type identifier in the code (although a user might type an
associated concept <code class="sourceCode cpp">Reference</code> or
<code class="sourceCode cpp">ReferenceOf</code>).</p>
<h2 data-number="18.12" id="quantities"><span class="header-section-number">18.12</span> Quantities<a href="#quantities" class="self-link"></a></h2>
<p>The <code class="sourceCode cpp">quantity</code> class template is a
workhorse of the library. It can be considered a generalization of <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration</code>,
but is not directly compatible with it.</p>
<p>Based on the ISO definition provided in the <a href="#quantity-references">Quantity references</a> chapter, the
<code class="sourceCode cpp">quantity</code> class template has the
following signature:</p>
<div class="sourceCode" id="cb250"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb250-1"><a href="#cb250-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span>Reference <span class="kw">auto</span> R, RepresentationOf<span class="op">&lt;</span>get_quantity_spec<span class="op">(</span>R<span class="op">)&gt;</span> Rep <span class="op">=</span> <span class="dt">double</span><span class="op">&gt;</span></span>
<span id="cb250-2"><a href="#cb250-2" aria-hidden="true" tabindex="-1"></a><span class="kw">class</span> quantity;</span></code></pre></div>
<p>It stores only one data member of
<code class="sourceCode cpp">Rep</code> type. Unfortunately, this data
member has to be publicly exposed to satisfy the C++ language
requirements for <a href="https://eel.is/c++draft/temp.param#def:type,structural">structural
types</a>. Hopefully, the language rules for structural types will
improve with time before this library gets standardized.</p>
<h3 data-number="18.12.1" id="multiply-syntax-commutativity"><span class="header-section-number">18.12.1</span> Multiply syntax
commutativity<a href="#multiply-syntax-commutativity" class="self-link"></a></h3>
<p>As of today, the multiply syntax that creates quantities is not
commutative:</p>
<div class="sourceCode" id="cb251"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb251-1"><a href="#cb251-1" aria-hidden="true" tabindex="-1"></a>quantity q1 <span class="op">=</span> <span class="dv">1</span> <span class="op">*</span> m;  <span class="co">// OK</span></span>
<span id="cb251-2"><a href="#cb251-2" aria-hidden="true" tabindex="-1"></a>quantity q2 <span class="op">=</span> m <span class="op">*</span> <span class="dv">1</span>;  <span class="co">// Compile-time error</span></span></code></pre></div>
<p>We decided to go this way to increase the readability of the code and
limit possible confusion with this syntax. After a while, we extended it
to support also the following:</p>
<div class="sourceCode" id="cb252"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb252-1"><a href="#cb252-1" aria-hidden="true" tabindex="-1"></a>quantity q3 <span class="op">=</span> <span class="dv">1</span> <span class="op">*</span> m <span class="op">/</span> s;    <span class="co">// OK</span></span>
<span id="cb252-2"><a href="#cb252-2" aria-hidden="true" tabindex="-1"></a>quantity q4 <span class="op">=</span> <span class="dv">1</span> <span class="op">*</span> m <span class="op">*</span> m;    <span class="co">// OK</span></span>
<span id="cb252-3"><a href="#cb252-3" aria-hidden="true" tabindex="-1"></a>quantity q5 <span class="op">=</span> <span class="dv">1</span> <span class="op">/</span> s <span class="op">*</span> m;    <span class="co">// OK</span></span>
<span id="cb252-4"><a href="#cb252-4" aria-hidden="true" tabindex="-1"></a>quantity q6 <span class="op">=</span> s <span class="op">/</span> <span class="dv">2</span>;        <span class="co">// Compile-time error</span></span>
<span id="cb252-5"><a href="#cb252-5" aria-hidden="true" tabindex="-1"></a>quantity q7 <span class="op">=</span> m <span class="op">*</span> <span class="op">(</span><span class="dv">1</span> <span class="op">/</span> s<span class="op">)</span>;  <span class="co">// Compile-time error</span></span>
<span id="cb252-6"><a href="#cb252-6" aria-hidden="true" tabindex="-1"></a>quantity q8 <span class="op">=</span> m <span class="op">*</span> <span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">)</span>;  <span class="co">// Compile-time error</span></span></code></pre></div>
<p>However, <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> users <a href="https://github.com/mpusz/mp-units/issues/621">requested the
following use case</a>:</p>
<div class="sourceCode" id="cb253"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb253-1"><a href="#cb253-1" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span><span class="op">(</span>num <span class="op">&lt;</span> Unit <span class="op">/</span> <span class="dv">1&#39;000&#39;000&#39;000&#39;000</span><span class="op">)</span> <span class="op">{</span></span>
<span id="cb253-2"><a href="#cb253-2" aria-hidden="true" tabindex="-1"></a>  quantity<span class="op">&lt;</span>si<span class="op">::</span>femto<span class="op">&lt;</span>Unit<span class="op">&gt;</span>, <span class="dt">double</span><span class="op">&gt;</span> n<span class="op">{</span>num<span class="op">}</span>;</span>
<span id="cb253-3"><a href="#cb253-3" aria-hidden="true" tabindex="-1"></a>  out <span class="op">&lt;&lt;</span> n;</span>
<span id="cb253-4"><a href="#cb253-4" aria-hidden="true" tabindex="-1"></a><span class="op">}</span> <span class="cf">else</span> <span class="cf">if</span><span class="op">(</span>num <span class="op">&lt;</span> Unit <span class="op">/</span> <span class="dv">1&#39;000&#39;000&#39;000</span><span class="op">)</span> <span class="op">{</span></span>
<span id="cb253-5"><a href="#cb253-5" aria-hidden="true" tabindex="-1"></a>  quantity<span class="op">&lt;</span>si<span class="op">::</span>pico<span class="op">&lt;</span>Unit<span class="op">&gt;</span>, <span class="dt">double</span><span class="op">&gt;</span> n<span class="op">{</span>num<span class="op">}</span>;</span>
<span id="cb253-6"><a href="#cb253-6" aria-hidden="true" tabindex="-1"></a>  out <span class="op">&lt;&lt;</span> n;</span>
<span id="cb253-7"><a href="#cb253-7" aria-hidden="true" tabindex="-1"></a><span class="op">}</span> <span class="cf">else</span> <span class="co">// ...</span></span></code></pre></div>
<p>Today, this does not compile. Should we extend the multiply syntax to
support such use cases and with this have entire commutative
property?</p>
<h3 data-number="18.12.2" id="why-dont-we-use-udls-to-create-quantities"><span class="header-section-number">18.12.2</span> Why don’t we use UDLs to
create quantities?<a href="#why-dont-we-use-udls-to-create-quantities" class="self-link"></a></h3>
<p><a href="#constructing-a-quantity">Constructing a quantity</a>
chapter describes and explains why we introduced the multiply syntax as
a construction helper for quantities. Many people ask why we chose this
approach over battle-proven User Defined Literals (UDLs) that work well
for the
<code class="sourceCode cpp">std<span class="op">::</span>chrono</code>
library.</p>
<p>It turns out that many reasons make UDLs a poor choice for a physical
units library:</p>
<ol type="1">
<li><p>UDLs work only with literals (compile-time known values). Our
observation is that besides the unit tests, only a few compile-time
known quantity values are used in the production code. Please note that
for <a href="#physical-constants">Physical constants</a>, we recommend
using units rather than compile-time constants.</p></li>
<li><p>Typical implementations of UDLs tend to always use the widest
representation type available. In the case of <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration</code>,
the following is true:</p>
<div class="sourceCode" id="cb254"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb254-1"><a href="#cb254-1" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> <span class="kw">namespace</span> std<span class="op">::</span>chrono_literals;</span>
<span id="cb254-2"><a href="#cb254-2" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> d1 <span class="op">=</span> <span class="dv">42</span><span class="bu">s</span>;</span>
<span id="cb254-3"><a href="#cb254-3" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> d2 <span class="op">=</span> <span class="fl">42.</span><span class="bu">s</span>;</span>
<span id="cb254-4"><a href="#cb254-4" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>std<span class="op">::</span>is_same_v<span class="op">&lt;</span><span class="kw">decltype</span><span class="op">(</span>d1<span class="op">)::</span>rep, std<span class="op">::</span><span class="dt">int64_t</span><span class="op">&gt;)</span>;</span>
<span id="cb254-5"><a href="#cb254-5" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>std<span class="op">::</span>is_same_v<span class="op">&lt;</span><span class="kw">decltype</span><span class="op">(</span>d2<span class="op">)::</span>rep, <span class="dt">long</span> <span class="dt">double</span><span class="op">&gt;)</span>;</span></code></pre></div>
<p>When such UDL is intermixed in arithmetics with any quantity type of
a shorter representation type, it will always expand it to the longest
one. In other words, such long type spreads until all types use it
everywhere.</p></li>
<li><p>While increasing the coverage for the <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> library, we learned that many
unit symbols conflict with built-in types or numeric extensions. A few
of those are: <code class="sourceCode cpp">F</code> (farad),
<code class="sourceCode cpp">J</code> (joule),
<code class="sourceCode cpp">W</code> (watt),
<code class="sourceCode cpp">K</code> (kelvin),
<code class="sourceCode cpp">d</code> (day),
<code class="sourceCode cpp">l</code> or
<code class="sourceCode cpp">L</code> (litre),
<code class="sourceCode cpp">erg</code>,
<code class="sourceCode cpp">ergps</code>. Using the
<code class="sourceCode cpp">_</code> prefix would make it work for
<span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span>, but if the library is
standardized, those naming collisions would be a big issue. This is why
we came up with the <code class="sourceCode cpp">_q_</code> prefix that
would become <code class="sourceCode cpp">q_</code> after
standardization (e.g., <code class="sourceCode cpp"><span class="dv">42</span><span class="er">q_s</span></code>),
which is not that nice anymore.</p></li>
<li><p>UDLs with the same identifiers defined in different namespace
can’t be disambiguated in the C++ language. If both SI and CGS systems
define <code class="sourceCode cpp">q_s</code> UDL for a second unit,
then it would not be possible to specify which one to use in case both
namespaces are “imported” with using directives.</p></li>
<li><p>Another bad property of UDLs is that they do not compose. A
coherent unit of angular momentum would have a UDL specified as
<code class="sourceCode cpp">q_kg_m2_per_s</code>. Now imagine that we
want to make every possible user happy. How many variations of that unit
would we predefine for differently scaled versions of all unit
ingredients?</p></li>
<li><p>UDLs are also really expensive to define and specify. Typically,
for each unit, we need two definitions. One for integral and another one
for floating-point representation. In version 0.8.0 of the <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> library, the coherent unit of
angular momentum was defined as:</p>
<div class="sourceCode" id="cb255"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb255-1"><a href="#cb255-1" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="kw">auto</span> <span class="kw">operator</span><span class="st">&quot;&quot;</span> _q_kg_m2_per_s<span class="op">(</span><span class="dt">unsigned</span> <span class="dt">long</span> <span class="dt">long</span> l<span class="op">)</span></span>
<span id="cb255-2"><a href="#cb255-2" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb255-3"><a href="#cb255-3" aria-hidden="true" tabindex="-1"></a>  gsl_ExpectsAudit<span class="op">(</span>std<span class="op">::</span>in_range<span class="op">&lt;</span>std<span class="op">::</span><span class="dt">int64_t</span><span class="op">&gt;(</span>l<span class="op">))</span>;</span>
<span id="cb255-4"><a href="#cb255-4" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> angular_momentum<span class="op">&lt;</span>kilogram_metre_sq_per_second, std<span class="op">::</span><span class="dt">int64_t</span><span class="op">&gt;(</span><span class="kw">static_cast</span><span class="op">&lt;</span>std<span class="op">::</span><span class="dt">int64_t</span><span class="op">&gt;(</span>l<span class="op">))</span>;</span>
<span id="cb255-5"><a href="#cb255-5" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<span id="cb255-6"><a href="#cb255-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb255-7"><a href="#cb255-7" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="kw">auto</span> <span class="kw">operator</span><span class="st">&quot;&quot;</span> _q_kg_m2_per_s<span class="op">(</span><span class="dt">long</span> <span class="dt">double</span> l<span class="op">)</span></span>
<span id="cb255-8"><a href="#cb255-8" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb255-9"><a href="#cb255-9" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> angular_momentum<span class="op">&lt;</span>kilogram_metre_sq_per_second, <span class="dt">long</span> <span class="dt">double</span><span class="op">&gt;(</span>l<span class="op">)</span>;</span>
<span id="cb255-10"><a href="#cb255-10" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div></li>
</ol>
<p>The multiply syntax that we chose for this library does not have any
of those issues.</p>
<h3 data-number="18.12.3" id="special-values-of-a-quantity"><span class="header-section-number">18.12.3</span> Special values of a
quantity<a href="#special-values-of-a-quantity" class="self-link"></a></h3>
<p><code class="sourceCode cpp">quantity</code> class template,
similarly to <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration</code>,
exposes some special values as
<code class="sourceCode cpp"><span class="kw">static</span></code>
member functions:</p>
<ul>
<li><code class="sourceCode cpp">min<span class="op">()</span></code>,</li>
<li><code class="sourceCode cpp">max<span class="op">()</span></code>,</li>
<li><code class="sourceCode cpp">zero<span class="op">()</span></code>,</li>
<li><code class="sourceCode cpp">one<span class="op">()</span></code>.</li>
</ul>
<p>Also, similarly to <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration</code>
those functions are implemented in terms of a type trait:</p>
<div class="sourceCode" id="cb256"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb256-1"><a href="#cb256-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span><span class="kw">typename</span> Rep<span class="op">&gt;</span></span>
<span id="cb256-2"><a href="#cb256-2" aria-hidden="true" tabindex="-1"></a><span class="kw">struct</span> quantity_values <span class="op">:</span> std<span class="op">::</span>chrono<span class="op">::</span>duration_values<span class="op">&lt;</span>Rep<span class="op">&gt;</span> <span class="op">{</span></span>
<span id="cb256-3"><a href="#cb256-3" aria-hidden="true" tabindex="-1"></a>  <span class="kw">static</span> <span class="kw">constexpr</span> Rep one<span class="op">()</span> <span class="kw">noexcept</span></span>
<span id="cb256-4"><a href="#cb256-4" aria-hidden="true" tabindex="-1"></a>    <span class="kw">requires</span> std<span class="op">::</span>constructible_from<span class="op">&lt;</span>Rep, <span class="dt">int</span><span class="op">&gt;</span></span>
<span id="cb256-5"><a href="#cb256-5" aria-hidden="true" tabindex="-1"></a> <span class="op">{</span></span>
<span id="cb256-6"><a href="#cb256-6" aria-hidden="true" tabindex="-1"></a>    <span class="cf">return</span> Rep<span class="op">(</span><span class="dv">1</span><span class="op">)</span>;</span>
<span id="cb256-7"><a href="#cb256-7" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span>
<span id="cb256-8"><a href="#cb256-8" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span></code></pre></div>
<p>This is good for consistency but does not comply with the approach
proposed in <span class="citation" data-cites="P1841R3">[<a href="https://wg21.link/p1841r3" role="doc-biblioref">P1841R3</a>]</span>. Should we be consistent with
<code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration</code>
here?</p>
<p>Please also note that in C++26, <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration</code>
is not a part of the freestanding library.</p>
<h3 data-number="18.12.4" id="quantity-arithmetics"><span class="header-section-number">18.12.4</span> Quantity arithmetics<a href="#quantity-arithmetics" class="self-link"></a></h3>
<h4 data-number="18.12.4.1" id="quantity-is-a-numeric-wrapper"><span class="header-section-number">18.12.4.1</span>
<code class="sourceCode cpp">quantity</code> is a numeric wrapper<a href="#quantity-is-a-numeric-wrapper" class="self-link"></a></h4>
<p>If we think about it, the
<code class="sourceCode cpp">quantity</code> class template is just a
“smart” numeric wrapper. It exposes properly constrained set of
arithmetic operations on one or two operands.</p>
<p>Every single arithmetic operator is exposed by the
<code class="sourceCode cpp">quantity</code> class template only if the
underlying representation type provides it as well and its
implementation has proper semantics (e.g., returns a reasonable
type).</p>
<p>For example, in the following code,
<code class="sourceCode cpp"><span class="op">-</span>a</code> will
compile only if <code class="sourceCode cpp">MyInt</code> exposes such
an operation as well:</p>
<div class="sourceCode" id="cb257"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb257-1"><a href="#cb257-1" aria-hidden="true" tabindex="-1"></a>quantity a <span class="op">=</span> MyInt<span class="op">{</span><span class="dv">42</span><span class="op">}</span> <span class="op">*</span> m;</span>
<span id="cb257-2"><a href="#cb257-2" aria-hidden="true" tabindex="-1"></a>quantity b <span class="op">=</span> <span class="op">-</span>a;</span></code></pre></div>
<p>Assuming that:</p>
<ul>
<li><code class="sourceCode cpp">q</code> is our quantity,</li>
<li><code class="sourceCode cpp">qq</code> is a quantity implicitly
convertible to <code class="sourceCode cpp">q</code>,</li>
<li><code class="sourceCode cpp">q2</code> is any other quantity,</li>
<li><code class="sourceCode cpp">kind</code> is a quantity of the same
kind as <code class="sourceCode cpp">q</code>,</li>
<li><code class="sourceCode cpp">one</code> is a quantity of
<code class="sourceCode cpp">dimension_one</code> with the unit
<code class="sourceCode cpp">one</code>,</li>
<li><code class="sourceCode cpp">number</code> is a value of a type
“compatible” with <code class="sourceCode cpp">q</code>’s representation
type,</li>
</ul>
<p>here is the list of all the supported operators:</p>
<ul>
<li>unary:
<ul>
<li><code class="sourceCode cpp"><span class="op">+</span>q</code></li>
<li><code class="sourceCode cpp"><span class="op">-</span>q</code></li>
<li><code class="sourceCode cpp"><span class="op">++</span>q</code></li>
<li><code class="sourceCode cpp">q<span class="op">++</span></code></li>
<li><code class="sourceCode cpp"><span class="op">--</span>q</code></li>
<li><code class="sourceCode cpp">q<span class="op">--</span></code></li>
</ul></li>
<li>compound assignment:
<ul>
<li><code class="sourceCode cpp">q <span class="op">+=</span> qq</code></li>
<li><code class="sourceCode cpp">q <span class="op">-=</span> qq</code></li>
<li><code class="sourceCode cpp">q <span class="op">%=</span> qq</code></li>
<li><code class="sourceCode cpp">q <span class="op">*=</span> number</code></li>
<li><code class="sourceCode cpp">q <span class="op">*=</span> one</code></li>
<li><code class="sourceCode cpp">q <span class="op">/=</span> number</code></li>
<li><code class="sourceCode cpp">q <span class="op">/=</span> one</code></li>
</ul></li>
<li>binary:
<ul>
<li><code class="sourceCode cpp">q <span class="op">+</span> kind</code></li>
<li><code class="sourceCode cpp">q <span class="op">-</span> kind</code></li>
<li><code class="sourceCode cpp">q <span class="op">%</span> kind</code></li>
<li><code class="sourceCode cpp">q <span class="op">*</span> q2</code></li>
<li><code class="sourceCode cpp">q <span class="op">*</span> number</code></li>
<li><code class="sourceCode cpp">number <span class="op">*</span> q</code></li>
<li><code class="sourceCode cpp">q <span class="op">/</span> q2</code></li>
<li><code class="sourceCode cpp">q <span class="op">/</span> number</code></li>
<li><code class="sourceCode cpp">number <span class="op">/</span> q</code></li>
</ul></li>
<li>ordering and comparison:
<ul>
<li><code class="sourceCode cpp">q <span class="op">==</span> kind</code></li>
<li><code class="sourceCode cpp">q <span class="op">&lt;=&gt;</span> kind</code></li>
</ul></li>
</ul>
<p>As we can see, there are plenty of operations one can do on a value
of a <code class="sourceCode cpp">quantity</code> type. As most of them
are obvious, in the following chapters, we will discuss only the most
important or non-trivial aspects of quantity arithmetics.</p>
<h4 data-number="18.12.4.2" id="addition-and-subtraction"><span class="header-section-number">18.12.4.2</span> Addition and
subtraction<a href="#addition-and-subtraction" class="self-link"></a></h4>
<p>Quantities can easily be added or subtracted from each other:</p>
<div class="sourceCode" id="cb258"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb258-1"><a href="#cb258-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> m <span class="op">==</span> <span class="dv">2</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb258-2"><a href="#cb258-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">2</span> <span class="op">*</span> m <span class="op">-</span> <span class="dv">1</span> <span class="op">*</span> m <span class="op">==</span> <span class="dv">1</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb258-3"><a href="#cb258-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>isq<span class="op">::</span>height<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">+</span> isq<span class="op">::</span>height<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">==</span> isq<span class="op">::</span>height<span class="op">(</span><span class="dv">2</span> <span class="op">*</span> m<span class="op">))</span>;</span>
<span id="cb258-4"><a href="#cb258-4" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>isq<span class="op">::</span>height<span class="op">(</span><span class="dv">2</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">-</span> isq<span class="op">::</span>height<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">==</span> isq<span class="op">::</span>height<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">))</span>;</span></code></pre></div>
<p>The above uses the same types for LHS, RHS, and the result, but in
general, we can add, subtract, or compare the values of any quantity
type as long as both quantities are of the same kind. The result of
addition and subtraction will be the common type of the arguments:</p>
<div class="sourceCode" id="cb259"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb259-1"><a href="#cb259-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">1</span> <span class="op">*</span> km <span class="op">+</span> <span class="fl">1.5</span> <span class="op">*</span> m <span class="op">==</span> <span class="fl">1001.5</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb259-2"><a href="#cb259-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>isq<span class="op">::</span>height<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">+</span> isq<span class="op">::</span>width<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">==</span> isq<span class="op">::</span>length<span class="op">(</span><span class="dv">2</span> <span class="op">*</span> m<span class="op">))</span>;</span>
<span id="cb259-3"><a href="#cb259-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>isq<span class="op">::</span>height<span class="op">(</span><span class="dv">2</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">-</span> isq<span class="op">::</span>distance<span class="op">(</span><span class="fl">0.5</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">==</span> <span class="fl">1.5</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb259-4"><a href="#cb259-4" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>isq<span class="op">::</span>radius<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">-</span> <span class="fl">0.5</span> <span class="op">*</span> m <span class="op">==</span> isq<span class="op">::</span>radius<span class="op">(</span><span class="fl">0.5</span> <span class="op">*</span> m<span class="op">))</span>;</span></code></pre></div>
<p>Please note that for the compound assignment operators, we always
need to end up with the left-hand-side argument type:</p>
<div class="sourceCode" id="cb260"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb260-1"><a href="#cb260-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">((</span><span class="dv">1</span> <span class="op">*</span> m <span class="op">+=</span> <span class="dv">1</span> <span class="op">*</span> km<span class="op">)</span> <span class="op">==</span> <span class="dv">1001</span> <span class="op">*</span> m<span class="op">)</span>;</span>
<span id="cb260-2"><a href="#cb260-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">((</span>isq<span class="op">::</span>length<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">+=</span> isq<span class="op">::</span>height<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">))</span> <span class="op">==</span> isq<span class="op">::</span>length<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">))</span>;</span>
<span id="cb260-3"><a href="#cb260-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">((</span>isq<span class="op">::</span>height<span class="op">(</span><span class="fl">1.5</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">-=</span> <span class="dv">1</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">==</span> isq<span class="op">::</span>height<span class="op">(</span><span class="fl">0.5</span> <span class="op">*</span> m<span class="op">))</span>;</span></code></pre></div>
<p>If we break those rules, the code will not compile:</p>
<div class="sourceCode" id="cb261"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb261-1"><a href="#cb261-1" aria-hidden="true" tabindex="-1"></a>quantity q1 <span class="op">=</span> <span class="dv">1</span> <span class="op">*</span> m <span class="op">-=</span> <span class="fl">0.5</span> <span class="op">*</span> m;                         <span class="co">// Compile-time error (1)</span></span>
<span id="cb261-2"><a href="#cb261-2" aria-hidden="true" tabindex="-1"></a>quantity q2 <span class="op">=</span> <span class="dv">1</span> <span class="op">*</span> km <span class="op">+=</span> <span class="dv">1</span> <span class="op">*</span> m;                          <span class="co">// Compile-time error (2)</span></span>
<span id="cb261-3"><a href="#cb261-3" aria-hidden="true" tabindex="-1"></a>quantity q3 <span class="op">=</span> isq<span class="op">::</span>height<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">+=</span> isq<span class="op">::</span>length<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">)</span>; <span class="co">// Compile-time error (3)</span></span></code></pre></div>
<p><code class="sourceCode cpp"><span class="op">(</span><span class="dv">1</span><span class="op">)</span></code>
Convertions of the floating-point to integral representation type is
considered narrowing.</p>
<p><code class="sourceCode cpp"><span class="op">(</span><span class="dv">2</span><span class="op">)</span></code>
Conversion of quantity with integral representation type from a unit of
a higher resolution to the one with a lower resolution is considered
narrowing.</p>
<p><code class="sourceCode cpp"><span class="op">(</span><span class="dv">3</span><span class="op">)</span></code>
Conversion from a more generic quantity type to a more specific one is
considered unsafe.</p>
<p>Please note that all the above operations either preserved the input
representation types or returned a common type if those were different
for both arguments. This is not the case for irrational conversion
factors. In such cases, the library will force the user to use at least
one floating-point representation type to prevent truncation:</p>
<div class="sourceCode" id="cb262"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb262-1"><a href="#cb262-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;</span><span class="kw">typename</span><span class="op">...</span> Ts<span class="op">&gt;</span></span>
<span id="cb262-2"><a href="#cb262-2" aria-hidden="true" tabindex="-1"></a><span class="kw">consteval</span> <span class="dt">bool</span> invalid_arithmetic<span class="op">(</span>Ts<span class="op">...</span> ts<span class="op">)</span></span>
<span id="cb262-3"><a href="#cb262-3" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb262-4"><a href="#cb262-4" aria-hidden="true" tabindex="-1"></a>  <span class="cf">return</span> <span class="op">!</span><span class="kw">requires</span> <span class="op">{</span> <span class="op">(...</span> <span class="op">+</span> ts<span class="op">)</span>; <span class="op">}</span> <span class="op">&amp;&amp;</span> <span class="op">!</span><span class="kw">requires</span> <span class="op">{</span> <span class="op">(...</span> <span class="op">-</span> ts<span class="op">)</span>; <span class="op">}</span>;</span>
<span id="cb262-5"><a href="#cb262-5" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span>
<span id="cb262-6"><a href="#cb262-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb262-7"><a href="#cb262-7" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>invalid_arithmetic<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> rad, <span class="dv">1</span> <span class="op">*</span> deg<span class="op">))</span>;</span>
<span id="cb262-8"><a href="#cb262-8" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>is_of_type<span class="op">&lt;</span><span class="fl">1.</span> <span class="op">*</span> rad <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> deg, quantity<span class="op">&lt;</span>deg, <span class="dt">double</span><span class="op">&gt;&gt;)</span>;</span>
<span id="cb262-9"><a href="#cb262-9" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>is_of_type<span class="op">&lt;</span><span class="dv">1</span> <span class="op">*</span> rad <span class="op">+</span> <span class="fl">1.</span> <span class="op">*</span> deg, quantity<span class="op">&lt;</span>deg, <span class="dt">double</span><span class="op">&gt;&gt;)</span>;</span>
<span id="cb262-10"><a href="#cb262-10" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>is_of_type<span class="op">&lt;</span><span class="fl">1.</span> <span class="op">*</span> rad <span class="op">+</span> <span class="fl">1.</span> <span class="op">*</span> deg, quantity<span class="op">&lt;</span>deg, <span class="dt">double</span><span class="op">&gt;&gt;)</span>;</span></code></pre></div>
<h4 data-number="18.12.4.3" id="multiplication-and-division"><span class="header-section-number">18.12.4.3</span> Multiplication and
division<a href="#multiplication-and-division" class="self-link"></a></h4>
<p>Multiplying or dividing a quantity by a number does not change its
quantity type or unit. However, its representation type may change. For
example:</p>
<div class="sourceCode" id="cb263"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb263-1"><a href="#cb263-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>isq<span class="op">::</span>height<span class="op">(</span><span class="dv">3</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">*</span> <span class="fl">0.5</span> <span class="op">==</span> isq<span class="op">::</span>height<span class="op">(</span><span class="fl">1.5</span> <span class="op">*</span> m<span class="op">))</span>;</span></code></pre></div>
<p>Unless we use a compound assignment operator, in which case we always
have to result with the type of the left-hand-side argument. This,
together with the fact that this library tries to prevent truncation of
a quantity value means, that the following does not compile:</p>
<div class="sourceCode" id="cb264"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb264-1"><a href="#cb264-1" aria-hidden="true" tabindex="-1"></a>quantity q <span class="op">=</span> isq<span class="op">::</span>height<span class="op">(</span><span class="dv">3</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">*=</span> <span class="fl">0.5</span>; <span class="co">// Compile-time error</span></span></code></pre></div>
<p>However, suppose we multiply or divide quantities of the same or
different types, or we divide a raw number by a quantity. In that case,
we most probably will end up in a quantity of yet another type:</p>
<div class="sourceCode" id="cb265"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb265-1"><a href="#cb265-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">120</span> <span class="op">*</span> km <span class="op">/</span> <span class="op">(</span><span class="dv">2</span> <span class="op">*</span> h<span class="op">)</span> <span class="op">==</span> <span class="dv">60</span> <span class="op">*</span> km <span class="op">/</span> h<span class="op">)</span>;</span>
<span id="cb265-2"><a href="#cb265-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>isq<span class="op">::</span>width<span class="op">(</span><span class="dv">2</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">*</span> isq<span class="op">::</span>length<span class="op">(</span><span class="dv">2</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">==</span> isq<span class="op">::</span>area<span class="op">(</span><span class="dv">4</span> <span class="op">*</span> m2<span class="op">))</span>;</span>
<span id="cb265-3"><a href="#cb265-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">50</span> <span class="op">/</span> isq<span class="op">::</span>time<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> s<span class="op">)</span> <span class="op">==</span> isq<span class="op">::</span>frequency<span class="op">(</span><span class="dv">50</span> <span class="op">*</span> Hz<span class="op">))</span>;</span></code></pre></div>
<p>An exception from the above rule happens when one of the arguments is
a dimensionless quantity. If we multiply or divide by such a quantity,
the quantity type will not change. If such a quantity has a unit
<code class="sourceCode cpp">one</code>, also the unit of a quantity
will not change:</p>
<div class="sourceCode" id="cb266"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb266-1"><a href="#cb266-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">120</span> <span class="op">*</span> m <span class="op">/</span> <span class="op">(</span><span class="dv">2</span> <span class="op">*</span> one<span class="op">)</span> <span class="op">==</span> <span class="dv">60</span> <span class="op">*</span> m<span class="op">)</span>;</span></code></pre></div>
<p>An interesting special case happens when we divide the same quantity
kinds or multiply a quantity by its inverted type. In such a case, we
end up with a dimensionless quantity.</p>
<div class="sourceCode" id="cb267"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb267-1"><a href="#cb267-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>isq<span class="op">::</span>height<span class="op">(</span><span class="dv">4</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">/</span> isq<span class="op">::</span>width<span class="op">(</span><span class="dv">2</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">==</span> <span class="dv">2</span> <span class="op">*</span> one<span class="op">)</span>; <span class="co">// (1)</span></span>
<span id="cb267-2"><a href="#cb267-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">5</span> <span class="op">*</span> h <span class="op">/</span> <span class="op">(</span><span class="dv">120</span> <span class="op">*</span> min<span class="op">)</span> <span class="op">==</span> <span class="dv">0</span> <span class="op">*</span> one<span class="op">)</span>;                    <span class="co">// (2)</span></span>
<span id="cb267-3"><a href="#cb267-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="fl">5.</span> <span class="op">*</span> h <span class="op">/</span> <span class="op">(</span><span class="dv">120</span> <span class="op">*</span> min<span class="op">)</span> <span class="op">==</span> <span class="fl">2.5</span> <span class="op">*</span> one<span class="op">)</span>;</span></code></pre></div>
<p><code class="sourceCode cpp"><span class="op">(</span><span class="dv">1</span><span class="op">)</span></code>
The resulting quantity type of the LHS is <code class="sourceCode cpp">isq<span class="op">::</span>height <span class="op">/</span> isq<span class="op">::</span>width</code>,
which is a quantity of the dimensionless kind.</p>
<p><code class="sourceCode cpp"><span class="op">(</span><span class="dv">2</span><span class="op">)</span></code>
The resulting quantity of the LHS is <code class="sourceCode cpp"><span class="dv">0</span> <span class="op">*</span> dimensionless<span class="op">[</span>h <span class="op">/</span> min<span class="op">]</span></code>.
To be consistent with the division of different quantity types, we do
not convert quantity values to a common unit before the division.</p>
<h5 data-number="18.12.4.3.1" id="beware-of-integral-division"><span class="header-section-number">18.12.4.3.1</span> Beware of integral
division<a href="#beware-of-integral-division" class="self-link"></a></h5>
<p>The physical units library can’t do any runtime branching logic for
the division operator. All logic has to be done at compile-time when the
actual values are not known, and the quantity types can’t change at
runtime.</p>
<p>If we expect <code class="sourceCode cpp"><span class="dv">120</span> <span class="op">*</span> km <span class="op">/</span> <span class="op">(</span><span class="dv">2</span> <span class="op">*</span> h<span class="op">)</span></code>
to return <code class="sourceCode cpp"><span class="dv">60</span> km<span class="op">/</span>h</code>,
we have to agree with the fact that <code class="sourceCode cpp"><span class="dv">5</span> <span class="op">*</span> km <span class="op">/</span> <span class="op">(</span><span class="dv">24</span> <span class="op">*</span> h<span class="op">)</span></code>
returns <code class="sourceCode cpp"><span class="dv">0</span> km<span class="op">/</span>h</code>.
We can’t do a range check at runtime to dynamically adjust scales and
types based on the values of provided function arguments.</p>
<p>This is why we often prefer floating-point representation types when
dealing with units. Some popular physical units libraries even <a href="https://aurora-opensource.github.io/au/main/troubleshooting/#integer-division-forbidden">forbid
integer division at all</a>.</p>
<h4 data-number="18.12.4.4" id="modulo"><span class="header-section-number">18.12.4.4</span> Modulo<a href="#modulo" class="self-link"></a></h4>
<p>Now that we know how addition, subtraction, multiplication, and
division work, it is time to talk about modulo. What would we expect to
be returned from the following quantity equation?</p>
<div class="sourceCode" id="cb268"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb268-1"><a href="#cb268-1" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> q <span class="op">=</span> <span class="dv">5</span> <span class="op">*</span> h <span class="op">%</span> <span class="op">(</span><span class="dv">120</span> <span class="op">*</span> min<span class="op">)</span>;</span></code></pre></div>
<p>Most of us would probably expect to see
<code class="sourceCode cpp"><span class="dv">1</span> h</code> or
<code class="sourceCode cpp"><span class="dv">60</span> min</code> as a
result. And this is where the problems start.</p>
<p>The C++ language defines its
<code class="sourceCode cpp"><span class="op">/</span></code> and
<code class="sourceCode cpp"><span class="op">%</span></code> operators
with the <a href="https://eel.is/c++draft/expr.mul#4">quotient-remainder
theorem</a>:</p>
<pre class="text"><code>q = a / b;
r = a % b;
q * b + r == a;</code></pre>
<p>The important property of the modulo operator is that it only works
for integral representation types (it is undefined what modulo for
floating-point types means). However, as we saw in the previous chapter,
integral types are tricky because they often truncate the value.</p>
<p>From the quotient-remainder theorem, the result of modulo operation
is <code class="sourceCode cpp">r <span class="op">=</span> a <span class="op">-</span> q <span class="op">*</span> b</code>.
Let’s see what we get from such a quantity equation on integral
representation types:</p>
<div class="sourceCode" id="cb269"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb269-1"><a href="#cb269-1" aria-hidden="true" tabindex="-1"></a>quantity a <span class="op">=</span> <span class="dv">5</span> <span class="op">*</span> h;</span>
<span id="cb269-2"><a href="#cb269-2" aria-hidden="true" tabindex="-1"></a>quantity b <span class="op">=</span> <span class="dv">120</span> <span class="op">*</span> min;</span>
<span id="cb269-3"><a href="#cb269-3" aria-hidden="true" tabindex="-1"></a>quantity q <span class="op">=</span> a <span class="op">/</span> b;</span>
<span id="cb269-4"><a href="#cb269-4" aria-hidden="true" tabindex="-1"></a>quantity r <span class="op">=</span> a <span class="op">-</span> q <span class="op">*</span> b;</span>
<span id="cb269-5"><a href="#cb269-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb269-6"><a href="#cb269-6" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="st">&quot;reminder: &quot;</span> <span class="op">&lt;&lt;</span> r <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span></code></pre></div>
<p>The above code outputs:</p>
<pre class="text"><code>reminder: 5 h</code></pre>
<p>And now, a tough question needs an answer. Do we really want modulo
operator on physical units to be consistent with the quotient-remainder
theorem and return
<code class="sourceCode cpp"><span class="dv">5</span> h</code> for
<code class="sourceCode cpp"><span class="dv">5</span> <span class="op">*</span> h <span class="op">%</span> <span class="op">(</span><span class="dv">120</span> <span class="op">*</span> min<span class="op">)</span></code>?</p>
<p>This is exactly why we decided not to follow this hugely surprising
path in this library. The selected approach was also consistent with the
feedback from C++ experts. For example, this is what Richard Smith said
about this issue:</p>
<blockquote>
<p>I think the quotient-remainder property is a less important
motivation here than other factors – the constraints on
<code class="sourceCode cpp"><span class="op">%</span></code> and
<code class="sourceCode cpp"><span class="op">/</span></code> are quite
different, so they lack the inherent connection they have for integers.
In particular, I would expect that
<code class="sourceCode cpp">A <span class="op">/</span> B</code> works
for all quantities <code class="sourceCode cpp">A</code> and
<code class="sourceCode cpp">B</code>, whereas
<code class="sourceCode cpp">A <span class="op">%</span> B</code> is
only meaningful when <code class="sourceCode cpp">A</code> and
<code class="sourceCode cpp">B</code> have the same dimension. It seems
like a nice-to-have for the property to apply in the case where both
<code class="sourceCode cpp"><span class="op">/</span></code> and
<code class="sourceCode cpp"><span class="op">%</span></code> are
defined, but internal consistency of
<code class="sourceCode cpp"><span class="op">/</span></code> across all
cases seems much more important to me.</p>
<p>I would expect <code class="sourceCode cpp"><span class="dv">61</span> min <span class="op">%</span> <span class="dv">1</span> h</code>
to be <code class="sourceCode cpp"><span class="dv">1</span> min</code>,
and <code class="sourceCode cpp"><span class="dv">1</span> h <span class="op">%</span> <span class="dv">59</span> min</code>
to also be
<code class="sourceCode cpp"><span class="dv">1</span> min</code>, so my
intuition tells me that the result type of
<code class="sourceCode cpp">A <span class="op">%</span> B</code>, where
<code class="sourceCode cpp">A</code> and
<code class="sourceCode cpp">B</code> have the same dimension, should
have the smaller unit of <code class="sourceCode cpp">A</code> and
<code class="sourceCode cpp">B</code> (and if the smaller one doesn’t
divide the larger one, we should either use the <code class="sourceCode cpp">gcd <span class="op">/</span> std<span class="op">::</span>common_type</code>
of the units of <code class="sourceCode cpp">A</code> and
<code class="sourceCode cpp">B</code> or perhaps just produce an error).
I think any other behavior for
<code class="sourceCode cpp"><span class="op">%</span></code> is hard to
defend.</p>
<p>On the other hand, for division it seems to me that the choice of
unit should probably not affect the result, and so if we want that <code class="sourceCode cpp"><span class="dv">5</span> mm <span class="op">/</span> <span class="dv">120</span> min <span class="op">=</span> <span class="dv">0</span> mm<span class="op">/</span>min</code>,
then <code class="sourceCode cpp"><span class="dv">5</span> h <span class="op">/</span> <span class="dv">120</span> min <span class="op">==</span> <span class="dv">0</span> hc</code>
(where <code class="sourceCode cpp">hc</code> is a dimensionless
“hexaconta”, or <code class="sourceCode cpp"><span class="dv">60</span><span class="er">x</span></code>,
unit). I don’t like the idea of taking SI base units into account; that
seems arbitrary and like it would do the wrong thing as often as it does
the right thing, especially when the units have a multiplier that is
very large or small. We could special-case the situation of a
dimensionless quantity, but that could lead to problematic overflow
pretty easily: a calculation such as <code class="sourceCode cpp"><span class="dv">10</span> s <span class="op">*</span> <span class="dv">5</span> GHz <span class="op">*</span> <span class="dv">2</span> uW</code>
would overflow an
<code class="sourceCode cpp"><span class="dt">int</span></code> if it
produces a dimensionless quantity for <code class="sourceCode cpp"><span class="dv">10</span> s <span class="op">*</span> <span class="dv">5</span> GHz</code>,
but it could equally produce <code class="sourceCode cpp"><span class="dv">50</span> G <span class="op">*</span> <span class="dv">2</span> uW <span class="op">=</span> <span class="dv">100</span> kW</code>
without any overflow, and presumably would if the terms were merely
reordered.</p>
<p>If people want to use integer-valued quantities, I think it’s
fundamental that you need to know what the units of the result of an
operation will be, and take that into account in how you express
computations; the simplest rule for heterogeneous operators like
<code class="sourceCode cpp"><span class="op">*</span></code> or
<code class="sourceCode cpp"><span class="op">/</span></code> seems to
be that the units of the result are determined by applying the operator
to the units of the operands – and for homogeneous operators like
<code class="sourceCode cpp"><span class="op">+</span></code> or
<code class="sourceCode cpp"><span class="op">%</span></code>, it seems
like the only reasonable option is that you get the <code class="sourceCode cpp">std<span class="op">::</span>common_type</code>
of the units of the operands.</p>
</blockquote>
<p>To summarize, the modulo operator on physical units has more in
common with addition and division operators than with the
quotient-remainder theorem. To avoid surprising results, the operation
uses a common unit to do the calculation and provide its result:</p>
<div class="sourceCode" id="cb270"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb270-1"><a href="#cb270-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">5</span> <span class="op">*</span> h <span class="op">/</span> <span class="op">(</span><span class="dv">120</span> <span class="op">*</span> min<span class="op">)</span> <span class="op">==</span> <span class="dv">0</span> <span class="op">*</span> one<span class="op">)</span>;</span>
<span id="cb270-2"><a href="#cb270-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">5</span> <span class="op">*</span> h <span class="op">%</span> <span class="op">(</span><span class="dv">120</span> <span class="op">*</span> min<span class="op">)</span> <span class="op">==</span> <span class="dv">60</span> <span class="op">*</span> min<span class="op">)</span>;</span>
<span id="cb270-3"><a href="#cb270-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">61</span> <span class="op">*</span> min <span class="op">%</span> <span class="op">(</span><span class="dv">1</span> <span class="op">*</span> h<span class="op">)</span> <span class="op">==</span> <span class="dv">1</span> <span class="op">*</span> min<span class="op">)</span>;</span>
<span id="cb270-4"><a href="#cb270-4" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">1</span> <span class="op">*</span> h <span class="op">%</span> <span class="op">(</span><span class="dv">59</span> <span class="op">*</span> min<span class="op">)</span> <span class="op">==</span> <span class="dv">1</span> <span class="op">*</span> min<span class="op">)</span>;</span></code></pre></div>
<h4 data-number="18.12.4.5" id="comparison-against-zero"><span class="header-section-number">18.12.4.5</span> Comparison against zero<a href="#comparison-against-zero" class="self-link"></a></h4>
<p>Zero is special. It is the only number that unambiguously defines the
value of any kind of quantity, regardless of its units: zero inches and
zero meters and zero miles are all identical. For this reason, it’s very
common to compare the value of a quantity against zero. For example,
when checking the sign of a quantity, or when making sure that it’s
nonzero.</p>
<p>We could implement such checks in the following way:</p>
<div class="sourceCode" id="cb271"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb271-1"><a href="#cb271-1" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span><span class="op">(</span>q1 <span class="op">/</span> q2 <span class="op">!=</span> <span class="dv">0</span> <span class="op">*</span> m <span class="op">/</span> s<span class="op">)</span></span>
<span id="cb271-2"><a href="#cb271-2" aria-hidden="true" tabindex="-1"></a>  <span class="co">// ...</span></span></code></pre></div>
<p>The above would work (assuming we are dealing with the quantity of
<em>speed</em>), but it’s not ideal. If the result of
<code class="sourceCode cpp">q1 <span class="op">/</span> q2</code> is
not expressed in
<code class="sourceCode cpp">m <span class="op">/</span> s</code>, we’ll
incur an extra unit conversion. Even if it is in
<code class="sourceCode cpp">m <span class="op">/</span> s</code>, it’s
cumbersome to repeat the unit in a context where it makes no
difference.</p>
<p>We could avoid repeating the unit, and guarantee there won’t be an
extra conversion, by writing:</p>
<div class="sourceCode" id="cb272"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb272-1"><a href="#cb272-1" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span><span class="op">(</span><span class="kw">auto</span> q <span class="op">=</span> q1 <span class="op">/</span> q2; q <span class="op">!=</span> q<span class="op">.</span>zero<span class="op">())</span></span>
<span id="cb272-2"><a href="#cb272-2" aria-hidden="true" tabindex="-1"></a>  <span class="co">// ...</span></span></code></pre></div>
<p>But that is a bit inconvenient, and inexperienced users could be
unaware of this technique and its rationale.</p>
<h5 data-number="18.12.4.5.1" id="named-comparison-functions"><span class="header-section-number">18.12.4.5.1</span> Named comparison
functions<a href="#named-comparison-functions" class="self-link"></a></h5>
<p>For the above reasons, the <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> library provides dedicated
interfaces to compare against zero that follow the naming convention of
<a href="https://en.cppreference.com/w/cpp/utility/compare/named_comparison_functions">named
comparison functions</a> in the C++ Standard Library:</p>
<ul>
<li><code class="sourceCode cpp">is_eq_zero</code></li>
<li><code class="sourceCode cpp">is_neq_zero</code></li>
<li><code class="sourceCode cpp">is_lt_zero</code></li>
<li><code class="sourceCode cpp">is_gt_zero</code></li>
<li><code class="sourceCode cpp">is_lteq_zero</code></li>
<li><code class="sourceCode cpp">is_gteq_zero</code></li>
</ul>
<p>Thanks to them, to save typing and not pay for unneeded conversions,
our check could be implemented as follows:</p>
<div class="sourceCode" id="cb273"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb273-1"><a href="#cb273-1" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> <span class="op">(</span>is_neq_zero<span class="op">(</span>q1 <span class="op">/</span> q2<span class="op">))</span></span>
<span id="cb273-2"><a href="#cb273-2" aria-hidden="true" tabindex="-1"></a>  <span class="co">// ...</span></span></code></pre></div>
<p>Those functions will work with any type
<code class="sourceCode cpp">T</code> that exposes a
<code class="sourceCode cpp">zero<span class="op">()</span></code>
member function returning something comparable to
<code class="sourceCode cpp">T</code>. Thanks to that, we can use them
not only with quantities but also with <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration</code>
or any other type that exposes such an interface.</p>
<p><em>Note:</em> If we do not feel that we have a need for such generic
functions in the <code class="sourceCode cpp">std</code> namespace, we
can make them hidden friends of the
<code class="sourceCode cpp">quantity</code> which will limit their
scope to just this library.</p>
<p>This approach has a downside, though: it produces a set of new APIs
which users must learn. Nor are these six the only such functions that
will need to exist: for example, <code class="sourceCode cpp">max</code>
and <code class="sourceCode cpp">min</code> are perfectly reasonable to
use with <code class="sourceCode cpp"><span class="dv">0</span></code>
regardless of the units, but supporting them under this strategy would
require adding a new utility function for each — and coming up with a
name for those functions.</p>
<p>It also introduces small opportunities for error and diffs that are
harder to review, because we’re replacing a pattern that uses an
operator (say, <code class="sourceCode cpp">a <span class="op">&gt;</span> <span class="dv">0</span></code>)
with a named function call (say, <code class="sourceCode cpp">is_gt_zero<span class="op">(</span>a<span class="op">)</span></code>).</p>
<p>These pitfalls motivate us to consider other approaches as well.</p>
<h5 data-number="18.12.4.5.2" id="zero-type"><span class="header-section-number">18.12.4.5.2</span>
<code class="sourceCode cpp">Zero</code> type<a href="#zero-type" class="self-link"></a></h5>
<p>The <span class="citation" data-cites="AU">[<a href="https://aurora-opensource.github.io/au" role="doc-biblioref">Au</a>]</span> library takes a different approach
to this problem. It provides an empty type,
<code class="sourceCode cpp">Zero</code>, which represents a value of
exactly <code class="sourceCode cpp"><span class="dv">0</span></code>
(in any units). It also provides an instance
<code class="sourceCode cpp">ZERO</code> of this type. Every quantity is
implicitly constructible from
<code class="sourceCode cpp">Zero</code>.</p>
<p>Consider this example legacy (i.e., pre-units-library) code:</p>
<div class="sourceCode" id="cb274"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb274-1"><a href="#cb274-1" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> <span class="op">(</span>speed_squared_m2ps2 <span class="op">&gt;</span> <span class="dv">0</span><span class="op">)</span> <span class="op">{</span> <span class="co">/* ... */</span> <span class="op">}</span></span></code></pre></div>
<p>When users upgrade to a units library, they will replace the raw
number <code class="sourceCode cpp">speed_squared_m2ps2</code> with a
strongly typed quantity
<code class="sourceCode cpp">speed_squared</code>. Unfortunately, this
replacement won’t compile, because quantities can’t be constructed from
raw numeric values such as
<code class="sourceCode cpp"><span class="dv">0</span></code>. They can
fix this problem by using the instance,
<code class="sourceCode cpp">ZERO</code>, which encodes its value in the
type:</p>
<div class="sourceCode" id="cb275"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb275-1"><a href="#cb275-1" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> <span class="op">(</span>speed_squared <span class="op">&gt;</span> ZERO<span class="op">)</span> <span class="op">{</span> <span class="co">/* ... */</span> <span class="op">}</span></span></code></pre></div>
<p>This has significant advantages. It preserves the form of the code,
making the transition less error prone than replacement with a function
such as <code class="sourceCode cpp">is_gt_zero</code>. It also reduces
the number of new comparison APIs a user must learn:
<code class="sourceCode cpp">Zero</code> handles them all.</p>
<p><code class="sourceCode cpp">Zero</code> has one downside: it will
not work when passed across generic quantity interfaces.
<code class="sourceCode cpp">Zero</code>’s value comes in situations
where the surrounding context makes it unambiguous which quantity type
it should construct. While it converts to any specific quantity type, it
is not itself a quantity. This could confuse users.</p>
<p>This downside manifests in several different ways. Here are some
examples:</p>
<ol type="1">
<li><p>While refactoring the <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> code to try out this approach,
we found out a perfectly reasonable place where we could not replace the
numerical value
<code class="sourceCode cpp"><span class="dv">0</span></code> with
<code class="sourceCode cpp">ZERO</code>:</p>
<div class="sourceCode" id="cb276"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb276-1"><a href="#cb276-1" aria-hidden="true" tabindex="-1"></a>msl_altitude alt <span class="op">=</span> mean_sea_level <span class="op">+</span> <span class="dv">0</span> <span class="op">*</span> si<span class="op">::</span>metre;  <span class="co">// OK</span></span>
<span id="cb276-2"><a href="#cb276-2" aria-hidden="true" tabindex="-1"></a>msl_altitude alt <span class="op">=</span> mean_sea_level <span class="op">+</span> ZERO;           <span class="co">// Compile-time error</span></span></code></pre></div>
<p>This would not work because the
<code class="sourceCode cpp">mean_sea_level</code> is an absolute point
origin that stores the information about the quantity type but not its
value or unit, which <code class="sourceCode cpp">msl_altitude</code>
needs, but none of which <code class="sourceCode cpp">ZERO</code>
has.</p></li>
<li><p>Callsites passing <code class="sourceCode cpp">ZERO</code> can
add friction when refactoring a concrete interface to be more
generic.</p>
<div class="sourceCode" id="cb277"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb277-1"><a href="#cb277-1" aria-hidden="true" tabindex="-1"></a><span class="kw">namespace</span> v1 <span class="op">{</span> <span class="dt">void</span> foo<span class="op">(</span>quantity<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">&gt;</span> q<span class="op">)</span>; <span class="op">}</span></span>
<span id="cb277-2"><a href="#cb277-2" aria-hidden="true" tabindex="-1"></a><span class="kw">namespace</span> v2 <span class="op">{</span> <span class="dt">void</span> foo<span class="op">(</span>QuantityOf<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">&gt;</span> <span class="kw">auto</span> q<span class="op">)</span>; <span class="op">}</span></span>
<span id="cb277-3"><a href="#cb277-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb277-4"><a href="#cb277-4" aria-hidden="true" tabindex="-1"></a>v1<span class="op">::</span>foo<span class="op">(</span>ZERO<span class="op">)</span>;   <span class="co">// OK</span></span>
<span id="cb277-5"><a href="#cb277-5" aria-hidden="true" tabindex="-1"></a>v2<span class="op">::</span>foo<span class="op">(</span>ZERO<span class="op">)</span>;   <span class="co">// Compile-time error</span></span></code></pre></div>
<p>In practice, this issue will be discovered at the point of
refactoring, so it mainly affects library authors, not their clients.
They can handle this by adding an overload for
<code class="sourceCode cpp">Zero</code>, if appropriate. However, this
wouldn’t scale well for APIs with multiple parameters where users would
want to pass <code class="sourceCode cpp">Zero</code>.</p></li>
<li><p>For completeness, we mention that
<code class="sourceCode cpp">Zero</code> works for addition but not
multiplication. When multiplying, we do not know what units (or even
what dimension!) is desired for the result. However, this is not a
problem in practice because users would not be motivated to write this
in the first place, as simple multiplication with
<code class="sourceCode cpp"><span class="dv">0</span></code> (including
any necessary units, if the result has a different dimension) would
work.</p>
<div class="sourceCode" id="cb278"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb278-1"><a href="#cb278-1" aria-hidden="true" tabindex="-1"></a>quantity q1 <span class="op">=</span> <span class="dv">1</span> <span class="op">*</span> m <span class="op">/</span> s;</span>
<span id="cb278-2"><a href="#cb278-2" aria-hidden="true" tabindex="-1"></a>quantity q2 <span class="op">=</span> q1 <span class="op">+</span> <span class="dv">0</span> <span class="op">*</span> m <span class="op">/</span> s;   <span class="co">// OK</span></span>
<span id="cb278-3"><a href="#cb278-3" aria-hidden="true" tabindex="-1"></a>quantity q3 <span class="op">=</span> q1 <span class="op">*</span> <span class="op">(</span><span class="dv">0</span> <span class="op">*</span> s<span class="op">)</span>;     <span class="co">// OK</span></span></code></pre></div>
<div class="sourceCode" id="cb279"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb279-1"><a href="#cb279-1" aria-hidden="true" tabindex="-1"></a>quantity q1 <span class="op">=</span> <span class="dv">1</span> <span class="op">*</span> m <span class="op">/</span> s;</span>
<span id="cb279-2"><a href="#cb279-2" aria-hidden="true" tabindex="-1"></a>quantity q2 <span class="op">=</span> q1 <span class="op">+</span> ZERO;        <span class="co">// OK</span></span>
<span id="cb279-3"><a href="#cb279-3" aria-hidden="true" tabindex="-1"></a>quantity q3 <span class="op">=</span> q1 <span class="op">*</span> ZERO;        <span class="co">// Compile-time error</span></span></code></pre></div></li>
</ol>
<p>The main concern with the <code class="sourceCode cpp">Zero</code>
feature is that novices might be tempted to replace every numeric value
<code class="sourceCode cpp"><span class="dv">0</span></code> with the
instance <code class="sourceCode cpp">ZERO</code>, becoming confused
when it doesn’t work. We could address this with easy-to-read
documentation that clarifies its use cases and mental models.</p>
<h5 data-number="18.12.4.5.3" id="summary-comparison-against-zero"><span class="header-section-number">18.12.4.5.3</span> Summary (comparison
against zero)<a href="#summary-comparison-against-zero" class="self-link"></a></h5>
<p>Overall, these two approaches — special functions, and a
<code class="sourceCode cpp">Zero</code> type — represent two local
optima in design space. Each has its strengths and weaknesses; each
makes different tradeoffs. It’s currently an open question as to which
approach would be best suited for a quantity type in the standard
library.</p>
<h4 data-number="18.12.4.6" id="other-maths"><span class="header-section-number">18.12.4.6</span> Other maths<a href="#other-maths" class="self-link"></a></h4>
<p>This chapter scoped only on the
<code class="sourceCode cpp">quantity</code> type’s operators. However,
there are many named math functions provided in the <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> library. Among others, we can
find there the following:</p>
<ul>
<li><code class="sourceCode cpp">pow<span class="op">()</span></code>,
<code class="sourceCode cpp">sqrt<span class="op">()</span></code>, and
<code class="sourceCode cpp">cbrt<span class="op">()</span></code>,</li>
<li><code class="sourceCode cpp">exp<span class="op">()</span></code>,</li>
<li><code class="sourceCode cpp">abs<span class="op">()</span></code>,</li>
<li><code class="sourceCode cpp">epsilon<span class="op">()</span></code>,</li>
<li><code class="sourceCode cpp">fma<span class="op">()</span></code>,
<code class="sourceCode cpp">fmod<span class="op">()</span></code>,</li>
<li><code class="sourceCode cpp">floor<span class="op">()</span></code>,
<code class="sourceCode cpp">ceil<span class="op">()</span></code>,
<code class="sourceCode cpp">round<span class="op">()</span></code>,</li>
<li><code class="sourceCode cpp">inverse<span class="op">()</span></code>,</li>
<li><code class="sourceCode cpp">hypot<span class="op">()</span></code>,</li>
<li><code class="sourceCode cpp">sin<span class="op">()</span></code>,
<code class="sourceCode cpp">cos<span class="op">()</span></code>,
<code class="sourceCode cpp">tan<span class="op">()</span></code>,</li>
<li><code class="sourceCode cpp">asin<span class="op">()</span></code>,
<code class="sourceCode cpp">acos<span class="op">()</span></code>,
<code class="sourceCode cpp">atan<span class="op">()</span></code>,
<code class="sourceCode cpp">atan2<span class="op">()</span></code>.</li>
</ul>
<p>In the library, we can also find the <code class="sourceCode cpp"><span class="op">&lt;</span>mp<span class="op">-</span>units<span class="op">/</span>random<span class="op">.</span>h<span class="op">&gt;</span></code>
header file with all the pseudo-random number generators.</p>
<p>We plan to provide a separate paper on those in the future.</p>
<h3 data-number="18.12.5" id="dimensionless-quantities"><span class="header-section-number">18.12.5</span> Dimensionless quantities<a href="#dimensionless-quantities" class="self-link"></a></h3>
<p>The quantities we discussed so far always had some specific type and
physical dimension. However, this is not always the case. While
performing various computations, we sometimes end up with so-called
“dimensionless” quantities, which <span class="citation" data-cites="ISO-GUIDE">[<a href="https://www.iso.org/obp/ui#iso:std:iso-iec:guide:99" role="doc-biblioref">ISO/IEC Guide 99</a>]</span> correctly defines as
quantities of dimension one:</p>
<blockquote>
<ul>
<li>Quantity for which all the exponents of the factors corresponding to
the base quantities in its quantity dimension are zero.</li>
<li>The measurement units and values of quantities of dimension one are
numbers, but such quantities convey more information than a number.</li>
<li>Some quantities of dimension one are defined as the ratios of two
quantities of the same kind.</li>
<li>Numbers of entities are quantities of dimension one.</li>
</ul>
</blockquote>
<h4 data-number="18.12.5.1" id="dividing-two-quantities-of-the-same-kind"><span class="header-section-number">18.12.5.1</span> Dividing two quantities
of the same kind<a href="#dividing-two-quantities-of-the-same-kind" class="self-link"></a></h4>
<p>Dividing two quantities of the same kind always results in a quantity
of dimension one. However, depending on what type of quantities we
divide or what their units are, we may end up with slightly different
types.</p>
<p>Dividing two quantities of the same dimension always results in a
quantity with the dimension being
<code class="sourceCode cpp">dimension_one</code>. This is often
different for other physical units libraries, which may return a raw
representation type for such cases. A raw value is also always returned
from the division of two <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration</code>
values.</p>
<p>In the initial design of the <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> library, the resulting type of
division of two quantities was their common representation type (just
like <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration</code>):</p>
<div class="sourceCode" id="cb280"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb280-1"><a href="#cb280-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>std<span class="op">::</span>is_same_v<span class="op">&lt;</span><span class="kw">decltype</span><span class="op">(</span><span class="dv">10</span> <span class="op">*</span> km <span class="op">/</span> <span class="op">(</span><span class="dv">5</span> <span class="op">*</span> km<span class="op">))</span>, <span class="dt">int</span><span class="op">&gt;)</span>;</span></code></pre></div>
<p>The reasoning behind it was not providing a false impression of a
strong <code class="sourceCode cpp">quantity</code> type for something
that looks and feels like a regular number. Also, all of the mathematic
and trigonometric functions were working fine out of the box with such
representation types, so we did not have to rewrite
<code class="sourceCode cpp">sin<span class="op">()</span></code>,
<code class="sourceCode cpp">cos<span class="op">()</span></code>,
<code class="sourceCode cpp">exp<span class="op">()</span></code>, and
others.</p>
<p>However, the feedback we got from the production usage was that such
an approach is really bad for generic programming. It is hard to handle
the result of the two quantities’ division (or multiplication) as it
might be either a quantity or a fundamental type. If we want to raise
such a result to some power, we must use
<code class="sourceCode cpp">units<span class="op">::</span>pow</code>
or <code class="sourceCode cpp">std<span class="op">::</span>pow</code>
depending on the resulting type
(<code class="sourceCode cpp">units<span class="op">::</span>pow</code>
takes the power as template arguments). Those are only a few issues
related to such an approach.</p>
<p>Moreover, suppose we divide quantities of the same dimension, but
with units of significantly different magnitudes. In such case, we may
end up with a really small or a huge floating-point value, which may
result in losing lots of precision. Returning a dimensionless quantity
from such cases allows us to benefit from all the properties of scaled
units and is consistent with the rest of the library.</p>
<h5 data-number="18.12.5.1.1" id="dividing-quantities-of-the-same-type"><span class="header-section-number">18.12.5.1.1</span> Dividing quantities of
the same type<a href="#dividing-quantities-of-the-same-type" class="self-link"></a></h5>
<p>First, let’s analyze what happens if we divide two quantities of the
same type:</p>
<div class="sourceCode" id="cb281"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb281-1"><a href="#cb281-1" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> QuantityOf<span class="op">&lt;</span>dimensionless<span class="op">&gt;</span> <span class="kw">auto</span> q <span class="op">=</span> isq<span class="op">::</span>height<span class="op">(</span><span class="dv">200</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">/</span> isq<span class="op">::</span>height<span class="op">(</span><span class="dv">50</span> <span class="op">*</span> m<span class="op">)</span>;</span></code></pre></div>
<p>In such a case, we end up with a dimensionless quantity that has the
following properties:</p>
<div class="sourceCode" id="cb282"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb282-1"><a href="#cb282-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>q<span class="op">.</span>quantity_spec <span class="op">==</span> dimensionless<span class="op">)</span>;</span>
<span id="cb282-2"><a href="#cb282-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>q<span class="op">.</span>dimension <span class="op">==</span> dimension_one<span class="op">)</span>;</span>
<span id="cb282-3"><a href="#cb282-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>q<span class="op">.</span>unit <span class="op">==</span> one<span class="op">)</span>;</span></code></pre></div>
<p>In case we would like to print its value, we would see a raw value of
<code class="sourceCode cpp"><span class="dv">4</span></code> in the
output with no unit being printed.</p>
<h5 data-number="18.12.5.1.2" id="dividing-quantities-of-different-types"><span class="header-section-number">18.12.5.1.2</span> Dividing quantities of
different types<a href="#dividing-quantities-of-different-types" class="self-link"></a></h5>
<p>We can divide quantities of the same dimension and unit but of
different quantity types:</p>
<div class="sourceCode" id="cb283"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb283-1"><a href="#cb283-1" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> QuantityOf<span class="op">&lt;</span>dimensionless<span class="op">&gt;</span> <span class="kw">auto</span> q <span class="op">=</span> isq<span class="op">::</span>work<span class="op">(</span><span class="dv">200</span> <span class="op">*</span> J<span class="op">)</span> <span class="op">/</span> isq<span class="op">::</span>heat<span class="op">(</span><span class="dv">50</span> <span class="op">*</span> J<span class="op">)</span>;</span></code></pre></div>
<p>Again we end up with
<code class="sourceCode cpp">dimension_one</code> and
<code class="sourceCode cpp">one</code>, but this time:</p>
<div class="sourceCode" id="cb284"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb284-1"><a href="#cb284-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>q<span class="op">.</span>quantity_spec <span class="op">==</span> isq<span class="op">::</span>work <span class="op">/</span> isq<span class="op">::</span>heat<span class="op">)</span>;</span></code></pre></div>
<p>As shown above, the result is not of a
<code class="sourceCode cpp">dimensionless</code> type anymore. Instead,
we get a quantity type derived from the performed quantity equation.
According to the <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span>, <em>work</em> divided by
<em>heat</em> is the recipe for the <em>thermodynamic efficiency</em>
quantity, thus:</p>
<div class="sourceCode" id="cb285"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb285-1"><a href="#cb285-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>implicitly_convertible<span class="op">(</span>q<span class="op">.</span>quantity_spec, isq<span class="op">::</span>efficiency_thermodynamics<span class="op">))</span>;</span></code></pre></div>
<p>Please note that the quantity of <code class="sourceCode cpp">isq<span class="op">::</span>efficiency_thermodynamics</code>
is of a kind <code class="sourceCode cpp">dimensionless</code>, so it is
implicitly convertible to
<code class="sourceCode cpp">dimensionless</code> and satisfies the <a href="#QuantityOf-concept"><code class="sourceCode cpp">QuantityOf<span class="op">&lt;</span>dimensionless<span class="op">&gt;</span></code></a>
concept.</p>
<h5 data-number="18.12.5.1.3" id="dividing-quantities-of-different-units"><span class="header-section-number">18.12.5.1.3</span> Dividing quantities of
different units<a href="#dividing-quantities-of-different-units" class="self-link"></a></h5>
<p>Now, let’s see what happens when we divide two quantities of the same
type but different units:</p>
<div class="sourceCode" id="cb286"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb286-1"><a href="#cb286-1" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> QuantityOf<span class="op">&lt;</span>dimensionless<span class="op">&gt;</span> <span class="kw">auto</span> q <span class="op">=</span> isq<span class="op">::</span>height<span class="op">(</span><span class="dv">4</span> <span class="op">*</span> km<span class="op">)</span> <span class="op">/</span> isq<span class="op">::</span>height<span class="op">(</span><span class="dv">2</span> <span class="op">*</span> m<span class="op">)</span>;</span></code></pre></div>
<p>This time we get a quantity of
<code class="sourceCode cpp">dimensionless</code> type with a
<code class="sourceCode cpp">dimension_one</code> as its dimension.
However, the resulting unit is not
<code class="sourceCode cpp">one</code> anymore:</p>
<div class="sourceCode" id="cb287"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb287-1"><a href="#cb287-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>q<span class="op">.</span>unit <span class="op">==</span> mag_power<span class="op">&lt;</span><span class="dv">10</span>, <span class="dv">3</span><span class="op">&gt;</span> <span class="op">*</span> one<span class="op">)</span>;</span></code></pre></div>
<p>In case we would print the text output of this quantity, we would not
see a raw value of
<code class="sourceCode cpp"><span class="dv">2000</span></code>, but
<code class="sourceCode cpp"><span class="dv">2</span> km<span class="op">/</span>m</code>.</p>
<p>First, it may look surprising, but this is actually consistent with
the division of quantities of different dimensions. For example, if we
divide <code class="sourceCode cpp"><span class="dv">4</span> <span class="op">*</span> km <span class="op">/</span> <span class="op">(</span><span class="dv">2</span> <span class="op">*</span> s<span class="op">)</span></code>,
we do not expect <code class="sourceCode cpp">km</code> to be “expanded”
to <code class="sourceCode cpp">m</code> before the division, right? We
would expect the result of <code class="sourceCode cpp"><span class="dv">2</span> <span class="op">*</span> <span class="op">(</span>km <span class="op">/</span> s<span class="op">)</span></code>,
which is exactly what we get when we divide quantities of the same
kind.</p>
<p>This is a compelling feature that allows us to express huge or tiny
ratios without the need for big and expensive representation types. With
this, we can easily define things like a <a href="https://en.wikipedia.org/wiki/Hubble%27s_law#Dimensionless_Hubble_constant">Hubble’s
constant</a> that uses a unit that is proportional to the ratio of
kilometers per megaparsecs, which are both units of length:</p>
<div class="sourceCode" id="cb288"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb288-1"><a href="#cb288-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> hubble_constant <span class="kw">final</span> <span class="op">:</span></span>
<span id="cb288-2"><a href="#cb288-2" aria-hidden="true" tabindex="-1"></a>    named_unit<span class="op">&lt;{</span><span class="st">u8&quot;H₀&quot;</span>, <span class="st">&quot;H_0&quot;</span><span class="op">}</span>, mag_ratio<span class="op">&lt;</span><span class="dv">701</span>, <span class="dv">10</span><span class="op">&gt;</span> <span class="op">*</span> si<span class="op">::</span>kilo<span class="op">&lt;</span>si<span class="op">::</span>metre<span class="op">&gt;</span> <span class="op">/</span> si<span class="op">::</span>second <span class="op">/</span> si<span class="op">::</span>mega<span class="op">&lt;</span>parsec<span class="op">&gt;&gt;</span> <span class="op">{</span></span>
<span id="cb288-3"><a href="#cb288-3" aria-hidden="true" tabindex="-1"></a><span class="op">}</span> hubble_constant;</span></code></pre></div>
<h4 data-number="18.12.5.2" id="counts-of-things"><span class="header-section-number">18.12.5.2</span> Counts of things<a href="#counts-of-things" class="self-link"></a></h4>
<p>Another important use case for dimensionless quantities is to provide
strong types for counts of things. For example:</p>
<ul>
<li><span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> (part 3) provides a
<em>rotation</em> quantity defined as the number of revolutions,</li>
<li><span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> (part 6) provides a
<em>number of turns in a winding</em> quantity,</li>
<li><span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> (part 13) provides a
<em>Hamming distance</em> quantity defined as the number of digit
positions in which the corresponding digits of two words of the same
length are different.</li>
</ul>
<p>Thanks to assigning strong names to such quantities, they can be used
in the quantity equation of other quantities. For example,
<em>rotational frequency</em> is defined by <code class="sourceCode cpp">rotation <span class="op">/</span> duration</code>.</p>
<h4 data-number="18.12.5.3" id="convertibility-from-fundamental-types"><span class="header-section-number">18.12.5.3</span> Convertibility from
fundamental types<a href="#convertibility-from-fundamental-types" class="self-link"></a></h4>
<p>As stated before, the division of two quantities of the same kind
results in a quantity of dimension one. Even though it does not have a
specific physical dimension it still uses units with various ratios such
as <code class="sourceCode cpp">one</code>,
<code class="sourceCode cpp">percent</code>,
<code class="sourceCode cpp">radian</code>,
<code class="sourceCode cpp">degree</code>, etc. It is essential to be
explicit about which unit we want to use for such a quantity.</p>
<p>However, in some cases, this might look like an overkill. For
example:</p>
<div class="sourceCode" id="cb289"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb289-1"><a href="#cb289-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">10</span> <span class="op">*</span> km <span class="op">/</span> <span class="op">(</span><span class="dv">5</span> <span class="op">*</span> km<span class="op">)</span> <span class="op">==</span> <span class="dv">2</span> <span class="op">*</span> one<span class="op">)</span>;</span></code></pre></div>
<p>This is why we’ve added support for such feature. It was described in
the <a href="#superpowers-of-the-unit-one">Superpowers of the unit
<code class="sourceCode cpp">one</code></a> chapter already. Such
support has sense only for quantities with a unit
<code class="sourceCode cpp">one</code>. In the case of all the other
units, the specific unit should still be provided. We also need to use
explicit units to create a quantity for some cases. For example, in the
following code, <code class="sourceCode cpp">asin<span class="op">(-</span><span class="dv">1</span><span class="op">)</span></code>
would use the overload from the <code class="sourceCode cpp"><span class="op">&lt;</span>math<span class="op">&gt;</span></code>
header of the C++ standard library rather than the one for quantities
provided in <code class="sourceCode cpp"><span class="op">&lt;</span>mp<span class="op">-</span>units<span class="op">/</span>math<span class="op">.</span>h<span class="op">&gt;</span></code>
header file:</p>
<div class="sourceCode" id="cb290"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb290-1"><a href="#cb290-1" aria-hidden="true" tabindex="-1"></a>REQUIRE_THAT<span class="op">(</span>asin<span class="op">(-</span><span class="dv">1</span> <span class="op">*</span> one<span class="op">)</span>, AlmostEquals<span class="op">(-</span><span class="fl">90.</span> <span class="op">*</span> deg<span class="op">))</span>;</span></code></pre></div>
<p>We may also want to discuss convertibility rules in the LEWG. Here
are the questions to ask:</p>
<ol type="1">
<li><p>Should such a conversion be explicit or implicit?</p>
<p>We may be tempted to stay on the safe side and choose explicit
conversions here. However, this would make the following expression
illegal or at least awkward:</p>
<div class="sourceCode" id="cb291"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb291-1"><a href="#cb291-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">10</span> <span class="op">*</span> km <span class="op">/</span> <span class="op">(</span><span class="dv">5</span> <span class="op">*</span> km<span class="op">)</span> <span class="op">+</span> <span class="dv">1</span> <span class="op">==</span> <span class="dv">3</span><span class="op">)</span>;</span></code></pre></div>
<p>It would be strange to support arithmetics against the raw value if
the quantity type can’t be implicitly constructed from it.</p></li>
<li><p>Should we support converting from the dimensionless quantity with
unit <code class="sourceCode cpp">one</code> to the raw value? If yes,
should it be implicit or explicit?</p>
<p>It could probably be better to allow implicit conversions to work
with legacy interfaces or to benefit from regular math-related functions
that work on fundamental types. Otherwise, we will need to type
something like this in our code:</p>
<div class="sourceCode" id="cb292"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb292-1"><a href="#cb292-1" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> res <span class="op">=</span> sin<span class="op">(</span><span class="kw">static_cast</span><span class="op">&lt;</span><span class="dt">double</span><span class="op">&gt;(</span>q<span class="op">))</span>;</span></code></pre></div>
<p>which really is not a great improvement over:</p>
<div class="sourceCode" id="cb293"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb293-1"><a href="#cb293-1" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> res <span class="op">=</span> sin<span class="op">(</span>q<span class="op">.</span>numerical_value_in<span class="op">(</span>one<span class="op">))</span>;</span></code></pre></div>
<p>However, this breaks <code class="sourceCode cpp">std<span class="op">::</span>common_type_t<span class="op">&lt;</span>quantity<span class="op">&lt;</span>one<span class="op">&gt;</span>, <span class="dt">double</span><span class="op">&gt;</span></code>.
It is why we’ve decided to stay with an explicit conversion so
far.</p></li>
</ol>
<h4 data-number="18.12.5.4" id="predefined-units-of-the-dimensionless-quantity"><span class="header-section-number">18.12.5.4</span> Predefined units of the
dimensionless quantity<a href="#predefined-units-of-the-dimensionless-quantity" class="self-link"></a></h4>
<p>As we observed above, the most common unit for dimensionless
quantities is <code class="sourceCode cpp">one</code>. It has the ratio
of <code class="sourceCode cpp"><span class="dv">1</span></code> and
does not output any textual symbol.</p>
<p>A unit <code class="sourceCode cpp">one</code> is special in the
entire type system of units as it is considered to be an identity
operand in the unit expression templates. This means that, for
example:</p>
<div class="sourceCode" id="cb294"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb294-1"><a href="#cb294-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>one <span class="op">*</span> one <span class="op">==</span> one<span class="op">)</span>;</span>
<span id="cb294-2"><a href="#cb294-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>one <span class="op">*</span> si<span class="op">::</span>metre <span class="op">==</span> si<span class="op">::</span>metre<span class="op">)</span>;</span>
<span id="cb294-3"><a href="#cb294-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>si<span class="op">::</span>metre <span class="op">/</span> si<span class="op">::</span>metre <span class="op">==</span> one<span class="op">)</span>;</span></code></pre></div>
<p>The same is also true for
<code class="sourceCode cpp">dimension_one</code> and
<code class="sourceCode cpp">dimensionless</code> in the domains of
dimensions and quantity specifications, respectively.</p>
<p>Besides the unit <code class="sourceCode cpp">one</code>, there are a
few other scaled units predefined in the library for usage with
dimensionless quantities:</p>
<div class="sourceCode" id="cb295"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb295-1"><a href="#cb295-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> percent <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;%&quot;</span>, mag_ratio<span class="op">&lt;</span><span class="dv">1</span>, <span class="dv">100</span><span class="op">&gt;</span> <span class="op">*</span> one<span class="op">&gt;</span> <span class="op">{}</span> percent;</span>
<span id="cb295-2"><a href="#cb295-2" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> per_mille <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;{</span><span class="st">u8&quot;‰&quot;</span>, <span class="st">&quot;</span><span class="sc">%o</span><span class="st">&quot;</span><span class="op">}</span>, mag_ratio<span class="op">&lt;</span><span class="dv">1</span>, <span class="dv">1000</span><span class="op">&gt;</span> <span class="op">*</span> one<span class="op">&gt;</span> <span class="op">{}</span> per_mille;</span>
<span id="cb295-3"><a href="#cb295-3" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> parts_per_million <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;ppm&quot;</span>, mag_ratio<span class="op">&lt;</span><span class="dv">1</span>, <span class="dv">1&#39;000&#39;000</span><span class="op">&gt;</span> <span class="op">*</span> one<span class="op">&gt;</span> <span class="op">{}</span> parts_per_million;</span>
<span id="cb295-4"><a href="#cb295-4" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">auto</span> ppm <span class="op">=</span> parts_per_million;</span></code></pre></div>
<h5 data-number="18.12.5.4.1" id="superpowers-of-the-unit-one"><span class="header-section-number">18.12.5.4.1</span> Superpowers of the unit
<code class="sourceCode cpp">one</code><a href="#superpowers-of-the-unit-one" class="self-link"></a></h5>
<p>Quantities of the unit <code class="sourceCode cpp">one</code> are
the only ones that are implicitly convertible from a raw value and
explicitly convertible to it. This property also expands to usual
arithmetic operators.</p>
<p>Thanks to the above, we can type:</p>
<div class="sourceCode" id="cb296"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb296-1"><a href="#cb296-1" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>one<span class="op">&gt;</span> inc<span class="op">(</span>quantity<span class="op">&lt;</span>one<span class="op">&gt;</span> q<span class="op">)</span> <span class="op">{</span> <span class="cf">return</span> q <span class="op">+</span> <span class="dv">1</span>; <span class="op">}</span></span>
<span id="cb296-2"><a href="#cb296-2" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> legacy<span class="op">(</span><span class="dt">double</span><span class="op">)</span> <span class="op">{</span> <span class="co">/* ... */</span> <span class="op">}</span></span>
<span id="cb296-3"><a href="#cb296-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb296-4"><a href="#cb296-4" aria-hidden="true" tabindex="-1"></a><span class="cf">if</span> <span class="op">(</span><span class="kw">auto</span> q <span class="op">=</span> inc<span class="op">(</span><span class="dv">42</span><span class="op">)</span>; q <span class="op">!=</span> <span class="dv">0</span><span class="op">)</span></span>
<span id="cb296-5"><a href="#cb296-5" aria-hidden="true" tabindex="-1"></a>  legacy<span class="op">(</span><span class="kw">static_cast</span><span class="op">&lt;</span><span class="dt">int</span><span class="op">&gt;(</span>q<span class="op">))</span>;</span></code></pre></div>
<p>Please note that those rules do not apply to all the dimensionless
quantities. It would be unsafe and misleading to allow such operations
on units with a magnitude different than
<code class="sourceCode cpp"><span class="dv">1</span></code> (e.g.,
<code class="sourceCode cpp">percent</code> or
<code class="sourceCode cpp">radian</code>).</p>
<h4 data-number="18.12.5.5" id="angular-quantities"><span class="header-section-number">18.12.5.5</span> Angular quantities<a href="#angular-quantities" class="self-link"></a></h4>
<p>Special, often controversial, examples of dimensionless quantities
are the <em>angular measure</em> and <em>solid angular measure</em>
quantities that are defined in <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> (part 3) to be the result
of a division of <code class="sourceCode cpp">arc_length <span class="op">/</span> radius</code>
and <code class="sourceCode cpp">area <span class="op">/</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>radius<span class="op">)</span></code>
respectively. Moreover, <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> also explicitly states
that both can be expressed in the unit
<code class="sourceCode cpp">one</code>. This means that both <code class="sourceCode cpp">isq<span class="op">::</span>angular_measure</code>
and <code class="sourceCode cpp">isq<span class="op">::</span>solid_angular_measure</code>
should be of a kind of
<code class="sourceCode cpp">dimensionless</code>.</p>
<p>On the other hand, <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> also specifies that the
unit <code class="sourceCode cpp">radian</code> can be used for
<em>angular measure</em>, and the unit
<code class="sourceCode cpp">steradian</code> can be used for <em>solid
angular measure</em>. Those should not be mixed or used to express other
types of dimensionless quantities. We should not be able to measure:</p>
<ul>
<li>basic dimensionless quantity in radians or steradians,</li>
<li><em>angular measure</em> in steradians,</li>
<li><em>solid angular measure</em> in radians.</li>
</ul>
<p>This means that both <code class="sourceCode cpp">isq<span class="op">::</span>angular_measure</code>
and <code class="sourceCode cpp">isq<span class="op">::</span>solid_angular_measure</code>
should also be quantity kinds by themselves.</p>
<p><em>Note: Many people claim that angle being a dimensionless quantity
is a bad idea. There are proposals submitted to make an angle a base
quantity and <code class="sourceCode cpp">rad</code> to become a base
unit in both <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span> and <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span>.</em></p>
<h5 data-number="18.12.5.5.1" id="radians-and-degrees-support"><span class="header-section-number">18.12.5.5.1</span> Radians and degrees
support<a href="#radians-and-degrees-support" class="self-link"></a></h5>
<p>Thanks to the usage of magnitudes the library provides efficient
strong types for all angular types. This means that with the built-in
support for magnitudes of <span class="math inline">\(\pi\)</span> we
can provide accurate conversions between radians and degrees. The
library also provides common trigonometric functions for angular
quantities:</p>
<div class="sourceCode" id="cb297"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb297-1"><a href="#cb297-1" aria-hidden="true" tabindex="-1"></a>quantity speed <span class="op">=</span> <span class="dv">110</span> <span class="op">*</span> km <span class="op">/</span> h;</span>
<span id="cb297-2"><a href="#cb297-2" aria-hidden="true" tabindex="-1"></a>quantity rate_of_climb <span class="op">=</span> <span class="op">-</span><span class="fl">0.63657</span> <span class="op">*</span> m <span class="op">/</span> s;</span>
<span id="cb297-3"><a href="#cb297-3" aria-hidden="true" tabindex="-1"></a>quantity glide_ratio <span class="op">=</span> speed <span class="op">/</span> <span class="op">-</span>rate_of_climb;</span>
<span id="cb297-4"><a href="#cb297-4" aria-hidden="true" tabindex="-1"></a>quantity glide_angle <span class="op">=</span> angular<span class="op">::</span>asin<span class="op">(</span><span class="dv">1</span> <span class="op">/</span> glide_ratio<span class="op">)</span>;</span>
<span id="cb297-5"><a href="#cb297-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb297-6"><a href="#cb297-6" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Glide ratio: {::N[.1f]}</span><span class="sc">\n</span><span class="st">&quot;</span>, value_cast<span class="op">&lt;</span>one<span class="op">&gt;(</span>glide_ratio<span class="op">))</span>;</span>
<span id="cb297-7"><a href="#cb297-7" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Glide angle:&quot;</span><span class="op">)</span>;</span>
<span id="cb297-8"><a href="#cb297-8" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot; - {::N[.4f]}</span><span class="sc">\n</span><span class="st">&quot;</span>, glide_angle<span class="op">)</span>;</span>
<span id="cb297-9"><a href="#cb297-9" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot; - {::N[.2f]}</span><span class="sc">\n</span><span class="st">&quot;</span>, value_cast<span class="op">&lt;</span>angular<span class="op">::</span>degree<span class="op">&gt;(</span>glide_angle<span class="op">))</span>;</span>
<span id="cb297-10"><a href="#cb297-10" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot; - {::N[.2f]}</span><span class="sc">\n</span><span class="st">&quot;</span>, value_cast<span class="op">&lt;</span>angular<span class="op">::</span>gradian<span class="op">&gt;(</span>glide_angle<span class="op">))</span>;</span></code></pre></div>
<p>The above program prints:</p>
<pre class="text"><code>Glide ratio: 48.0
Glide angle:
 - 0.0208 rad
 - 1.19°
 - 1.33ᵍ</code></pre>
<h4 data-number="18.12.5.6" id="nested-quantity-kinds"><span class="header-section-number">18.12.5.6</span> Nested quantity kinds<a href="#nested-quantity-kinds" class="self-link"></a></h4>
<p>Angular quantities are not the only ones with such a “strange”
behavior. A similar case is the <em>storage capacity</em> quantity
specified in <span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> (part 13) that again
allows expressing it in both <code class="sourceCode cpp">one</code> and
<code class="sourceCode cpp">bit</code> units.</p>
<p>Those cases make dimensionless quantities an exceptional tree in the
library. This quantity hierarchy contains more than one quantity kind
and more than one unit in its tree:</p>
<p><img src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lnaHQ9IjM5IiB3aWR0aD0iMzIuNjI1IiB5PSItMTkuNSIgeD0iLTE2LjMxMjUiIHJ5PSIwIiByeD0iMCIgc3R5bGU9IiIgY2xhc3M9ImJhc2ljIGxhYmVsLWNvbnRhaW5lciI+PC9yZWN0PjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKC04LjgxMjUsIC0xMikiIHN0eWxlPSIiIGNsYXNzPSJsYWJlbCI+PHJlY3Q+PC9yZWN0Pjxmb3JlaWduT2JqZWN0IGhlaWdodD0iMjQiIHdpZHRoPSIxNy42MjUiPjxkaXYgc3R5bGU9ImRpc3BsYXk6IGlubGluZS1ibG9jazsgd2hpdGUtc3BhY2U6IG5vd3JhcDsiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hodG1sIj48c3BhbiBjbGFzcz0ibm9kZUxhYmVsIj4uLi48L3NwYW4+PC9kaXY+PC9mb3JlaWduT2JqZWN0PjwvZz48L2c+PC9nPjwvZz48L2c+PC9zdmc+" /></p>
<p>To provide such support in the library, we provided an
<code class="sourceCode cpp">is_kind</code> specifier that can be
appended to the quantity specification:</p>
<div class="sourceCode" id="cb298"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb298-1"><a href="#cb298-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> angular_measure <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>dimensionless, arc_length <span class="op">/</span> radius, is_kind<span class="op">&gt;</span> <span class="op">{}</span> angular_measure;</span>
<span id="cb298-2"><a href="#cb298-2" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> solid_angular_measure <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>dimensionless, area <span class="op">/</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>radius<span class="op">)</span>, is_kind<span class="op">&gt;</span> <span class="op">{}</span> solid_angular_measure;</span>
<span id="cb298-3"><a href="#cb298-3" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> storage_capacity <span class="kw">final</span> <span class="op">:</span> quantity_spec<span class="op">&lt;</span>dimensionless, is_kind<span class="op">&gt;</span> <span class="op">{}</span> storage_capacity;</span></code></pre></div>
<p>With the above, we can constrain
<code class="sourceCode cpp">radian</code>,
<code class="sourceCode cpp">steradian</code>, and
<code class="sourceCode cpp">bit</code> to be allowed for usage with
specific quantity kinds only:</p>
<div class="sourceCode" id="cb299"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb299-1"><a href="#cb299-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> radian <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;rad&quot;</span>, metre <span class="op">/</span> metre, kind_of<span class="op">&lt;</span>isq<span class="op">::</span>angular_measure<span class="op">&gt;&gt;</span> <span class="op">{}</span> radian;</span>
<span id="cb299-2"><a href="#cb299-2" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> steradian <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;sr&quot;</span>, square<span class="op">(</span>metre<span class="op">)</span> <span class="op">/</span> square<span class="op">(</span>metre<span class="op">)</span>, kind_of<span class="op">&lt;</span>isq<span class="op">::</span>solid_angular_measure<span class="op">&gt;&gt;</span> <span class="op">{}</span> steradian;</span>
<span id="cb299-3"><a href="#cb299-3" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> bit <span class="kw">final</span> <span class="op">:</span> named_unit<span class="op">&lt;</span><span class="st">&quot;bit&quot;</span>, one, kind_of<span class="op">&lt;</span>storage_capacity<span class="op">&gt;&gt;</span> <span class="op">{}</span> bit;</span></code></pre></div>
<p>This still allows the usage of
<code class="sourceCode cpp">one</code> (possibly scaled) for such
quantities which is exactly what we wanted to achieve.</p>
<h3 data-number="18.12.6" id="value-conversions"><span class="header-section-number">18.12.6</span> Value conversions<a href="#value-conversions" class="self-link"></a></h3>
<p><a href="#preventing-truncation-of-data">Preventing truncation of
data</a> and <a href="#safe-unit-conversions">Safe unit conversions</a>
chapters describe the motivation, usage, and safety benefits of the
<code class="sourceCode cpp">value_cast</code>,
<code class="sourceCode cpp">in</code>, and
<code class="sourceCode cpp">force_in</code> value conversion
functions.</p>
<h4 data-number="18.12.6.1" id="template-disambiguation-concerns"><span class="header-section-number">18.12.6.1</span>
<code class="sourceCode cpp"><span class="kw">template</span></code>
disambiguation concerns<a href="#template-disambiguation-concerns" class="self-link"></a></h4>
<p>Initially <strong>mp-units</strong> library allowed changing of the
<code class="sourceCode cpp">quantity</code> representation type only
via the <code class="sourceCode cpp">value_cast</code> non-member
function. Introducing such a functionality to
<code class="sourceCode cpp">in</code> and
<code class="sourceCode cpp">force_in</code> member functions would
mandate the usage of the
<code class="sourceCode cpp"><span class="kw">template</span></code>
disambiguator in generic contexts that we encorage with <a href="#generic-interfaces">Generic interfaces</a>.</p>
<p>After bringing those concerns to LEWGI in St. Louis, the room agreed
that we should provide this functionality for member functions as well.
It is really useful and user-friendly in non-generic contexts and for
the cases where we deal with a dependent name, we should leave
<code class="sourceCode cpp">value_cast</code> even if it is an always
conversion-forcing operation.</p>
<h4 data-number="18.12.6.2" id="value-conversions-summary"><span class="header-section-number">18.12.6.2</span> Value conversions
summary<a href="#value-conversions-summary" class="self-link"></a></h4>
<p>The table below provides all the value conversions functions that may
be run on <code class="sourceCode cpp">x</code> being the instance of
either <code class="sourceCode cpp">quantity</code> or
<code class="sourceCode cpp">quantity_point</code>:</p>
<table>
<colgroup>
<col style="width: 9%" />
<col style="width: 16%" />
<col style="width: 6%" />
<col style="width: 20%" />
<col style="width: 48%" />
</colgroup>
<thead>
<tr class="header">
<th style="text-align: center;"><div style="text-align:center">
<strong>Forcing</strong>
</div></th>
<th style="text-align: center;"><div style="text-align:center">
<strong>Representation</strong>
</div></th>
<th style="text-align: center;"><div style="text-align:center">
<strong>Unit</strong>
</div></th>
<th><div style="text-align:center">
<strong>Member function</strong>
</div></th>
<th><div style="text-align:center">
<strong>Non-member function</strong>
</div></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td style="text-align: center;">No</td>
<td style="text-align: center;">Same</td>
<td style="text-align: center;"><code class="sourceCode cpp">u</code></td>
<td><code class="sourceCode cpp">x<span class="op">.</span>in<span class="op">(</span>u<span class="op">)</span></code></td>
<td></td>
</tr>
<tr class="even">
<td style="text-align: center;">No</td>
<td style="text-align: center;"><code class="sourceCode cpp">T</code></td>
<td style="text-align: center;">Same</td>
<td><code class="sourceCode cpp">x<span class="op">.</span>in<span class="op">&lt;</span>T<span class="op">&gt;()</span></code></td>
<td></td>
</tr>
<tr class="odd">
<td style="text-align: center;">No</td>
<td style="text-align: center;"><code class="sourceCode cpp">T</code></td>
<td style="text-align: center;"><code class="sourceCode cpp">u</code></td>
<td><code class="sourceCode cpp">x<span class="op">.</span>in<span class="op">&lt;</span>T<span class="op">&gt;(</span>u<span class="op">)</span></code></td>
<td></td>
</tr>
<tr class="even">
<td style="text-align: center;">Yes</td>
<td style="text-align: center;">Same</td>
<td style="text-align: center;"><code class="sourceCode cpp">u</code></td>
<td><code class="sourceCode cpp">x<span class="op">.</span>force_in<span class="op">(</span>u<span class="op">)</span></code></td>
<td><code class="sourceCode cpp">value_cast<span class="op">&lt;</span>u<span class="op">&gt;(</span>x<span class="op">)</span></code></td>
</tr>
<tr class="odd">
<td style="text-align: center;">Yes</td>
<td style="text-align: center;"><code class="sourceCode cpp">T</code></td>
<td style="text-align: center;">Same</td>
<td><code class="sourceCode cpp">x<span class="op">.</span>force_in<span class="op">&lt;</span>T<span class="op">&gt;()</span></code></td>
<td><code class="sourceCode cpp">value_cast<span class="op">&lt;</span>T<span class="op">&gt;(</span>x<span class="op">)</span></code></td>
</tr>
<tr class="even">
<td style="text-align: center;">Yes</td>
<td style="text-align: center;"><code class="sourceCode cpp">T</code></td>
<td style="text-align: center;"><code class="sourceCode cpp">u</code></td>
<td><code class="sourceCode cpp">x<span class="op">.</span>force_in<span class="op">&lt;</span>T<span class="op">&gt;(</span>u<span class="op">)</span></code></td>
<td><code class="sourceCode cpp">value_cast<span class="op">&lt;</span>u, T<span class="op">&gt;(</span>x<span class="op">)</span></code>
or <code class="sourceCode cpp">value_cast<span class="op">&lt;</span>T, u<span class="op">&gt;(</span>x<span class="op">)</span></code></td>
</tr>
</tbody>
</table>
<h4 data-number="18.12.6.3" id="bikeshedding-force_inu"><span class="header-section-number">18.12.6.3</span> Bikeshedding <code class="sourceCode cpp">force_in<span class="op">(</span>U<span class="op">)</span></code><a href="#bikeshedding-force_inu" class="self-link"></a></h4>
<p><code class="sourceCode cpp">force_in</code> is a bit ambiguous name
for the conversion function in a quantities and units library. Writing
<code class="sourceCode cpp">x<span class="op">.</span>force_in<span class="op">(</span>s<span class="op">)</span></code>
may be misleading for a quantity of <em>time</em> rather than
<em>force</em>. However, we do not have good alternatives here.</p>
<p>Before we provide some alternatives it is good to mention that we
also heve a <code class="sourceCode cpp">x<span class="op">.</span>force_numerical_value_in<span class="op">(</span>u<span class="op">)</span></code>
to force a truncation while obtaining a numerical value of the
quantity.</p>
<p><span class="citation" data-cites="AU">[<a href="https://aurora-opensource.github.io/au" role="doc-biblioref">Au</a>]</span> library uses <code class="sourceCode cpp">x<span class="op">.</span>coerse_in<span class="op">(</span>u<span class="op">)</span></code>
for this operation. We could also consider different names. Here are a
few possbile alternatives:</p>
<ul>
<li><code class="sourceCode cpp">x<span class="op">.</span>force_in<span class="op">(</span>u<span class="op">)</span></code>,
<code class="sourceCode cpp">x<span class="op">.</span>force_numerical_value_in<span class="op">(</span>u<span class="op">)</span></code>,</li>
<li><code class="sourceCode cpp">x<span class="op">.</span>forced_into<span class="op">(</span>u<span class="op">)</span></code>,
<code class="sourceCode cpp">x<span class="op">.</span>forced_numerical_value_into<span class="op">(</span>u<span class="op">)</span></code>,</li>
<li><code class="sourceCode cpp">x<span class="op">.</span>coerse_in<span class="op">(</span>u<span class="op">)</span></code>,
<code class="sourceCode cpp">x<span class="op">.</span>coerse_numerical_value_in<span class="op">(</span>u<span class="op">)</span></code>,</li>
<li><code class="sourceCode cpp">x<span class="op">.</span>unsafe_in<span class="op">(</span>u<span class="op">)</span></code>,
<code class="sourceCode cpp">x<span class="op">.</span>unsafe_numerical_value_in<span class="op">(</span>u<span class="op">)</span></code>,</li>
<li><code class="sourceCode cpp">x<span class="op">.</span>cast_in<span class="op">(</span>u<span class="op">)</span></code>,
<code class="sourceCode cpp">x<span class="op">.</span>cast_numerical_value_in<span class="op">(</span>u<span class="op">)</span></code>,</li>
<li><code class="sourceCode cpp">x<span class="op">.</span>cast_to<span class="op">(</span>u<span class="op">)</span></code>,
<code class="sourceCode cpp">x<span class="op">.</span>cast_numerical_value_to<span class="op">(</span>u<span class="op">)</span></code>.</li>
</ul>
<p>In case we select <code class="sourceCode cpp">x<span class="op">.</span>cast_to<span class="op">(</span>u<span class="op">)</span></code>
we probably should also rename <code class="sourceCode cpp">q<span class="op">.</span>in<span class="op">(</span>u<span class="op">)</span></code>
to <code class="sourceCode cpp">q<span class="op">.</span>to<span class="op">(</span>u<span class="op">)</span></code>.</p>
<h4 data-number="18.12.6.4" id="bikeshedding-quantityrep"><span class="header-section-number">18.12.6.4</span> Bikeshedding <code class="sourceCode cpp">quantity<span class="op">::</span>rep</code><a href="#bikeshedding-quantityrep" class="self-link"></a></h4>
<p><span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> initially tried to be
compatible with <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration</code>.
This is why we chose <code class="sourceCode cpp">rep</code> as the name
for a public member type exposed from
<code class="sourceCode cpp">quantity</code> to denote its
representation type. This is consistent but may not be the best
name.</p>
<p>First, we use <code class="sourceCode cpp">q<span class="op">.</span>numerical_value_in<span class="op">()</span></code>
to get the underlying value which is already inconsistent with <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration<span class="op">::</span>count<span class="op">()</span></code>.
Also, as we mentioned already, <a href="#quantity-is-a-numeric-wrapper"><code class="sourceCode cpp">quantity</code>
is a numeric wrapper</a>. To provide compatibility between different
numeric types maybe we should set a policy that those should expose
<code class="sourceCode cpp">value_type</code> or
<code class="sourceCode cpp">element_type</code>? Both seem to be valid
choices here as well.</p>
<h3 data-number="18.12.7" id="binary-operators"><span class="header-section-number">18.12.7</span> Binary operators<a href="#binary-operators" class="self-link"></a></h3>
<p>Binary operators for quantities (and quantity points) should take
both arguments as template parameters. Implementing them in terms of
implicit convertibility leads to invalid resulting types. Let’s see the
following example:</p>
<div class="sourceCode" id="cb300"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb300-1"><a href="#cb300-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>std<span class="op">::</span>convertible_to<span class="op">&lt;</span>quantity<span class="op">&lt;</span>isq<span class="op">::</span>speed<span class="op">[</span>m<span class="op">/</span>s<span class="op">]</span>, <span class="dt">int</span><span class="op">&gt;</span>, </span>
<span id="cb300-2"><a href="#cb300-2" aria-hidden="true" tabindex="-1"></a> quantity<span class="op">&lt;(</span>isq<span class="op">::</span>length <span class="op">/</span> isq<span class="op">::</span>time<span class="op">)[</span>m<span class="op">/</span>s<span class="op">]</span>, <span class="dt">double</span><span class="op">&gt;&gt;)</span>;</span>
<span id="cb300-3"><a href="#cb300-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(!</span>std<span class="op">::</span>convertible_to<span class="op">&lt;</span>quantity<span class="op">&lt;(</span>isq<span class="op">::</span>length <span class="op">/</span> isq<span class="op">::</span>time<span class="op">)[</span>m<span class="op">/</span>s<span class="op">]</span>, <span class="dt">double</span><span class="op">&gt;</span>,</span>
<span id="cb300-4"><a href="#cb300-4" aria-hidden="true" tabindex="-1"></a> quantity<span class="op">&lt;</span>isq<span class="op">::</span>speed<span class="op">[</span>m<span class="op">/</span>s<span class="op">]</span>, <span class="dt">int</span><span class="op">&gt;&gt;)</span>;</span></code></pre></div>
<p>As we see above, <code class="sourceCode cpp">quantity<span class="op">&lt;</span>isq<span class="op">::</span>speed<span class="op">[</span>m<span class="op">/</span>s<span class="op">]</span>, <span class="dt">int</span><span class="op">&gt;</span></code>
converts to <code class="sourceCode cpp">quantity<span class="op">&lt;(</span>isq<span class="op">::</span>length <span class="op">/</span> isq<span class="op">::</span>time<span class="op">)[</span>m<span class="op">/</span>s<span class="op">]</span>, <span class="dt">double</span><span class="op">&gt;</span></code>,
but this is not the case in the other direction. This is caused by the
fact that conversion from
<code class="sourceCode cpp"><span class="dt">double</span></code> to
<code class="sourceCode cpp"><span class="dt">int</span></code> is
considered truncating. If we would implement the operators in terms of
the implicit conversion then we would end up with the quantity of <code class="sourceCode cpp">isq<span class="op">::</span>length <span class="op">/</span> isq<span class="op">::</span>time</code>
as a result, which is suboptimal. We prefer
<code class="sourceCode cpp">isq<span class="op">::</span>speed</code>
in this case:</p>
<div class="sourceCode" id="cb301"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb301-1"><a href="#cb301-1" aria-hidden="true" tabindex="-1"></a>quantity q1 <span class="op">=</span> isq<span class="op">::</span>speed<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">/</span>s<span class="op">)</span>;</span>
<span id="cb301-2"><a href="#cb301-2" aria-hidden="true" tabindex="-1"></a>quantity q2 <span class="op">=</span> isq<span class="op">::</span>length<span class="op">(</span><span class="fl">1.</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">/</span> isq<span class="op">::</span>time<span class="op">(</span><span class="fl">1.</span> <span class="op">*</span> s<span class="op">)</span>;</span>
<span id="cb301-3"><a href="#cb301-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>is_of_type<span class="op">&lt;</span>q1 <span class="op">+</span> q2, quantity<span class="op">&lt;</span>isq<span class="op">::</span>speed<span class="op">[</span>m<span class="op">/</span>s<span class="op">]</span>, <span class="dt">double</span><span class="op">&gt;&gt;)</span>;</span></code></pre></div>
<p>In the following example, we consistently use floating-point
representation types and both quantities are interconvertible:</p>
<div class="sourceCode" id="cb302"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb302-1"><a href="#cb302-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>std<span class="op">::</span>convertible_to<span class="op">&lt;</span>quantity<span class="op">&lt;(</span>isq<span class="op">::</span>mass <span class="op">*</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>isq<span class="op">::</span>length <span class="op">/</span> isq<span class="op">::</span>time<span class="op">))[</span>J<span class="op">]</span>, <span class="dt">double</span><span class="op">&gt;</span>,</span>
<span id="cb302-2"><a href="#cb302-2" aria-hidden="true" tabindex="-1"></a> quantity<span class="op">&lt;</span>isq<span class="op">::</span>energy<span class="op">[</span>kg<span class="op">*</span>m2<span class="op">/</span>s2<span class="op">]</span>, <span class="dt">double</span><span class="op">&gt;&gt;)</span>;</span>
<span id="cb302-3"><a href="#cb302-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>std<span class="op">::</span>convertible_to<span class="op">&lt;</span>quantity<span class="op">&lt;</span>isq<span class="op">::</span>energy<span class="op">[</span>kg<span class="op">*</span>m2<span class="op">/</span>s2<span class="op">]</span>, <span class="dt">double</span><span class="op">&gt;</span>,</span>
<span id="cb302-4"><a href="#cb302-4" aria-hidden="true" tabindex="-1"></a> quantity<span class="op">&lt;(</span>isq<span class="op">::</span>mass <span class="op">*</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>isq<span class="op">::</span>length <span class="op">/</span> isq<span class="op">::</span>time<span class="op">))[</span>J<span class="op">]</span>, <span class="dt">double</span><span class="op">&gt;&gt;)</span>;</span></code></pre></div>
<p>We could think that the problem is gone, and we can use implicit
conversions. However, depending on how we implement it, this might lead
to an ambiguous overload resolution or lack of substitutability of
addition. Even if we somehow solve those issues, none of the types would
be perfect as a return type. While forming a resulting type
<code class="sourceCode cpp">isq<span class="op">::</span>energy</code>
should have a priority over <code class="sourceCode cpp">isq<span class="op">::</span>mass <span class="op">*</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>isq<span class="op">::</span>length <span class="op">/</span> isq<span class="op">::</span>time<span class="op">)</span></code>
and <code class="sourceCode cpp">J</code> should have a priority over
<code class="sourceCode cpp">kg<span class="op">*</span>m2<span class="op">/</span>s2</code>:</p>
<div class="sourceCode" id="cb303"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb303-1"><a href="#cb303-1" aria-hidden="true" tabindex="-1"></a>quantity q1 <span class="op">=</span> <span class="op">(</span>isq<span class="op">::</span>mass<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> kg<span class="op">)</span> <span class="op">*</span> pow<span class="op">&lt;</span><span class="dv">2</span><span class="op">&gt;(</span>isq<span class="op">::</span>length<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> m<span class="op">)</span> <span class="op">/</span> isq<span class="op">::</span>time<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> s<span class="op">))).</span>in<span class="op">(</span>J<span class="op">)</span>;</span>
<span id="cb303-2"><a href="#cb303-2" aria-hidden="true" tabindex="-1"></a>quantity q2 <span class="op">=</span> isq<span class="op">::</span>energy<span class="op">(</span><span class="dv">1</span> <span class="op">*</span> kg<span class="op">*</span>m2<span class="op">/</span>s2<span class="op">)</span>;</span>
<span id="cb303-3"><a href="#cb303-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>is_of_type<span class="op">&lt;</span>q1 <span class="op">+</span> q2, quantity<span class="op">&lt;</span>isq<span class="op">::</span>energy<span class="op">[</span>J<span class="op">]</span>, <span class="dt">int</span><span class="op">&gt;&gt;)</span>;</span></code></pre></div>
<p>It is also worth noting that this approach is compatible with <a href="https://eel.is/c++draft/time.duration.nonmember">binary operators
for <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration</code></a>.
As we can read in the <a href="#interoperability-with-the-stdchrono-abstractions">Interoperability
with the
<code class="sourceCode cpp">std<span class="op">::</span>chrono</code>
abstractions</a> chapter, <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration</code>
is interconvertible with the quantity. Nevertheless, with the above, we
always need to explicitly convert the argument to a proper entity before
doing any arithmetic:</p>
<div class="sourceCode" id="cb304"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb304-1"><a href="#cb304-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">1</span> <span class="op">*</span> s <span class="op">+</span> <span class="dv">1</span><span class="bu">s</span> <span class="op">==</span> <span class="dv">2</span> <span class="op">*</span> s<span class="op">)</span>; <span class="co">// does not compile</span></span>
<span id="cb304-2"><a href="#cb304-2" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span><span class="dv">1</span> <span class="op">*</span> s <span class="op">+</span> quantity<span class="op">{</span><span class="dv">1</span><span class="bu">s</span><span class="op">}</span> <span class="op">==</span> <span class="dv">2</span> <span class="op">*</span> s<span class="op">)</span>; <span class="co">// OK</span></span></code></pre></div>
<p>This prevents ambiguity with <code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration</code>
operators and works the same for any user-defined
<code class="sourceCode cpp">QuantityLike</code> type or any other type
that is convertible to a
<code class="sourceCode cpp">quantity</code>.</p>
<h2 data-number="18.13" id="quantity-points"><span class="header-section-number">18.13</span> Quantity Points<a href="#quantity-points" class="self-link"></a></h2>
<h3 data-number="18.13.1" id="delta-and-absolute-creation-helpers"><span class="header-section-number">18.13.1</span>
<code class="sourceCode cpp">delta</code> and
<code class="sourceCode cpp">absolute</code> creation helpers<a href="#delta-and-absolute-creation-helpers" class="self-link"></a></h3>
<p>The features described in this chapter directly solve an issue raised
on <a href="https://lists.isocpp.org/std-proposals/2024/06/10118.php">std-proposals
reflector</a>. As it was reported, the code below may look correct, but
it provides an invalid result:</p>
<div class="sourceCode" id="cb305"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb305-1"><a href="#cb305-1" aria-hidden="true" tabindex="-1"></a>quantity Volume <span class="op">=</span> <span class="fl">1.0</span> <span class="op">*</span> m3;</span>
<span id="cb305-2"><a href="#cb305-2" aria-hidden="true" tabindex="-1"></a>quantity Temperature <span class="op">=</span> <span class="fl">28.0</span> <span class="op">*</span> deg_C;</span>
<span id="cb305-3"><a href="#cb305-3" aria-hidden="true" tabindex="-1"></a>quantity n_ <span class="op">=</span> <span class="fl">0.04401</span> <span class="op">*</span> kg <span class="op">/</span> mol;</span>
<span id="cb305-4"><a href="#cb305-4" aria-hidden="true" tabindex="-1"></a>quantity R_boltzman <span class="op">=</span> <span class="fl">8.314</span> <span class="op">*</span> N <span class="op">*</span> m <span class="op">/</span> <span class="op">(</span>K <span class="op">*</span> mol<span class="op">)</span>;</span>
<span id="cb305-5"><a href="#cb305-5" aria-hidden="true" tabindex="-1"></a>quantity mass <span class="op">=</span> <span class="fl">40.0</span> <span class="op">*</span> kg;</span>
<span id="cb305-6"><a href="#cb305-6" aria-hidden="true" tabindex="-1"></a>quantity Pressure <span class="op">=</span> R_boltzman <span class="op">*</span> Temperature<span class="op">.</span>in<span class="op">(</span>K<span class="op">)</span> <span class="op">*</span> mass <span class="op">/</span> n_ <span class="op">/</span> Volume;</span>
<span id="cb305-7"><a href="#cb305-7" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> Pressure <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span></code></pre></div>
<p>The problem is related to the accidental usage of a
<code class="sourceCode cpp">quantity</code> rather than
<code class="sourceCode cpp">quantity_point</code> for
<code class="sourceCode cpp">Temperature</code>. This means that after
conversion to kelvins, we will get
<code class="sourceCode cpp"><span class="dv">28</span> K</code> instead
of the expected
<code class="sourceCode cpp"><span class="fl">301.15</span> K</code>,
corrupting all further calculations.</p>
<p>A correct code should use a
<code class="sourceCode cpp">quantity_point</code>:</p>
<div class="sourceCode" id="cb306"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb306-1"><a href="#cb306-1" aria-hidden="true" tabindex="-1"></a>quantity_point Temperature<span class="op">(</span><span class="fl">28.0</span> <span class="op">*</span> deg_C<span class="op">)</span>;</span></code></pre></div>
<p>This might be an obvious thing for domain experts, but new users of
the library may not be aware of the affine space abstractions and how
they influence temperature handling.</p>
<p>After a lengthy discussion on handling such scenarios, we decided
to:</p>
<ul>
<li>make the above code ill-formed,</li>
<li>provide an alternative way to create
<code class="sourceCode cpp">quantity</code> and
<code class="sourceCode cpp">quantity_point</code> with the
<code class="sourceCode cpp">delta</code> and
<code class="sourceCode cpp">absolute</code> construction helpers
respectively.</li>
</ul>
<p>Here are the main points of this new design:</p>
<ol type="1">
<li><p>All references/units that specify point origin in their
definition (i.e.,
<code class="sourceCode cpp">si<span class="op">::</span>kelvin</code>,
   <code class="sourceCode cpp">si<span class="op">::</span>degree_Celsius</code>,
and <code class="sourceCode cpp">usc<span class="op">::</span>degree_Fahrenheit</code>)
are excluded from the multiply syntax.</p></li>
<li><p>A new <code class="sourceCode cpp">delta</code> quantity
construction helper is introduced:</p>
<ul>
<li><code class="sourceCode cpp">delta<span class="op">&lt;</span>m<span class="op">&gt;(</span><span class="dv">42</span><span class="op">)</span></code>
results with a <code class="sourceCode cpp">quantity<span class="op">&lt;</span>si<span class="op">::</span>metre, <span class="dt">int</span><span class="op">&gt;</span></code>,</li>
<li><code class="sourceCode cpp">delta<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="dv">5</span><span class="op">)</span></code>
results with a <code class="sourceCode cpp">quantity<span class="op">&lt;</span>si<span class="op">::</span>deg_C, <span class="dt">int</span><span class="op">&gt;</span></code>.</li>
</ul></li>
<li><p>A new <code class="sourceCode cpp">absolute</code> quantity point
construction helper is introduced:</p>
<ul>
<li><code class="sourceCode cpp">absolute<span class="op">&lt;</span>m<span class="op">&gt;(</span><span class="dv">42</span><span class="op">)</span></code>
results with a <code class="sourceCode cpp">quantity_point<span class="op">&lt;</span>si<span class="op">::</span>metre, zeroth_point_origin<span class="op">&lt;</span>kind_of<span class="op">&lt;</span>isq<span class="op">::</span>length<span class="op">&gt;&gt;{}</span>, <span class="dt">int</span><span class="op">&gt;</span></code>,</li>
<li><code class="sourceCode cpp">absolute<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="dv">5</span><span class="op">)</span></code>
results with a <code class="sourceCode cpp">quantity<span class="op">&lt;</span>si<span class="op">::</span>metre, si<span class="op">::</span>ice_point, <span class="dt">int</span><span class="op">&gt;</span></code>.</li>
</ul></li>
</ol>
<p>Please note that
<code class="sourceCode cpp">si<span class="op">::</span>kelvin</code>
is also excluded from the multiply syntax to prevent the following
surprising issues:</p>
<table>
<thead>
<tr class="header">
<th><div style="text-align:center">
<strong>Before</strong>
</div></th>
<th><div style="text-align:center">
<strong>Now</strong>
</div></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><div>

<div class="sourceCode" id="cb307"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb307-1"><a href="#cb307-1" aria-hidden="true" tabindex="-1"></a>quantity q<span class="op">(</span><span class="dv">300</span> <span class="op">*</span> K<span class="op">)</span>;</span>
<span id="cb307-2"><a href="#cb307-2" aria-hidden="true" tabindex="-1"></a>quantity_point qp<span class="op">(</span><span class="dv">300</span> <span class="op">*</span> K<span class="op">)</span>;</span>
<span id="cb307-3"><a href="#cb307-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>q<span class="op">.</span>in<span class="op">(</span>deg_C<span class="op">)</span> <span class="op">!=</span> qp<span class="op">.</span>in<span class="op">(</span>deg_C<span class="op">).</span>quantity_from_zero<span class="op">())</span>;</span></code></pre></div>

</div></td>
<td><div>

<div class="sourceCode" id="cb308"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb308-1"><a href="#cb308-1" aria-hidden="true" tabindex="-1"></a>quantity q <span class="op">=</span> delta<span class="op">&lt;</span>K<span class="op">&gt;(</span><span class="dv">300</span><span class="op">)</span>;</span>
<span id="cb308-2"><a href="#cb308-2" aria-hidden="true" tabindex="-1"></a>quantity_point qp <span class="op">=</span> absolute<span class="op">&lt;</span>K<span class="op">&gt;(</span><span class="dv">300</span><span class="op">)</span>;</span>
<span id="cb308-3"><a href="#cb308-3" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>q<span class="op">.</span>in<span class="op">(</span>deg_C<span class="op">)</span> <span class="op">!=</span> qp<span class="op">.</span>in<span class="op">(</span>deg_C<span class="op">).</span>quantity_from_zero<span class="op">())</span>;</span></code></pre></div>

</div></td>
</tr>
</tbody>
</table>
<p>We believe that the code enforced with new utilities makes it much
easier to understand what happens here.</p>
<p>With such changes to the interface design, the offending code will
not compile as initially written. Users will be forced to think more
about what they write. To enable the compilation, the users have to
create explicitly:</p>
<ul>
<li><p>a <code class="sourceCode cpp">quantity_point</code> (the
intended abstraction in this example) with any of the below
syntaxes:</p>
<div class="sourceCode" id="cb309"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb309-1"><a href="#cb309-1" aria-hidden="true" tabindex="-1"></a>quantity_point Temperature <span class="op">=</span> absolute<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="fl">28.0</span><span class="op">)</span>;</span>
<span id="cb309-2"><a href="#cb309-2" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> Temperature <span class="op">=</span> absolute<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="fl">28.0</span><span class="op">)</span>;</span>
<span id="cb309-3"><a href="#cb309-3" aria-hidden="true" tabindex="-1"></a>quantity_point Temperature<span class="op">(</span>delta<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="fl">28.0</span><span class="op">))</span>;</span></code></pre></div></li>
<li><p>a <code class="sourceCode cpp">quantity</code> (an incorrect
abstraction in this example) with:</p>
<div class="sourceCode" id="cb310"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb310-1"><a href="#cb310-1" aria-hidden="true" tabindex="-1"></a>quantity Temperature <span class="op">=</span> delta<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="fl">28.0</span><span class="op">)</span>;</span>
<span id="cb310-2"><a href="#cb310-2" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> Temperature <span class="op">=</span> delta<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="fl">28.0</span><span class="op">)</span>;</span></code></pre></div></li>
</ul>
<p>Thanks to the new design, we can immediately see what happens here
and why the result might be incorrect in the second case.</p>
<h3 data-number="18.13.2" id="default_point_originreference-quantity_from_zero-and-zeroth_point_originquantityspec"><span class="header-section-number">18.13.2</span> <code class="sourceCode cpp">default_point_origin<span class="op">&lt;</span>Reference<span class="op">&gt;</span></code>,
<code class="sourceCode cpp">quantity_from_zero<span class="op">()</span></code>,
and <code class="sourceCode cpp">zeroth_point_origin<span class="op">&lt;</span>QuantitySpec<span class="op">&gt;</span></code><a href="#default_point_originreference-quantity_from_zero-and-zeroth_point_originquantityspec" class="self-link"></a></h3>
<p><code class="sourceCode cpp">default_point_origin<span class="op">&lt;</span>Reference<span class="op">&gt;</span></code>,
<code class="sourceCode cpp">quantity_from_zero<span class="op">()</span></code>,
and <code class="sourceCode cpp">zeroth_point_origin<span class="op">&lt;</span>QuantitySpec<span class="op">&gt;</span></code>
are introduced to simplify the usage of:</p>
<ul>
<li>temperature (and quantities with similar units) points where each
unit has its own origin,</li>
<li>quantity points for domains with one unquestionable “zero” origin
and for which we do not have other predefined origins known at compile
time.</li>
</ul>
<p>In theory, those abstractions are not needed, and in this chapter, we
will describe how the API and use cases would look like without it.</p>
<p>Let’s try to reimplement parts of our room AC temperature controller
from the <a href="#temperature-support">Temperature support</a>
chapter:</p>
<div class="sourceCode" id="cb311"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb311-1"><a href="#cb311-1" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="kw">struct</span> room_reference_temp <span class="kw">final</span> <span class="op">:</span> relative_point_origin<span class="op">&lt;</span>si<span class="op">::</span>zeroth_degree_Celsius <span class="op">+</span> delta<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="dv">21</span><span class="op">)&gt;</span> <span class="op">{}</span> room_reference_temp;</span>
<span id="cb311-2"><a href="#cb311-2" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> room_temp <span class="op">=</span> quantity_point<span class="op">&lt;</span>isq<span class="op">::</span>Celsius_temperature<span class="op">[</span>deg_C<span class="op">]</span>, room_reference_temp<span class="op">&gt;</span>;</span>
<span id="cb311-3"><a href="#cb311-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb311-4"><a href="#cb311-4" aria-hidden="true" tabindex="-1"></a>room_temp room_ref<span class="op">{}</span>;</span>
<span id="cb311-5"><a href="#cb311-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb311-6"><a href="#cb311-6" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Room reference temperature: {} ({}, {::N[.2f]})</span><span class="sc">\n</span><span class="st">&quot;</span>,</span>
<span id="cb311-7"><a href="#cb311-7" aria-hidden="true" tabindex="-1"></a>             room_ref<span class="op">.</span>in<span class="op">(</span>deg_C<span class="op">).</span>quantity_from<span class="op">(</span>si<span class="op">::</span>zeroth_degree_Celsius<span class="op">)</span>,</span>
<span id="cb311-8"><a href="#cb311-8" aria-hidden="true" tabindex="-1"></a>             room_ref<span class="op">.</span>in<span class="op">(</span>deg_F<span class="op">).</span>quantity_from<span class="op">(</span>usc<span class="op">::</span>zeroth_degree_Fahrenheit<span class="op">)</span>,</span>
<span id="cb311-9"><a href="#cb311-9" aria-hidden="true" tabindex="-1"></a>             room_ref<span class="op">.</span>in<span class="op">(</span>K<span class="op">).</span>quantity_from<span class="op">(</span>si<span class="op">::</span>zeroth_kelvin<span class="op">))</span>;</span></code></pre></div>
<p>Now let’s compare it to the implementation using a currently proposed
design:</p>
<div class="sourceCode" id="cb312"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb312-1"><a href="#cb312-1" aria-hidden="true" tabindex="-1"></a><span class="kw">constexpr</span> <span class="kw">struct</span> room_reference_temp <span class="kw">final</span> <span class="op">:</span> relative_point_origin<span class="op">&lt;</span>absolute<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="dv">21</span><span class="op">)&gt;</span> <span class="op">{}</span> room_reference_temp;</span>
<span id="cb312-2"><a href="#cb312-2" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> room_temp <span class="op">=</span> quantity_point<span class="op">&lt;</span>isq<span class="op">::</span>Celsius_temperature<span class="op">[</span>deg_C<span class="op">]</span>, room_reference_temp<span class="op">&gt;</span>;</span>
<span id="cb312-3"><a href="#cb312-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb312-4"><a href="#cb312-4" aria-hidden="true" tabindex="-1"></a>room_temp room_ref<span class="op">{}</span>;</span>
<span id="cb312-5"><a href="#cb312-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb312-6"><a href="#cb312-6" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Room reference temperature: {} ({}, {::N[.2f]})</span><span class="sc">\n</span><span class="st">&quot;</span>,</span>
<span id="cb312-7"><a href="#cb312-7" aria-hidden="true" tabindex="-1"></a>             room_ref<span class="op">.</span>quantity_from_zero<span class="op">()</span>,</span>
<span id="cb312-8"><a href="#cb312-8" aria-hidden="true" tabindex="-1"></a>             room_ref<span class="op">.</span>in<span class="op">(</span>deg_F<span class="op">).</span>quantity_from_zero<span class="op">()</span>,</span>
<span id="cb312-9"><a href="#cb312-9" aria-hidden="true" tabindex="-1"></a>             room_ref<span class="op">.</span>in<span class="op">(</span>K<span class="op">).</span>quantity_from_zero<span class="op">())</span>;</span></code></pre></div>
<p>First, removing those features also renders <code class="sourceCode cpp">absolute<span class="op">&lt;</span>deg_C<span class="op">&gt;(</span><span class="dv">21</span><span class="op">)</span></code>
impossible to implement. Second, mandating an explicit point origin when
we convert to <code class="sourceCode cpp">quantity</code> makes the
code harder to maintain as we have to track a current unit of a quantity
carefully. If someone changes a unit, a point origin also has to be
changed to get meaningful results. This is why, to ensure that we are
origin-safe, we also need to provide <code class="sourceCode cpp"><span class="op">.</span>in<span class="op">(</span>deg_C<span class="op">).</span></code>
in the first print argument.</p>
<p>In the proposed design, the above problems are eliminated with the
<code class="sourceCode cpp">quantity_from_zero<span class="op">()</span></code>
usage that always returns a proper value for a current unit.</p>
<h2 data-number="18.14" id="interoperability-with-other-libraries"><span class="header-section-number">18.14</span> Interoperability with other
libraries<a href="#interoperability-with-other-libraries" class="self-link"></a></h2>
<p>It is easy to cooperate with similar entities of other libraries. No
matter if we want to provide interoperability with a simple home-grown
strongly typed wrapper type (e.g.,
<code class="sourceCode cpp">Meter</code>,
<code class="sourceCode cpp">Timestamp</code>, …) or with a feature-rich
quantities and units library, we have to provide specializations of:</p>
<ul>
<li>a <code class="sourceCode cpp">quantity_like_traits</code> for
external <code class="sourceCode cpp">quantity</code>-like type,</li>
<li>a <code class="sourceCode cpp">quantity_point_like_traits</code> for
external <code class="sourceCode cpp">quantity_point</code>-like
type.</li>
</ul>
<h3 data-number="18.14.1" id="specifying-a-conversion-kind"><span class="header-section-number">18.14.1</span> Specifying a conversion
kind<a href="#specifying-a-conversion-kind" class="self-link"></a></h3>
<p>Before we delve into the template specialization details, let’s first
decide if we want the conversions to happen implicitly or if explicit
ones would be a better choice. Or maybe the conversion should be
implicit in one direction only (e.g., into abstractions in this library)
while the explicit conversions in the other direction should be
preferred?</p>
<p>There is no one unified answer to the above questions. Everything
depends on the use case.</p>
<p>Typically, in the C++ language, the implicit conversions are allowed
in cases where:</p>
<ul>
<li>both abstractions mean exactly the same, and interchanging them in
the code should not change its logic,</li>
<li>there is no significant runtime overhead introduced by such a
conversion (e.g., no need for dynamic allocation or copying of huge
internal buffers),</li>
<li>the target type of the conversion provides the same or better safety
to the users,</li>
<li>we prefer the simplicity of implicit conversions over safety during
the (hopefully short) transition period of refactoring our code base
from the usage of one library to the other.</li>
</ul>
<p>In all other scenarios, we should probably enforce explicit
conversions.</p>
<p>The kinds of inter-library conversions can be easily configured in
partial specializations of conversion traits in the
<strong>mp-units</strong> library. Conversion traits should provide a
static data member convertible to
<code class="sourceCode cpp"><span class="dt">bool</span></code>. If the
value is
<code class="sourceCode cpp"><span class="kw">true</span></code>, then
the conversion is
<code class="sourceCode cpp"><span class="kw">explicit</span></code>.
Otherwise, if the value is
<code class="sourceCode cpp"><span class="kw">false</span></code>,
implicit conversions will be allowed. The names of the flags are as
follows:</p>
<ul>
<li><code class="sourceCode cpp">explicit_import</code> to describe
conversion from the external entity to the one in this library (import
case),</li>
<li><code class="sourceCode cpp">explicit_export</code> to describe
conversion from the entity in this library to the external one (export
case).</li>
</ul>
<h3 data-number="18.14.2" id="quantities-conversions"><span class="header-section-number">18.14.2</span> Quantities conversions<a href="#quantities-conversions" class="self-link"></a></h3>
<p>For example, let’s assume that some company has its own
<code class="sourceCode cpp">Meter</code> strong-type wrapper:</p>
<div class="sourceCode" id="cb313"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb313-1"><a href="#cb313-1" aria-hidden="true" tabindex="-1"></a><span class="kw">struct</span> Meter <span class="op">{</span></span>
<span id="cb313-2"><a href="#cb313-2" aria-hidden="true" tabindex="-1"></a>  <span class="dt">int</span> value;</span>
<span id="cb313-3"><a href="#cb313-3" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span></code></pre></div>
<p>As every usage of <code class="sourceCode cpp">Meter</code> is at
least as good and safe as the usage of <code class="sourceCode cpp">quantity<span class="op">&lt;</span>si<span class="op">::</span>metre, <span class="dt">int</span><span class="op">&gt;</span></code>,
and as there is no significant runtime performance penalty, we would
like to allow the conversion to <code class="sourceCode cpp">mp_units<span class="op">::</span>quantity</code>
to happen implicitly.</p>
<p>On the other hand, the <code class="sourceCode cpp">quantity</code>
type is much safer than the <code class="sourceCode cpp">Meter</code>,
and that is why we would prefer to see the opposite conversions stated
explicitly in our code.</p>
<p>To enable such interoperability, we must define a partial
specialization of the <code class="sourceCode cpp">quantity_like_traits<span class="op">&lt;</span>T<span class="op">&gt;</span></code>
type trait. Such specialization should provide:</p>
<ul>
<li><code class="sourceCode cpp">reference</code> static data member
that provides the quantity reference (e.g., unit),</li>
<li><code class="sourceCode cpp">rep</code> type that specifies the
underlying storage type,</li>
<li><code class="sourceCode cpp">explicit_import</code> static data
member convertible to
<code class="sourceCode cpp"><span class="dt">bool</span></code> that
specifies that the conversion from <code class="sourceCode cpp">T</code>
to a <code class="sourceCode cpp">quantity</code> type should happen
explicitly (if
<code class="sourceCode cpp"><span class="kw">true</span></code>),</li>
<li><code class="sourceCode cpp">explicit_export</code> static data
member convertible to
<code class="sourceCode cpp"><span class="dt">bool</span></code> that
specifies that the conversion from a
<code class="sourceCode cpp">quantity</code> type to
<code class="sourceCode cpp">T</code> should happen explicitly (if
<code class="sourceCode cpp"><span class="kw">true</span></code>),</li>
<li><code class="sourceCode cpp">to_numerical_value<span class="op">(</span>T<span class="op">)</span></code>
static member function returning a quantity’s raw value of
<code class="sourceCode cpp">rep</code> type,</li>
<li><code class="sourceCode cpp">from_numerical_value<span class="op">(</span>rep<span class="op">)</span></code>
static member function returning
<code class="sourceCode cpp">T</code>.</li>
</ul>
<p>For example, for our <code class="sourceCode cpp">Meter</code> type,
we could provide the following:</p>
<div class="sourceCode" id="cb314"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb314-1"><a href="#cb314-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;&gt;</span></span>
<span id="cb314-2"><a href="#cb314-2" aria-hidden="true" tabindex="-1"></a><span class="kw">struct</span> mp_units<span class="op">::</span>quantity_like_traits<span class="op">&lt;</span>Meter<span class="op">&gt;</span> <span class="op">{</span></span>
<span id="cb314-3"><a href="#cb314-3" aria-hidden="true" tabindex="-1"></a>  <span class="kw">static</span> <span class="kw">constexpr</span> <span class="kw">auto</span> reference <span class="op">=</span> si<span class="op">::</span>metre;</span>
<span id="cb314-4"><a href="#cb314-4" aria-hidden="true" tabindex="-1"></a>  <span class="kw">static</span> <span class="kw">constexpr</span> <span class="dt">bool</span> explicit_import <span class="op">=</span> <span class="kw">false</span>;</span>
<span id="cb314-5"><a href="#cb314-5" aria-hidden="true" tabindex="-1"></a>  <span class="kw">static</span> <span class="kw">constexpr</span> <span class="dt">bool</span> explicit_export <span class="op">=</span> <span class="kw">false</span>;</span>
<span id="cb314-6"><a href="#cb314-6" aria-hidden="true" tabindex="-1"></a>  <span class="kw">using</span> rep <span class="op">=</span> <span class="kw">decltype</span><span class="op">(</span>Meter<span class="op">::</span>value<span class="op">)</span>;</span>
<span id="cb314-7"><a href="#cb314-7" aria-hidden="true" tabindex="-1"></a>  <span class="kw">static</span> <span class="kw">constexpr</span> rep to_numerical_value<span class="op">(</span>Meter m<span class="op">)</span> <span class="op">{</span> <span class="cf">return</span> m<span class="op">.</span>value; <span class="op">}</span></span>
<span id="cb314-8"><a href="#cb314-8" aria-hidden="true" tabindex="-1"></a>  <span class="kw">static</span> <span class="kw">constexpr</span> Meter from_numerical_value<span class="op">(</span>rep v<span class="op">)</span> <span class="op">{</span> <span class="cf">return</span> Meter<span class="op">{</span>v<span class="op">}</span>; <span class="op">}</span></span>
<span id="cb314-9"><a href="#cb314-9" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span></code></pre></div>
<p>After that, we can check that the <a href="#QuantityLike-concept"><code class="sourceCode cpp">QuantityLike</code></a>
concept is satisfied:</p>
<div class="sourceCode" id="cb315"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb315-1"><a href="#cb315-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>QuantityLike<span class="op">&lt;</span>Meter<span class="op">&gt;)</span>;</span></code></pre></div>
<p>and we can write the following:</p>
<div class="sourceCode" id="cb316"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb316-1"><a href="#cb316-1" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> print<span class="op">(</span>Meter m<span class="op">)</span> <span class="op">{</span> std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> m<span class="op">.</span>value <span class="op">&lt;&lt;</span> <span class="st">&quot; m</span><span class="sc">\n</span><span class="st">&quot;</span>; <span class="op">}</span></span>
<span id="cb316-2"><a href="#cb316-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb316-3"><a href="#cb316-3" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> main<span class="op">()</span></span>
<span id="cb316-4"><a href="#cb316-4" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb316-5"><a href="#cb316-5" aria-hidden="true" tabindex="-1"></a>  <span class="kw">using</span> <span class="kw">namespace</span> std<span class="op">::</span>si<span class="op">::</span>unit_symbols;</span>
<span id="cb316-6"><a href="#cb316-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb316-7"><a href="#cb316-7" aria-hidden="true" tabindex="-1"></a>  Meter height<span class="op">{</span><span class="dv">42</span><span class="op">}</span>;</span>
<span id="cb316-8"><a href="#cb316-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb316-9"><a href="#cb316-9" aria-hidden="true" tabindex="-1"></a>  <span class="co">// implicit conversions</span></span>
<span id="cb316-10"><a href="#cb316-10" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>quantity h1 <span class="op">=</span> height;</span>
<span id="cb316-11"><a href="#cb316-11" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>quantity<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>m<span class="op">]</span>, <span class="dt">int</span><span class="op">&gt;</span> h2 <span class="op">=</span> height;</span>
<span id="cb316-12"><a href="#cb316-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb316-13"><a href="#cb316-13" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> h1 <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb316-14"><a href="#cb316-14" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> h2 <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb316-15"><a href="#cb316-15" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb316-16"><a href="#cb316-16" aria-hidden="true" tabindex="-1"></a>  <span class="co">// explicit conversions</span></span>
<span id="cb316-17"><a href="#cb316-17" aria-hidden="true" tabindex="-1"></a>  print<span class="op">(</span>Meter<span class="op">(</span>h1<span class="op">))</span>;</span>
<span id="cb316-18"><a href="#cb316-18" aria-hidden="true" tabindex="-1"></a>  print<span class="op">(</span>Meter<span class="op">(</span>h2<span class="op">))</span>;</span>
<span id="cb316-19"><a href="#cb316-19" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>No matter if we decide to use implicit or explicit conversions, the
library’s framework will not allow unsafe operations to happen.</p>
<p>If we extend the above example with unsafe conversions, the code will
not compile, and we will have to fix the issues first before the
conversion may be performed:</p>
<table>
<thead>
<tr class="header">
<th><div style="text-align:center">
<strong>Unsafe</strong>
</div></th>
<th><div style="text-align:center">
<strong>Fixed</strong>
</div></th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><div>

<div class="sourceCode" id="cb317"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb317-1"><a href="#cb317-1" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>m<span class="op">]&gt;</span> h3 <span class="op">=</span> height;</span>
<span id="cb317-2"><a href="#cb317-2" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>mm<span class="op">]</span>, <span class="dt">int</span><span class="op">&gt;</span> h4 <span class="op">=</span> height;</span>
<span id="cb317-3"><a href="#cb317-3" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>km<span class="op">]</span>, <span class="dt">int</span><span class="op">&gt;</span> h5 <span class="op">=</span> height;  <span class="co">// Error (1)</span></span>
<span id="cb317-4"><a href="#cb317-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb317-5"><a href="#cb317-5" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> h3 <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb317-6"><a href="#cb317-6" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> h4 <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb317-7"><a href="#cb317-7" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> h5 <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb317-8"><a href="#cb317-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb317-9"><a href="#cb317-9" aria-hidden="true" tabindex="-1"></a>print<span class="op">(</span>Meter<span class="op">(</span>h3<span class="op">))</span>;                            <span class="co">// Error (2)</span></span>
<span id="cb317-10"><a href="#cb317-10" aria-hidden="true" tabindex="-1"></a>print<span class="op">(</span>Meter<span class="op">(</span>h4<span class="op">))</span>;                            <span class="co">// Error (3)</span></span>
<span id="cb317-11"><a href="#cb317-11" aria-hidden="true" tabindex="-1"></a>print<span class="op">(</span>Meter<span class="op">(</span>h5<span class="op">))</span>;</span></code></pre></div>

</div></td>
<td><div>

<div class="sourceCode" id="cb318"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb318-1"><a href="#cb318-1" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>m<span class="op">]&gt;</span> h3 <span class="op">=</span> height;</span>
<span id="cb318-2"><a href="#cb318-2" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>mm<span class="op">]</span>, <span class="dt">int</span><span class="op">&gt;</span> h4 <span class="op">=</span> height;</span>
<span id="cb318-3"><a href="#cb318-3" aria-hidden="true" tabindex="-1"></a>quantity<span class="op">&lt;</span>isq<span class="op">::</span>height<span class="op">[</span>km<span class="op">]</span>, <span class="dt">int</span><span class="op">&gt;</span> h5 <span class="op">=</span> quantity<span class="op">{</span>height<span class="op">}.</span>force_in<span class="op">(</span>km<span class="op">)</span>;</span>
<span id="cb318-4"><a href="#cb318-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb318-5"><a href="#cb318-5" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> h3 <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb318-6"><a href="#cb318-6" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> h4 <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb318-7"><a href="#cb318-7" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> h5 <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb318-8"><a href="#cb318-8" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb318-9"><a href="#cb318-9" aria-hidden="true" tabindex="-1"></a>print<span class="op">(</span>Meter<span class="op">(</span>value_cast<span class="op">&lt;</span><span class="dt">int</span><span class="op">&gt;(</span>h3<span class="op">)))</span>;</span>
<span id="cb318-10"><a href="#cb318-10" aria-hidden="true" tabindex="-1"></a>print<span class="op">(</span>Meter<span class="op">(</span>h4<span class="op">.</span>force_in<span class="op">(</span>m<span class="op">)))</span>;</span>
<span id="cb318-11"><a href="#cb318-11" aria-hidden="true" tabindex="-1"></a>print<span class="op">(</span>Meter<span class="op">(</span>h5<span class="op">))</span>;</span></code></pre></div>

</div></td>
</tr>
</tbody>
</table>
<p><code class="sourceCode cpp"><span class="op">(</span><span class="dv">1</span><span class="op">)</span></code>
Truncation of value while converting from meters to kilometers.</p>
<p><code class="sourceCode cpp"><span class="op">(</span><span class="dv">2</span><span class="op">)</span></code>
Conversion of
<code class="sourceCode cpp"><span class="dt">double</span></code> to
<code class="sourceCode cpp"><span class="dt">int</span></code> is not
value-preserving.</p>
<p><code class="sourceCode cpp"><span class="op">(</span><span class="dv">3</span><span class="op">)</span></code>
Truncation of value while converting from millimeters to meters.</p>
<h3 data-number="18.14.3" id="quantity-points-conversions"><span class="header-section-number">18.14.3</span> Quantity points
conversions<a href="#quantity-points-conversions" class="self-link"></a></h3>
<p>To play with quantity point conversions, let’s assume that we have a
<code class="sourceCode cpp">Timestamp</code> strong type in our
codebase, and we would like to start using this library to work with
this abstraction.</p>
<div class="sourceCode" id="cb319"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb319-1"><a href="#cb319-1" aria-hidden="true" tabindex="-1"></a><span class="kw">struct</span> Timestamp <span class="op">{</span></span>
<span id="cb319-2"><a href="#cb319-2" aria-hidden="true" tabindex="-1"></a>  <span class="dt">int</span> seconds;</span>
<span id="cb319-3"><a href="#cb319-3" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span></code></pre></div>
<p>As we described in <a href="#the-affine-space">The Affine Space</a>
chapter, timestamps should be modeled as quantity points rather than
regular quantities.</p>
<p>To allow the conversion between our custom
<code class="sourceCode cpp">Timestamp</code> type and the
<code class="sourceCode cpp">quantity_point</code> class template we
need to provide the following in the partial specialization of the <code class="sourceCode cpp">quantity_point_like_traits<span class="op">&lt;</span>T<span class="op">&gt;</span></code>
type trait:</p>
<ul>
<li><code class="sourceCode cpp">reference</code> static data member
that provides the quantity point reference (e.g., unit),</li>
<li><code class="sourceCode cpp">point_origin</code> static data member
that specifies the absolute point, which is the beginning of our
measurement scale for our points,</li>
<li><code class="sourceCode cpp">rep</code> type that specifies the
underlying storage type,</li>
<li><code class="sourceCode cpp">explicit_import</code> static data
member convertible to
<code class="sourceCode cpp"><span class="dt">bool</span></code> that
specifies that the conversion from <code class="sourceCode cpp">T</code>
to a <code class="sourceCode cpp">quantity</code> type should happen
explicitly (if
<code class="sourceCode cpp"><span class="kw">true</span></code>),</li>
<li><code class="sourceCode cpp">explicit_export</code> static data
member convertible to
<code class="sourceCode cpp"><span class="dt">bool</span></code> that
specifies that the conversion from a
<code class="sourceCode cpp">quantity</code> type to
<code class="sourceCode cpp">T</code> should happen explicitly (if
<code class="sourceCode cpp"><span class="kw">true</span></code>),</li>
<li><code class="sourceCode cpp">to_numerical_value<span class="op">(</span>T<span class="op">)</span></code>
static member function returning a raw value of the
<code class="sourceCode cpp">quantity</code> being the offset of the
point from the origin,</li>
<li><code class="sourceCode cpp">from_numerical_value<span class="op">(</span>rep<span class="op">)</span></code>
static member function returning
<code class="sourceCode cpp">T</code>.</li>
</ul>
<p>For example, for our <code class="sourceCode cpp">Timestamp</code>
type, we could provide the following:</p>
<div class="sourceCode" id="cb320"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb320-1"><a href="#cb320-1" aria-hidden="true" tabindex="-1"></a><span class="kw">template</span><span class="op">&lt;&gt;</span></span>
<span id="cb320-2"><a href="#cb320-2" aria-hidden="true" tabindex="-1"></a><span class="kw">struct</span> mp_units<span class="op">::</span>quantity_point_like_traits<span class="op">&lt;</span>Timestamp<span class="op">&gt;</span> <span class="op">{</span></span>
<span id="cb320-3"><a href="#cb320-3" aria-hidden="true" tabindex="-1"></a>  <span class="kw">static</span> <span class="kw">constexpr</span> <span class="kw">auto</span> reference <span class="op">=</span> si<span class="op">::</span>second;</span>
<span id="cb320-4"><a href="#cb320-4" aria-hidden="true" tabindex="-1"></a>  <span class="kw">static</span> <span class="kw">constexpr</span> <span class="kw">auto</span> point_origin <span class="op">=</span> default_point_origin<span class="op">(</span>reference<span class="op">)</span>;</span>
<span id="cb320-5"><a href="#cb320-5" aria-hidden="true" tabindex="-1"></a>  <span class="kw">static</span> <span class="kw">constexpr</span> <span class="dt">bool</span> explicit_import <span class="op">=</span> <span class="kw">false</span>;</span>
<span id="cb320-6"><a href="#cb320-6" aria-hidden="true" tabindex="-1"></a>  <span class="kw">static</span> <span class="kw">constexpr</span> <span class="dt">bool</span> explicit_export <span class="op">=</span> <span class="kw">false</span>;</span>
<span id="cb320-7"><a href="#cb320-7" aria-hidden="true" tabindex="-1"></a>  <span class="kw">using</span> rep <span class="op">=</span> <span class="kw">decltype</span><span class="op">(</span>Timestamp<span class="op">::</span>seconds<span class="op">)</span>;</span>
<span id="cb320-8"><a href="#cb320-8" aria-hidden="true" tabindex="-1"></a>  <span class="kw">static</span> <span class="kw">constexpr</span> rep to_numerical_value<span class="op">(</span>Timestamp ts<span class="op">)</span> <span class="op">{</span> <span class="cf">return</span> ts<span class="op">.</span>seconds; <span class="op">}</span></span>
<span id="cb320-9"><a href="#cb320-9" aria-hidden="true" tabindex="-1"></a>  <span class="kw">static</span> <span class="kw">constexpr</span> Timestamp from_numerical_value<span class="op">(</span>rep v<span class="op">)</span> <span class="op">{</span> <span class="cf">return</span> Timestamp<span class="op">(</span>v<span class="op">)</span>; <span class="op">}</span></span>
<span id="cb320-10"><a href="#cb320-10" aria-hidden="true" tabindex="-1"></a><span class="op">}</span>;</span></code></pre></div>
<p>After that, we can check that the <a href="#QuantityPointLike-concept"><code class="sourceCode cpp">QuantityPointLike</code></a>
concept is satisfied:</p>
<div class="sourceCode" id="cb321"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb321-1"><a href="#cb321-1" aria-hidden="true" tabindex="-1"></a><span class="kw">static_assert</span><span class="op">(</span>mp_units<span class="op">::</span>QuantityPointLike<span class="op">&lt;</span>Timestamp<span class="op">&gt;)</span>;</span></code></pre></div>
<p>and we can write the following:</p>
<div class="sourceCode" id="cb322"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb322-1"><a href="#cb322-1" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> print<span class="op">(</span>Timestamp ts<span class="op">)</span> <span class="op">{</span> std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> ts<span class="op">.</span>seconds <span class="op">&lt;&lt;</span> <span class="st">&quot; s</span><span class="sc">\n</span><span class="st">&quot;</span>; <span class="op">}</span></span>
<span id="cb322-2"><a href="#cb322-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb322-3"><a href="#cb322-3" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> main<span class="op">()</span></span>
<span id="cb322-4"><a href="#cb322-4" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb322-5"><a href="#cb322-5" aria-hidden="true" tabindex="-1"></a>  <span class="kw">using</span> <span class="kw">namespace</span> mp_units;</span>
<span id="cb322-6"><a href="#cb322-6" aria-hidden="true" tabindex="-1"></a>  <span class="kw">using</span> <span class="kw">namespace</span> mp_units<span class="op">::</span>si<span class="op">::</span>unit_symbols;</span>
<span id="cb322-7"><a href="#cb322-7" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb322-8"><a href="#cb322-8" aria-hidden="true" tabindex="-1"></a>  Timestamp ts<span class="op">{</span><span class="dv">42</span><span class="op">}</span>;</span>
<span id="cb322-9"><a href="#cb322-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb322-10"><a href="#cb322-10" aria-hidden="true" tabindex="-1"></a>  <span class="co">// implicit conversion</span></span>
<span id="cb322-11"><a href="#cb322-11" aria-hidden="true" tabindex="-1"></a>  quantity_point qp <span class="op">=</span> ts;</span>
<span id="cb322-12"><a href="#cb322-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb322-13"><a href="#cb322-13" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> qp<span class="op">.</span>quantity_from_zero<span class="op">()</span> <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb322-14"><a href="#cb322-14" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb322-15"><a href="#cb322-15" aria-hidden="true" tabindex="-1"></a>  <span class="co">// explicit conversion</span></span>
<span id="cb322-16"><a href="#cb322-16" aria-hidden="true" tabindex="-1"></a>  print<span class="op">(</span>Timestamp<span class="op">(</span>qp<span class="op">))</span>;</span>
<span id="cb322-17"><a href="#cb322-17" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<h3 data-number="18.14.4" id="interoperability-with-the-stdchrono-abstractions"><span class="header-section-number">18.14.4</span> Interoperability with the
<code class="sourceCode cpp">std<span class="op">::</span>chrono</code>
abstractions<a href="#interoperability-with-the-stdchrono-abstractions" class="self-link"></a></h3>
<p>In the C++ standard library, we have two types that handle quantities
and model the affine space. Those are:</p>
<ul>
<li><a href="https://en.cppreference.com/w/cpp/chrono/duration"><code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>duration</code></a>
- specifies quantities of time,</li>
<li><a href="https://en.cppreference.com/w/cpp/chrono/time_point"><code class="sourceCode cpp">std<span class="op">::</span>chrono<span class="op">::</span>time_point</code></a>
- specifies quantity points of time.</li>
</ul>
<p>This library comes with built-in interoperability with those types
thanks to:</p>
<ul>
<li>partial specializations of
<code class="sourceCode cpp">quantity_like_traits</code> and
<code class="sourceCode cpp">quantity_point_like_traits</code> that
provide support for implicit conversions between types in both
directions,</li>
<li><code class="sourceCode cpp">chrono_point_origin<span class="op">&lt;</span>Clock<span class="op">&gt;</span></code>
point origin for <code class="sourceCode cpp">std</code> clocks,</li>
<li><code class="sourceCode cpp">to_chrono_duration</code> and
<code class="sourceCode cpp">to_chrono_time_point</code> dedicated
conversion functions that result in types exactly representing this
library’s abstractions.</li>
</ul>
<p>It is important to note here that only a
<code class="sourceCode cpp">quantity_point</code> that uses <code class="sourceCode cpp">chrono_point_origin<span class="op">&lt;</span>Clock<span class="op">&gt;</span></code>
as its origin can be converted to the
<code class="sourceCode cpp">std<span class="op">::</span>chrono</code>
abstractions:</p>
<div class="sourceCode" id="cb323"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb323-1"><a href="#cb323-1" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> ts_origin <span class="kw">final</span> <span class="op">:</span> relative_point_origin<span class="op">&lt;</span>chrono_point_origin<span class="op">&lt;</span>system_clock<span class="op">&gt;</span> <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> h<span class="op">&gt;</span> <span class="op">{}</span> ts_origin;</span>
<span id="cb323-2"><a href="#cb323-2" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> my_origin <span class="kw">final</span> <span class="op">:</span> absolute_point_origin<span class="op">&lt;</span>isq<span class="op">::</span>time<span class="op">&gt;</span> <span class="op">{}</span> my_origin;</span>
<span id="cb323-3"><a href="#cb323-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb323-4"><a href="#cb323-4" aria-hidden="true" tabindex="-1"></a>quantity_point qp1 <span class="op">=</span> sys_seconds<span class="op">{</span><span class="dv">1</span><span class="bu">s</span><span class="op">}</span>;</span>
<span id="cb323-5"><a href="#cb323-5" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> tp1 <span class="op">=</span> to_chrono_time_point<span class="op">(</span>qp1<span class="op">)</span>;  <span class="co">// OK</span></span>
<span id="cb323-6"><a href="#cb323-6" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb323-7"><a href="#cb323-7" aria-hidden="true" tabindex="-1"></a>quantity_point qp2 <span class="op">=</span> chrono_point_origin<span class="op">&lt;</span>system_clock<span class="op">&gt;</span> <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> s;</span>
<span id="cb323-8"><a href="#cb323-8" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> tp2 <span class="op">=</span> to_chrono_time_point<span class="op">(</span>qp2<span class="op">)</span>;  <span class="co">// OK</span></span>
<span id="cb323-9"><a href="#cb323-9" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb323-10"><a href="#cb323-10" aria-hidden="true" tabindex="-1"></a>quantity_point qp3 <span class="op">=</span> ts_origin <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> s;</span>
<span id="cb323-11"><a href="#cb323-11" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> tp3 <span class="op">=</span> to_chrono_time_point<span class="op">(</span>qp3<span class="op">)</span>;  <span class="co">// OK</span></span>
<span id="cb323-12"><a href="#cb323-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb323-13"><a href="#cb323-13" aria-hidden="true" tabindex="-1"></a>quantity_point qp4 <span class="op">=</span> my_origin <span class="op">+</span> <span class="dv">1</span> <span class="op">*</span> s;</span>
<span id="cb323-14"><a href="#cb323-14" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> tp4 <span class="op">=</span> to_chrono_time_point<span class="op">(</span>qp4<span class="op">)</span>;  <span class="co">// Compile-time Error (1)</span></span>
<span id="cb323-15"><a href="#cb323-15" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb323-16"><a href="#cb323-16" aria-hidden="true" tabindex="-1"></a>quantity_point qp5<span class="op">{</span><span class="dv">1</span> <span class="op">*</span> s<span class="op">}</span>;</span>
<span id="cb323-17"><a href="#cb323-17" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> tp5 <span class="op">=</span> to_chrono_time_point<span class="op">(</span>qp5<span class="op">)</span>;  <span class="co">// Compile-time Error (2)</span></span></code></pre></div>
<p><code class="sourceCode cpp"><span class="op">(</span><span class="dv">1</span><span class="op">)</span></code>
<code class="sourceCode cpp">my_origin</code> is not defined in terms of
<code class="sourceCode cpp">chrono_point_origin<span class="op">&lt;</span>Clock<span class="op">&gt;</span></code>.</p>
<p><code class="sourceCode cpp"><span class="op">(</span><span class="dv">2</span><span class="op">)</span></code>
<code class="sourceCode cpp">zeroth_point_origin</code> is not defined
in terms of <code class="sourceCode cpp">chrono_point_origin<span class="op">&lt;</span>Clock<span class="op">&gt;</span></code>.</p>
<p>Here is an example of how interoperability described in this chapter
can be used in practice:</p>
<div class="sourceCode" id="cb324"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb324-1"><a href="#cb324-1" aria-hidden="true" tabindex="-1"></a><span class="kw">using</span> <span class="kw">namespace</span> std<span class="op">::</span>chrono;</span>
<span id="cb324-2"><a href="#cb324-2" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb324-3"><a href="#cb324-3" aria-hidden="true" tabindex="-1"></a>sys_seconds ts_now <span class="op">=</span> floor<span class="op">&lt;</span>seconds<span class="op">&gt;(</span>system_clock<span class="op">::</span>now<span class="op">())</span>;</span>
<span id="cb324-4"><a href="#cb324-4" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb324-5"><a href="#cb324-5" aria-hidden="true" tabindex="-1"></a>quantity_point start_time <span class="op">=</span> ts_now;</span>
<span id="cb324-6"><a href="#cb324-6" aria-hidden="true" tabindex="-1"></a>quantity speed <span class="op">=</span> <span class="fl">925.</span> <span class="op">*</span> km <span class="op">/</span> h;</span>
<span id="cb324-7"><a href="#cb324-7" aria-hidden="true" tabindex="-1"></a>quantity distance <span class="op">=</span> <span class="fl">8111.</span> <span class="op">*</span> km;</span>
<span id="cb324-8"><a href="#cb324-8" aria-hidden="true" tabindex="-1"></a>quantity flight_time <span class="op">=</span> distance <span class="op">/</span> speed;</span>
<span id="cb324-9"><a href="#cb324-9" aria-hidden="true" tabindex="-1"></a>quantity_point exp_end_time <span class="op">=</span> start_time <span class="op">+</span> flight_time;</span>
<span id="cb324-10"><a href="#cb324-10" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb324-11"><a href="#cb324-11" aria-hidden="true" tabindex="-1"></a>sys_seconds ts_end <span class="op">=</span> value_cast<span class="op">&lt;</span><span class="dt">int</span><span class="op">&gt;(</span>exp_end_time<span class="op">.</span>in<span class="op">(</span>s<span class="op">))</span>;</span>
<span id="cb324-12"><a href="#cb324-12" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb324-13"><a href="#cb324-13" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> curr_time <span class="op">=</span> zoned_time<span class="op">(</span>current_zone<span class="op">()</span>, ts_now<span class="op">)</span>;</span>
<span id="cb324-14"><a href="#cb324-14" aria-hidden="true" tabindex="-1"></a><span class="kw">auto</span> mst_time <span class="op">=</span> zoned_time<span class="op">(</span><span class="st">&quot;America/Denver&quot;</span>, ts_end<span class="op">)</span>;</span>
<span id="cb324-15"><a href="#cb324-15" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb324-16"><a href="#cb324-16" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="st">&quot;Takeoff: &quot;</span> <span class="op">&lt;&lt;</span> curr_time <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span>
<span id="cb324-17"><a href="#cb324-17" aria-hidden="true" tabindex="-1"></a>std<span class="op">::</span>cout <span class="op">&lt;&lt;</span> <span class="st">&quot;Landing: &quot;</span> <span class="op">&lt;&lt;</span> mst_time <span class="op">&lt;&lt;</span> <span class="st">&quot;</span><span class="sc">\n</span><span class="st">&quot;</span>;</span></code></pre></div>
<p>The above may print the following output:</p>
<div class="sourceCode" id="cb325"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb325-1"><a href="#cb325-1" aria-hidden="true" tabindex="-1"></a>Takeoff<span class="op">:</span> <span class="dv">2023</span><span class="op">-</span><span class="dv">11</span><span class="op">-</span><span class="dv">18</span> <span class="dv">13</span><span class="op">:</span><span class="dv">20</span><span class="op">:</span><span class="dv">54</span> UTC</span>
<span id="cb325-2"><a href="#cb325-2" aria-hidden="true" tabindex="-1"></a>Landing<span class="op">:</span> <span class="dv">2023</span><span class="op">-</span><span class="dv">11</span><span class="op">-</span><span class="dv">18</span> <span class="dv">15</span><span class="op">:</span><span class="bn">07</span><span class="op">:</span><span class="bn">01</span> MST</span></code></pre></div>
<p>As mentioned above, conversions between entities in this and
<code class="sourceCode cpp">std<span class="op">::</span>chrono</code>
libraries are implicit in both directions. This simplifies many
scenarios. However, with such rules, <code class="sourceCode cpp">common_type_t<span class="op">&lt;</span>chrono<span class="op">::</span>seconds, quantity<span class="op">&lt;</span>si<span class="op">::</span>second, <span class="dt">int</span><span class="op">&gt;&gt;</span>;</code>
and the ternary operator on such arguments will not work. If this
concerns LEWG, we may consider implicit conversion in only one
direction. However, it is not easy to decide which one to choose.</p>
<h1 data-number="19" id="teachability"><span class="header-section-number">19</span> Teachability<a href="#teachability" class="self-link"></a></h1>
<p>Through the last years <span class="citation" data-cites="MP-UNITS">[<a href="https://mpusz.github.io/mp-units" role="doc-biblioref">mp-units</a>]</span> library proved to be very
intuitive to both novices in the domain and non-C++ experts. Thanks to
the user-friendly multiply syntax, support for CTAD, excellent
readability of generated types in compiler error messages, and
simplicity of systems definitions, this library makes it easy to do the
first steps in the dimensional analysis domain.</p>
<p>If someone is new to the domain, a concise introduction of <a href="#systems-of-units">Systems of units</a>, the <span class="citation" data-cites="SI">[<a href="https://www.bipm.org/en/publications/si-brochure" role="doc-biblioref">SI</a>]</span>, and the US Customary System (and
how it relates to SI) might be needed.</p>
<p>After that, every new user, even a C++ newbie, should have no
problems with understanding the topics of the <a href="#unit-based-quantities-simple-mode">Unit-based quantities (simple
mode)</a> chapter and should be able to start using the library
successfully. At least as long as they keep operating in the safety zone
using floating-point representation types.</p>
<p>Eventually, the library will stand in the way, disallowing “unsafe”
conversions. This would be a perfect place to mention the importance of
providing safe interfaces at compile-time and describe why narrowing
conversions are unwelcome and what the side effects of those might be.
After that, forced conversions in the library should be presented.</p>
<p>In case a target audience needs to interact with legacy interfaces
that take raw numeric values, <a href="#obtaining-a-numerical-value-of-a-quantity">Obtaining a numerical
value of a quantity</a> chapter should be introduced. In such a case, it
is important to warn students of why this operation is unsafe and what
are the potential maintainability issues.</p>
<p>Next, we could show how easy extending the library with custom units
is. A simple and funny example like the below could be a great exercise
here:</p>
<div class="sourceCode" id="cb326"><pre class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb326-1"><a href="#cb326-1" aria-hidden="true" tabindex="-1"></a><span class="kw">import</span> mp_units;</span>
<span id="cb326-2"><a href="#cb326-2" aria-hidden="true" tabindex="-1"></a><span class="kw">import</span> std;</span>
<span id="cb326-3"><a href="#cb326-3" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb326-4"><a href="#cb326-4" aria-hidden="true" tabindex="-1"></a><span class="kw">inline</span> <span class="kw">constexpr</span> <span class="kw">struct</span> smoot <span class="kw">final</span> <span class="op">:</span> std<span class="op">::</span>named_unit<span class="op">&lt;</span><span class="st">&quot;smoot&quot;</span>, std<span class="op">::</span>mag<span class="op">&lt;</span><span class="dv">67</span><span class="op">&gt;</span> <span class="op">*</span> std<span class="op">::</span>usc<span class="op">::</span>inch<span class="op">&gt;</span> <span class="op">{}</span> smoot;</span>
<span id="cb326-5"><a href="#cb326-5" aria-hidden="true" tabindex="-1"></a></span>
<span id="cb326-6"><a href="#cb326-6" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> main<span class="op">()</span></span>
<span id="cb326-7"><a href="#cb326-7" aria-hidden="true" tabindex="-1"></a><span class="op">{</span></span>
<span id="cb326-8"><a href="#cb326-8" aria-hidden="true" tabindex="-1"></a>  <span class="kw">constexpr</span> std<span class="op">::</span>quantity dist <span class="op">=</span> <span class="fl">364.4</span> <span class="op">*</span> smoot;</span>
<span id="cb326-9"><a href="#cb326-9" aria-hidden="true" tabindex="-1"></a>  std<span class="op">::</span>println<span class="op">(</span><span class="st">&quot;Harvard Bridge length = {::N[.5]} ({::N[.5]}, {::N[.5]}) ± 1 εar&quot;</span>,</span>
<span id="cb326-10"><a href="#cb326-10" aria-hidden="true" tabindex="-1"></a>               dist, dist<span class="op">.</span>in<span class="op">(</span>usc<span class="op">::</span>foot<span class="op">)</span>, dist<span class="op">.</span>in<span class="op">(</span>si<span class="op">::</span>metre<span class="op">))</span>;</span>
<span id="cb326-11"><a href="#cb326-11" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div>
<p>After a while, we can also introduce students to <a href="#the-affine-space">The affine space</a> abstractions and discuss
the <a href="#temperature-support">Temperature support</a>.</p>
<p>With the above, we have learned enough for most users’ needs and do
not need to delve into more details. The library is intuitive and will
prevent all errors at compile time.</p>
<p>For more advanced classes, groups, or use cases, we can introduce <a href="#generic-interfaces">Generic Interfaces</a> and <a href="#systems-of-quantities">Systems of quantities</a> but we don’t
have to describe every detail and corner cases of quantity types design
and their convertibility. It is good to start here with <a href="#why-do-we-need-typed-quantities">Why do we need typed
quantities?</a>, followed by <a href="#quantities-of-the-same-kind">Quantities of the same kind</a> and
<a href="#system-of-quantities-is-not-only-about-kinds">System of
quantities is not only about kinds</a>.</p>
<p>According to our experience, the most common pitfall in using
quantity types might be related to the names chosen for them by the
<span class="citation" data-cites="ISO80000">[<a href="https://www.iso.org/standard/76921.html" role="doc-biblioref">ISO/IEC 80000</a>]</span> (e.g., <em>length</em>).
It might be good to describe what <em>length</em> means when we say
“every <em>height</em> is a <em>length</em>” and what it means when we
describe a box of <em>length</em>, <em>width</em>, and <em>height</em>
dimensions. In the latter case, <em>length</em> will not restrict us to
the horizontal dimension only. This is how the ISQ is defined, and we
should accept this. However, we should present a way to define
<em>horizontal length</em> as presented in the <a href="#comparing-adding-and-subtracting-quantities-of-the-same-kind">Comparing,
adding, and subtracting quantities of the same kind</a> and describe its
rationale.</p>
<h1 data-number="20" id="acknowledgements"><span class="header-section-number">20</span> Acknowledgements<a href="#acknowledgements" class="self-link"></a></h1>
<p>Special thanks and recognition goes to <a href="http://www.epam.com">Epam Systems</a> for supporting Mateusz’s
membership in the ISO C++ Committee and the production of this
proposal.</p>
<p>We would also like to thank Peter Sommerlad for providing valuable
feedback that helped us shape the final version of this document, and
Michael Hordijk for discovering typos and improving the flow of some
confusing passages.</p>
<!-- markdownlint-disable -->
<h1 data-number="21" id="bibliography"><span class="header-section-number">21</span> References<a href="#bibliography" class="self-link"></a></h1>
<div id="refs" class="references csl-bib-body hanging-indent" data-entry-spacing="1" role="doc-bibliography">
<div id="ref-ARIANE" class="csl-entry" role="doc-biblioentry">
[Ariane flight V88] Ariane flight V88. <a href="https://en.wikipedia.org/wiki/Ariane_flight_V88"><div class="csl-block">https://en.wikipedia.org/wiki/Ariane_flight_V88</div></a>
</div>
<div id="ref-AU" class="csl-entry" role="doc-biblioentry">
[Au] The Au Units library. <a href="https://aurora-opensource.github.io/au"><div class="csl-block">https://aurora-opensource.github.io/au</div></a>
</div>
<div id="ref-BOOST-UNITS" class="csl-entry" role="doc-biblioentry">
[Boost.Units] Matthias C. Schabel and Steven Watanabe. Boost.Units. <a href="https://www.boost.org/doc/libs/1_83_0/doc/html/boost_units.html"><div class="csl-block">https://www.boost.org/doc/libs/1_83_0/doc/html/boost_units.html</div></a>
</div>
<div id="ref-CHEP98" class="csl-entry" role="doc-biblioentry">
[CHEP’98] Walter E. Brown. Introduction to the SI Library of Unit-Based
Computation. <a href="https://digital.library.unt.edu/ark:/67531/metadc668099"><div class="csl-block">https://digital.library.unt.edu/ark:/67531/metadc668099</div></a>
</div>
<div id="ref-CLARENCE" class="csl-entry" role="doc-biblioentry">
[Clarence] Steve Chawkins. Mismeasure for Measure. <a href="https://www.latimes.com/archives/la-xpm-2001-feb-09-me-23253-story.html"><div class="csl-block">https://www.latimes.com/archives/la-xpm-2001-feb-09-me-23253-story.html</div></a>
</div>
<div id="ref-COLUMBUS" class="csl-entry" role="doc-biblioentry">
[Columbus] Christopher Columbus. <a href="https://en.wikipedia.org/wiki/Christopher_Columbus"><div class="csl-block">https://en.wikipedia.org/wiki/Christopher_Columbus</div></a>
</div>
<div id="ref-DISNEY" class="csl-entry" role="doc-biblioentry">
[Disney] Cause of the Space Mountain Incident Determined at Tokyo
Disneyland Park. <a href="https://web.archive.org/web/20040209033827/http://www.olc.co.jp/news/20040121_01en.html"><div class="csl-block">https://web.archive.org/web/20040209033827/http://www.olc.co.jp/news/20040121_01en.html</div></a>
</div>
<div id="ref-FLIGHT_6316" class="csl-entry" role="doc-biblioentry">
[Flight 6316] Korean Air Flight 6316 MD-11, Shanghai, China - April 15,
1999. <a href="https://web.archive.org/web/20210917190721/https://www.ntsb.gov/news/press-releases/Pages/Korean_Air_Flight_6316_MD-11_Shanghai_China_-_April_15_1999.aspx"><div class="csl-block">https://web.archive.org/web/20210917190721/https://www.ntsb.gov/news/press-releases/Pages/Korean_Air_Flight_6316_MD-11_Shanghai_China_-_April_15_1999.aspx</div></a>
</div>
<div id="ref-GIMLI_GLIDER" class="csl-entry" role="doc-biblioentry">
[Gimli Glider] Gimli Glider. <a href="https://en.wikipedia.org/wiki/Gimli_Glider"><div class="csl-block">https://en.wikipedia.org/wiki/Gimli_Glider</div></a>
</div>
<div id="ref-HOCHRHEINBRÜCKE" class="csl-entry" role="doc-biblioentry">
[Hochrheinbrücke] An embarrassing discovery during the construction of a
bridge. <a href="https://www.normaalamsterdamspeil.nl/wp-content/uploads/2015/03/website_bridge.pdf"><div class="csl-block">https://www.normaalamsterdamspeil.nl/wp-content/uploads/2015/03/website_bridge.pdf</div></a>
</div>
<div id="ref-ISO80000" class="csl-entry" role="doc-biblioentry">
[ISO/IEC 80000] ISO/IEC 80000: Quantities and units. <a href="https://www.iso.org/standard/76921.html"><div class="csl-block">https://www.iso.org/standard/76921.html</div></a>
</div>
<div id="ref-ISO-GUIDE" class="csl-entry" role="doc-biblioentry">
[ISO/IEC Guide 99] ISO/IEC Guide 99: International vocabulary of
metrology — Basic and general concepts and associated terms (VIM). <a href="https://www.iso.org/obp/ui#iso:std:iso-iec:guide:99"><div class="csl-block">https://www.iso.org/obp/ui#iso:std:iso-iec:guide:99</div></a>
</div>
<div id="ref-BIPM-VIM" class="csl-entry" role="doc-biblioentry">
[JCGM 200:2012] International vocabulary of metrology - Basic and
general concepts and associated terms (VIM) (JCGM 200:2012, 3rd
edition). <a href="https://jcgm.bipm.org/vim/en"><div class="csl-block">https://jcgm.bipm.org/vim/en</div></a>
</div>
<div id="ref-JSR-385" class="csl-entry" role="doc-biblioentry">
[JSR 385] Units of Measurement. <a href="https://unitsofmeasurement.github.io/indriya"><div class="csl-block">https://unitsofmeasurement.github.io/indriya</div></a>
</div>
<div id="ref-LK8000" class="csl-entry" role="doc-biblioentry">
[LK8000] LK8000 - Tactical Flight Computer. <a href="http://lk8000.it"><div class="csl-block">http://lk8000.it</div></a>
</div>
<div id="ref-MARS_ORBITER" class="csl-entry" role="doc-biblioentry">
[Mars Orbiter] Mars Climate Orbiter. <a href="https://en.wikipedia.org/wiki/Mars_Climate_Orbiter"><div class="csl-block">https://en.wikipedia.org/wiki/Mars_Climate_Orbiter</div></a>
</div>
<div id="ref-MSRMT_DATA" class="csl-entry" role="doc-biblioentry">
[Measurement Data] William Kent, Stephanie Leichner Janowski, Bruce
Hamilton, and Dan Hepner. Measurement Data (Archive Report). <a href="https://www.bkent.net/Doc/mdarchiv.pdf"><div class="csl-block">https://www.bkent.net/Doc/mdarchiv.pdf</div></a>
</div>
<div id="ref-MEDICATION_DOSE_ERRORS" class="csl-entry" role="doc-biblioentry">
[Medication dose errors] Alma Mulac, Ellen Hagesaether, and Anne Gerd
Granas. Medication dose calculation errors and other numeracy mishaps in
hospitals: Analysis of the nature and enablers of incident reports. <a href="https://onlinelibrary.wiley.com/doi/10.1111/jan.15072"><div class="csl-block">https://onlinelibrary.wiley.com/doi/10.1111/jan.15072</div></a>
</div>
<div id="ref-MISRA_CPP" class="csl-entry" role="doc-biblioentry">
[MISRA C++] MISRA C++:2008 Guidelines for the use of the C++ language in
critical systems. <a href="https://misra.org.uk/misra-c-plus-plus/"><div class="csl-block">https://misra.org.uk/misra-c-plus-plus/</div></a>
</div>
<div id="ref-MP-UNITS" class="csl-entry" role="doc-biblioentry">
[mp-units] mp-units - A Physical Quantities and Units library for C++.
<a href="https://mpusz.github.io/mp-units"><div class="csl-block">https://mpusz.github.io/mp-units</div></a>
</div>
<div id="ref-NHOLTHAUS-UNITS" class="csl-entry" role="doc-biblioentry">
[nholthaus/units] UNITS - A compile-time, header-only, dimensional
analysis and unit conversion library built on c++14 with no
dependencies. <a href="https://github.com/nholthaus/units"><div class="csl-block">https://github.com/nholthaus/units</div></a>
</div>
<div id="ref-P0870R5" class="csl-entry" role="doc-biblioentry">
[P0870R5] Giuseppe D’Angelo. 2023-02-15. A proposal for a type trait to
detect narrowing conversions. <a href="https://wg21.link/p0870r5"><div class="csl-block">https://wg21.link/p0870r5</div></a>
</div>
<div id="ref-P1045R1" class="csl-entry" role="doc-biblioentry">
[P1045R1] David Stone. 2019-09-27. constexpr Function Parameters. <a href="https://wg21.link/p1045r1"><div class="csl-block">https://wg21.link/p1045r1</div></a>
</div>
<div id="ref-P1729R3" class="csl-entry" role="doc-biblioentry">
[P1729R3] Elias Kosunen, Victor Zverovich. 2023-10-12. Text Parsing. <a href="https://wg21.link/p1729r3"><div class="csl-block">https://wg21.link/p1729r3</div></a>
</div>
<div id="ref-P1841R3" class="csl-entry" role="doc-biblioentry">
[P1841R3] Walter E Brown. 2022-02-14. Wording for Individually
Specializable Numeric Traits. <a href="https://wg21.link/p1841r3"><div class="csl-block">https://wg21.link/p1841r3</div></a>
</div>
<div id="ref-P1930R0" class="csl-entry" role="doc-biblioentry">
[P1930R0] Vincent Reverdy. 2019-10-07. Towards a standard unit systems
library. <a href="https://wg21.link/p1930r0"><div class="csl-block">https://wg21.link/p1930r0</div></a>
</div>
<div id="ref-P1935R2" class="csl-entry" role="doc-biblioentry">
[P1935R2] Mateusz Pusz. 2020-01-13. A C++ Approach to Physical Units. <a href="https://wg21.link/p1935r2"><div class="csl-block">https://wg21.link/p1935r2</div></a>
</div>
<div id="ref-P1949R7" class="csl-entry" role="doc-biblioentry">
[P1949R7] Steve Downey, Zach Laine, Tom Honermann, Peter Bindels, Jens
Maurer. 2021-04-15. C++ Identifier Syntax using Unicode Standard Annex
31. <a href="https://wg21.link/p1949r7"><div class="csl-block">https://wg21.link/p1949r7</div></a>
</div>
<div id="ref-P2509R0" class="csl-entry" role="doc-biblioentry">
[P2509R0] Giuseppe D’Angelo. 2021-12-17. A proposal for a type trait to
detect value-preserving conversions. <a href="https://wg21.link/p2509r0"><div class="csl-block">https://wg21.link/p2509r0</div></a>
</div>
<div id="ref-P2980R1" class="csl-entry" role="doc-biblioentry">
[P2980R1] Mateusz Pusz, Dominik Berner, Johel Ernesto Guerrero Peña,
Charles Hogg, Nicolas Holthaus, Roth Michaels, Vincent Reverdy.
2023-11-28. A motivation, scope, and plan for a quantities and units
library. <a href="https://wg21.link/p2980r1"><div class="csl-block">https://wg21.link/p2980r1</div></a>
</div>
<div id="ref-P2981R1" class="csl-entry" role="doc-biblioentry">
[P2981R1] Mateusz Pusz, Dominik Berner, Johel Ernesto Guerrero Peña.
2023-11-09. Improving our safety with a physical quantities and units
library. <a href="https://wg21.link/p2981r1"><div class="csl-block">https://wg21.link/p2981r1</div></a>
</div>
<div id="ref-P2982R1" class="csl-entry" role="doc-biblioentry">
[P2982R1] Mateusz Pusz, Chip Hogg. 2023-11-09. `std::quantity` as a
numeric type. <a href="https://wg21.link/p2982r1"><div class="csl-block">https://wg21.link/p2982r1</div></a>
</div>
<div id="ref-P2993R0" class="csl-entry" role="doc-biblioentry">
[P2993R0] Luke Valenty. 2024-03-21. Constrained Numbers. <a href="https://wg21.link/p2993r0"><div class="csl-block">https://wg21.link/p2993r0</div></a>
</div>
<div id="ref-P3003R0" class="csl-entry" role="doc-biblioentry">
[P3003R0] Johel Ernesto Guerrero Peña. 2023-10-14. The design of a
library of number concepts. <a href="https://wg21.link/p3003r0"><div class="csl-block">https://wg21.link/p3003r0</div></a>
</div>
<div id="ref-P3045R0" class="csl-entry" role="doc-biblioentry">
[P3045R0] Mateusz Pusz, Dominik Berner, Johel Ernesto Guerrero Peña,
Charles Hogg, Nicolas Holthaus, Roth Michaels, Vincent Reverdy.
2024-02-15. Quantities and units library. <a href="https://wg21.link/p3045r0"><div class="csl-block">https://wg21.link/p3045r0</div></a>
</div>
<div id="ref-P3045R1" class="csl-entry" role="doc-biblioentry">
[P3045R1] Mateusz Pusz, Dominik Berner, Johel Ernesto Guerrero Peña,
Charles Hogg, Nicolas Holthaus, Roth Michaels, Vincent Reverdy.
2024-05-22. Quantities and units library. <a href="https://wg21.link/p3045r1"><div class="csl-block">https://wg21.link/p3045r1</div></a>
</div>
<div id="ref-P3045R2" class="csl-entry" role="doc-biblioentry">
[P3045R2] Mateusz Pusz, Dominik Berner, Johel Ernesto Guerrero Peña,
Charles Hogg, Nicolas Holthaus, Roth Michaels, Vincent Reverdy.
2024-10-09. Quantities and units library. <a href="https://wg21.link/p3045r2"><div class="csl-block">https://wg21.link/p3045r2</div></a>
</div>
<div id="ref-P3045R3" class="csl-entry" role="doc-biblioentry">
[P3045R3] Mateusz Pusz, Dominik Berner, Johel Ernesto Guerrero Peña,
Charles Hogg, Nicolas Holthaus, Roth Michaels, Vincent Reverdy.
2024-10-15. Quantities and units library. <a href="https://wg21.link/p3045r3"><div class="csl-block">https://wg21.link/p3045r3</div></a>
</div>
<div id="ref-P3094R0" class="csl-entry" role="doc-biblioentry">
[P3094R0] Mateusz Pusz. 2024-02-05. std::basic_fixed_string. <a href="https://wg21.link/p3094r0"><div class="csl-block">https://wg21.link/p3094r0</div></a>
</div>
<div id="ref-P3133R0" class="csl-entry" role="doc-biblioentry">
[P3133R0] Chip Hogg. 2024-02-14. Fast first-factor finding function. <a href="https://wg21.link/p3133r0"><div class="csl-block">https://wg21.link/p3133r0</div></a>
</div>
<div id="ref-PINT" class="csl-entry" role="doc-biblioentry">
[Pint] Pint: makes units easy. <a href="https://pint.readthedocs.io/en/stable/index.html"><div class="csl-block">https://pint.readthedocs.io/en/stable/index.html</div></a>
</div>
<div id="ref-SI" class="csl-entry" role="doc-biblioentry">
[SI] SI Brochure: The International System of Units (SI). <a href="https://www.bipm.org/en/publications/si-brochure"><div class="csl-block">https://www.bipm.org/en/publications/si-brochure</div></a>
</div>
<div id="ref-SI_LIB" class="csl-entry" role="doc-biblioentry">
[SI library] SI - Type safety for physical units”. <a href="https://si.dominikberner.ch/doc"><div class="csl-block">https://si.dominikberner.ch/doc</div></a>
</div>
<div id="ref-STONEHENGE" class="csl-entry" role="doc-biblioentry">
[Stonehenge] Tim Robey. Tiny stones, giant laughs: the story behind
Spinal Tap’s Stonehenge. <a href="https://www.telegraph.co.uk/films/2020/05/01/tiny-stones-giant-laughs-story-behind-spinal-taps-stonehenge"><div class="csl-block">https://www.telegraph.co.uk/films/2020/05/01/tiny-stones-giant-laughs-story-behind-spinal-taps-stonehenge</div></a>
</div>
<div id="ref-THE_GUARDIAN" class="csl-entry" role="doc-biblioentry">
[The Guardian] Charles Pensulo. Record Heat: Malawi swelters with
temperatures nearly 68F above average. <a href="https://randomascii.wordpress.com/2023/10/17/localization-failure-temperature-is-hard"><div class="csl-block">https://randomascii.wordpress.com/2023/10/17/localization-failure-temperature-is-hard</div></a>
</div>
<div id="ref-VCINL" class="csl-entry" role="doc-biblioentry">
[Value Category Is Not Lifetime] Arthur O’Dwyer. Value Category Is Not
Lifetime. <a href="https://quuxplusone.github.io/blog/2019/03/11/value-category-is-not-lifetime/"><div class="csl-block">https://quuxplusone.github.io/blog/2019/03/11/value-category-is-not-lifetime/</div></a>
</div>
<div id="ref-VASA" class="csl-entry" role="doc-biblioentry">
[Vasa] Rhitu Chatterjee and Lisa Mullins. New Clues Emerge in
Centuries-Old Swedish Shipwreck. <a href="https://theworld.org/stories/2012-02-23/new-clues-emerge-centuries-old-swedish-shipwreck"><div class="csl-block">https://theworld.org/stories/2012-02-23/new-clues-emerge-centuries-old-swedish-shipwreck</div></a>
</div>
<div id="ref-WILD_RICE" class="csl-entry" role="doc-biblioentry">
[Wild Rice] Manufacturers, exporters think metric. <a href="https://www.bizjournals.com/eastbay/stories/2001/07/09/focus3.html"><div class="csl-block">https://www.bizjournals.com/eastbay/stories/2001/07/09/focus3.html</div></a>
</div>
</div>
</div>
</div>
</body>
</html>
