PageSourceSearch

https://nerdai.app/mathquill-basic.js

js nerdai.app collected 2026-10-02 00:04:31 UTC 92,742 bytes, 2,802 lines download raw bytes

1!(function () {
2  var t,
3    e = window.jQuery,
4    n = 'mathquill-command-id',
5    i = 'mathquill-block-id',
6    s = Math.min,
7    r = Math.max
8  function o() {}
9  var a = [].slice
10  function c(t) {
11    var e = t.length - 1
12    return function () {
13      var n = a.call(arguments, 0, e),
14        i = a.call(arguments, e)
15      return t.apply(this, n.concat([i]))
16    }
17  }
18  var l = c(function (t, e) {
19    return c(function (n, i) {
20      if (t in n) return n[t].apply(n, e.concat(i))
21    })
22  })
23  function u(t) {
24    return c(function (e, n) {
25      'function' != typeof e && (e = l(e))
26      return t.call(this, function (t) {
27        return e.apply(t, [t].concat(n))
28      })
29    })
30  }
31  function h(t) {
32    var e = a.call(arguments, 1)
33    return function () {
34      return t.apply(this, e)
35    }
36  }
37  var f = (function (t, e, n) {
38      function i(t) {
39        return 'object' == typeof t
40      }
41      function s(t) {
42        return 'function' == typeof t
43      }
44      function r() {}
45      return function n(o, a) {
46        function c() {
47          var t = new l()
48          return s(t.init) && t.init.apply(t, arguments), t
49        }
50        function l() {}
51        undefined === a && ((a = o), (o = Object)), (c.Bare = l)
52        var u,
53          h = (r[t] = o[t]),
54          f = (l[t] = c[t] = c.p = new r())
55        return (
56          (f.constructor = c),
57          (c.mixin = function (e) {
58            return (l[t] = c[t] = n(c, e)[t]), c
59          }),
60          (c.open = function (t) {
61            if (((u = {}), s(t) ? (u = t.call(c, f, h, c, o)) : i(t) && (u = t), i(u)))
62              for (var n in u) e.call(u, n) && (f[n] = u[n])
63            return s(f.init) || (f.init = o), c
64          })(a)
65        )
66      }
67    })('prototype', {}.hasOwnProperty),
68    p = -1
69  var d = f(e, function (t) {
70      ;(t.insDirOf = function (t, e) {
71        return t === p ? this.insertBefore(e.first()) : this.insertAfter(e.last())
72      }),
73        (t.insAtDirEnd = function (t, e) {
74          return t === p ? this.prependTo(e) : this.appendTo(e)
75        })
76    }),
77    m = f(function (t) {
78      ;(t.parent = 0),
79        (t[p] = 0),
80        (t[1] = 0),
81        (t.init = function (t, e, n) {
82          ;(this.parent = t), (this[p] = e), (this[1] = n)
83        }),
84        (this.copy = function (t) {
85          return m(t.parent, t[p], t[1])
86        })
87    }),
88    v = f(function (t) {
89      ;(t[p] = 0), (t[1] = 0), (t.parent = 0)
90      var e = 0
91      ;(this.byId = {}),
92        (t.init = function () {
93          ;(this.id = e += 1),
94            (v.byId[this.id] = this),
95            (this.ends = {}),
96            (this.ends[p] = 0),
97            (this.ends[1] = 0)
98        }),
99        (t.dispose = function () {
100          delete v.byId[this.id]
101        }),
102        (t.toString = function () {
103          return '{{ MathQuill Node #' + this.id + ' }}'
104        }),
105        (t.jQ = d()),
106        (t.jQadd = function (t) {
107          return (this.jQ = this.jQ.add(t))
108        }),
109        (t.jQize = function (t) {
110          t = d(t || this.html())
111          function e(t) {
112            if (t.getAttribute) {
113              var n = t.getAttribute('mathquill-command-id'),
114                i = t.getAttribute('mathquill-block-id')
115              n && v.byId[n].jQadd(t), i && v.byId[i].jQadd(t)
116            }
117            for (t = t.firstChild; t; t = t.nextSibling) e(t)
118          }
119          for (var n = 0; n < t.length; n += 1) e(t[n])
120          return t
121        }),
122        (t.createDir = function (t, e) {
123          var n = this
124          return n.jQize(), n.jQ.insDirOf(t, e.jQ), (e[t] = n.adopt(e.parent, e[p], e[1])), n
125        }),
126        (t.createLeftOf = function (t) {
127          return this.createDir(p, t)
128        }),
129        (t.selectChildren = function (t, e) {
130          return y(t, e)
131        }),
132        (t.bubble = u(function (t) {
133          for (var e = this; e; e = e.parent) {
134            if (!1 === t(e)) break
135          }
136          return this
137        })),
138        (t.postOrder = u(function (t) {
139          return (
140            (function e(n) {
141              n.eachChild(e), t(n)
142            })(this),
143            this
144          )
145        })),
146        (t.isEmpty = function () {
147          return 0 === this.ends[p] && 0 === this.ends[1]
148        }),
149        (t.children = function () {
150          return b(this.ends[p], this.ends[1])
151        }),
152        (t.eachChild = function () {
153          var t = this.children()
154          return t.each.apply(t, arguments), this
155        }),
156        (t.foldChildren = function (t, e) {
157          return this.children().fold(t, e)
158        }),
159        (t.withDirAdopt = function (t, e, n, i) {
160          return b(this, this).withDirAdopt(t, e, n, i), this
161        }),
162        (t.adopt = function (t, e, n) {
163          return b(this, this).adopt(t, e, n), this
164        }),
165        (t.disown = function () {
166          return b(this, this).disown(), this
167        }),
168        (t.remove = function () {
169          return this.jQ.remove(), this.postOrder('dispose'), this.disown()
170        })
171    })
172  function g(t, e, n) {
173    e ? e[1] === n && e.parent : t.ends[p], n ? n[p] === e && n.parent : t.ends[1]
174  }
175  var b = f(function (e) {
176      ;(e.init = function (e, n, i) {
177        if ((i === t && (i = p), (this.ends = {}), e)) {
178          e.parent, n.parent, (this.ends[i] = e), (this.ends[-i] = n)
179          var s = this.fold([], function (t, e) {
180            return t.push.apply(t, e.jQ.get()), t
181          })
182          this.jQ = this.jQ.add(s)
183        }
184      }),
185        (e.jQ = d()),
186        (e.withDirAdopt = function (t, e, n, i) {
187          return t === p ? this.adopt(e, n, i) : this.adopt(e, i, n)
188        }),
189        (e.adopt = function (t, e, n) {
190          g(t, e, n)
191          var i = this
192          i.disowned = !1
193          var s = i.ends[p]
194          if (!s) return this
195          var r = i.ends[1]
196          return (
197            e || (t.ends[p] = s),
198            n ? (n[p] = r) : (t.ends[1] = r),
199            (i.ends[1][1] = n),
200            i.each(function (n) {
201              ;(n[p] = e), (n.parent = t), e && (e[1] = n), (e = n)
202            }),
203            i
204          )
205        }),
206        (e.disown = function () {
207          var t = this,
208            e = t.ends[p]
209          if (!e || t.disowned) return t
210          t.disowned = !0
211          var n = t.ends[1],
212            i = e.parent
213          return (
214            g(i, e[p], e),
215            g(i, n, n[1]),
216            e[p] ? (e[p][1] = n[1]) : (i.ends[p] = n[1]),
217            n[1] ? (n[1][p] = e[p]) : (i.ends[1] = e[p]),
218            t
219          )
220        }),
221        (e.remove = function () {
222          return this.jQ.remove(), this.each('postOrder', 'dispose'), this.disown()
223        }),
224        (e.each = u(function (t) {
225          var e = this,
226            n = e.ends[p]
227          if (!n) return e
228          for (; n !== e.ends[1][1]; n = n[1]) {
229            if (!1 === t(n)) break
230          }
231          return e
232        })),
233        (e.fold = function (t, e) {
234          return (
235            this.each(function (n) {
236              t = e.call(this, t, n)
237            }),
238            t
239          )
240        })
241    }),
242    w = {},
243    q = {},
244    O = f(m, function (t) {
245      ;(t.init = function (t, e) {
246        ;(this.parent = t), (this.options = e)
247        var n = (this.jQ = this._jQ = d('<span class="mq-cursor">&#8203;</span>'))
248        ;(this.blink = function () {
249          n.toggleClass('mq-blink')
250        }),
251          (this.upDownCache = {})
252      }),
253        (t.show = function () {
254          return (
255            (this.jQ = this._jQ.removeClass('mq-blink')),
256            'intervalId' in this
257              ? clearInterval(this.intervalId)
258              : (this[1]
259                  ? this.selection && this.selection.ends[p][p] === this[p]
260                    ? this.jQ.insertBefore(this.selection.jQ)
261                    : this.jQ.insertBefore(this[1].jQ.first())
262                  : this.jQ.appendTo(this.parent.jQ),
263                this.parent.focus()),
264            (this.intervalId = setInterval(this.blink, 500)),
265            this
266          )
267        }),
268        (t.hide = function () {
269          return (
270            'intervalId' in this && clearInterval(this.intervalId),
271            delete this.intervalId,
272            this.jQ.detach(),
273            (this.jQ = d()),
274            this
275          )
276        }),
277        (t.withDirInsertAt = function (t, e, n, i) {
278          var s = this.parent
279          ;(this.parent = e), (this[t] = n), (this[-t] = i), s !== e && s.blur && s.blur()
280        }),
281        (t.insDirOf = function (t, e) {
282          return (
283            this.jQ.insDirOf(t, e.jQ),
284            this.withDirInsertAt(t, e.parent, e[t], e),
285            this.parent.jQ.addClass('mq-hasCursor'),
286            this
287          )
288        }),
289        (t.insLeftOf = function (t) {
290          return this.insDirOf(p, t)
291        }),
292        (t.insRightOf = function (t) {
293          return this.insDirOf(1, t)
294        }),
295        (t.insAtDirEnd = function (t, e) {
296          return (
297            this.jQ.insAtDirEnd(t, e.jQ), this.withDirInsertAt(t, e, 0, e.ends[t]), e.focus(), this
298          )
299        }),
300        (t.insAtLeftEnd = function (t) {
301          return this.insAtDirEnd(p, t)
302        }),
303        (t.insAtRightEnd = function (t) {
304          return this.insAtDirEnd(1, t)
305        }),
306        (t.jumpUpDown = function (t, e) {
307          var n = this
308          n.upDownCache[t.id] = m.copy(n)
309          var i = n.upDownCache[e.id]
310          if (i) i[1] ? n.insLeftOf(i[1]) : n.insAtRightEnd(i.parent)
311          else {
312            var s = n.offset().left
313            e.seek(s, n)
314          }
315        }),
316        (t.offset = function () {
317          var t = this.jQ.removeClass('mq-cursor').offset()
318          return this.jQ.addClass('mq-cursor'), t
319        }),
320        (t.unwrapGramp = function () {
321          var t = this.parent.parent,
322            e = t.parent,
323            n = t[1],
324            i = t[p]
325          if (
326            (t.disown().eachChild(function (s) {
327              s.isEmpty() ||
328                (s
329                  .children()
330                  .adopt(e, i, n)
331                  .each(function (e) {
332                    e.jQ.insertBefore(t.jQ.first())
333                  }),
334                (i = s.ends[1]))
335            }),
336            !this[1])
337          )
338            if (this[p]) this[1] = this[p][1]
339            else
340              for (; !this[1]; ) {
341                if (((this.parent = this.parent[1]), !this.parent)) {
342                  ;(this[1] = t[1]), (this.parent = e)
343                  break
344                }
345                this[1] = this.parent.ends[p]
346              }
347          this[1] ? this.insLeftOf(this[1]) : this.insAtRightEnd(e),
348            t.jQ.remove(),
349            t[p].siblingDeleted && t[p].siblingDeleted(this.options, 1),
350            t[1].siblingDeleted && t[1].siblingDeleted(this.options, p)
351        }),
352        (t.startSelection = function () {
353          for (
354            var t = (this.anticursor = m.copy(this)), e = (t.ancestors = {}), n = t;
355            n.parent;
356            n = n.parent
357          )
358            e[n.parent.id] = n
359        }),
360        (t.endSelection = function () {
361          delete this.anticursor
362        }),
363        (t.select = function () {
364          var t = this.anticursor
365          if (this[p] === t[p] && this.parent === t.parent) return !1
366          for (var e = this; e.parent; e = e.parent)
367            if (e.parent.id in t.ancestors) {
368              var n = e.parent
369              break
370            }
371          var i,
372            s,
373            r = t.ancestors[n.id],
374            o = 1
375          if (e[p] !== r)
376            for (var a = e; a; a = a[1])
377              if (a[1] === r[1]) {
378                ;
378(o = p), (i = e), (s = r)
379                break
380              }
381          return (
382            1 === o && ((i = r), (s = e)),
383            i instanceof m && (i = i[1]),
384            s instanceof m && (s = s[p]),
385            (this.hide().selection = n.selectChildren(i, s)),
386            this.insDirOf(o, this.selection.ends[o]),
387            this.selectionChanged(),
388            !0
389          )
390        }),
391        (t.clearSelection = function () {
392          return (
393            this.selection &&
394              (this.selection.clear(), delete this.selection, this.selectionChanged()),
395            this
396          )
397        }),
398        (t.deleteSelection = function () {
399          this.selection &&
400            ((this[p] = this.selection.ends[p][p]),
401            (this[1] = this.selection.ends[1][1]),
402            this.selection.remove(),
403            this.selectionChanged(),
404            delete this.selection)
405        }),
406        (t.replaceSelection = function () {
407          var t = this.selection
408          return t && ((this[p] = t.ends[p][p]), (this[1] = t.ends[1][1]), delete this.selection), t
409        })
410    }),
411    y = f(b, function (t, e) {
412      ;(t.init = function () {
413        e.init.apply(this, arguments),
414          (this.jQ = this.jQ.wrapAll('<span class="mq-selection"></span>').parent())
415      }),
416        (t.adopt = function () {
417          return this.jQ.replaceWith((this.jQ = this.jQ.children())), e.adopt.apply(this, arguments)
418        }),
419        (t.clear = function () {
420          return this.jQ.replaceWith(this.jQ[0].childNodes), this
421        }),
422        (t.join = function (t) {
423          return this.fold('', function (e, n) {
424            return e + n[t]()
425          })
426        })
427    }),
428    x = f(function (t) {
429      ;(t.init = function (t, e, n) {
430        ;(this.id = t.id),
431          (this.data = {}),
432          (this.root = t),
433          (this.container = e),
434          (this.options = n),
435          (t.controller = this),
436          (this.cursor = t.cursor = O(t, n))
437      }),
438        (t.handle = function (t, e) {
439          var n = this.options.handlers
440          if (n && n.fns[t]) {
441            var i = n.APIClasses[this.KIND_OF_MQ](this)
442            e === p || 1 === e ? n.fns[t](e, i) : n.fns[t](i)
443          }
444        })
445      var e = []
446      ;(this.onNotify = function (t) {
447        e.push(t)
448      }),
449        (t.notify = function () {
450          for (var t = 0; t < e.length; t += 1) e[t].apply(this.cursor, arguments)
451          return this
452        })
453    }),
454    k = {},
455    j = f(),
456    Q = {},
457    T = f(),
458    C = {}
459  function S() {
460    window.console &&
461      console.warn(
462        'You are using the MathQuill API without specifying an interface version, which will fail in v1.0.0. You can fix this easily by doing this before doing anything else:\n\n    MathQuill = MathQuill.getInterface(1);\n    // now MathQuill.MathField() works like it used to\n\nSee also the "`dev` branch (2014–2015) → v0.10.0 Migration Guide" at\n  https://github.com/mathquill/mathquill/wiki/%60dev%60-branch-(2014%E2%80%932015)-%E2%86%92-v0.10.0-Migration-Guide'
463      )
464  }
465  function _(t) {
466    return S(), Tt(t)
467  }
468  ;(_.prototype = T.p),
469    (_.interfaceVersion = function (t) {
470      if (1 !== t) throw 'Only interface version 1 supported. You specified: ' + t
471      return (
472        (S = function () {
473          window.console &&
474            console.warn(
475              'You called MathQuill.interfaceVersion(1); to specify the interface version, which will fail in v1.0.0. You can fix this easily by doing this before doing anything else:\n\n    MathQuill = MathQuill.getInterface(1);\n    // now MathQuill.MathField() works like it used to\n\nSee also the "`dev` branch (2014–2015) → v0.10.0 Migration Guide" at\n  https://github.com/mathquill/mathquill/wiki/%60dev%60-branch-(2014%E2%80%932015)-%E2%86%92-v0.10.0-Migration-Guide'
476            )
477        })(),
478        _
479      )
480    }),
481    (_.getInterface = L)
482  var D = (L.MIN = 1),
483    E = (L.MAX = 2)
484  function L(t) {
485    if (!(D <= t && t <= E))
486      throw 'Only interface versions between ' + D + ' and ' + E + ' supported. You specified: ' + t
487    function e(t) {
488      if (!t || !t.nodeType) return null
489      var e = d(t).children('.mq-root-block').attr(i),
490        s = e && v.byId[e].controller
491      return s ? n[s.KIND_OF_MQ](s) : null
492    }
493    var n = {}
494    function s(t, e) {
495      for (var i in (e && e.handlers && (e.handlers = { fns: e.handlers, APIClasse
495s: n }), e))
496        if (e.hasOwnProperty(i)) {
497          var s = e[i],
498            r = Q[i]
499          t[i] = r ? r(s) : s
500        }
501    }
502    ;(e.L = p),
503      (e.R = 1),
504      (e.config = function (t) {
505        return s(j.p, t), this
506      }),
507      (e.registerEmbed = function (t, e) {
508        if (!/^[a-z][a-z0-9]*$/i.test(t))
509          throw 'Embed name must start with letter and be only letters and digits'
510        C[t] = e
511      })
512    var r = (n.AbstractMathQuill = f(T, function (t) {
513      ;(t.init = function (t) {
514        ;(this.__controller = t),
515          (this.__options = t.options),
516          (this.id = t.id),
517          (this.data = t.data)
518      }),
519        (t.__mathquillify = function (t) {
520          var e = this.__controller,
521            n = e.root,
522            s = e.container
523          e.createTextarea()
524          var r = s.addClass(t).contents().detach()
525          ;(n.jQ = d('<span class="mq-root-block"/>').attr(i, n.id).appendTo(s)),
526            this.latex(r.text()),
527            (this.revert = function () {
528              return s
529                .empty()
530                .unbind('.mathquill')
531                .removeClass('mq-editable-field mq-math-mode mq-text-mode')
532                .append(r)
533            })
534        }),
535        (t.config = function (t) {
536          return s(this.__options, t), this
537        }),
538        (t.el = function () {
539          return this.__controller.container[0]
540        }),
541        (t.text = function () {
542          return this.__controller.exportText()
543        }),
544        (t.latex = function (t) {
545          return arguments.length > 0
546            ? (this.__controller.renderLatexMath(t),
547              this.__controller.blurred && this.__controller.curs
547or.hide().parent.blur(),
548              this)
549            : this.__controller.exportLatex()
550        }),
551        (t.html = function () {
552          return this.__controller.root.jQ
553            .html()
554            .replace(/ mathquill-(?:command|block)-id="?\d+"?/g, '')
555            .replace(/<span class="?mq-cursor( mq-blink)?"?>.?<\/span>/i, '')
556            .replace(/ mq-hasCursor|mq-hasCursor ?/, '')
557            .replace(/ class=(""|(?= |>))/g, '')
558        }),
559        (t.reflow = function () {
560          return this.__controller.root.postOrder('reflow'), this
561        })
562    }))
563    for (var a in ((e.prototype = r.prototype),
564    (n.EditableField = f(r, function (t, e) {
565      ;(t.__mathquillify = function () {
566        return (
567          e.__mathquillify.apply(this, arguments),
568          (this.__controller.editable = !0),
569          this.__controller.delegateMouseEvents(),
570          this.__controller.editablesTextareaEvents(),
571          this
572        )
573      }),
574        (t.focus = function () {
575          return this.__controller.textarea.focus(), this
576        }),
577        (t.blur = function () {
578          return this.__controller.textarea.blur(), this
579        }),
580        (t.write = function (t) {
581          return (
582            this.__controller.writeLatex(t),
583            this.__controller.scrollHoriz(),
584            this.__controller.blurred && this.__controller.cursor.hide().parent.blur(),
585            this
586          )
587        }),
588        (t.cmd = function (t) {
589          var e = this.__controller.notify(),
590            n = e.cursor
591          if (/^\\[a-z]+$/i.test(t)) {
592            t = t.slice(1)
593            var i = w[t]
594            i &&
595              ((t = i(t)),
596              n.selection && t.replaces(n.replaceSelection()),
597              t.createLeftOf(n.show()),
598              this.__controller.scrollHoriz())
599          } else n.parent.write(n, t)
600          return e.blurred && n.hide().parent.blur(), this
601        }),
602        (t.select = function () {
603          var t = this.__controller
604          for (t.notify('move').cursor.insAtRightEnd(t.root); t.cursor[p]; ) t.selectLeft()
605          return this
606        }),
607        (t.clearSelection = function () {
608          return this.__controller.cursor.clearSelection(), this
609        }),
610        (t.moveToDirEnd = function (t) {
611          return (
612            this.__controller.notify('move').cursor.insAtDirEnd(t, this.__controller.root), this
613          )
614        }),
615        (t.moveToLeftEnd = function () {
616          return this.moveToDirEnd(p)
617        }),
618        (t.moveToRightEnd = function () {
619          return this.moveToDirEnd(1)
620        }),
621        (t.keystroke = function (t) {
622          t = t.replace(/^\s+|\s+$/g, '').split(/\s+/)
623          for (var e = 0; e < t.length; e += 1)
624            this.__controller.keystroke(t[e], { preventDefault: o })
625          return this
626        }),
627        (t.typedText = function (t) {
628          for (var e = 0; e < t.length; e += 1) this.__controller.typedText(t.charAt(e))
629          return this
630        }),
631        (t.dropEmbedded = function (t, e, n) {
632          var i = t - d(window).scrollLeft(),
633            s = e - d(window).scrollTop(),
634            r = document.elementFromPoint(i, s)
635          this.__controller.seek(d(r), t, e),
636            Qt().setOptions(n).createLeftOf(this.__controller.curs
636or)
637        })
638    })),
639    (e.EditableField = function () {
640      throw "wtf don't call me, I'm 'abstract'"
641    }),
642    (e.EditableField.prototype = n.EditableField.prototype),
643    k))
644      !(function (i, s) {
645        var r = (n[i] = s(n))
646        ;(e[i] = function (n, s) {
647          var o = e(n)
648          if (o instanceof r || !n || !n.nodeType) return o
649          var a = x(r.RootBlock(), d(n), j())
650          return (a.KIND_OF_MQ = i), r(a).__mathquillify(s, t)
651        }),
652          (e[i].prototype = r.prototype)
653      })(a, k[a])
654    return e
655  }
656  _.noConflict = function () {
657    return (window.MathQuill = A), _
658  }
659  var A = window.MathQuill
660  function I(t) {
661    for (
662      var e = 'moveOutOf deleteOutOf selectOutOf upOutOf downOutOf'.split(' '), n = 0;
663      n < e.length;
664      n += 1
665    )
666      !(function (e) {
667        t[e] = function (t) {
668          this.controller.handle(e, t)
669        }
670      })(e[n])
671    t.reflow = function () {
672      this.controller.handle('reflow'),
673        this.controller.handle('edited'),
674        this.controller.handle('edit')
675    }
676  }
677  window.MathQuill = _
678  var z,
679    M = f(function (t, e, n) {
680      function i(t, e) {
681        throw 'Parse Error: ' + e + ' at ' + (t = t ? "'" + t + "'" : 'EOF')
682      }
683      ;(t.init = function (t) {
684        this._ = t
685      }),
686        (t.parse = function (t) {
687          return this.skip(o)._(
688            '' + t,
689            function (t, e) {
690              return e
691            },
692            i
693          )
694        }),
695        (t.or = function (t) {
696          var e = this
697          return n(function (n, i, s) {
698            return e._(n, i, function (e) {
699              return t._(n, i, s)
700            })
701          })
702        }),
703        (t.then = function (t) {
704          var e = this
705          return n(function (i, s, r) {
706            return e._(
707              i,
708              function (e, i) {
709                var o = t instanceof n ? t : t(i)
710                return o._(e, s, r)
711              },
712              r
713            )
714          })
715        }),
716        (t.many = function () {
717          var t = this
718          return n(function (e, n, i) {
719            for (var s = []; t._(e, r, o); );
720            return n(e, s)
721            function r(t, n) {
722              return (e = t), s.push(n), !0
723            }
724            function o() {
725              return !1
726            }
727          })
728        }),
729        (t.times = function (t, e) {
730          arguments.length < 2 && (e = t)
731          var i = this
732          return n(function (n, s, r) {
733            for (var o, a = [], c = !0, l = 0; l < t; l += 1)
734              if (!(c = i._(n, u, h))) return r(n, o)
735            for (; l < e && c; l += 1) c = i._(n, u, f)
736            return s(n, a)
737            function u(t, e) {
738              return a.push(e), (n = t), !0
739            }
740            function h(t, e) {
741              return (o = e), (n = t), !1
742            }
743            function f(t, e) {
744              return !1
745            }
746          })
747        }),
748        (t.result = function (t) {
749          return this.then(r(t))
750        }),
751        (t.atMost = function (t) {
752          return this.times(0, t)
753        }),
754        (t.atLeast = function (t) {
755          var e = this
756          return e.times(t).then(function (t) {
757            return e.many().map(function (e) {
758              return t.concat(e)
759            })
760          })
761        }),
762        (t.map = function (t) {
763          return this.then(function (e) {
764            return r(t(e))
765          })
766        }),
767        (t.skip = function (t) {
768          return this.then(function (e) {
769            return t.result(e)
770          })
771        })
772      this.string = function (t) {
773        var e = t.length,
774          i = "expected '" + t + "'"
775        return n(function (n, s, r) {
776          var o = n.slice(0, e)
777          return o === t ? s(n.slice(e), o) : r(n, i)
778        })
779      }
780      var s = (this.regex = function (t) {
781          t.toString().charAt(1)
782          var e = 'expected ' + t
783          return n(function (n, i, s) {
784            var r = t.exec(n)
785            if (r) {
786              var o = r[0]
787              return i(n.slice(o.length), o)
788            }
789            return s(n, e)
790          })
791        }),
792        r = (n.succeed = function (t) {
793          return n(function (e, n) {
794            return n(e, t)
795          })
796        }),
797        o =
798          ((n.fail = function (t) {
799            return n(function (e, n, i) {
800              return i(e, t)
801            })
802          }),
803          (n.letter = s(/^[a-z]/i)),
804          (n.letters = s(/^[a-z]*/i)),
805          (n.digit = s(/^[0-9]/)),
806          (n.digits = s(/^[0-9]*/)),
807          (n.whitespace = s(/^\s+/)),
808          (n.optWhitespace = s(/^\s*/)),
809          (n.any = n(function (t, e, n) {
810            return t ? e(t.slice(1), t.charAt(0)) : n(t, 'expected any character')
811          })),
812          (n.all = n(function (t, e, n) {
813            return e('', t)
814          })),
815          (n.eof = n(function (t, e, n) {
816            return t ? n(t, 'expected EOF') : e(t, t)
817          })))
818    }),
819    R =
820      ((z = {
821        8: 'Backspace',
822        9: 'Tab',
823        10: 'Enter',
824        13: 'Enter',
825        16: 'Shift',
826        17: 'Control',
827        18: 'Alt',
828        20: 'CapsLock',
829        27: 'Esc',
830        32: 'Spacebar',
831        33: 'PageUp',
832        34: 'PageDown',
833        35: 'End',
834        36: 'Home',
835        37: 'Left',
836        38: 'Up',
837        39: 'Right',
838        40: 'Down',
839        45: 'Insert',
840        46: 'Del',
841        144: 'NumLock'
842      }),
843      function (t, n) {
844        var i,
845          s = null,
846          r = null,
847          a = e(t),
848          c = e(n.container || a),
849          l = o
850        function u(t) {
851          ;(l = t), clearTimeout(i), (i = setTimeout(t))
852        }
853        c.bind('keydown keypress input keyup focusout paste', function (t) {
854          l(t)
855        })
856        var h = !1
857        function f() {
858          n.keystroke(
859            (function (t) {
860              var e,
861                n = t.which || t.keyCode,
862                i = z[n],
863                s = []
864              return (
865                t.ctrlKey && s.push('Ctrl'),
866                t.originalEvent && t.originalEvent.metaKey && s.push('Meta'),
867                t.altKey && s.push('Alt'),
868                t.shiftKey && s.push('Shift'),
869                (e = i || String.fromCharCode(n)),
870                s.length || i ? (s.push(e), s.join('-')) : e
871              )
872            })(s),
873            s
874          )
875        }
876        function p() {
877          if (!('selectionStart' in (t = a[0])) || t.selectionStart === t.selectionEnd) {
878            var t,
879              e = a.val()
880            1 === e.length ? (a.val(''), n.typedText(e)) : e && a[0].select && a[0].select()
881          }
882        }
883        function d() {
884          var t = a.val()
885          a.val(''), t && n.paste(t)
886        }
887        return (
888          c.bind({
889            keydown: function (t) {
890              ;(s = t),
891                (r = null),
892                h &&
893                  u(function (t) {
894                    ;(t && 'focusout' === t.type) || !a[0].select || a[0].select(),
895                      (l = o),
896                      clearTimeout(i)
897                  }),
898                f()
899            },
900            keypress: function (t) {
901              s && r && f(), (r = t), u(p)
902            },
903            focusout: function () {
904              s = r = null
905            },
906            paste: function (t) {
907              a.focus(), u(d)
908            }
909          }),
910          {
911            select: function (t) {
912              l(), (l = o), clearTimeout(i), a.val(t), t && a[0].select && a[0].select(), (h = !!t)
913            }
914          }
915        )
916      })
917  x.open(function (t, e) {
918    t.exportText = function () {
919      return this.root.foldChildren('', function (t, e) {
920        return t + e.text()
921      })
922    }
923  }),
924    x.open(function (t) {
925      t.focusBlurEvents = function () {
926        var t,
927          e = this,
928          n = e.root,
929          i = e.cursor
930        function s() {
931          clearTimeout(t), i.selection && i.selection.jQ.addClass('mq-blur'), r()
932        }
933        function r() {
934          i.hide().parent.blur(), e.container.removeClass('mq-focused'), d(window).off('blur', s)
935        }
936        e.textarea
937          .focus(function () {
938            ;(e.blurred = !1),
939              clearTimeout(t),
940              e.container.addClass('mq-focused'),
941              i.parent || i.insAtRightEnd(n),
942              i.selection ? (i.selection.jQ.removeClass('mq-blur'), e.selectionChanged()) : i.show()
943          })
944          .blur(function () {
945            ;(e.blurred = !0),
946              (t = setTimeout(function () {
947                n.postOrder('intentionalBlur'), i.clearSelection().endSelection(), r()
948              })),
949              d(window).on('blur', s)
950          }),
951          (e.blurred = !0),
952          i.hide().parent.blur()
953      }
954    }),
955    x.open(function (t) {
956      t.keystroke = function (t, e) {
957        this.cursor.parent.keystroke(t, e, this)
958      }
959    }),
960    v.open(function (t) {
961      ;(t.keystroke = function (t, e, n) {
962        var i = n.cursor
963        switch (t) {
964          case 'Ctrl-Shift-Backspace':
965          case 'Ctrl-Backspace':
966            n.ctrlDeleteDir(p)
967            break
968          case 'Shift-Backspace':
969          case 'Backspace':
970            n.backspace()
971            break
972          case 'Esc':
973          case 'Tab':
974            return void n.escapeDir(1, t, e)
975          case 'Shift-Tab':
976          case 'Shift-Esc':
977            return void n.escapeDir(p, t, e)
978          case 'End':
979            n.notify('move').cursor.insAtRightEnd(i.parent)
980            break
981          case 'Ctrl-End':
982            n.notify('move').cursor.insAtRightEnd(n.root)
983            break
984          case 'Shift-End':
985            for (; i[1]; ) n.selectRight()
986            break
987          case 'Ctrl-Shift-End':
988            for (; i[1] || i.parent !== n.root; ) n.selectRight()
989            break
990          case 'Home':
991            n.notify('move').cursor.insAtLeftEnd(i.parent)
992            break
993          case 'Ctrl-Home':
994            n.notify('move').cursor.insAtLeftEnd(n.root)
995            break
996          case 'Shift-Home':
997            for (; i[p]; ) n.selectLeft()
998            break
999          case 'Ctrl-Shift-Home':
1000            for (; i[p] || i.parent !== n.root; ) n.selectLeft()
1001            break
1002          case 'Left':
1003            n.moveLeft()
1004            break
1005          case 'Shift-Left':
1006            n.selectLeft()
1007            break
1008          case 'Ctrl-Left':
1009            break
1010          case 'Right':
1011            n.moveRight()
1012            break
1013          case 'Shift-Right':
1014            n.selectRight()
1015            break
1016          case 'Ctrl-Right':
1017            break
1018          case 'Up':
1019            n.moveUp()
1020            break
1021          case 'Down':
1022            n.moveDown()
1023            break
1024          case 'Shift-Up':
1025            if (i[p]) for (; i[p]; ) n.selectLeft()
1026            else n.selectLeft()
1027          case 'Shift-Down':
1028            if (i[1]) for (; i[1]; ) n.selectRight()
1029            else n.selectRight()
1030          case 'Ctrl-Up':
1031          case 'Ctrl-Down':
1032            break
1033          case 'Ctrl-Shift-Del':
1034          case 'Ctrl-Del':
1035            n.ctrlDeleteDir(1)
1036            break
1037          case 'Shift-Del':
1038          case 'Del':
1039            n.deleteForward()
1040            break
1041          case 'Meta-A':
1042          case 'Ctrl-A':
1043            for (n.notify('move').cursor.insAtRightEnd(n.root); i[p]; ) n.selectLeft()
1044            break
1045          default:
1046            return
1047        }
1048        e.preventDefault(), n.scrollHoriz()
1049      }),
1050        (t.moveOutOf =
1051          t.moveTowards =
1052          t.deleteOutOf =
1053          t.deleteTowards =
1054          t.unselectInto =
1055          t.selectOutOf =
1056          t.selectTowards =
1057            function () {})
1058    }),
1059    x.open(function (t) {
1060      function e(t, e) {
1061        var n = t.notify('upDown').cursor,
1062          i = e + 'Into',
1063          s = e + 'OutOf'
1064        return (
1065          n[1][i]
1066            ? n.insAtLeftEnd(n[1][i])
1067            : n[p][i]
1068            ? n.insAtRightEnd(n[p][i])
1069            : n.parent.bubble(function (t) {
1070                var e = t[s]
1071                if (
1072                  e &&
1073                  ('function' == typeof e && (e = t[s](n)),
1074                  e instanceof v && n.jumpUpDown(t, e),
1075                  !0 !== e)
1076                )
1077                  return !1
1078              }),
1079          t
1080        )
1081      }
1082      this.onNotify(function (t) {
1083        ;('move' !== t && 'upDown' !== t) || this.show().clearSelection()
1084      }),
1085        (t.escapeDir = function (t, e, n) {
1086          var i = this.cursor
1087          if ((i.parent !== this.root && n.preventDefault(), i.parent !== this.root))
1088            return i.parent.moveOutOf(t, i), this.notify('move')
1089        }),
1090        (Q.leftRightIntoCmdGoes = function (t) {
1091          if (t && 'up' !== t && 'down' !== t)
1092            throw '"up" or "down" required for leftRightIntoCmdGoes option, got "' + t + '"'
1093          return t
1094        }),
1095        (t.moveDir = function (t) {
1096          var e = this.cursor,
1097            n = e.options.leftRightIntoCmdGoes
1098          return (
1099            e.selection
1100              ? e.insDirOf(t, e.selection.ends[t])
1101              : e[t]
1102              ? e[t].moveTowards(t, e, n)
1103              : e.parent.moveOutOf(t, e, n),
1104            this.notify('move')
1105          )
1106        }),
1107        (t.moveLeft = function () {
1108          return this.moveDir(p)
1109        }),
1110        (t.moveRight = function () {
1111          return this.moveDir(1)
1112        }),
1113        (t.moveUp = function () {
1114          return e(this, 'up')
1115        }),
1116        (t.moveDown = function () {
1117          return e(this, 'down')
1118        }),
1119        this.onNotify(function (t) {
1120          'upDown' !== t && (this.upDownCache = {})
1121        }),
1122        this.onNotify(function (t) {
1123          'edit' === t && this.show().deleteSelection()
1124        }),
1125        (t.deleteDir = function (t) {
1126          var e = this.cursor,
1127            n = e.selection
1128          return (
1129            this.notify('edit'),
1130            n || (e[t] ? e[t].deleteTowards(t, e) : e.parent.deleteOutOf(t, e)),
1131            e[p].siblingDeleted && e[p].siblingDeleted(e.options, 1),
1132            e[1].siblingDeleted && e[1].siblingDeleted(e.options, p),
1133            e.parent.bubble('reflow'),
1134            this
1135          )
1136        }),
1137        (t.ctrlDeleteDir = function (t) {
1138          var e = this.cursor
1139          return !e[p] || e.selection
1140            ? ctrlr.deleteDir()
1141            : (this.notify('edit'),
1142              b(e.parent.ends[p], e[p]).remove(),
1143              e.insAtDirEnd(p, e.parent),
1144              e[p].siblingDeleted && e[p].siblingDeleted(e.options, 1),
1145              e[1].siblingDeleted && e[1].siblingDeleted(e.options, p),
1146              e.parent.bubble('reflow'),
1147              this)
1148        }),
1149        (t.backspace = function () {
1150          return this.deleteDir(p)
1151        }),
1152        (t.deleteForward = function () {
1153          return this.deleteDir(1)
1154        }),
1155        this.onNotify(function (t) {
1156          'select' !== t && this.endSelection()
1157        }),
1158        (t.selectDir = function (t) {
1159          var e = this.notify('select').cursor,
1160            n = e.selection
1161          e.anticursor || e.startSelection()
1162          var i = e[t]
1163          i
1164            ? n && n.ends[t] === i && e.anticursor[-t] !== i
1165              ? i.unselectInto(t, e)
1166              : i.selectTowards(t, e)
1167            : e.parent.selectOutOf(t, e),
1168            e.clearSelection(),
1169            e.select() || e.show()
1170        }),
1171        (t.selectLeft = function () {
1172          return this.selectDir(p)
1173        }),
1174        (t.selectRight = function () {
1175          return this.selectDir(1)
1176        })
1177    })
1178  var B = (function () {
1179    function t(t) {
1180      for (var e = t[0] || U(), n = 1; n < t.length; n += 1) t[n].children().adopt(e, e.ends[1], 0)
1181      return e
1182    }
1183    var e = M.string,
1184      n = M.regex,
1185      i = M.letter,
1186      s = M.any,
1187      r = M.optWhitespace,
1188      o = M.succeed,
1189      a = M.fail,
1190      c = i.map(function (t) {
1191        return Y(t)
1192      }),
1193      l = n(/^[^${}\\_^]/).map(function (t) {
1194        return P(t)
1195      }),
1196      u = n(/^[^\\a-eg-zA-Z]/)
1197        .or(
1198          e('\\').then(
1199            n(/^[a-z]+/i)
1200              .or(n(/^\s+/).result(' '))
1201              .or(s)
1202          )
1203        )
1204        .then(function (t) {
1205          var e = w[t]
1206          return e ? e(t).parser() : a('unknown command: \\' + t)
1207        })
1208        .or(c)
1209        .or(l),
1210      h = e('{')
1211        .then(function () {
1212          return p
1213        })
1214        .skip(e('}')),
1215      f = r.then(
1216        h.or(
1217          u.map(function (t) {
1218            var e = U()
1219            return t.adopt(e, 0, 0), e
1220          })
1221        )
1222      ),
1223      p = f.many().map(t).skip(r),
1224      d = e('[')
1225        .then(
1226          f
1227            .then(function (t) {
1228              return ']' !== t.join('latex') ? o(t) : a()
1229            })
1230            .many()
1231            .map(t)
1232            .skip(r)
1233        )
1234        .skip(e(']')),
1235      m = p
1236    return (m.block = f), (m.optBlock = d), m
1237  })()
1238  x.open(function (t, e) {
1239    ;(t.exportLatex = function () {
1240      return this.root.latex().replace(/(\\[a-z]+) (?![a-z])/gi, '$1')
1241    }),
1242      (t.writeLatex = function (t) {
1243        var e = this.notify('edit').cursor,
1244          n = M.all,
1245          i = M.eof,
1246          s = B.skip(i).or(n.result(!1)).parse(t)
1247        s &&
1248          !s.isEmpty() &&
1249          (s.children().adopt(e.parent, e[p], e[1]),
1250          s.jQize().insertBefore(e.jQ),
1251          (e[p] = s.ends[1]),
1252          s.finalizeInsert(e.options, e),
1253          s.ends[1][1].siblingCreated && s.ends[1][1].siblingCreated(e.options, p),
1254          s.ends[p][p].siblingCreated && s.ends[p][p].siblingCreated(e.options, 1),
1255          e.parent.bubble('reflow'))
1256        return this
1257      }),
1258      (t.renderLatexMath = function (t) {
1259        var e = this.root,
1260          n = this.cursor,
1261          i = M.all,
1262          s = M.eof,
1263          r = B.skip(s).or(i.result(!1)).parse(t)
1264        e.eachChild('postOrder', 'dispose'),
1265          (e.ends[p] = e.ends[1] = 0),
1266          r && r.children().adopt(e, 0, 0)
1267        var o = e.jQ
1268        if (r) {
1269          var a = r.join('html')
1270          o.html(a), e.jQize(o.children()), e.finalizeInsert(n.options)
1271        } else o.empty()
1272        delete n.selection, n.insAtRightEnd(e)
1273      }),
1274      (t.renderLatexText = function (t) {
1275        var e = this.root,
1276          n = this.cursor
1277        e.jQ.children().slice(1).remove(),
1278          e.eachChild('postOrder', 'dispose'),
1279          (e.ends[p] = e.ends[1] = 0),
1280          delete n.selection,
1281          n.show().insAtRightEnd(e)
1282        var i = M.regex,
1283          s = M.string,
1284          r = M.eof,
1285          o = M.all,
1286          a = s('$')
1287            .then(B)
1288            .skip(s('$').or(r))
1289            .map(function (t) {
1290              var e = RootMathCommand(n)
1291              e.createBlocks()
1292              var i = e.ends[p]
1293              return t.children().adopt(i, 0, 0), e
1294            }),
1295          c = s('\\$').result('$').or(i(/^[^$]/)).map(P),
1296          l = a.or(c).many().skip(r).or(o.result(!1)).parse(t)
1297        if (l) {
1298          for (var u = 0; u < l.length; u += 1) l[u].adopt(e, e.ends[1], 0)
1299          e.jQize().appendTo(e.jQ), e.finalizeInsert(n.options)
1300        }
1301      })
1302  }),
1303    x.open(function (e) {
1304      e.delegateMouseEvents = function () {
1305        var e = this.root.jQ
1306        this.container.bind('mousedown.mathquill', function (n) {
1307          var s,
1308            r = d(n.target).closest('.mq-root-block'),
1309            a = v.byId[r.attr(i) || e.attr(i)].controller,
1310            c = a.cursor,
1311            l = c.blink,
1312            u = a.textareaSpan,
1313            h = a.textarea
1314          function f(t) {
1315            s = d(t.target)
1316          }
1317          function p(e) {
1318            c.anticursor || c.startSelection(), a.seek(s, e.pageX, e.pageY).cursor.select(), (s = t)
1319          }
1320          a.blurred && (a.editable || r.prepend(u), h.focus()),
1321            n.preventDefault(),
1322            (n.target.unselectable = !0),
1323            (c.blink = o),
1324            a.seek(d(n.target), n.pageX, n.pageY).cursor.startSelection(),
1325            r.mousemove(f),
1326            d(n.target.ownerDocument)
1327              .mousemove(p)
1328              .mouseup(function t(e) {
1329                ;(c.blink = l),
1330                  c.selection || (a.editable ? c.show() : u.detach()),
1331                  r.unbind('mousemove', f),
1332                  d(e.target.ownerDocument).unbind('mousemove', p).unbind('mouseup', t)
1333              })
1334        })
1335      }
1336    }),
1337    x.open(function (t) {
1338      t.seek = function (t, e, s) {
1339        var r = this.notify('select').cursor
1340        if (t) {
1341          var o = t.attr(i) || t.attr(n)
1342          if (!o) {
1343            var a = t.parent()
1344            o = a.attr(i) || a.attr(n)
1345          }
1346        }
1347        var c = o ? v.byId[o] : this.root
1348        return r.clearSelection().show(), c.seek(e, r), this.scrollHoriz(), this
1349      }
1350    }),
1351    x.open(function (t) {
1352      t.scrollHoriz = function () {
1353        var t = this.cursor,
1354          e = t.selection,
1355          n = this.root.jQ[0].getBoundingClientRect()
1356        if (e) {
1357          var i = e.jQ[0].getBoundingClientRect(),
1358            s = i.left - (n.left + 20),
1359            r = i.right - (n.right - 20)
1360          if (e.ends[p] === t[1])
1361            if (s < 0) a = s
1362            else {
1363              if (!(r > 0)) return
1364              if (i.left - r < n.left + 20) a = s
1365              else a = r
1366            }
1367          else if (r > 0) a = r
1368          else {
1369            if (!(s < 0)) return
1370            if (i.right - s > n.right - 20) a = r
1371            else a = s
1372          }
1373        } else {
1374          var o = t.jQ[0].getBoundingClientRect().left
1375          if (o > n.right - 20) var a = o - (n.right - 20)
1376          else {
1377            if (!(o < n.left + 20)) return
1378            var a = o - (n.left + 20)
1379          }
1380        }
1381        this.root.jQ.stop().animate({ scrollLeft: '+=' + a }, 100)
1382      }
1383    }),
1384    x.open(function (e) {
1385      ;(j.p.substituteTextarea = function () {
1386        return d(
1387          '<textarea autocapitalize=off autocomplete=off autocorrect=off spellcheck=false x-palm-disable-ste-all=true />'
1388        )[0]
1389      }),
1390        (e.createTextarea = function () {
1391          var t = (this.textareaSpan = d('<span class="mq-textarea"></span>')),
1392            e = this.options.substituteTextarea()
1393          if (!e.nodeType) throw 'substituteTextarea() must return a DOM element, got ' + e
1394          e = this.textarea = d(e).appendTo(t)
1395          var n = this
1396          ;(n.cursor.selectionChanged = function () {
1397            n.selectionChanged()
1398          }),
1399            n.container.bind('copy', function () {
1400              n.setTextareaSelection()
1401            })
1402        }),
1403        (e.selectionChanged = function () {
1404          var e = this
1405          ut(e.container[0]),
1406            e.textareaSelectionTimeout === t &&
1407              (e.textareaSelectionTimeout = setTimeout(function () {
1408                e.setTextareaSelection()
1409              }))
1410        }),
1411        (e.setTextareaSelection = function () {
1412          this.textareaSelectionTimeout = t
1413          var e 
1413= ''
1414          this.cursor.selection &&
1415            ((e = this.cursor.selection.join('latex')),
1416            this.options.statelessClipboard && (e = '$' + e + '$')),
1417            this.selectFn(e)
1418        }),
1419        (e.staticMathTextareaEvents = function () {
1420          var t = this,
1421            e = (t.root, t.cursor),
1422            n = t.textarea,
1423            i = t.textareaSpan
1424          function s() {
1425            i.detach(), (t.blurred = !0)
1426          }
1427          this.container.prepend('<span class="mq-selectable">$' + t.exportLatex() + '$</span>'),
1428            (t.blurred = !0),
1429            n
1430              .bind('cut paste', !1)
1431              .focus(function () {
1432                t.blurred = !1
1433              })
1434              .blur(function () {
1435                e.selection && e.selection.clear(), setTimeout(s)
1436              }),
1437            (t.selectFn = function (t) {
1438              n.val(t), t && n.select()
1439            })
1440        }),
1441        (e.editablesTextareaEvents = function () {
1442          var t = this,
1443            e = (t.root, t.cursor),
1444            n = t.textarea,
1445            i = t.textareaSpan,
1446            s = R(n, this)
1447          ;(this.selectFn = function (t) {
1448            s.select(t)
1449          }),
1450            this.container.prepend(i).on('cut', function (n) {
1451              e.selection &&
1452                setTimeout(function () {
1453                  t.notify('edit'), e.parent.bubble('reflow')
1454                })
1455            }),
1456            this.focusBlurEvents()
1457        }),
1458        (e.typedText = function (t) {
1459          if ('\n' === t) return this.handle('enter')
1460          var e = this.notify().cursor
1461          e.parent.write(e, t), this.scrollHoriz()
1462        }),
1463        (e.paste = function (t) {
1464          this.options.statelessClipboard &&
1465            (t =
1466              '$' === t.slice(0, 1) && '$' === t.slice(-1) ? t.slice(1, -1) : '\\text{' + t + '}'),
1467            this.writeLatex(t).cursor.show()
1468        })
1469    })
1470  var F = f(v, function (t, e) {
1471      t.finalizeInsert = function (t, e) {
1472        var n = this
1473        n.postOrder('finalizeTree', t),
1474          n.postOrder('contactWeld', e),
1475          n.postOrder('blur'),
1476          n.postOrder('reflow'),
1477          n[1].siblingCreated && n[1].siblingCreated(t, p),
1478          n[p].siblingCreated && n[p].siblingCreated(t, 1),
1479          n.bubble('reflow')
1480      }
1481    }),
1482    N = f(F, function (t, e) {
1483      ;(t.init = function (t, n, i) {
1484        var s = this
1485        e.init.call(s),
1486          s.ctrlSeq || (s.ctrlSeq = t),
1487          n && (s.htmlTemplate = n),
1488          i && (s.textTemplate = i)
1489      }),
1490        (t.replaces = function (t) {
1491          t.disown(), (this.replacedFragment = t)
1492        }),
1493        (t.isEmpty = function () {
1494          return this.foldChildren(!0, function (t, e) {
1495            return t && e.isEmpty()
1496          })
1497        }),
1498        (t.parser = function () {
1499          var t = B.block,
1500            e = this
1501          return t.times(e.numBlocks()).map(function (t) {
1502            e.blocks = t
1503            for (var n = 0; n < t.length; n += 1) t[n].adopt(e, e.ends[1], 0)
1504            return e
1505          })
1506        }),
1507        (t.createLeftOf = function (t) {
1508          var n = this,
1509            i = n.replacedFragment
1510          n.createBlocks(),
1511            e.createLeftOf.call(n, t),
1512            i && (i.adopt(n.ends[p], 0, 0), i.jQ.appendTo(n.ends[p].jQ)),
1513            n.finalizeInsert(t.options),
1514            n.placeCursor(t)
1515        }),
1516        (t.createBlocks = function () {
1517          for (var t = this, e = t.numBlocks(), n = (t.blocks = Array(e)), i = 0; i < e; i += 1) {
1518            ;(n[i] = U()).adopt(t, t.ends[1], 0)
1519          }
1520        }),
1521        (t.placeCursor = function (t) {
1522          t.insAtRightEnd(
1523            this.foldChildren(this.ends[p], function (t, e) {
1524              return t.isEmpty() ? t : e
1525            })
1526          )
1527        }),
1528        (t.moveTowards = function (t, e, n) {
1529          var i = n && this[n + 'Into']
1530          e.insAtDirEnd(-t, i || this.ends[-t])
1531        }),
1532        (t.deleteTowards = function (t, e) {
1533          this.isEmpty() ? (e[t] = this.remove()[t]) : this.moveTowards(t, e, null)
1534        }),
1535        (t.selectTowards = function (t, e) {
1536          ;(e[-t] = this), (e[t] = this[t])
1537        }),
1538        (t.selectChildren = function () {
1539          return y(this, this)
1540        }),
1541        (t.unselectInto = function (t, e) {
1542          e.insAtDirEnd(-t, e.anticursor.ancestors[this.id])
1543        }),
1544        (t.seek = function (t, e) {
1545          function n(t) {
1546            var e = {}
1547            return (e[p] = t.jQ.offset().left), (e[1] = e[p] + t.jQ.outerWidth()), e
1548          }
1549          var i = this,
1550            s = n(i)
1551          if (t < s[p]) return e.insLeftOf(i)
1552          if (t > s[1]) return e.insRightOf(i)
1553          var r = s[p]
1554          i.eachChild(function (o) {
1555            var a = n(o)
1556            return t < a[p]
1557              ? (t - r < a[p] - t
1558                  ? o[p]
1559                    ? e.insAtRightEnd(o[p])
1560                    : e.insLeftOf(i)
1561                  : e.insAtLeftEnd(o),
1562                !1)
1563              : t > a[1]
1564              ? void (o[1]
1565                  ? (r = a[1])
1566                  : s[1] - t < t - a[1]
1567                  ? e.insRightOf(i)
1568                  : e.insAtRightEnd(o))
1569              : (o.seek(t, e), !1)
1570          })
1571        }),
1572        (t.numBlocks = function () {
1573          var t = this.htmlTemplate.match(/&\d+/g)
1574          return t ? t.length : 0
1575        }),
1576        (t.html = function () {
1577          var t = this,
1578            e = t.blocks,
1579            n = ' mathquill-command-id=' + t.id,
1580            i = t.htmlTemplate.match(/<[^<>]+>|[^<>]+/g)
1581          i.join(''), this.htmlTemplate
1582          for (var s = 0, r = i[0]; r; r = i[(s += 1)])
1583            if ('/>' === r.slice(-2)) i[s] = r.slice(0, -2) + n + '/>'
1584            else if ('<' === r.charAt(0)) {
1585              r.charAt(1), (i[s] = r.slice(0, -1) + n + '>')
1586              var o = 1
1587              do {
1588                '</' === (r = i[(s += 1)]).slice(0, 2)
1589                  ? (o -= 1)
1590                  : '<' === r.charAt(0) && '/>' !== r.slice(-2) && (o += 1)
1591              } while (o > 0)
1592            }
1593          return i.join('').replace(/>&(\d+)/g, function (t, n) {
1594            return ' mathquill-block-id=' + e[n].id + '>' + e[n].join('html')
1595          })
1596        }),
1597        (t.latex = function () {
1598          return this.foldChildren(this.ctrlSeq, function (t, e) {
1599            return t + '{' + (e.latex() || ' ') + '}'
1600          })
1601        }),
1602        (t.textTemplate = ['']),
1603        (t.text = function () {
1604          var t = this,
1605            e = 0
1606          return t.foldChildren(t.textTemplate[e], function (n, i) {
1607            e += 1
1608            var s = i.text()
1609            return n && '(' === t.textTemplate[e] && '(' === s[0] && ')' === s.slice(-1)
1610              ? n + s.slice(1, -1) + t.textTemplate[e]
1611              : n + i.text() + (t.textTemplate[e] || '')
1612          })
1613        })
1614    }),
1615    $ = f(N, function (t, e) {
1616      ;(t.init = function (t, n, i) {
1617        i || (i = t && t.length > 1 ? t.slice(1) : t), e.init.call(this, t, n, [i])
1618      }),
1619        (t.parser = function () {
1620          return M.succeed(this)
1621        }),
1622        (t.numBlocks = function () {
1623          return 0
1624        }),
1625        (t.replaces = function (t) {
1626          t.remove()
1627        }),
1628        (t.createBlocks = o),
1629        (t.moveTowards = function (t, e) {
1630          e.jQ.insDirOf(t, this.jQ), (e[-t] = this), (e[t] = this[t])
1631        }),
1632        (t.deleteTowards = function (t, e) {
1633          e[t] = this.remove()[t]
1634        }),
1635        (t.seek = function (t, e) {
1636          t - this.jQ.offset().left < this.jQ.outerWidth() / 2
1637            ? e.insLeftOf(this)
1638            : e.insRightOf(this)
1639        }),
1640        (t.latex = function () {
1641          return this.ctrlSeq
1642        }),
1643        (t.text = function () {
1644          return this.textTemplate
1645        }),
1646        (t.placeCursor = o),
1647        (t.isEmpty = function () {
1648          return !0
1649        })
1650    }),
1651    P = f($, function (t, e) {
1652      t.init = function (t, n) {
1653        e.init.call(this, t, '<span>' + (n || t) + '</span>')
1654      }
1655    }),
1656    W = f($, function (t, e) {
1657      t.init = function (t, n, i) {
1658        e.init.call(this, t, '<span class="mq-binary-operator">' + n + '</span>', i)
1659      }
1660    }),
1661    U = f(F, function (t, e) {
1662      ;(t.join = function (t) {
1663        return this.foldChildren('', function (e, n) {
1664          return e + n[t]()
1665        })
1666      }),
1667        (t.html = function () {
1668          return this.join('html')
1669        }),
1670        (t.latex = function () {
1671          return this.join('latex')
1672        }),
1673        (t.text = function () {
1674          return this.ends[p] === this.ends[1] && 0 !== this.ends[p]
1675            ? this.ends[p].text()
1676            : this.join('text')
1677        }),
1678        (t.keystroke = function (t, n, i) {
1679          return !i.options.spaceBehavesLikeTab || ('Spacebar' !== t && 'Shift-Spacebar' !== t)
1680            ? e.keystroke.apply(this, arguments)
1681            : (n.preventDefault(), void i.escapeDir('Shift-Spacebar' === t ? p : 1, t, n))
1682        }),
1683        (t.moveOutOf = function (t, e, n) {
1684          !(n && this.parent[n + 'Into']) && this[t]
1685            ? e.insAtDirEnd(-t, this[t])
1686            : e.insDirOf(t, this.parent)
1687        }),
1688        (t.selectOutOf = function (t, e) {
1689          e.insDirOf(t, this.parent)
1690        }),
1691        (t.deleteOutOf = function (t, e) {
1692          e.unwrapGramp()
1693        }),
1694        (t.seek = function (t, e) {
1695          var n = this.ends[1]
1696          if (!n || n.jQ.offset().left + n.jQ.outerWidth() < t) return e.insAtRightEnd(this)
1697          if (t < this.ends[p].jQ.offset().left) return e.insAtLeftEnd(this)
1698          for (; t < n.jQ.offset().left; ) n = n[p]
1699          return n.seek(t, e)
1700        }),
1701        (t.chToCmd = function (t) {
1702          var e
1703          return t.match(/^[a-eg-zA-Z]$/)
1704            ? Y(t)
1705            : /^\d$/.test(t)
1706            ? G(t)
1707            : (e = q[t] || w[t])
1708            ? e(t)
1709            : P(t)
1710        }),
1711        (t.write = function (t, e) {
1712          var n = this.chToCmd(e)
1713          t.selection && n.replaces(t.replaceSelection()), n.createLeftOf(t.show())
1714        }),
1715        (t.focus = function () {
1716          return this.jQ.addClass('mq-hasCursor'), this.jQ.removeClass('mq-empty'), this
1717        }),
1718        (t.blur = function () {
1719          return (
1720            this.jQ.removeClass('mq-hasCursor'),
1721            this.isEmpty() && this.jQ.addClass('mq-empty'),
1722            this
1723          )
1724        })
1725    })
1726  k.StaticMath = function (t) {
1727    return f(t.AbstractMathQuill, function (e, n) {
1728      ;(this.RootBlock = U),
1729        (e.__mathquillify = function () {
1730          return (
1731            n.__mathquillify.call(this, 'mq-math-mode'),
1732            this.__controller.delegateMouseEvents(),
1733            this.__controller.staticMathTextareaEvents(),
1734            this
1735          )
1736        }),
1737        (e.init = function () {
1738          n.init.apply(this, arguments),
1739            this.__controller.root.postOrder(
1740              'registerInnerField',
1741              (this.innerFields = []),
1742              t.MathField
1743            )
1744        }),
1745        (e.latex = function () {
1746          var e = n.latex.apply(this, arguments)
1747          return (
1748            arguments.length > 0 &&
1749              this.__controller.root.postOrder(
1750                'registerInnerField',
1751                (this.innerFields = []),
1752                t.MathField
1753              ),
1754            e
1755          )
1756        })
1757    })
1758  }
1759  var H = f(U, I)
1760  k.MathField = function (t) {
1761    return f(t.EditableField, function (t, e) {
1762      ;(this.RootBlock = H),
1763        (t.__mathquillify = function (t, n) {
1764          return (
1765            this.config(t),
1766            n > 1 && (this.__controller.root.reflow = o),
1767            e.__mathquillify.call(this, 'mq-editable-field mq-math-mode'),
1768            delete this.__controller.root.reflow,
1769            this
1770          )
1771        })
1772    })
1773  }
1774  var G = f(P, function (t, e) {
1775      t.createLeftOf = function (t) {
1776        t.options.autoSubscriptNumerals &&
1777        t.parent !== t.parent.parent.sub &&
1778        ((t[p] instanceof K && !1 !== t[p].isItalic) ||
1779          (t[p] instanceof dt && t[p][p] instanceof K && !1 !== t[p][p].isItalic))
1780          ? (w._().createLeftOf(t), e.createLeftOf.call(this, t), t.insRightOf(t.parent.parent))
1781          : e.createLeftOf.call(this, t)
1782      }
1783    }),
1784    K = f($, function (t, e) {
1785      ;(t.init = function (t, n) {
1786        e.init.call(this, t, '<var>' + (n || t) + '</var>')
1787      }),
1788        (t.text = function () {
1789          var t = this.ctrlSeq
1790          return (
1791            !this[p] ||
1792              this[p] instanceof K ||
1793              this[p] instanceof W ||
1794              '\\ ' === this[p].ctrlSeq ||
1795              (t = '*' + t),
1796            !this[1] || this[1] instanceof W || this[1] instanceof dt || (t += '*'),
1797            t
1798          )
1799        })
1800    })
1801  ;(j.p.autoCommands = { _maxLength: 0 }),
1802    (Q.autoCommands = function (t) {
1803      if (!/^[a-z]+(?: [a-z]+)*$/i.test(t))
1804        throw '"' + t + '" not a space-delimited list of only letters'
1805      for (var e = t.split(' '), n = {}, i = 0, s = 0; s < e.length; s += 1) {
1806        var o = e[s]
1807        if (o.length < 2) throw 'autocommand "' + o + '" not minimum length of 2'
1808        if (w[o] === J) throw '"' + o + '" is a built-in operator name'
1809        ;(n[o] = 1), (i = r(i, o.length))
1810      }
1811      return (n._maxLength = i), n
1812    })
1813  var Y = f(K, function (t, e) {
1814      function n(t) {
1815        return t instanceof $ && !(t instanceof W)
1816      }
1817      ;(t.init = function (t) {
1818        return e.init.call(this, (this.letter = t))
1819      }),
1820        (t.createLeftOf = function (t) {
1821          var n = t.options.autoCommands,
1822            i = n._maxLength
1823          if (i > 0) {
1824            for (var s = this.letter, r = t[p], o = 1; r instanceof Y && o < i; )
1825              (s = r.letter + s), (r = r[p]), (o += 1)
1826            for (; s.length; ) {
1827              if (n.hasOwnProperty(s)) {
1828                for (o = 2, r = t[p]; o < s.length; o += 1, r = r[p]);
1829                return b(r, t[p]).remove(), (t[p] = r[p]), w[s](s).createLeftOf(t)
1830              }
1831              s = s.slice(1)
1832            }
1833          }
1834          e.createLeftOf.apply(this, arguments)
1835        }),
1836        (t.italicize = function (t) {
1837          return (this.isItalic = t), this.jQ.toggleClass('mq-operator-name', !t), this
1838        }),
1839        (t.finalizeTree =
1840          t.siblingDeleted =
1841          t.siblingCreated =
1842            function (t, e) {
1843              ;(e !== p && this[1] instanceof Y) || this.autoUnItalicize(t)
1844            }),
1845        (t.autoUnItalicize = function (t) {
1846          var e = t.autoOperatorNames
1847          if (0 !== e._maxLength) {
1848            for (var i = this.letter, r = this[p]; r instanceof Y; r = r[p]) i = r.letter + i
1849            for (var o = this[1]; o instanceof Y; o = o[1]) i += o.letter
1850            b(r[1] || this.parent.ends[p], o[p] || this.parent.ends[1]).each(function (t) {
1851              t.italicize(!0).jQ.removeClass('mq-first mq-last'), (t.ctrlSeq = t.letter)
1852            })
1853            t: for (var a = 0, c = r[1] || this.parent.ends[p]; a < i.length; a += 1, c = c[1])
1854              for (var l = s(e._maxLength, i.length - a); l > 0; l -= 1) {
1855                var u = i.slice(a, a + l)
1856                if (e.hasOwnProperty(u)) {
1857                  for (var h = 0, f = c; h < l; h += 1, f = f[1]) {
1858                    f.italicize(!1)
1859                    var d = f
1860                  }
1861                  var m = X.hasOwnProperty(u)
1862                  ;(c.ctrlSeq = (m ? '\\' : '\\operatorname{') + c.ctrlSeq),
1863                    (d.ctrlSeq += m ? ' ' : '}'),
1864                    Z.hasOwnProperty(u) && d[p][p][p].jQ.addClass('mq-last'),
1865                    n(c[p]) && c.jQ.addClass('mq-first'),
1866                    n(d[1]) && d.jQ.addClass('mq-last'),
1867                    (a += l - 1),
1868                    (c = d)
1869                  continue t
1870                }
1871              }
1872          }
1873        })
1874    }),
1875    X = {},
1876    V = (j.p.autoOperatorNames = { _maxLength: 9 }),
1877    Z = { limsup: 1, liminf: 1, projlim: 1, injlim: 1 }
1878  !(function () {
1879    for (
1880      var t =
1881          'arg deg det dim exp gcd hom inf ker lg lim ln log max min sup limsup liminf injlim projlim Pr'.split(
1882            ' '
1883          ),
1884        e = 0;
1885      e < t.length;
1886      e += 1
1887    )
1888      X[t[e]] = V[t[e]] = 1
1889    var n = 'sin cos tan arcsin arccos arctan sinh cosh tanh sec csc cot coth'.split(' ')
1890    for (e = 0; e < n.length; e += 1) X[n[e]] = 1
1891    var i = 'sin cos tan sec cosec csc cotan cot ctg'.split(' ')
1892    for (e = 0; e < i.length; e += 1)
1893      V[i[e]] = V['arc' + i[e]] = V[i[e] + 'h'] = V['ar' + i[e] + 'h'] = V['arc' + i[e] + 'h'] = 1
1894    var s = 'gcf hcf lcm proj span'.split(' ')
1895    for (e = 0; e < s.length; e += 1) V[s[e]] = 1
1896  })(),
1897    (Q.autoOperatorNames = function (t) {
1898      if (!/^[a-z]+(?: [a-z]+)*$/i.test(t))
1899        throw '"' + t + '" not a space-delimited list of only letters'
1900      for (var e = t.split(' '), n = {}, i = 0, s = 0; s < e.length; s += 1) {
1901        var o = e[s]
1902        if (o.length < 2) throw '"' + o + '" not minimum length of 2'
1903        ;(n[o] = 1), (i = r(i, o.length))
1904      }
1905      return (n._maxLength = i), n
1906    })
1907  var J = f($, function (t, e) {
1908    ;(t.init = function (t) {
1909      this.ctrlSeq = t
1910    }),
1911      (t.createLeftOf = function (t) {
1912        for (var e = this.ctrlSeq, n = 0; n < e.length; n += 1) Y(e.charAt(n)).createLeftOf(t)
1913      }),
1914      (t.parser = function () {
1915        for (var t = this.ctrlSeq, e = U(), n = 0; n < t.length; n += 1)
1916          Y(t.charAt(n)).adopt(e, e.ends[1], 0)
1917        return M.succeed(e.children())
1918      })
1919  })
1920  for (var tt in V) V.hasOwnProperty(tt) && (w[tt] = J)
1921  ;(w.operatorname = f(N, function (t) {
1922    ;(t.createLeftOf = o),
1923      (t.numBlocks = function () {
1924        return 1
1925      }),
1926      (t.parser = function () {
1927        return B.block.map(function (t) {
1928          return t.children()
1929        })
1930      })
1931  })),
1932    (w.f = f(Y, function (t, e) {
1933      ;(t.init = function () {
1934        $.p.init.call(this, (this.letter = 'f'), '<var class="mq-f">f</var>')
1935      }),
1936        (t.italicize = function (t) {
1937          return this.jQ.html('f').toggleClass('mq-f', t), e.italicize.apply(this, arguments)
1938        })
1939    })),
1940    (w[' '] = w.space = h(P, '\\ ', '&nbsp;')),
1941    (w["'"] = w.prime = h(P, "'", '&prime;')),
1942    (w.backslash = h(P, '\\backslash ', '\\')),
1943    q['\\'] || (q['\\'] = w.backslash),
1944    (w.$ = h(P, '\\$', '$'))
1945  var et = f($, function (t, e) {
1946    t.init = function (t, n) {
1947      e.init.call(this, t, '<span class="mq-nonSymbola">' + (n || t) + '</span>')
1948    }
1949  })
1950  ;(w['@'] = et),
1951    (w['&'] = h(et, '\\&', '&amp;')),
1952    (w['%'] = h(et, '\\%', '%')),
1953    (w.alpha =
1954      w.beta =
1955      w.gamma =
1956      w.delta =
1957      w.zeta =
1958      w.eta =
1959      w.theta =
1960      w.iota =
1961      w.kappa =
1962      w.mu =
1963      w.nu =
1964      w.xi =
1965      w.rho =
1966      w.sigma =
1967      w.tau =
1968      w.chi =
1969      w.psi =
1970      w.omega =
1971        f(K, function (t, e) {
1972          t.init = function (t) {
1973            e.init.call(this, '\\' + t + ' ', '&' + t + ';')
1974          }
1975        })),
1976    (w.phi = h(K, '\\phi ', '&#981;')),
1977    (w.phiv = w.varphi = h(K, '\\varphi ', '&phi;')),
1978    (w.epsilon = h(K, '\\epsilon ', '&#1013;')),
1979    (w.epsiv = w.varepsilon = h(K, '\\varepsilon ', '&epsilon;')),
1980    (w.piv = w.varpi = h(K, '\\varpi ', '&piv;')),
1981    (w.sigmaf = w.sigmav = w.varsigma = h(K, '\\varsigma ', '&sigmaf;')),
1982    (w.thetav = w.vartheta = w.thetasym = h(K, '\\vartheta ', '&thetasym;')),
1983    (w.upsilon = w.upsi = h(K, '\\upsilon ', '&upsilon;')),
1984    (w.gammad = w.Gammad = w.digamma = h(K, '\\digamma ', '&#989;')),
1985    (w.kappav = w.varkappa = h(K, '\\varkappa ', '&#1008;')),
1986    (w.rhov = w.varrho = h(K, '\\varrho ', '&#1009;')),
1987    (w.pi = w['π'] = h(et, '\\pi ', '&pi;')),
1988    (w.lambda = h(et, '\\lambda ', '&lambda;')),
1989    (w.Upsilon =
1990      w.Upsi =
1991      w.upsih =
1992      w.Upsih =
1993        h($, '\\Upsilon ', '<var style="font-family: serif">&upsih;</var>')),
1994    (w.Gamma =
1995      w.Delta =
1996      w.Theta =
1997      w.Lambda =
1998      w.Xi =
1999      w.Pi =
2000      w.Sigma =
2001      w.Phi =
2002      w.Psi =
2003      w.Omega =
2004      w.forall =
2005        f(P, function (t, e) {
2006          t.init = function (t) {
2007            e.init.call(this, '\\' + t + ' ', '&' + t + ';')
2008          }
2009        }))
2010  var nt = f(N, function (t) {
2011    ;(t.init = function (t) {
2012      this.latex = t
2013    }),
2014      (t.createLeftOf = function (t) {
2015        var e = B.parse(this.latex)
2016        e.children().adopt(t.parent, t[p], t[1]),
2017          (t[p] = e.ends[1]),
2018          e.jQize().insertBefore(t.jQ),
2019          e.finalizeInsert(t.options, t),
2020          e.ends[1][1].siblingCreated && e.ends[1][1].siblingCreated(t.options, p),
2021          e.ends[p][p].siblingCreated && e.ends[p][p].siblingCreated(t.options, 1),
2022          t.parent.bubble('reflow')
2023      }),
2024      (t.parser = function () {
2025        var t = B.parse(this.latex).children()
2026        return M.succeed(t)
2027      })
2028  })
2029  ;(w['¹'] = h(nt, '^1')),
2030    (w['²'] = h(nt, '^2')),
2031    (w['³'] = h(nt, '^3')),
2032    (w['¼'] = h(nt, '\\frac14')),
2033    (w['½'] = h(nt, '\\frac12')),
2034    (w['¾'] = h(nt, '\\frac34'))
2035  var it = f(W, function (t) {
2036    ;(t.init = P.prototype.init),
2037      (t.contactWeld =
2038        t.siblingCreated =
2039        t.siblingDeleted =
2040          function (t, e) {
2041            if (1 !== e)
2042              retur
2042n (
2043                (this.jQ[0].className =
2044                  !this[p] || this[p] instanceof W ? '' : 'mq-binary-operator'),
2045                this
2046              )
2047          })
2048  })
2049  ;(w['+'] = h(it, '+', '+')),
2050    (w['–'] = w['-'] = h(it, '-', '&minus;')),
2051    (w['±'] = w.pm = w.plusmn = w.plusminus = h(it, '\\pm ', '&plusmn;')),
2052    (w.mp = w.mnplus = w.minusplus = h(it, '\\mp ', '&#8723;')),
2053    (q['*'] = w.sdot = w.cdot = h(W, '\\cdot ', '&middot;', '*'))
2054  var st = f(W, function (t, e) {
2055      ;(t.init = function (t, n) {
2056        ;(this.data = t), (this.strict = n)
2057        var i = n ? 'Strict' : ''
2058        e.init.call(this, t['ctrlSeq' + i], t['html' + i], t['text' + i])
2059      }),
2060        (t.swap = function (t) {
2061          this.strict = t
2062          var e = t ? 'Strict' : ''
2063          ;(this.ctrlSeq = this.data['ctrlSeq' + e]),
2064            this.jQ.html(this.data['html' + e]),
2065            (this.textTemplate = [this.data['text' + e]])
2066        }),
2067        (t.deleteTowards = function (t, n) {
2068          if (t === p && !this.strict) return this.swap(!0), void this.bubble('reflow')
2069          e.deleteTowards.apply(this, arguments)
2070        })
2071    }),
2072    rt = {
2073      ctrlSeq: '\\le ',
2074      html: '&le;',
2075      text: '≤',
2076      ctrlSeqStrict: '<',
2077      htmlStrict: '&lt;',
2078      textStrict: '<'
2079    },
2080    ot = {
2081      ctrlSeq: '\\ge ',
2082      html: '&ge;',
2083      text: '≥',
2084      ctrlSeqStrict: '>',
2085      htmlStrict: '&gt;',
2086      textStrict: '>'
2087    }
2088  ;(w['<'] = w.lt = h(st, rt, !0)),
2089    (w['>'] = w.gt = h(st, ot, !0)),
2090    (w['≤'] = w.le = w.leq = h(st, rt, !1)),
2091    (w['≥'] = w.ge = w.geq = h(st, ot, !1))
2092  var at = f(W, function (t, e) {
2093    ;(t.init = function () {
2094      e.init.call(this, '=', '=')
2095    }),
2096      (t.createLeftOf = function (t) {
2097        if (t[p] instanceof st && t[p].strict) return t[p].swap(!1), void t[p].bubble('reflow')
2098        e.createLeftOf.apply(this, arguments)
2099      })
2100  })
2101  ;(w['='] = at),
2102    (w['×'] = w.times = h(W, '\\times ', '&times;', '[x]')),
2103    (w['÷'] = w.div = w.divide = w.divides = h(W, '\\div ', '&divide;', '[/]')),
2104    (q['~'] = w.sim = h(W, '\\sim ', '~', '~'))
2105  var ct,
2106    lt,
2107    ut = o,
2108    ht = document.createElement('div').style
2109  for (var ft in {
2110    transform: 1,
2111    WebkitTransform: 1,
2112    MozTransform: 1,
2113    OTransform: 1,
2114    msTransform: 1
2115  })
2116    if (ft in ht) {
2117      lt = ft
2118      break
2119    }
2120  lt
2121    ? (ct = function (t, e, n) {
2122        t.css(lt, 'scale(' + e + ',' + n + ')')
2123      })
2124    : 'filter' in ht
2125    ? ((ut = function (t) {
2126        t.className = t.className
2127      }),
2128      (ct = function (t, e, n) {
2129        ;(e /= 1 + (n - 1) / 2),
2130          t.css('fontSize', n + 'em'),
2131          t.hasClass('mq-matrixed-container') ||
2132            t.addClass('mq-matrixed-container').wrapInner('<span class="mq-matrixed"></span>')
2133        var i = t
2134          .children()
2135          .css(
2136            'filter',
2137            'progid:DXImageTransform.Microsoft.Matrix(M11=' + e + ",SizingMethod='auto expand')"
2138          )
2139        function s() {
2140          t.css('marginRight', ((i.width() - 1) * (e - 1)) / e + 'px')
2141        }
2142        s()
2143        var r = setInterval(s)
2144        d(window).load(function () {
2145          clearTimeout(r), s()
2146        })
2147      }))
2148    : (ct = function (t, e, n) {
2149        t.css('fontSize', n + 'em')
2150      })
2151  var pt = f(N, function (t, e) {
2152    t.init = function (t, n, i) {
2153      e.init.call(this, t, '<' + n + ' ' + i + '>&0</' + n + '>')
2154    }
2155  })
2156  ;(w.mathrm = h(pt, '\\mathrm', 'span', 'class="mq-roman mq-font"')),
2157    (w.mathit = h(pt, '\\mathit', 'i', 'class="mq-font"')),
2158    (w.mathbf = h(pt, '\\mathbf', 'b', 'class="mq-font"')),
2159    (w.mathsf = h(pt, '\\mathsf', 'span', 'class="mq-sans-serif mq-font"')),
2160    (w.mathtt = h(pt, '\\mathtt', 'span', 'class="mq-monospace mq-font"')),
2161    (w.underline = h(pt, '\\underline', 'span', 'class="mq-non-leaf mq-underline"')),
2162    (w.overline = w.bar = h(pt, '\\overline', 'span', 'class="mq-non-leaf mq-overline"')),
2163    (w.overrightarrow = h(
2164      pt,
2165      '\\overrightarrow',
2166      'span',
2167      'class="mq-non-leaf mq-overarrow mq-arrow-right"'
2168    )),
2169    (w.overleftarrow = h(
2170      pt,
2171      '\\overleftarrow',
2172      'span',
2173      'class="mq-non-leaf mq-overarrow mq-arrow-left"'
2174    ))
2175  ;(w.textcolor = f(N, function (t, e) {
2176    ;(t.setColor = function (t) {
2177      ;(this.color = t),
2178        (this.htmlTemplate = '<span class="mq-textcolor" style="color:' + t + '">&0</span>')
2179    }),
2180      (t.latex = function () {
2181        return '\\textcolor{' + this.color + '}{' + this.blocks[0].latex() + '}'
2182      }),
2183      (t.parser = function () {
2184        var t = this,
2185          n = M.optWhitespace,
2186          i = M.string,
2187          s = M.regex
2188        return n
2189          .then(i('{'))
2190          .then(s(/^[#\w\s.,()%-]*/))
2191          .skip(i('}'))
2192          .then(function (n) {
2193            return t.setColor(n), e.parser.call(t)
2194          })
2195      })
2196  })),
2197    (w.class = f(N, function (t, e) {
2198      t.parser = function () {
2199        var t = this,
2200          n = M.string,
2201          i = M.regex
2202        return M.optWhitespace
2203          .then(n('{'))
2204          .then(i(/^[-\w\s\\\xA0-\xFF]*/))
2205          .skip(n('}'))
2206          .then(function (n) {
2207            return (t.htmlTemplate = '<span class="mq-class ' + n + '">&0</span>'), e.parser.call(t)
2208          })
2209      }
2210    }))
2211  var dt = f(N, function (t, e) {
2212    ;(t.ctrlSeq = '_{...}^{...}'),
2213      (t.createLeftOf = function (t) {
2214        if (t[p] || !t.options.supSubsRequireOperand) return e.createLeftOf.apply(this, arguments)
2215      }),
2216      (t.contactWeld = function (t) {
2217        for (var e = p; e; e = e === p && 1)
2218          if (this[e] instanceof dt) {
2219            for (var n = 'sub'; n; n = 'sub' === n && 'sup') {
2220              var i = this[n],
2221                s = this[e][n]
2222              if (i) {
2223                if (s)
2224                  if (i.isEmpty()) o = m(s, 0, s.ends[p])
2225                  else {
2226                    i.jQ.children().insAtDirEnd(-e, s.jQ)
2227                    var r = i.children().disown(),
2228                      o = m(s, r.ends[1], s.ends[p])
2229                    e === p ? r.adopt(s, s.ends[1], 0) : r.adopt(s, 0, s.ends[p])
2230                  }
2231                else this[e].addBlock(i.disown())
2232                this.placeCursor = (function (t, n) {
2233                  return function (i) {
2234                    i.insAtDirEnd(-e, t || n)
2235                  }
2236                })(s, i)
2237              }
2238            }
2239            this.remove(),
2240              t &&
2241                t[p] === this &&
2242                (1 === e && o
2243                  ? o[p]
2244                    ? t.insRightOf(o[p])
2245                    : t.insAtLeftEnd(o.parent)
2246                  : t.insRightOf(this[e]))
2247            break
2248          }
2249        this.respace()
2250      }),
2251      (j.p.charsThatBreakOutOfSupSub = ''),
2252      (t.finalizeTree = function () {
2253        this.ends[p].write = function (t, e) {
2254          if (t.options.autoSubscriptNumerals && this === this.parent.sub) {
2255            if ('_' === e) return
2256            var n = this.chToCmd(e)
2257            return (
2258              n instanceof $ ? t.deleteSelection() : t.clearSelection().insRightOf(this.parent),
2259              n.createLeftOf(t.show())
2260            )
2261          }
2262          t[p] &&
2263            !t[1] &&
2264            !t.selection &&
2265            t.options.charsThatBreakOutOfSupSub.indexOf(e) > -1 &&
2266            t.insRightOf(this.parent),
2267            U.p.write.apply(this, arguments)
2268        }
2269      }),
2270      (t.moveTowards = function (t, n, i) {
2271        n.options.autoSubscriptNumerals && !this.sup
2272          ? n.insDirOf(t, this)
2273          : e.moveTowards.apply(this, arguments)
2274      }),
2275      (t.deleteTowards = function (t, n) {
2276        if (n.options.autoSubscriptNumerals && this.sub) {
2277          var i = this.sub.ends[-t]
2278          i instanceof $ ? i.remove() : i && i.deleteTowards(t, n.insAtDirEnd(-t, this.sub)),
2279            this.sub.isEmpty() &&
2280              (this.sub.deleteOutOf(p, n.insAtLeftEnd(this.sub)), this.sup && n.insDirOf(-t, this))
2281        } else e.deleteTowards.apply(this, arguments)
2282      }),
2283      (t.latex = function () {
2284        function t(t, e) {
2285          var n = e && e.latex()
2286          return e ? t + (1 === n.length ? n : '{' + (n || ' ') + '}') : ''
2287        }
2288        return t('_', this.sub) + t('^', this.sup)
2289      }),
2290      (t.respace =
2291        t.siblingCreated =
2292        t.siblingDeleted =
2293          function (t, e) {
2294            1 !== e && this.jQ.toggleClass('mq-limit', '\\int ' === this[p].ctrlSeq)
2295          }),
2296      (t.addBlock = function (t) {
2297        'sub' === this.supsub
2298          ? ((this.sup = this.upInto = this.sub.upOutOf = t),
2299            (t.adopt(this, this.sub, 0).downOutOf = this.sub),
2300            (t.jQ = d('<span class="mq-sup"/>')
2301              .append(t.jQ.children())
2302              .attr(i, t.id)
2303              .prependTo(this.jQ)))
2304          : ((this.sub = this.downInto = this.sup.downOutOf = t),
2305            (t.adopt(this, 0, this.sup).upOutOf = this.sup),
2306            (t.jQ = d('<span class="mq-sub"></span>')
2307              .append(t.jQ.children())
2308              .attr(i, t.id)
2309              .appendTo(this.jQ.removeClass('mq-sup-only'))),
2310            this.jQ.append('<span style="display:inline-block;width:0">&#8203;</span>'))
2311        for (var e = 0; e < 2; e += 1)
2312          !(function (t, e, n, i) {
2313            t[e].deleteOutOf = function (s, r) {
2314              if ((r.insDirOf(this[s] ? -s : s, this.parent), !this.isEmpty())) {
2315                var o = this.ends[s]
2316                this.children()
2317                  .disown()
2318                  .withDirAdopt(s, r.parent, r[s], r[-s])
2319                  .jQ.insDirOf(-s, r.jQ),
2320                  (r[-s] = o)
2321              }
2322              ;(t.supsub = n),
2323                delete t[e],
2324                delete t[i + 'Into'],
2325                (t[n][i + 'OutOf'] = mt),
2326                delete t[n].deleteOutOf,
2327                'sub' === e && d(t.jQ.addClass('mq-sup-only')[0].lastChild).remove(),
2328                this.remove()
2329            }
2330          })(this, 'sub sup'.split(' ')[e], 'sup sub'.split(' ')[e], 'down up'.split(' ')[e])
2331      })
2332  })
2333  function mt(t) {
2334    var e = this.parent,
2335      n = t
2336    do {
2337      if (n[1]) return t.insLeftOf(e)
2338      n = n.parent.parent
2339    } while (n !== e)
2340    t.insRightOf(e)
2341  }
2342  ;(w.subscript = w._ =
2343    f(dt, function (t, e) {
2344      ;(t.supsub = 'sub'),
2345        (t.htmlTemplate =
2346          '<span class="mq-supsub mq-non-leaf"><span class="mq-sub">&0</span><span style="display:inline-block;width:0">&#8203;</span></span>'),
2347        (t.textTemplate = ['_']),
2348        (t.finalizeTree = function () {
2349          ;(this.downInto = this.sub = this.ends[p]),
2350            (this.sub.upOutOf = mt),
2351            e.finalizeTree.call(this)
2352        })
2353    })),
2354    (w.superscript =
2355      w.supscript =
2356      w['^'] =
2357        f(dt, function (t, e) {
2358          ;(t.supsub = 'sup'),
2359            (t.htmlTemplate =
2360              '<span class="mq-supsub mq-non-leaf mq-sup-only"><span class="mq-sup">&0</span></span>'),
2361            (t.textTemplate = ['^']),
2362            (t.finalizeTree = function () {
2363              ;(this.upInto = this.sup = this.ends[1]),
2364                (this.sup.downOutOf = mt),
2365                e.finalizeTree.call(this)
2366            })
2367        }))
2368  var vt = f(N, function (t, e) {
2369    ;(t.init = function (t, e) {
2370      var n =
2371        '<span class="mq-large-operator mq-non-leaf"><span class="mq-to"><span>&1</span></span><big>' +
2372        e +
2373        '</big><span class="mq-from"><span>&0</span></span></span>'
2374      $.prototype.init.call(this, t, n)
2375    }),
2376      (t.createLeftOf = function (t) {
2377        e.createLeftOf.apply(this, arguments),
2378          t.options.sumStartsWithNEquals && (Y('n').createLeftOf(t), at().createLeftOf(t))
2379      }),
2380      (t.latex = function () {
2381        function t(t) {
2382          return 1 === t.length ? t : '{' + (t || ' ') + '}'
2383        }
2384        return this.ctrlSeq + '_' + t(this.ends[p].latex()) + '^' + t(this.ends[1].latex())
2385      }),
2386      (t.parser = function () {
2387        for (
2388          var t = M.string,
2389            e = M.optWhitespace,
2390            n = M.succeed,
2391            i = B.block,
2392            s = this,
2393            r = (s.blocks = [U(), U()]),
2394            o = 0;
2395          o < r.length;
2396          o += 1
2397        )
2398          r[o].adopt(s, s.ends[1], 0)
2399        return e
2400          .then(t('_').or(t('^')))
2401          .then(function (t) {
2402            var e = r['_' === t ? 0 : 1]
2403            return i.then(function (t) {
2404              return t.children().adopt(e, e.ends[1], 0), n(s)
2405            })
2406          })
2407          .many()
2408          .result(s)
2409      }),
2410      (t.finalizeTree = function () {
2411        ;(this.downInto = this.ends[p]),
2412          (this.upInto = this.ends[1]),
2413          (this.ends[p].upOutOf = this.ends[1]),
2414          (this.ends[1].downOutOf = this.ends[p])
2415      })
2416  })
2417  ;(w['∑'] = w.sum = w.summation = h(vt, '\\sum ', '&sum;')),
2418    (w['∏'] = w.prod = w.product = h(vt, '\\prod ', '&prod;')),
2419    (w.coprod = w.coproduct = h(vt, '\\coprod ', '&#8720;'))
2420  var gt =
2421      (w.frac =
2422      w.dfrac =
2423      w.cfrac =
2424      w.fraction =
2425        f(N, function (t, e) {
2426          ;(t.ctrlSeq = '\\frac'),
2427            (t.htmlTemplate =
2428              '<span class="mq-fraction mq-non-leaf"><span class="mq-numerator">&0</span><span class="mq-denominator">&1</span><span style="display:inline-block;width:0">&#8203;</span></span>'),
2429            (t.textTemplate = ['(', ')/(', ')']),
2430            (t.finalizeTree = function () {
2431              ;(this.upInto = this.ends[1].upOutOf = this.ends[p]),
2432                (this.downInto = this.ends[p].downOutOf = this.ends[1])
2433            })
2434        })),
2435    bt =
2436      (w.over =
2437      q['/'] =
2438        f(gt, function (t, e) {
2439          t.createLeftOf = function (t) {
2440            if (!this.replacedFragment) {
2441              for (
2442                var n = t[p];
2443                n &&
2444                !(
2445                  n instanceof W ||
2446                  n instanceof (w.text || o) ||
2447                  n instanceof vt ||
2448                  '\\ ' === n.ctrlSeq ||
2449                  /^[,;:]$/.test(n.ctrlSeq)
2450                );
2451
2452              )
2453                n = n[p]
2454              n instanceof vt &&
2455                n[1] instanceof dt &&
2456                (n = n[1])[1] instanceof dt &&
2457                n[1].ctrlSeq != n.ctrlSeq &&
2458                (n = n[1]),
2459                n !== t[p] && (this.replaces(b(n[1] || t.parent.ends[p], t[p])), (t[p] = n))
2460            }
2461            e.createLeftOf.call(this, t)
2462          }
2463        })),
2464    wt =
2465      (w.sqrt =
2466      w['√'] =
2467        f(N, function (t, e) {
2468          ;(t.ctrlSeq = '\\sqrt'),
2469            (t.htmlTemplate =
2470              '<span class="mq-non-leaf"><span class="mq-scaled mq-sqrt-prefix">&radic;</span><span class="mq-non-leaf mq-sqrt-stem">&0</span></span>'),
2471            (t.textTemplate = ['sqrt(', ')']),
2472            (t.parser = function () {
2473              return B.optBlock
2474                .then(function (t) {
2475                  return B.block.map(function (e) {
2476                    var n = qt()
2477                    return (n.blocks = [t, e]), t.adopt(n, 0, 0), e.adopt(n, t, 0), n
2478                  })
2479                })
2480                .or(e.parser.call(this))
2481            }),
2482            (t.reflow = function () {
2483              var t = this.ends[1].jQ
2484              ct(t.prev(), 1, t.innerHeight() / +t.css('fontSize').slice(0, -2) - 0.1)
2485            })
2486        })),
2487    qt =
2488      ((w.vec = f(N, function (t, e) {
2489        ;(t.ctrlSeq = '\\vec'),
2490          (t.htmlTemplate =
2491            '<span class="mq-non-leaf"><span class="mq-vector-prefix">&rarr;</span><span class="mq-vector-stem">&0</span></span>'),
2492          (t.textTemplate = ['vec(', ')'])
2493      })),
2494      (w.nthroot = f(wt, function (t, e) {
2495        ;(t.htmlTemplate =
2496          '<sup class="mq-nthroot mq-non-leaf">&0</sup><span class="mq-scaled"><span class="mq-sqrt-prefix mq-scaled">&radic;</span><span class="mq-sqrt-stem mq-non-leaf">&1</span></span>'),
2497          (t.textTemplate = ['sqrt[', '](', ')']),
2498          (t.latex = function () {
2499            return '\\sqrt[' + this.ends[p].latex() + ']{' + this.ends[1].latex() + '}'
2500          })
2501      })))
2502  function Ot(t, e) {
2503    ;(t.jQadd = function () {
2504      e.jQadd.apply(this, arguments),
2505        (this.delimjQs = this.jQ.children(':first').add(this.jQ.children(':last'))),
2506        (this.contentjQ = this.jQ.children(':eq(1)'))
2507    }),
2508      (t.reflow = function () {
2509        var t = this.contentjQ.outerHeight() / parseFloat(this.contentjQ.css('fontSize'))
2510        ct(this.delimjQs, s(1 + 0.2 * (t - 1), 1.2), 1.2 * t)
2511      })
2512  }
2513  var yt = f(f(N, Ot), function (e, n) {
2514      ;(e.init = function (e, i, s, r, o) {
2515        n.init.call(this, '\\left' + r, t, [i, s]),
2516          (this.side = e),
2517          (this.sides = {}),
2518          (this.sides[p] = { ch: i, ctrlSeq: r }),
2519          (this.sides[1] = { ch: s, ctrlSeq: o })
2520      }),
2521        (e.numBlocks = function () {
2522          return 1
2523        }),
2524        (e.html = function () {
2525          return (
2526            (this.htmlTemplate =
2527              '<span class="mq-non-leaf"><span class="mq-scaled mq-paren' +
2528              (1 === this.side ? ' mq-ghost' : '') +
2529              '">' +
2530              this.sides[p].ch +
2531              '</span><span class="mq-non-leaf">&0</span><span class="mq-scaled mq-paren' +
2532              (this.side === p ? ' mq-ghost' : '') +
2533              '">' +
2534              this.sides[1].ch +
2535              '</span></span>'),
2536            n.html.call(this)
2537          )
2538        }),
2539        (e.latex = function () {
2540          return (
2541            '\\left' +
2542            this.sides[p].ctrlSeq +
2543            this.ends[p].latex() +
2544            '\\right' +
2545            this.sides[1].ctrlSeq
2546          )
2547        }),
2548        (e.oppBrack = function (t, e, n) {
2549          return (
2550            e instanceof yt &&
2551            e.side &&
2552            e.side !== -n &&
2553            ('|' === this.sides[this.side].ch || e.side === -this.side) &&
2554            (!t.restrictMismatchedBrackets ||
2555              xt[this.sides[this.side].ch] === e.sides[e.side].ch ||
2556              { '(': ']', '[': ')' }[this.sides[p].ch] === e.sides[1].ch) &&
2557            e
2558          )
2559        }),
2560        (e.closeOpposing = function (t) {
2561          ;(t.side = 0),
2562            (t.sides[this.side] = this.sides[this.side]),
2563            t.delimjQs
2564              .eq(this.side === p ? 0 : 1)
2565              .removeClass('mq-ghost')
2566              .html(this.sides[this.side].ch)
2567        }),
2568        (e.createLeftOf = function (t) {
2569          if (!this.replacedFragment)
2570            var e = t.options,
2571              i =
2572                this.oppBrack(e, t[p], p) ||
2573                this.oppBrack(e, t[1], 1) ||
2574                this.oppBrack(e, t.parent.parent)
2575          if (i) {
2576            var s = (this.side = -i.side)
2577            this.closeOpposing(i),
2578              i === t.parent.parent &&
2579                t[s] &&
2580                (b(t[s], t.parent.ends[s], -s)
2581                  .disown()
2582                  .withDirAdopt(-s, i.parent, i, i[s])
2583                  .jQ.insDirOf(s, i.jQ),
2584                i.bubble('reflow'))
2585          } else
2586            (s = (i = this).side),
2587              i.replacedFragment
2588                ? (i.side = 0)
2589                : t[-s] && (i.replaces(b(t[-s], t.parent.ends[-s], s)), (t[-s] = 0)),
2590              n.createLeftOf.call(i, t)
2591          s === p ? t.insAtLeftEnd(i.ends[p]) : t.insRightOf(i)
2592        }),
2593        (e.placeCursor = o),
2594        (e.unwrap = function () {
2595          this.ends[p]
2596            .children()
2597            .disown()
2598            .adopt(this.parent, this, this[1])
2599            .jQ.insertAfter(this.jQ),
2600            this.remove()
2601        }),
2602        (e.deleteSide = function (t, e, n) {
2603          var i = this.parent,
2604            s = this[t],
2605            r = i.ends[t]
2606          if (t === this.side)
2607            return this.unwrap(), void (s ? n.insDirOf(-t, s) : n.insAtDirEnd(t, i))
2608          var o = n.options,
2609            a = !this.side
2610          if (((this.side = -t), this.oppBrack(o, this.ends[p].ends[this.side], t))) {
2611            this.closeOpposing(this.ends[p].ends[this.side])
2612            var c = this.ends[p].ends[t]
2613            this.unwrap(),
2614              c.siblingCreated && c.siblingCreated(n.options, t),
2615              s ? n.insDirOf(-t, s) : n.insAtDirEnd(t, i)
2616          } else {
2617            if (this.oppBrack(o, this.parent.parent, t))
2618              this.parent.parent.closeOpposing(this), this.parent.parent.unwrap()
2619            else {
2620              if (e && a) return this.unwrap(), void (s ? n.insDirOf(-t, s) : n.insAtDirEnd(t, i))
2621              ;(this.sides[t] = {
2622                ch: xt[this.sides[this.side].ch],
2623                ctrlSeq: xt[this.sides[this.side].ctrlSeq]
2624              }),
2625                this.delimjQs
2626                  .removeClass('mq-ghost')
2627                  .eq(t === p ? 0 : 1)
2628                  .addClass('mq-ghost')
2629                  .html(this.sides[t].ch)
2630            }
2631            if (s) {
2632              c = this.ends[p].ends[t]
2633              b(s, r, -t)
2634                .disown()
2635                .withDirAdopt(-t, this.ends[p], c, 0)
2636                .jQ.insAtDirEnd(t, this.ends[p].jQ.removeClass('mq-empty')),
2637                c.siblingCreated && c.siblingCreated(n.options, t),
2638                n.insDirOf(-t, s)
2639            } else e ? n.insDirOf(t, this) : n.insAtDirEnd(t, this.ends[p])
2640          }
2641        }),
2642        (e.deleteTowards = function (t, e) {
2643          this.deleteSide(-t, !1, e)
2644        }),
2645        (e.finalizeTree = function () {
2646          ;(this.ends[p].deleteOutOf = function (t, e) {
2647            this.parent.deleteSide(t, !0, e)
2648          }),
2649            (this.finalizeTree = this.intentionalBlur =
2650              function () {
2651                this.delimjQs.eq(this.side === p ? 1 : 0).removeClass('mq-ghost'), (this.side = 0)
2652              })
2653        }),
2654        (e.siblingCreated = function (t, e) {
2655          e === -this.side && this.finalizeTree()
2656        })
2657    }),
2658    xt = {
2659      '(': ')',
2660      ')': '(',
2661      '[': ']',
2662      ']': '[',
2663      '{': '}',
2664      '}': '{',
2665      '\\{': '\\}',
2666      '\\}': '\\{',
2667      '&lang;': '&rang;',
2668      '&rang;': '&lang;',
2669      '\\langle ': '\\rangle ',
2670      '\\rangle ': '\\langle ',
2671      '|': '|'
2672    }
2673  function kt(t, e) {
2674    e = e || t
2675    var n = xt[t],
2676      i = xt[e]
2677    ;(q[t] = h(yt, p, t, n, e, i)), (q[n] = h(yt, 1, t, n, e, i))
2678  }
2679  kt('('),
2680    kt('['),
2681    kt('{', '\\{'),
2682    (w.langle = h(yt, p, '&lang;', '&rang;', '\\langle ', '\\rangle ')),
2683    (w.rangle = h(yt, 1, '&lang;', '&rang;', '\\langle ', '\\rangle ')),
2684    (q['|'] = h(yt, p, '|', '|', '|', '|')),
2685    (w.left = f(N, function (t) {
2686      t.parser = function () {
2687        var t = M.regex,
2688          e = M.string,
2689          n = (M.succeed, M.optWhitespace)
2690        return n.then(t(/^(?:[([|]|\\\{)/)).then(function (i) {
2691          var s = '\\' === i.charAt(0) ? i.slice(1) : i
2692          return B.then(function (r) {
2693            return e('\\right')
2694              .skip(n)
2695              .then(t(/^(?:[\])|]|\\\})/))
2696              .map(function (t) {
2697                var e = '\\' === t.charAt(0) ? t.slice(1) : t,
2698                  n = yt(0, s, e, i, t)
2699                return (n.blocks = [r]), r.adopt(n, 0, 0), n
2700              })
2701          })
2702        })
2703      }
2704    })),
2705    (w.right = f(N, function (t) {
2706      t.parser = function () {
2707        return M.fail('unmatched \\right')
2708      }
2709    }))
2710  var jt =
2711    (w.binom =
2712    w.binomial =
2713      f(f(N, Ot), function (t, e) {
2714        ;(t.ctrlSeq = '\\binom'),
2715          (t.htmlTemplate =
2716            '<span class="mq-non-leaf"><span class="mq-paren mq-scaled">(</span><span class="mq-non-leaf"><span class="mq-array mq-non-leaf"><span>&0</span><span>&1</span></span></span><span class="mq-paren mq-scaled">)</span></span>'),
2717          (t.textTemplate = ['choose(', ',', ')'])
2718      }))
2719  w.choose = f(jt, function (t) {
2720    t.createLeftOf = bt.prototype.createLeftOf
2721  })
2722  w.editable = w.MathQuillMathField = f(N, function (t, e) {
2723    ;(t.ctrlSeq = '\\MathQuillMathField'),
2724      (t.htmlTemplate =
2725        '<span class="mq-editable-field"><span class="mq-root-block">&0</span></span>'),
2726      (t.parser = function () {
2727        var t = this,
2728          n = M.string,
2729          i = M.regex,
2730          s = M.succeed
2731        return n('[')
2732          .then(i(/^[a-z][a-z0-9]*/i))
2733          .skip(n(']'))
2734          .map(function (e) {
2735            t.name = e
2736          })
2737          .or(s())
2738          .then(e.parser.call(t))
2739      }),
2740      (t.finalizeTree = function () {
2741        var t = x(this.ends[p], this.jQ, j())
2742        ;(t.KIND_OF_MQ = 'MathField'),
2743          (t.editable = !0),
2744          t.createTextarea(),
2745          t.editablesTextareaEvents(),
2746          t.cursor.insAtRightEnd(t.root),
2747          I(t.root)
2748      }),
2749      (t.registerInnerField = function (t, e) {
2750        t.push((t[this.name] = e(this.ends[p].controller)))
2751      }),
2752      (t.latex = function () {
2753        return this.ends[p].latex()
2754      }),
2755      (t.text = function () {
2756        return this.ends[p].text()
2757      })
2758  })
2759  var Qt = (w.embed = f($, function (t, e) {
2760      ;(t.setOptions = function (t) {
2761        function e() {
2762          return ''
2763        }
2764        return (
2765          (this.text = t.text || e),
2766          (this.htmlTemplate = t.htmlString || ''),
2767          (this.latex = t.latex || e),
2768          this
2769        )
2770      }),
2771        (t.parser = function () {
2772          var t = this
2773          return (
2774            (string = M.string),
2775            (regex = M.regex),
2776            (succeed = M.succeed),
2777            string('{')
2778              .then(regex(/^[a-z][a-z0-9]*/i))
2779              .skip(string('}'))
2780              .then(function (e) {
2781                return string('[')
2782                  .then(regex(/^[-\w\s]*/))
2783                  .skip(string(']'))
2784                  .or(succeed())
2785                  .map(function (n) {
2786                    return t.setOptions(C[e](n))
2787                  })
2788              })
2789          )
2790        })
2791    })),
2792    Tt = L(1)
2793  for (var Ct in Tt)
2794    !(function (t, e) {
2795      'function' == typeof e
2796        ? ((_[t] = function () {
2797            return S(), e.apply(this, arguments)
2798          }),
2799          (_[t].prototype = e.prototype))
2800        : (_[t] = e)
2801    })(Ct, Tt[Ct])
2802})()

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.